From a0d23952d44d80ab2acbc46cf0a3d648d5e8f337 Mon Sep 17 00:00:00 2001 From: Peter Szel Date: Sun, 6 Nov 2016 18:42:15 +0100 Subject: [PATCH] Added currency handling to the start payment request model to handle EUR/USD currencies. --- library/common/Enumerations.php | 13 +++++++++++++ library/models/PreparePaymentRequestModel.php | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/library/common/Enumerations.php b/library/common/Enumerations.php index 93fce35..d1e3185 100755 --- a/library/common/Enumerations.php +++ b/library/common/Enumerations.php @@ -54,4 +54,17 @@ abstract class UILocale { const HU = "hu-HU"; const EN = "en-US"; +} + +abstract class Currency +{ + const HUF = "HUF"; + const EUR = "EUR"; + const USD = "USD"; + + public static function isValid($name) + { + $constants = self::getConstants(); + return array_key_exists($name, $constants); + } } \ No newline at end of file diff --git a/library/models/PreparePaymentRequestModel.php b/library/models/PreparePaymentRequestModel.php index 4ace1d8..b539f1b 100755 --- a/library/models/PreparePaymentRequestModel.php +++ b/library/models/PreparePaymentRequestModel.php @@ -32,8 +32,9 @@ class PreparePaymentRequestModel extends BaseRequestModel public $RecurrenceId; public $RedirectUrl; public $CallbackUrl; + public $Currency; - function __construct($requestId = null, $type = PaymentType::Immediate, $guestCheckoutAllowed = true, $allowedFundingSources = array(FundingSourceType::All), $window = "00:30:00", $locale = "hu-HU", $initiateRecurrence = false, $recurrenceId = null, $redirectUrl = null, $callbackUrl = null) + function __construct($requestId = null, $type = PaymentType::Immediate, $guestCheckoutAllowed = true, $allowedFundingSources = array(FundingSourceType::All), $window = "00:30:00", $locale = "hu-HU", $initiateRecurrence = false, $recurrenceId = null, $redirectUrl = null, $callbackUrl = null, $currency = Currency::HUF) { $this->PaymentRequestId = $requestId; $this->PaymentType = $type; @@ -45,6 +46,7 @@ function __construct($requestId = null, $type = PaymentType::Immediate, $guestCh $this->RecurrenceId = $recurrenceId; $this->RedirectUrl = $redirectUrl; $this->CallbackUrl = $callbackUrl; + $this->Currency = $currency; } public function AddTransaction(PaymentTransactionModel $transaction)