Skip to content

Commit

Permalink
Merge pull request #5 from digitickets/v2-add-customer-fields
Browse files Browse the repository at this point in the history
Add customer fields
  • Loading branch information
AdamJewell authored Jul 8, 2024
2 parents ab955a8 + a6859b4 commit c390b18
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Message/AuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function getData()
{
$this->validate('merchantId', 'description', 'transactionId', 'returnUrl', 'cancelUrl');

$card = $this->getCard();
$data = [
'merchant_id' => (int) $this->getMerchantId(),
'merchant_reference' => $this->getTransactionId(),
Expand All @@ -76,7 +77,17 @@ public function getData()
'abort' => $this->getCancelUrl()
],
'language' => $this->getLanguage(),
'customers' => [[
'first_name' => $card->getFirstName(),
'last_name' => $card->getLastName(),
]]
];
if($card->getEmail()){
$data['customers'][0]['email'] = $card->getEmail();
}
if($card->getPhone()){
$data['customers'][0]['phone'] = $card->getPhone(); //^\+\d{3,19}$
}

if (is_array($this->getPaymentMethods()) && count($this->getPaymentMethods()) > 0) {
$data['payment_methods'] = $this->getPaymentMethods();
Expand Down

0 comments on commit c390b18

Please sign in to comment.