This repository has been archived by the owner on Aug 26, 2020. It is now read-only.
forked from Strikewood/omnipay-first-atlantic-commerce
-
Notifications
You must be signed in to change notification settings - Fork 3
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 Strikewood#8 from CaswellWC/master
Updates the iso3166 package to the league package
- Loading branch information
Showing
6 changed files
with
120 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,6 @@ bin | |
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# phpstorm | ||
.idea |
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,65 @@ | ||
<?php | ||
|
||
namespace tests; | ||
|
||
|
||
use Omnipay\FirstAtlanticCommerce\Gateway; | ||
use Omnipay\Tests\GatewayTestCase; | ||
|
||
class AuthorizeTest extends GatewayTestCase | ||
{ | ||
|
||
/** @var Gateway */ | ||
protected $gateway; | ||
|
||
/** | ||
* Setup the gateway to be used for testing. | ||
*/ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest()); | ||
$this->gateway->setMerchantId('123'); | ||
$this->gateway->setMerchantPassword('abc123'); | ||
} | ||
|
||
/** | ||
* Test the country formatting functionality | ||
*/ | ||
public function testFormatCountry() | ||
{ | ||
//Alpha2 | ||
$card = $this->getValidCard(); | ||
$requestData = $this->getRequestData($card); | ||
$this->assertEquals(840, $requestData['BillingDetails']['BillToCountry']); | ||
|
||
//number | ||
$card['billingCountry'] = 840; | ||
$requestData = $this->getRequestData($card); | ||
$this->assertEquals(840, $requestData['BillingDetails']['BillToCountry']); | ||
|
||
//Alpha3 | ||
$card['billingCountry'] = 'USA'; | ||
$requestData = $this->getRequestData($card); | ||
$this->assertEquals(840, $requestData['BillingDetails']['BillToCountry']); | ||
} | ||
|
||
/** | ||
* @param $card | ||
* | ||
* @return array | ||
*/ | ||
private function getRequestData($card) | ||
{ | ||
$request = $this->gateway->authorize([ | ||
'amount' => '10.00', | ||
'currency' => 'USD', | ||
'transactionId' => uniqid(), | ||
'card' => $card | ||
]); | ||
$requestData = $request->getData(); | ||
return $requestData; | ||
} | ||
|
||
} |