diff --git a/src/Omnipay/Ecopayz/Message/AbstractRequest.php b/src/Omnipay/Ecopayz/Message/AbstractRequest.php index b8ee20fc..e168bbd4 100644 --- a/src/Omnipay/Ecopayz/Message/AbstractRequest.php +++ b/src/Omnipay/Ecopayz/Message/AbstractRequest.php @@ -96,6 +96,27 @@ public function setMerchantAccountNumber($value) return $this->setParameter('merchantAccountNumber', $value); } + /** + * Get the request callback URL. + * + * @return string + */ + public function getCallbackUrl() + { + return $this->getParameter('callbackUrl'); + } + + /** + * Sets the request callback URL. + * + * @param string $value + * @return AbstractRequest Provides a fluent interface + */ + public function setCallbackUrl($value) + { + return $this->setParameter('callbackUrl', $value); + } + /** * Get calculated checksum * diff --git a/src/Omnipay/Ecopayz/Message/PurchaseRequest.php b/src/Omnipay/Ecopayz/Message/PurchaseRequest.php index 68060389..675e29dd 100644 --- a/src/Omnipay/Ecopayz/Message/PurchaseRequest.php +++ b/src/Omnipay/Ecopayz/Message/PurchaseRequest.php @@ -78,6 +78,10 @@ public function getData() $data['TransferUrl'] = $notifyUrl; } + if ($callbackUrl = $this->getCallbackUrl()) { + $data['CallbackUrl'] = $callbackUrl; + } + $data['Checksum'] = $this->calculateArrayChecksum($data); return $data; } diff --git a/tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php b/tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php index 96fbb84f..83094c94 100644 --- a/tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php +++ b/tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php @@ -22,6 +22,7 @@ public function setUp() 'returnUrl' => 'http://example.com/return', 'cancelUrl' => 'http://example.com/cancel', 'notifyUrl' => 'http://example.com/notify', + 'callbackUrl' => 'http://example.com/callback', )); } @@ -36,10 +37,11 @@ public function testGetData() $this->assertSame('12.34', $data['Amount']); $this->assertSame('EUR', $data['Currency']); $this->assertSame('Free Text Description', $data['MerchantFreeText']); - $this->assertSame('7320d93a3daa1e296f56fa7f40d6fb8b', $data['Checksum']); + $this->assertSame('aa9f664af58922801ac1e23007962af8', $data['Checksum']); $this->assertSame('http://example.com/return', $data['OnSuccessUrl']); $this->assertSame('http://example.com/cancel', $data['OnFailureUrl']); $this->assertSame('http://example.com/notify', $data['TransferUrl']); + $this->assertSame('http://example.com/callback', $data['callbackUrl']); } public function testSendData()