-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added county to checksum of createUser
- Loading branch information
Showing
16 changed files
with
204 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
/** | ||
* MIT License | ||
* | ||
* Copyright (c) 2017 Safecharge Bulgaria ltd | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
namespace SafeCharge\Api\Service\Payments; | ||
|
||
use SafeCharge\Api\RestClient; | ||
use SafeCharge\Api\Service\BaseService; | ||
use SafeCharge\Api\Utils; | ||
|
||
|
||
class Payout extends BaseService | ||
{ | ||
|
||
/** | ||
* Payout constructor. | ||
* @param RestClient $client | ||
*/ | ||
public function __construct(RestClient $client) | ||
{ | ||
parent::__construct($client); | ||
} | ||
|
||
/** | ||
* @param array $params | ||
* @return mixed | ||
* @link https://www.safecharge.com/docs/API/#payout | ||
*/ | ||
public function payout(array $params) | ||
{ | ||
$mandatoryFields = ['merchantId', 'merchantSiteId', 'currency', 'amount', 'timeStamp', 'checksum']; | ||
|
||
$checksumParametersOrder = [ | ||
'merchantId', | ||
'merchantSiteId', | ||
'clientRequestId', | ||
'amount', | ||
'currency', | ||
'timeStamp', | ||
'merchantSecretKey' | ||
]; | ||
|
||
$params = $this->appendMerchantIdMerchantSiteIdTimeStamp($params); | ||
|
||
if (empty($params['checksum'])) { | ||
$params['checksum'] = Utils::calculateChecksum($params, $checksumParametersOrder, $this->_client->getConfig()->getMerchantSecretKey(), $this->_client->getConfig()->getHashAlgorithm()); | ||
} | ||
|
||
$this->validate($params, $mandatoryFields); | ||
|
||
return $this->requestJson($params, 'payout.do'); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* MIT License | ||
* | ||
* Copyright (c) 2017 Safecharge Bulgaria ltd | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
namespace SafeCharge\Tests; | ||
|
||
use SafeCharge\Api\Service\Payments\Payout; | ||
|
||
class PayoutTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
private $_service; | ||
|
||
public function __construct() | ||
{ | ||
$this->_service = new Payout(TestCaseHelper::getClient()); | ||
} | ||
|
||
public function testPayout() | ||
{ | ||
$params = [ | ||
'userTokenId' => TestCaseHelper::getUserTokenId(), | ||
'clientRequestId' => '100', | ||
'clientUniqueId' => '12345', | ||
'amount' => "9.0", | ||
'currency' => SimpleData::getCurrency(), | ||
'dynamicDescriptor' => SimpleData::getDynamicDescriptor(), | ||
'merchantDetails' => SimpleData::getMerchantDetails(), | ||
'userPaymentOption' => [ | ||
'userPaymentOptionId' => TestCaseHelper::getUPOCreditCardId(), | ||
'CVV' => '234' | ||
], | ||
'comment' => 'some comment', | ||
'urlDetails' => SimpleData::getUrlDetails(true), | ||
]; | ||
|
||
$response = $this->_service->payout($params); | ||
$this->assertEquals('SUCCESS', $response['status']); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,11 @@ | |
class SimpleData | ||
{ | ||
|
||
public static function getCurrency() | ||
{ | ||
return 'EUR'; | ||
} | ||
|
||
public static function getAmountDetails() | ||
{ | ||
return [ | ||
|
@@ -85,8 +90,8 @@ public static function getBillingAddress($addCountryCode = false) | |
"city" => "some city", | ||
$countryParameter => "US", | ||
"state" => "AK", | ||
"county" => "Anchorage", | ||
"email" => "[email protected]", | ||
"county" => "Anchorage", | ||
]; | ||
} | ||
|
||
|
@@ -115,7 +120,7 @@ public static function getDynamicDescriptor() | |
{ | ||
return [ | ||
"merchantName" => "merchantName", | ||
"merchantPhone" => "merchantPhone" | ||
"merchantPhone" => "+4412378" | ||
]; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ public function testCreateUser() | |
'city' => '', | ||
'zip' => '', | ||
'countryCode' => 'GB', | ||
'county' => 'Anchorage', | ||
'phone' => '', | ||
'locale' => 'en_UK', | ||
'email' => '[email protected]', | ||
|
@@ -53,6 +54,7 @@ public function testUpdateUser($userTokenId) | |
'city' => 'London', | ||
'zip' => '', | ||
'countryCode' => 'GB', | ||
'county' => 'Anchorage', | ||
'phone' => '', | ||
'locale' => 'en_UK', | ||
'email' => '[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters