mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for Sofort
This commit is contained in:
parent
42ff354eb9
commit
778cf73ad1
@ -62,10 +62,10 @@ class SupportMessageSent extends Mailable
|
|||||||
$company = auth()->user()->company();
|
$company = auth()->user()->company();
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$db = str_replace("db-ninja-", "", $company->db);
|
$db = str_replace("db-ninja-", "", $company->db);
|
||||||
$is_large = $company->is_large ? "L" : "";
|
$is_large = $company->is_large ? "L" : "S";
|
||||||
|
|
||||||
if(Ninja::isHosted())
|
if(Ninja::isHosted())
|
||||||
$subject = "{$priority}Hosted-{$db}{$is_large} :: {$plan} :: ".date('M jS, g:ia');
|
$subject = "{$priority}Hosted-{$db}-{$is_large} :: {$plan} :: ".date('M jS, g:ia');
|
||||||
else
|
else
|
||||||
$subject = "{$priority}Self Hosted :: {$plan} :: ".date('M jS, g:ia');
|
$subject = "{$priority}Self Hosted :: {$plan} :: ".date('M jS, g:ia');
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class SOFORT
|
|||||||
'gateway_type_id' => GatewayType::SOFORT,
|
'gateway_type_id' => GatewayType::SOFORT,
|
||||||
];
|
];
|
||||||
|
|
||||||
$payment = $this->stripe->createPayment($data, Payment::STATUS_PENDING);
|
// $payment = $this->stripe->createPayment($data, Payment::STATUS_PENDING);
|
||||||
|
|
||||||
SystemLogger::dispatch(
|
SystemLogger::dispatch(
|
||||||
['response' => $this->stripe->payment_hash->data, 'data' => $data],
|
['response' => $this->stripe->payment_hash->data, 'data' => $data],
|
||||||
@ -96,7 +96,7 @@ class SOFORT
|
|||||||
$this->stripe->client->company,
|
$this->stripe->client->company,
|
||||||
);
|
);
|
||||||
|
|
||||||
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
|
return redirect()->route('client.payments.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processUnsuccessfulPayment()
|
public function processUnsuccessfulPayment()
|
||||||
|
@ -22,6 +22,7 @@ use App\Models\ClientGatewayToken;
|
|||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentHash;
|
use App\Models\PaymentHash;
|
||||||
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
use App\PaymentDrivers\Stripe\ACH;
|
use App\PaymentDrivers\Stripe\ACH;
|
||||||
use App\PaymentDrivers\Stripe\Alipay;
|
use App\PaymentDrivers\Stripe\Alipay;
|
||||||
@ -422,7 +423,7 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
// Allow app to catch up with webhook request.
|
// Allow app to catch up with webhook request.
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
|
||||||
if ($request->type === 'charge.succeeded' || $request->type === 'source.chargeable') {
|
if ($request->type === 'charge.succeeded') {
|
||||||
foreach ($request->data as $transaction) {
|
foreach ($request->data as $transaction) {
|
||||||
$payment = Payment::query()
|
$payment = Payment::query()
|
||||||
->where('transaction_reference', $transaction['id'])
|
->where('transaction_reference', $transaction['id'])
|
||||||
@ -435,6 +436,33 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif($request->type === 'source.chargeable'){
|
||||||
|
|
||||||
|
$this->init();
|
||||||
|
|
||||||
|
$charge = \Stripe\Charge::create([
|
||||||
|
'amount' => $request->amount,
|
||||||
|
'currency' => $request->currency,
|
||||||
|
'source' => $request->id,
|
||||||
|
], $this->stripe_connect_auth);
|
||||||
|
|
||||||
|
if($charge->captured)
|
||||||
|
{
|
||||||
|
$this->setClientFromCustomer($request->customer);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'payment_method' => $request->id,
|
||||||
|
'payment_type' => PaymentType::SOFORT,
|
||||||
|
'amount' => $this->convertFromStripeAmount($request->amount, $this->client->currency()->precision, $this->client->currency()),
|
||||||
|
'transaction_reference' => $charge->id,
|
||||||
|
'gateway_type_id' => GatewayType::SOFORT,
|
||||||
|
];
|
||||||
|
|
||||||
|
$payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json([], 200);
|
return response()->json([], 200);
|
||||||
}
|
}
|
||||||
@ -540,6 +568,11 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
return Account::all();
|
return Account::all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setClientFromCustomer($customer)
|
||||||
|
{
|
||||||
|
$this->client = ClientGatewayToken::where('gateway_customer_reference', $customer)->client;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pull all client payment methods and update
|
* Pull all client payment methods and update
|
||||||
* the respective tokens in the system.
|
* the respective tokens in the system.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user