Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Commit

Permalink
Maintain PHP 5.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
leith committed Jun 17, 2016
1 parent bc878c3 commit 6ec1429
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Message/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function getData()
// get and merge customer data
$card = $this->getCard();
if ($card) {
$data += [
$data += array(
'cfname' => $card->getFirstName(),
'csname' => $card->getLastName(),
'chouse' => $card->getAddress1(), // "house name or number"
Expand All @@ -122,19 +122,19 @@ public function getData()
'ccountry' => $card->getCountry(),
'ctel' => $card->getPhone(),
'cemail' => $card->getEmail(),
];
);
}

// get and merge line item data
$items = $this->getItems();
$fundcode = $this->getFundCode();
if (empty($items)) {
$this->validate('amount', 'fundCode');
$data += [
$data += array(
'amount' => $this->getAmountInteger(),
'fundcode' => $fundcode,
'custref1' => $this->getDescription(),
];
);
} else {
foreach ($items as $n => $item) {
$suffix = $n > 0 ? '_a'.$n : '';
Expand All @@ -146,15 +146,15 @@ public function getData()
$itemCustref4 = $item->getCustRef4();

// amount, fundcode and custref1 are required
$data += [
$data += array(
'amount'.$suffix => $item->getQuantity() * $item->getPrice(),
'fundcode'.$suffix => empty($itemFundcode) ? $fundcode : $itemFundcode,
'custref1'.$suffix => empty($itemCustref1) ? $item->getName() : $itemCustref1,
'custref2'.$suffix => empty($itemCustref2) ? '' : $itemCustref2,
'custref3'.$suffix => empty($itemCustref3) ? '' : $itemCustref3,
'custref4'.$suffix => empty($itemCustref4) ? '' : $itemCustref4,
'description'.$suffix => substr($item->getDescription(), 0, 255),
];
);
}
}

Expand Down

0 comments on commit 6ec1429

Please sign in to comment.