Skip to content

Commit

Permalink
Amazon Pay API SDK PHP 2.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Nayan Kumar S committed Mar 28, 2024
1 parent 3adb8d2 commit 77ef94b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
31 changes: 29 additions & 2 deletions Amazon/Pay/API/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class Client implements ClientInterface, ReportingClientInterface, MerchantOnboardingClientInterface
{
const SDK_VERSION = '2.6.4';
const SDK_VERSION = '2.6.5';
const SDK_LANGUAGE = 'PHP';
const HASH_ALGORITHM = 'sha256';
const API_VERSION = 'v2';
Expand Down Expand Up @@ -322,7 +322,34 @@ protected function constructUserAgentHeader()
{
return 'amazon-pay-api-sdk-php/' . self::SDK_VERSION . ' ('
. 'PHP/' . phpversion() . '; '
. php_uname('s') . '/' . php_uname('m') . '/' . php_uname('r') . ')';
. self::getPhpUname('s') . '/' . self::getPhpUname('m') . '/' . self::getPhpUname('r') . ')';
}

/**
* Retrieves system information using the php_uname function if it's enabled
*
* @param mode - A mode specifying the information to retrieve (e.g., 's' for the System name)
* @return string - System information or '(disabled)' if php_uname is disabled
*/
public function getPhpUname($mode) {
$uname_disabled = self::_isDisabled(ini_get('disable_functions'), 'php_uname');
return $uname_disabled ? '(disabled)' : php_uname($mode);
}

/**
* Checks if a given function is disabled based on a comma-seperated string of disabled functions.
*
* @param string $disableFunctionsOutput - String value of the 'disable_function' setting, as output by ini_get('disable_functions')
* @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled
*
* @return bool - True if the function is disabled, false otherwise
*/
private static function _isDisabled($disableFunctionsOutput, $functionName) {
$disabledFunctions = explode(',', $disableFunctionsOutput);
if(in_array($functionName, $disabledFunctions)) {
return true;
}
return false;
}

public function getPostSignedHeaders($http_request_method, $request_uri, $request_parameters, $request_payload, $other_presigned_headers = null)
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### Version 2.6.5 - March 2024
* Avoid calling the php_uname function if it's disabled in the php.ini configuration

### Version 2.6.4 - September 2023
* Introducing new Merchant Onboarding & Account Management APIs, which allows our partners to onboard merchants programatically and as part of account management offer them creation, updation and deletion/dissociation capability.
* Added the Sample Code snippets for the Charge APIs, Charge Permission APIs and Refund APIs.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ If you need to make an Amazon Pay API call that uses the mws.amazonservices.com|

## Requirements

* PHP 5.5 or higher, but highly recommended to use only the latest PHP version, and update often, to ensure current security fixes are applied
* PHP 5.6.1 or higher, but highly recommended to use only the latest PHP version, and update often, to ensure current security fixes are applied
* Curl 7.18 or higher
* phpseclib 2.0
* phpseclib 3.0

## SDK Installation

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amzn/amazon-pay-api-sdk-php",
"type": "library",
"description": "Amazon Pay API SDK (PHP)",
"version": "2.6.4",
"version": "2.6.5",
"keywords": [
"amazon",
"pay",
Expand All @@ -27,7 +27,7 @@
},
"require": {
"ext-curl": "*",
"php": ">=5.5.0",
"php": ">=5.6.1",
"phpseclib/phpseclib": "~3.0"
},
"require-dev": {
Expand Down

0 comments on commit 77ef94b

Please sign in to comment.