Skip to content

Commit 5a922d4

Browse files
Merge pull request #85 from open-pay/develop
Develop
2 parents 65e42b0 + 9d04230 commit 5a922d4

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

Openpay/Data/OpenpayApi.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ class OpenpayApi extends OpenpayApiResourceBase
1919

2020
public static function getInstance($r, $p = null)
2121
{
22-
$resourceName = get_class();
22+
if(version_compare(phpversion(), '8.3.0', '<')){
23+
$resourceName = get_class();
24+
} else {
25+
$resourceName = self::class;
26+
}
2327
return parent::getInstance($resourceName);
2428
}
2529

Openpay/Data/OpenpayApiConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private function _request($method, $url, $params)
5050
$publicIp = Openpay::getPublicIp();
5151
if(is_null($publicIp)){
5252
throw new OpenpayApiAuthError("Empty or no public ip provided");
53-
} else if (!preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/", $publicIp)){
53+
} else if (!filter_var($publicIp, FILTER_VALIDATE_IP)){
5454
throw new OpenpayApiAuthError("Invalid public ip '" . $publicIp . "'");
5555
}
5656

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ Private key. There are three options:
8080
Openpay::setId('moiep6umtcnanql3jrxp');
8181
Openpay::setApiKey('sk_3433941e467c4875b178ce26348b0fac');
8282
Openpay::setCountry('MX'); // MX, CO, PE
83-
Openpay::setPublicIp('127.0.0.1'); //Tu ip publica
83+
Openpay::setPublicIp('127.0.0.1');
8484
```
85-
86-
- Pass Merchant ID, Private Key and country code as parameters to the method **Openpay::getInstance()**,
85+
- The **PublicIp** parameter refers to the IP of the customer who makes the purchase. This parameter is added for security reasons. It can be IPv4 and IPv6.
86+
- Pass Merchant ID, Private Key, country code and public ip as parameters to the method **Openpay::getInstance()**,
8787
which is the instance generator:
8888

8989
```php

0 commit comments

Comments
 (0)