mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Fix for go pro process
This commit is contained in:
parent
46ad320962
commit
c1713c190c
@ -181,9 +181,10 @@ class AccountController extends BaseController
|
||||
$account->company->pending_plan = null;
|
||||
$account->company->pending_term = null;
|
||||
|
||||
if ($account->company->payment) {
|
||||
$payment = $account->company->payment;
|
||||
$this->paymentService->refund($payment);
|
||||
if ($payment = $account->company->payment) {
|
||||
$ninjaAccount = $this->accountRepo->getNinjaAccount();
|
||||
$paymentDriver = $ninjaAccount->paymentDriver();
|
||||
$paymentDriver->refundPayment($payment);
|
||||
Session::flash('message', trans('texts.plan_refunded'));
|
||||
\Log::info("Refunded Plan Payment: {$account->name} - {$user->email}");
|
||||
} else {
|
||||
|
@ -6,7 +6,9 @@ use Request;
|
||||
use Omnipay;
|
||||
use Exception;
|
||||
use CreditCard;
|
||||
use DateTime;
|
||||
use App\Models\AccountGatewayToken;
|
||||
use App\Models\Account;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\Country;
|
||||
@ -628,9 +630,13 @@ class BasePaymentDriver
|
||||
return $payment;
|
||||
}
|
||||
|
||||
public function refundPayment($payment, $amount)
|
||||
public function refundPayment($payment, $amount = 0)
|
||||
{
|
||||
$amount = min($amount, $payment->getCompletedAmount());
|
||||
if ($amount) {
|
||||
$amount = min($amount, $payment->getCompletedAmount());
|
||||
} else {
|
||||
$amount = $payment->getCompletedAmount();
|
||||
}
|
||||
|
||||
if ( ! $amount) {
|
||||
return false;
|
||||
|
@ -76,6 +76,9 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return $data;
|
||||
}
|
||||
|
||||
// Stripe complains if the email field is set
|
||||
unset($data['email']);
|
||||
|
||||
if ( ! empty($this->input['sourceToken'])) {
|
||||
$data['token'] = $this->input['sourceToken'];
|
||||
unset($data['card']);
|
||||
@ -387,13 +390,9 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
|
||||
if ($eventType == 'customer.source.deleted' || $eventType == 'customer.bank_account.deleted') {
|
||||
$paymentMethod->delete();
|
||||
}
|
||||
|
||||
/*
|
||||
} elseif ($eventType == 'customer.source.updated') {
|
||||
$this->paymentService->convertPaymentMethodFromStripe($source, null, $paymentMethod)->save();
|
||||
//$this->paymentService->convertPaymentMethodFromStripe($source, null, $paymentMethod)->save();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return 'Processed successfully';
|
||||
|
@ -249,7 +249,7 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
if ($source->state == 'deleted') {
|
||||
$paymentMethod->delete();
|
||||
} else {
|
||||
$this->paymentService->convertPaymentMethodFromWePay($source, null, $paymentMethod)->save();
|
||||
//$this->paymentService->convertPaymentMethodFromWePay($source, null, $paymentMethod)->save();
|
||||
}
|
||||
|
||||
return 'Processed successfully';
|
||||
|
Loading…
Reference in New Issue
Block a user