forked from instride-ch/omnipay-datatrans
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #4 default the errorUrl() to the returnUrl()
For card tokenisation, and authorize/purchase.
- Loading branch information
Showing
5 changed files
with
117 additions
and
3 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
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,79 @@ | ||
<?php | ||
|
||
namespace Omnipay\Datatrans\Message; | ||
|
||
use Omnipay\Common\CreditCard; | ||
use Omnipay\Tests\TestCase; | ||
|
||
class TokenizeRequestTest extends TestCase | ||
{ | ||
/** | ||
* @var PurchaseRequest | ||
*/ | ||
private $request; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->request = new TokenizeRequest($this->getHttpClient(), $this->getHttpRequest()); | ||
} | ||
|
||
public function testGetDataWithoutCard() | ||
{ | ||
$this->request->initialize(array( | ||
'merchantId' => 'asdf', | ||
'sign' => '123', | ||
'testMode' => true, | ||
'currency' => 'CHF', | ||
'transactionId' => '123', | ||
'returnUrl' => 'https://www.example.com/success', | ||
'errorUrl' => 'https://www.example.com/error', | ||
'cancelUrl' => 'https://www.example.com/cancel' | ||
)); | ||
|
||
$expected = array( | ||
'merchantId' => 'asdf', | ||
'refno' => '123', | ||
'amount' => 0, | ||
'currency' => 'CHF', | ||
'sign' => '123', | ||
'successUrl' => 'https://www.example.com/success', | ||
'errorUrl' => 'https://www.example.com/error', | ||
'cancelUrl' => 'https://www.example.com/cancel', | ||
'useAlias' => 'yes', | ||
); | ||
|
||
$this->assertEquals($expected, $this->request->getData()); | ||
} | ||
|
||
/** | ||
* No errorUrl set explicitly. | ||
*/ | ||
public function testErrorUrlDefaults() | ||
{ | ||
$this->request->initialize(array( | ||
'merchantId' => 'asdfxxx', | ||
'sign' => '123', | ||
'testMode' => true, | ||
'currency' => 'CHF', | ||
'transactionId' => '123', | ||
'returnUrl' => 'https://www.example.com/return', | ||
'cancelUrl' => 'https://www.example.com/cancel' | ||
)); | ||
|
||
$expected = array( | ||
'merchantId' => 'asdfxxx', | ||
'refno' => '123', | ||
'amount' => 0, | ||
'currency' => 'CHF', | ||
'sign' => '123', | ||
'successUrl' => 'https://www.example.com/return', | ||
'errorUrl' => 'https://www.example.com/return', | ||
'cancelUrl' => 'https://www.example.com/cancel', | ||
'useAlias' => 'yes', | ||
); | ||
|
||
$this->assertEquals($expected, $this->request->getData()); | ||
} | ||
} |