Skip to content

Commit a6f1ba9

Browse files
committed
Merge branch 'develop' into 'master'
Develop See merge request !2
2 parents 2e4b9d5 + 0628694 commit a6f1ba9

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The widget is a payment page hosted by Paymentwall that embeds the entire paymen
6868
The Pingback is a webhook notifying about a payment being made. Pingbacks are sent via HTTP/HTTPS to your servers. To process pingbacks use the following code:
6969

7070
Pingback pingback = new Pingback(request.getParameterMap(), request.getRemoteAddr());
71-
if (pingback.validate(true)) {
71+
if (pingback.validate()) {
7272
String goods = pingback.getProductId();
7373
String userId = pingback.getUserId();
7474
if (pingback.isDeliverable()) {
@@ -104,7 +104,7 @@ The Pingback is a webhook notifying about a payment being made. Pingbacks are se
104104
#### Pingback Processing
105105

106106
Pingback pingback = new Pingback(request.getParameterMap(), request.getRemoteAddr());
107-
if (pingback.validate(true)) {
107+
if (pingback.validate()) {
108108
Integer currency = pingback.getVirtualCurrencyAmount();
109109
String userId = pingback.getUserId();
110110
if (pingback.isDeliverable()) {
@@ -155,7 +155,7 @@ You have to set up your products in merchant area for exact regions first in ord
155155
#### Pingback Processing
156156

157157
Pingback pingback = new Pingback(request.getParameterMap(), request.getRemoteAddr());
158-
if (pingback.validate(true)) {
158+
if (pingback.validate()) {
159159
ArrayList<Product> goods = pingback.getProducts();
160160
String userId = pingback.getUserId();
161161
if (pingback.isDeliverable()) {

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
<artifactId>httpclient</artifactId>
8585
<version>4.4</version>
8686
</dependency>
87+
<dependency>
88+
<groupId>commons-net</groupId>
89+
<artifactId>commons-net</artifactId>
90+
<version>3.6</version>
91+
</dependency>
8792
</dependencies>
8893

8994
<build>

src/main/java/com/paymentwall/java/Pingback.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import java.util.LinkedHashMap;
88
import java.util.Map;
99

10+
import org.apache.commons.net.util.SubnetUtils;
11+
1012
public class Pingback extends Instance {
1113
/**
1214
* Pingback types
@@ -136,6 +138,14 @@ public boolean isIpAddressValid() {
136138
ipsWhitelist.add("174.36.92.192");
137139
ipsWhitelist.add("174.37.14.28");
138140
}
141+
142+
SubnetUtils utils = new SubnetUtils("216.127.71.0/24");
143+
String[] allIps = utils.getInfo().getAllAddresses();
144+
145+
for (int i = 0; i < allIps.length; i++)
146+
{
147+
ipsWhitelist.add(allIps[i]);
148+
}
139149

140150
return ipsWhitelist.contains(ipAddress);
141151
}

0 commit comments

Comments
 (0)