Fix error with payment methods

This commit is contained in:
Hillel Coren 2016-09-19 13:31:04 +03:00
parent d3116f7a06
commit 5f861f491a

View File

@ -540,6 +540,7 @@ class BasePaymentDriver
$paymentMethod->setRelation('account_gateway_token', $customer); $paymentMethod->setRelation('account_gateway_token', $customer);
$paymentMethod = $this->creatingPaymentMethod($paymentMethod); $paymentMethod = $this->creatingPaymentMethod($paymentMethod);
if ($paymentMethod) {
// archive the old payment method // archive the old payment method
$oldPaymentMethod = PaymentMethod::clientId($this->client()->id) $oldPaymentMethod = PaymentMethod::clientId($this->client()->id)
->wherePaymentTypeId($paymentMethod->payment_type_id) ->wherePaymentTypeId($paymentMethod->payment_type_id)
@ -549,7 +550,6 @@ class BasePaymentDriver
$oldPaymentMethod->delete(); $oldPaymentMethod->delete();
} }
if ($paymentMethod) {
$paymentMethod->save(); $paymentMethod->save();
} }