クラス
EndpointSetter
ソース ソース
ファイル: src/IPN/EndpointSetter.php
class EndpointSetter
{
/**
* AmazonPay module object
*
* @var AmazonPay
*/
private $module;
/**
* Sets `$module` member var with dependency injection.
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param AmazonPay $module
* @return void
*/
public function __construct(AmazonPay $module) {
$this->module = $module;
}
/**
* Sets Merchant's IPN endpoint to their EC site domain
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param string $url
* @return int
* @throws InvalidArgumentException Thrown by V1 AmazonPay Client.
* @throws Exception Thrown by V1 AmazonPay Client.
*/
public function set($url) {
$client = $this->module->getAmazonV1Client();
// possible array values: ALL, ORDER_REFERENCE, PAYMENT_AUTHORIZE, PAYMENT_CAPTURE,
// PAYMENT_REFUND, BILLING_AGREEMENT, CHARGEBACK_DETAILED
$notificationConfiguration[$url] = ['ALL'];
$requestParameters['notification_configuration_list'] = $notificationConfiguration;
$response = $client->setMerchantNotificationConfiguration($requestParameters);
return $response->toArray();
}
}
- __construct — Sets `$module` member var with dependency injection.
- set — Sets Merchant's IPN endpoint to their EC site domain