mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04: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_plan = null;
|
||||||
$account->company->pending_term = null;
|
$account->company->pending_term = null;
|
||||||
|
|
||||||
if ($account->company->payment) {
|
if ($payment = $account->company->payment) {
|
||||||
$payment = $account->company->payment;
|
$ninjaAccount = $this->accountRepo->getNinjaAccount();
|
||||||
$this->paymentService->refund($payment);
|
$paymentDriver = $ninjaAccount->paymentDriver();
|
||||||
|
$paymentDriver->refundPayment($payment);
|
||||||
Session::flash('message', trans('texts.plan_refunded'));
|
Session::flash('message', trans('texts.plan_refunded'));
|
||||||
\Log::info("Refunded Plan Payment: {$account->name} - {$user->email}");
|
\Log::info("Refunded Plan Payment: {$account->name} - {$user->email}");
|
||||||
} else {
|
} else {
|
||||||
|
@ -6,7 +6,9 @@ use Request;
|
|||||||
use Omnipay;
|
use Omnipay;
|
||||||
use Exception;
|
use Exception;
|
||||||
use CreditCard;
|
use CreditCard;
|
||||||
|
use DateTime;
|
||||||
use App\Models\AccountGatewayToken;
|
use App\Models\AccountGatewayToken;
|
||||||
|
use App\Models\Account;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentMethod;
|
use App\Models\PaymentMethod;
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
@ -628,9 +630,13 @@ class BasePaymentDriver
|
|||||||
return $payment;
|
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) {
|
if ( ! $amount) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -76,6 +76,9 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stripe complains if the email field is set
|
||||||
|
unset($data['email']);
|
||||||
|
|
||||||
if ( ! empty($this->input['sourceToken'])) {
|
if ( ! empty($this->input['sourceToken'])) {
|
||||||
$data['token'] = $this->input['sourceToken'];
|
$data['token'] = $this->input['sourceToken'];
|
||||||
unset($data['card']);
|
unset($data['card']);
|
||||||
@ -387,13 +390,9 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
|
|
||||||
if ($eventType == 'customer.source.deleted' || $eventType == 'customer.bank_account.deleted') {
|
if ($eventType == 'customer.source.deleted' || $eventType == 'customer.bank_account.deleted') {
|
||||||
$paymentMethod->delete();
|
$paymentMethod->delete();
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
} elseif ($eventType == 'customer.source.updated') {
|
} elseif ($eventType == 'customer.source.updated') {
|
||||||
$this->paymentService->convertPaymentMethodFromStripe($source, null, $paymentMethod)->save();
|
//$this->paymentService->convertPaymentMethodFromStripe($source, null, $paymentMethod)->save();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'Processed successfully';
|
return 'Processed successfully';
|
||||||
|
@ -249,7 +249,7 @@ class WePayPaymentDriver extends BasePaymentDriver
|
|||||||
if ($source->state == 'deleted') {
|
if ($source->state == 'deleted') {
|
||||||
$paymentMethod->delete();
|
$paymentMethod->delete();
|
||||||
} else {
|
} else {
|
||||||
$this->paymentService->convertPaymentMethodFromWePay($source, null, $paymentMethod)->save();
|
//$this->paymentService->convertPaymentMethodFromWePay($source, null, $paymentMethod)->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'Processed successfully';
|
return 'Processed successfully';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user