Skip to content

Commit bd78e45

Browse files
authored
Merge pull request #20 from babuhaman/master
NameOnCard field is added to pass Credit Card Holder name on transaction
2 parents c783159 + 2158ec2 commit bd78e45

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Full Example
2626
$sp->TestConnection();
2727
print_r($sp->ResponseXml);
2828

29+
$sp->NameOnCard = 'John Citizen'; // optional
2930
$sp->Cc = 462834666666;
3031
$sp->ExpiryDate = '07/09';
3132
$sp->ChargeAmount = 123;
@@ -57,7 +58,7 @@ Obviously we need to load the library first:
5758
Create a new SecurePay object
5859
-------------------------------------------
5960
$sp = new SecurePay('username','password');
60-
61+
6162
OR
6263

6364
$sp = new SecurePay();

securepay.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ class SecurePay {
133133
*/
134134
public $PreAuth;
135135

136+
/**
137+
* Credit card holder name in credit card
138+
* @access public
139+
* @var string
140+
*/
141+
public $NameOnCard;
142+
136143
/**
137144
* The credit card number to work with
138145
* @access public
@@ -376,10 +383,11 @@ function TestMode($TestMode = TRUE) {
376383
* @param bool $PreAuth Indicate that this transaction is a preauth
377384
* @return int Returns the corresponding SECUREPAY_STATUS_* code
378385
*/
379-
function Process($ChargeAmount = null, $ChargeCurrency = null, $Cc = null, $ExpiryDate = null, $Cvv = null, $OrderId = null, $PreAuth = FALSE) {
386+
function Process($ChargeAmount = null, $ChargeCurrency = null, $NameOnCard = null, $Cc = null, $ExpiryDate = null, $Cvv = null, $OrderId = null, $PreAuth = FALSE) {
380387
// Set class variables from function call for later use {{{
381388
if ($ChargeAmount) $this->ChargeAmount = $ChargeAmount;
382389
if ($ChargeCurrency) $this->ChargeCurrency = $ChargeCurrency;
390+
if ($NameOnCard) $this->NameOnCard = $NameOnCard;
383391
if ($Cc) $this->Cc = $Cc;
384392
if ($ExpiryDate) $this->ExpiryDate = $ExpiryDate;
385393
if ($Cvv) $this->Cvv = $Cvv;
@@ -444,7 +452,7 @@ function Refund($TransactionId = null,$OrderId = null,$ChargeAmount=null){
444452

445453
$this->RequestXml = $this->_ComposeRefund();
446454
$this->ResponseXml = $this->_Dispatch($this->RequestXml);
447-
455+
448456
// If no XML response, assume processing timed out.
449457
if ((false === $this->ResponseXml) || (false == is_string($this->ResponseXml))) {
450458
return $this->_TranslateServerCode(512);
@@ -507,7 +515,7 @@ function TestConnection() {
507515
// If no XML response, assume processing timed out.
508516
if ((false === $this->ResponseXml) || (false == is_string($this->ResponseXml))) {
509517
$this->_TranslateServerCode(512);
510-
518+
511519
return false;
512520
}
513521

@@ -982,6 +990,8 @@ function _ComposePayment() {
982990
$message .= "\t\t\t\t\t<expiryDate>{$this->ExpiryDate}</expiryDate>\n";
983991
if ($this->Cvv) // Provided with CVV/CV2 number
984992
$message .= "\t\t\t\t\t<cvv>{$this->Cvv}</cvv>\n";
993+
if ($this->NameOnCard) // Provided with credit card holder name
994+
$message .= "\t\t\t\t\t<cardHolderName>{$this->NameOnCard}</cardHolderName>\n";
985995
$message .= "\t\t\t\t</CreditCardInfo>\n";
986996
$message .= "\t\t\t\t<amount>$cents</amount>\n";
987997
$message .= "\t\t\t\t<currency>{$this->ChargeCurrency}</currency>\n";
@@ -1028,6 +1038,8 @@ function _ComposePayment() {
10281038
$message .= "\t\t\t\t\t<expiryDate>{$this->ExpiryDate}</expiryDate>\n";
10291039
if ($this->Cvv) // Provided with CVV/CV2 number
10301040
$message .= "\t\t\t\t\t<cvv>{$this->Cvv}</cvv>\n";
1041+
if ($this->NameOnCard) // Provided with credit card holder name
1042+
$message .= "\t\t\t\t\t<cardHolderName>{$this->NameOnCard}</cardHolderName>\n";
10311043
}
10321044
$message .= "\t\t\t\t</CreditCardInfo>\n";
10331045
$message .= "\t\t\t</Txn>\n";

0 commit comments

Comments
 (0)