mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 06:32:40 +01:00
Fixes for webhook
This commit is contained in:
parent
c908819348
commit
0fe89ecf96
@ -641,7 +641,7 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
// if($request->type === 'payment_intent.requires_action')
|
// if($request->type === 'payment_intent.requires_action')
|
||||||
// nlog($request->all());
|
// nlog($request->all());
|
||||||
|
|
||||||
if($request->type === 'customer.source.updated') {
|
if($request->type === 'customer.source.updated') {
|
||||||
$ach = new ACH($this);
|
$ach = new ACH($this);
|
||||||
$ach->updateBankAccount($request->all());
|
$ach->updateBankAccount($request->all());
|
||||||
@ -730,7 +730,6 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
return response()->json([], 200);
|
return response()->json([], 200);
|
||||||
} elseif ($request->type === "checkout.session.completed"){
|
} elseif ($request->type === "checkout.session.completed"){
|
||||||
// Store payment token for Stripe BACS
|
// Store payment token for Stripe BACS
|
||||||
try {
|
|
||||||
$setup_intent = $this->stripe->stripe->setupIntents->retrieve($request->data->setup_inent, []);
|
$setup_intent = $this->stripe->stripe->setupIntents->retrieve($request->data->setup_inent, []);
|
||||||
$customer = $this->stripe->findOrCreateCustomer();
|
$customer = $this->stripe->findOrCreateCustomer();
|
||||||
$this->stripe->attach($setup_intent->payment_method, $customer);
|
$this->stripe->attach($setup_intent->payment_method, $customer);
|
||||||
@ -748,12 +747,9 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
];
|
];
|
||||||
$this->stripe->storeGatewayToken($data, ['gateway_customer_reference' => $customer->id]);
|
$this->stripe->storeGatewayToken($data, ['gateway_customer_reference' => $customer->id]);
|
||||||
return response()->json([], 200);
|
return response()->json([], 200);
|
||||||
} catch (\Exception $e) {
|
|
||||||
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
|
||||||
}
|
|
||||||
} elseif ($request->type === "mandate.updated"){
|
} elseif ($request->type === "mandate.updated"){
|
||||||
// Check if payment method BACS is still valid
|
// Check if payment method BACS is still valid
|
||||||
if ($request->data->status === "active"){
|
if ($request->data['status'] === "active"){
|
||||||
// Check if payment method exists
|
// Check if payment method exists
|
||||||
$clientgateway = ClientGatewayToken::query()
|
$clientgateway = ClientGatewayToken::query()
|
||||||
->where('token', $request->data->payment_method)
|
->where('token', $request->data->payment_method)
|
||||||
@ -763,14 +759,14 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
$clientgateway->save();
|
$clientgateway->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($request->data->status === "inactive"){
|
elseif ($request->data['status'] === "inactive"){
|
||||||
// Deactivate payment method
|
// Deactivate payment method
|
||||||
$clientgateway = ClientGatewayToken::query()
|
$clientgateway = ClientGatewayToken::query()
|
||||||
->where('token', $request->data->payment_method)
|
->where('token', $request->data->payment_method)
|
||||||
->first();
|
->first();
|
||||||
$clientgateway->delete();
|
$clientgateway->delete();
|
||||||
}
|
}
|
||||||
elseif ($request->data->status === "pending"){
|
elseif ($request->data['status'] === "pending"){
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
return response()->json([], 200);
|
return response()->json([], 200);
|
||||||
|
Loading…
Reference in New Issue
Block a user