Skip to content

Commit

Permalink
PHP 5.4 compatible structures.
Browse files Browse the repository at this point in the history
  • Loading branch information
judgej committed May 11, 2018
1 parent d1fd603 commit 0896e38
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,10 @@ public function getDataCard()
// https://github.com/thephpleague/omnipay-common/issues/29
// It is also assumed that an empty ('000') CVV is valid for a card, so we compare to null.

if (empty($card->getExpiryYear()) && empty($card->getExpiryMonth()) && $card->getCvv() === null) {
$expiryYear = $card->getExpiryYear();
$expiryMonth = $card->getExpiryMonth();

if (empty($expiryYear) && empty($expiryMonth) && $card->getCvv() === null) {
$data['pseudocardpan'] = $card->getNumber();
} elseif ($card->getNumber()) {
if ($this->getEcommerceMode()) {
Expand All @@ -454,7 +457,9 @@ public function getDataCard()
$data['cardholder'] = $card->getName();
}

if (!empty($card->getCvv())) {
$cvv = $card->getCvv();

if (! empty($cvv)) {
$data['cardcvc2'] = $card->getCvv();
}

Expand All @@ -479,17 +484,23 @@ public function getDataUrl()
$data = [];

// For when authentication passes.
if (!empty($this->getSuccessUrl())) {

$successUrl = $this->getSuccessUrl();
if (! empty($successUrl)) {
$data['successurl'] = $this->getSuccessUrl();
}

// For when authentication fails.
if (!empty($this->getErrorUrl())) {

$errorUrl = $this->getErrorUrl();
if (! empty($errorUrl)) {
$data['errorurl'] = $this->getErrorUrl();
}

// For when the user cancels payment on the remote gateway site.
if (!empty($this->getCancelUrl())) {

$cancelUrl = $this->getCancelUrl();
if (! empty($cancelUrl)) {
$data['backurl'] = $this->getCancelUrl();
}

Expand All @@ -506,7 +517,8 @@ public function getDataItems()
// Each item must be contingously numbered, starting from 1.
$item_count = 0;

if (!empty($this->getItems())) {
$items = $this->getItems();
if (! empty($items)) {
// Find the number of decimal digits the currency uses.
$currency_digits = Currency::find($this->getCurrency())->getDecimals();

Expand Down

0 comments on commit 0896e38

Please sign in to comment.