From 1f874cb9822fda46e208985022cddc4e0e8d78a2 Mon Sep 17 00:00:00 2001 From: Vincent van Wyk Date: Thu, 28 Jun 2018 14:14:14 +0200 Subject: [PATCH] Implemented mechanism enabling developers to overwrite existing configuration settings. --- src/Payfast.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Payfast.php b/src/Payfast.php index d6bb4d4..323fa40 100644 --- a/src/Payfast.php +++ b/src/Payfast.php @@ -54,10 +54,12 @@ class Payfast implements PaymentProcessor protected $payment_method; + protected $passphrase; public function __construct() { $this->merchant = config('payfast.merchant'); + $this->passphrase = config('payfast.passphrase'); } public function getMerchant() @@ -65,6 +67,11 @@ public function getMerchant() return $this->merchant; } + public function setMerchant(array $merchant) + { + $this->merchant = $merchant; + } + public function setBuyer($first, $last, $email) { $this->buyer = [ @@ -74,6 +81,11 @@ public function setBuyer($first, $last, $email) ]; } + public function setPassphrase(string $passphrase) + { + $this->passphrase = $passphrase; + } + public function setMerchantReference($reference) { $this->merchantReference = $reference; @@ -132,9 +144,9 @@ public function buildQueryString() } } $this->output = substr( $this->output, 0, -1 ); - if( isset( $passPhrase ) ) + if( !empty( $this->passphrase ) ) { - $this->output .= '&passphrase='.$passPhrase; + $this->output .= '&passphrase=' . $this->passphrase; } }