Skip to content

Commit

Permalink
Receipt - not required. Currency label variable name change, add curr…
Browse files Browse the repository at this point in the history
…ency to signature
  • Loading branch information
andchir committed Apr 30, 2019
1 parent 8a40ebc commit 7d53ad2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
19 changes: 19 additions & 0 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ public function setReceipt($value)
return $this->setParameter('receipt', $value);
}

/**
* Get the payment currency label.
*
* @return string
*/
public function getCurrencyLabel()
{
return $this->getParameter('currencyLabel');
}

/**
* @param string $value
* @return AbstractRequest
*/
public function setCurrencyLabel($value)
{
return $this->setParameter('currencyLabel', $value);
}

/**
* Get the secret key.
*
Expand Down
14 changes: 9 additions & 5 deletions src/Message/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ class PurchaseRequest extends AbstractRequest
public function getData()
{
$this->validate(
'purse', 'amount', 'currency', 'description', 'receipt'
'purse', 'amount', 'currency', 'description'
);

return [
'InvId' => $this->getInvId(),
'MrchLogin' => $this->getPurse(),
'OutSum' => $this->getAmount(),
'Desc' => $this->getDescription(),
'IncCurrLabel' => $this->getCurrency(),
'IncCurrLabel' => $this->getCurrencyLabel(),
'OutSumCurrency' => $this->getCurrency(),
'SignatureValue' => $this->generateSignature(),
'IsTest' => (int)$this->getTestMode(),
'IsTest' => (int) $this->getTestMode(),
'Receipt' => $this->getReceipt(),
] + $this->getCustomFields();
}
Expand All @@ -36,9 +37,12 @@ public function generateSignature()
$this->getPurse(),
$this->getAmount(),
$this->getInvId(),
$this->getReceipt(),
$this->getSecretKey()
$this->getCurrency()
];
if ($this->getReceipt()) {
array_push($params, $this->getReceipt());
}
array_push($params, $this->getSecretKey());

foreach ($this->getCustomFields() as $field => $value) {
$params[] = "$field=$value";
Expand Down

0 comments on commit 7d53ad2

Please sign in to comment.