Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Omnipay/Ecopayz/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
4 changes: 4 additions & 0 deletions src/Omnipay/Ecopayz/Message/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public function getData()
$data['TransferUrl'] = $notifyUrl;
}

if ($callbackUrl = $this->getCallbackUrl()) {
$data['CallbackUrl'] = $callbackUrl;
}

$data['Checksum'] = $this->calculateArrayChecksum($data);
return $data;
}
Expand Down
4 changes: 3 additions & 1 deletion tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
));
}

Expand All @@ -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()
Expand Down