From 0a000fef5278305e913908ad31eecdd539ba9602 Mon Sep 17 00:00:00 2001 From: andchir Date: Tue, 30 Apr 2019 14:14:36 +0300 Subject: [PATCH] Currency not required. Remove currency RUB (default) --- src/Message/AbstractRequest.php | 8 ++++++++ src/Message/PurchaseRequest.php | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index fab27f9..69a38c9 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -101,6 +101,14 @@ public function setReceipt($value) return $this->setParameter('receipt', $value); } + public function getCurrency() + { + if ($this->getParameter('currency') === 'RUB') { + return ''; + } + return $this->getParameter('currency'); + } + /** * Get the payment currency label. * diff --git a/src/Message/PurchaseRequest.php b/src/Message/PurchaseRequest.php index 0941cf3..1c68928 100644 --- a/src/Message/PurchaseRequest.php +++ b/src/Message/PurchaseRequest.php @@ -36,9 +36,11 @@ public function generateSignature() $params = [ $this->getPurse(), $this->getAmount(), - $this->getInvId(), - $this->getCurrency() + $this->getInvId() ]; + if ($this->getCurrency()) { + array_push($params, $this->getCurrency()); + } if ($this->getReceipt()) { array_push($params, $this->getReceipt()); }