-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from sufcboy/feature/gh-refund-with-data
Feature/gh refund with data
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 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
32 changes: 32 additions & 0 deletions
32
src/Adyen/Service/ResourceModel/Modification/RefundWithData.php
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,32 @@ | ||
<?php | ||
|
||
|
||
namespace Adyen\Service\ResourceModel\Modification; | ||
|
||
|
||
class RefundWithData extends \Adyen\Service\AbstractResource | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $endpoint; | ||
|
||
/** | ||
* Include applicationInfo key in the request parameters | ||
* | ||
* @var bool | ||
*/ | ||
protected $allowApplicationInfo = true; | ||
|
||
/** | ||
* Refund constructor. | ||
* | ||
* @param \Adyen\Service $service | ||
*/ | ||
public function __construct($service) | ||
{ | ||
$this->endpoint = $service->getClient()->getConfig()->get('endpoint') . | ||
'/pal/servlet/Payment/' . $service->getClient()->getApiPaymentVersion() . '/refundWithData'; | ||
parent::__construct($service, $this->endpoint, $this->allowApplicationInfo); | ||
} | ||
} |
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,50 @@ | ||
<?php | ||
|
||
namespace Adyen\MockTest; | ||
|
||
class ModificationTest extends TestCaseMock | ||
{ | ||
/** | ||
* @param $jsonFile | ||
* @param $httpStatus | ||
* @dataProvider successRefundWithDataProvider | ||
* @throws \Adyen\AdyenException | ||
*/ | ||
public function testRefundWithDataSuccess($jsonFile, $httpStatus) | ||
{ | ||
// create Checkout client | ||
$client = $this->createMockClient($jsonFile, $httpStatus); | ||
|
||
// initialize service | ||
$service = new \Adyen\Service\Modification($client); | ||
|
||
$params = json_decode(' | ||
{ | ||
"amount":{ | ||
"value":1500, | ||
"currency":"GBP" | ||
}, | ||
"selectedRecurringDetailReference":"8315535507322518", | ||
"shopperReference":"myshopperreference", | ||
"reference":"myreference", | ||
"merchantAccount":"mymerchantaccount", | ||
"recurring":{ | ||
"contract":"RECURRING" | ||
}, | ||
"shopperInteraction":"ContAuth" | ||
}', | ||
true | ||
); | ||
|
||
$result = $service->refundWithData($params); | ||
|
||
$this->assertContains($result['resultCode'], array('Received')); | ||
} | ||
|
||
public static function successRefundWithDataProvider() | ||
{ | ||
return array( | ||
array('tests/Resources/Modification/refundWithData-success.json', 200), | ||
); | ||
} | ||
} |
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,4 @@ | ||
{ | ||
"pspReference": "8835538461311270", | ||
"resultCode": "Received" | ||
} |