-
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.
Merge pull request #34 from moddengine/cs-risk-xml
Added support for risk management xml endpoint
- Loading branch information
Showing
4 changed files
with
146 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace Omnipay\NABTransact\Message; | ||
|
||
/** | ||
* NABTransact SecureXML Purchase Request. | ||
*/ | ||
class SecureXMLRiskPurchaseRequest extends SecureXMLAbstractRequest | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $liveEndpoint = 'https://transact.nab.com.au/riskmgmt/payment'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $testEndpoint = 'https://demo.transact.nab.com.au/riskmgmt/payment'; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
protected $txnType = 0; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $requiredFields = ['amount', 'card', 'transactionId', 'ip']; | ||
|
||
public function setIp($value) | ||
{ | ||
$this->setParameter('ip', $value); | ||
} | ||
|
||
public function getIp() | ||
{ | ||
return $this->getParameter('ip'); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getData() | ||
{ | ||
$xml = $this->getBasePaymentXMLWithCard(); | ||
|
||
$buyer = $xml->addChild('BuyerInfo'); | ||
$buyer->addChild('ip', $this->getIp('ip')); | ||
$card = $this->getCard(); | ||
if ($firstName = $card->getFirstName()) { | ||
$buyer->addChild('firstName', $firstName); | ||
} | ||
if ($lastName = $card->getLastName()) { | ||
$buyer->addChild('firstName', $lastName); | ||
} | ||
if ($postCode = $card->getBillingPostcode()) { | ||
$buyer->addChild('zipcode', $postCode); | ||
} | ||
if ($city = $card->getBillingCity()) { | ||
$buyer->addChild('town', $city); | ||
} | ||
if ($country = $card->getBillingCountry()) { | ||
$buyer->addChild('billingCountry', $country); | ||
} | ||
if ($email = $card->getEmail()) { | ||
$buyer->addChild('emailAddress', $email); | ||
} | ||
|
||
return $xml; | ||
} | ||
} |
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