Fixes from refactor

This commit is contained in:
Hillel Coren 2016-07-21 14:28:06 +03:00
parent 00f1c935cf
commit ee937d9994
9 changed files with 22 additions and 21 deletions

View File

@ -66,8 +66,8 @@ class BasePaymentDriver
* @param bool $gatewayType * @param bool $gatewayType
*/ */
public function __construct( public function __construct(
AccountGateway $accountGateway = false, AccountGateway $accountGateway = null,
Invitation $invitation = false, Invitation $invitation = null,
$gatewayType = false $gatewayType = false
) )
{ {
@ -173,7 +173,7 @@ class BasePaymentDriver
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
* @throws Exception * @throws Exception
*/ */
public function startPurchase(array $input = false, $sourceId = false) public function startPurchase(array $input = null, $sourceId = false)
{ {
$this->input = $input; $this->input = $input;
$this->sourceId = $sourceId; $this->sourceId = $sourceId;
@ -312,7 +312,7 @@ class BasePaymentDriver
* @return Payment|mixed|void * @return Payment|mixed|void
* @throws Exception * @throws Exception
*/ */
public function completeOnsitePurchase($input = false, PaymentMethod $paymentMethod = false) public function completeOnsitePurchase($input = false, PaymentMethod $paymentMethod = null)
{ {
$this->input = count($input) ? $input : false; $this->input = count($input) ? $input : false;
$gateway = $this->gateway(); $gateway = $this->gateway();
@ -411,7 +411,7 @@ class BasePaymentDriver
* *
* @return array * @return array
*/ */
protected function paymentDetails(PaymentMethod $paymentMethod = false) protected function paymentDetails(PaymentMethod $paymentMethod = null)
{ {
$invoice = $this->invoice(); $invoice = $this->invoice();
$completeUrl = url('complete/' . $this->invitation->invitation_key . '/' . $this->gatewayType); $completeUrl = url('complete/' . $this->invitation->invitation_key . '/' . $this->gatewayType);
@ -779,7 +779,7 @@ class BasePaymentDriver
* *
* @return Payment * @return Payment
*/ */
protected function creatingPayment(Payment $payment, $paymentMethod) protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod)
{ {
return $payment; return $payment;
} }
@ -860,7 +860,7 @@ class BasePaymentDriver
* @return bool|mixed * @return bool|mixed
* @throws Exception * @throws Exception
*/ */
public function completeOffsitePurchase($input) public function completeOffsitePurchase(array $input)
{ {
$this->input = $input; $this->input = $input;
$ref = array_get($this->input, 'token') ?: $this->invitation->transaction_reference; $ref = array_get($this->input, 'token') ?: $this->invitation->transaction_reference;

View File

@ -6,6 +6,7 @@ use App\Models\PaymentMethod;
use Exception; use Exception;
use Session; use Session;
use Braintree\Customer; use Braintree\Customer;
use App\Models\Payment;
/** /**
* Class BraintreePaymentDriver * Class BraintreePaymentDriver
@ -53,7 +54,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
* *
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/ */
public function startPurchase(array $input = false, $sourceId = false) public function startPurchase(array $input = null, $sourceId = false)
{ {
$data = parent::startPurchase($input, $sourceId); $data = parent::startPurchase($input, $sourceId);
@ -87,7 +88,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
* *
* @return array * @return array
*/ */
protected function paymentDetails(PaymentMethod $paymentMethod = false) protected function paymentDetails(PaymentMethod $paymentMethod = null)
{ {
$data = parent::paymentDetails($paymentMethod); $data = parent::paymentDetails($paymentMethod);

View File

@ -33,10 +33,10 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
/** /**
* @param PaymentMethod $paymentMethod * @param PaymentMethod $paymentMethod
* *
* @return array * @return array
*/ */
protected function paymentDetails(PaymentMethod $paymentMethod = false) protected function paymentDetails(PaymentMethod $paymentMethod = null)
{ {
$data = parent::paymentDetails(); $data = parent::paymentDetails();

View File

@ -9,10 +9,10 @@ class MolliePaymentDriver extends BasePaymentDriver
{ {
/** /**
* @param $input * @param $input
* *
* @return \App\Models\Payment|mixed * @return \App\Models\Payment|mixed
*/ */
public function completeOffsitePurchase($input) public function completeOffsitePurchase(array $input)
{ {
$details = $this->paymentDetails(); $details = $this->paymentDetails();

View File

@ -11,8 +11,8 @@ class PayFastPaymentDriver extends BasePaymentDriver
* @var string * @var string
*/ */
protected $transactionReferenceParam = 'm_payment_id'; protected $transactionReferenceParam = 'm_payment_id';
public function completeOffsitePurchase($input) public function completeOffsitePurchase(array $input)
{ {
if ($accountGateway->isGateway(GATEWAY_PAYFAST) && Request::has('pt')) { if ($accountGateway->isGateway(GATEWAY_PAYFAST) && Request::has('pt')) {
$token = Request::query('pt'); $token = Request::query('pt');

View File

@ -25,7 +25,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
* *
* @return array * @return array
*/ */
protected function paymentDetails(PaymentMethod $paymentMethod = false) protected function paymentDetails(PaymentMethod $paymentMethod = null)
{ {
$data = parent::paymentDetails(); $data = parent::paymentDetails();
@ -37,7 +37,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
/** /**
* @param Payment $payment * @param Payment $payment
* @param PaymentMethod $paymentMethod * @param PaymentMethod $paymentMethod
* *
* @return Payment * @return Payment
*/ */
protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod) protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod)

View File

@ -24,7 +24,7 @@ class PayPalProPaymentDriver extends BasePaymentDriver
* *
* @return array * @return array
*/ */
protected function paymentDetails(PaymentMethod $paymentMethod = false) protected function paymentDetails(PaymentMethod $paymentMethod = null)
{ {
$data = parent::paymentDetails(); $data = parent::paymentDetails();

View File

@ -98,7 +98,7 @@ class StripePaymentDriver extends BasePaymentDriver
* *
* @return array * @return array
*/ */
protected function paymentDetails(PaymentMethod $paymentMethod = false) protected function paymentDetails(PaymentMethod $paymentMethod = null)
{ {
$data = parent::paymentDetails($paymentMethod); $data = parent::paymentDetails($paymentMethod);
@ -394,7 +394,7 @@ class StripePaymentDriver extends BasePaymentDriver
/** /**
* @param $input * @param $input
* *
* @return array|string * @return array|string
* @throws Exception * @throws Exception
*/ */

View File

@ -70,7 +70,7 @@ class WePayPaymentDriver extends BasePaymentDriver
* *
* @return array * @return array
*/ */
protected function paymentDetails(PaymentMethod $paymentMethod = false) protected function paymentDetails(PaymentMethod $paymentMethod = null)
{ {
$data = parent::paymentDetails($paymentMethod); $data = parent::paymentDetails($paymentMethod);