Skip to content

Commit

Permalink
Implemented mechanism enabling developers to overwrite existing confi…
Browse files Browse the repository at this point in the history
…guration settings.
  • Loading branch information
Vincent van Wyk committed Jun 28, 2018
1 parent 0b42ca0 commit 1f874cb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Payfast.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,24 @@ 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()
{
return $this->merchant;
}

public function setMerchant(array $merchant)
{
$this->merchant = $merchant;
}

public function setBuyer($first, $last, $email)
{
$this->buyer = [
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 1f874cb

Please sign in to comment.