Skip to content

Commit

Permalink
Merge pull request #12 from efchubit/master
Browse files Browse the repository at this point in the history
Implemented mechanism enabling developers to overwrite existing confi…
  • Loading branch information
warhsn authored Jun 29, 2018
2 parents 0b42ca0 + 1f874cb commit a66d71f
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 a66d71f

Please sign in to comment.