mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:44:28 -04:00
Improve gateway descriptions for Stripe - credit card + acss
This commit is contained in:
parent
070b4fa6cf
commit
aa82f50150
@ -143,7 +143,7 @@ class ACSS
|
|||||||
'setup_future_usage' => 'off_session',
|
'setup_future_usage' => 'off_session',
|
||||||
'payment_method_types' => ['acss_debit'],
|
'payment_method_types' => ['acss_debit'],
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices').': '.collect($data['invoices'])->pluck('invoice_number')),
|
'description' => $this->stripe->getDescription(false),
|
||||||
'metadata' => [
|
'metadata' => [
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
'gateway_type_id' => GatewayType::ACSS,
|
'gateway_type_id' => GatewayType::ACSS,
|
||||||
@ -185,7 +185,7 @@ class ACSS
|
|||||||
$this->stripe->payment_hash->save();
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') {
|
if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') {
|
||||||
// $this->storePaymentMethod($gateway_response);
|
|
||||||
return $this->processSuccessfulPayment($gateway_response->id);
|
return $this->processSuccessfulPayment($gateway_response->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +60,7 @@ class CreditCard
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$invoice_numbers = collect($data['invoices'])->pluck('invoice_number')->implode(',');
|
$description = $this->stripe->getDescription(false);
|
||||||
$description = ctrans('texts.stripe_payment_text', ['invoicenumber' => $invoice_numbers, 'amount' => Number::formatMoney($data['total']['amount_with_fee'], $this->stripe->client), 'client' => $this->stripe->client->present()->name()], $this->stripe->client->company->locale());
|
|
||||||
|
|
||||||
$payment_intent_data = [
|
$payment_intent_data = [
|
||||||
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
||||||
@ -81,19 +80,6 @@ class CreditCard
|
|||||||
return render('gateways.stripe.credit_card.pay', $data);
|
return render('gateways.stripe.credit_card.pay', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function decodeUnicodeString($string)
|
|
||||||
{
|
|
||||||
return html_entity_decode($string, ENT_QUOTES, 'UTF-8');
|
|
||||||
// return iconv("UTF-8", "ISO-8859-1//TRANSLIT", $this->decode_encoded_utf8($string));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function decode_encoded_utf8($string)
|
|
||||||
{
|
|
||||||
return preg_replace_callback('#\\\\u([0-9a-f]{4})#ism', function ($matches) {
|
|
||||||
return mb_convert_encoding(pack('H*', $matches[1]), 'UTF-8', 'UCS-2BE');
|
|
||||||
}, $string);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function paymentResponse(PaymentResponseRequest $request)
|
public function paymentResponse(PaymentResponseRequest $request)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$this->stripe->init();
|
||||||
@ -166,8 +152,6 @@ class CreditCard
|
|||||||
$this->stripe->client->company,
|
$this->stripe->client->company,
|
||||||
);
|
);
|
||||||
|
|
||||||
//If the user has come from a subscription double check here if we need to redirect.
|
|
||||||
//08-08-2022
|
|
||||||
if ($payment->invoices()->whereHas('subscription')->exists()) {
|
if ($payment->invoices()->whereHas('subscription')->exists()) {
|
||||||
$subscription = $payment->invoices()->first()->subscription;
|
$subscription = $payment->invoices()->first()->subscription;
|
||||||
|
|
||||||
@ -175,7 +159,6 @@ class CreditCard
|
|||||||
return redirect($subscription->webhook_configuration['return_url']);
|
return redirect($subscription->webhook_configuration['return_url']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//08-08-2022
|
|
||||||
|
|
||||||
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
|
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ class AutoBillInvoice extends AbstractService
|
|||||||
|
|
||||||
$payment_hash = PaymentHash::create([
|
$payment_hash = PaymentHash::create([
|
||||||
'hash' => Str::random(64),
|
'hash' => Str::random(64),
|
||||||
'data' => ['invoices' => [['invoice_id' => $this->invoice->hashed_id, 'amount' => $amount, 'invoice_number' => $this->invoice->number]]],
|
'data' => ['amount_with_fee' => $amount + $fee, 'invoices' => [['invoice_id' => $this->invoice->hashed_id, 'amount' => $amount, 'invoice_number' => $this->invoice->number]]],
|
||||||
'fee_total' => $fee,
|
'fee_total' => $fee,
|
||||||
'fee_invoice_id' => $this->invoice->id,
|
'fee_invoice_id' => $this->invoice->id,
|
||||||
]);
|
]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user