mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add back interface methods for new payment flows
This commit is contained in:
parent
4e59f4d8a8
commit
cba76cd608
@ -101,7 +101,10 @@ class ActivityExport extends BaseExport
|
|||||||
$t = app('translator');
|
$t = app('translator');
|
||||||
$t->replace(Ninja::transformTranslations($this->company->settings));
|
$t->replace(Ninja::transformTranslations($this->company->settings));
|
||||||
|
|
||||||
$this->date_format = DateFormat::find($this->company->settings->date_format_id)->format;
|
/** @var \App\Models\DateFormat $df */
|
||||||
|
$df = DateFormat::query()->find($this->company->settings->date_format_id);
|
||||||
|
|
||||||
|
$this->date_format = $df->format;
|
||||||
|
|
||||||
if (count($this->input['report_keys']) == 0) {
|
if (count($this->input['report_keys']) == 0) {
|
||||||
$this->input['report_keys'] = array_values($this->entity_keys);
|
$this->input['report_keys'] = array_values($this->entity_keys);
|
||||||
|
@ -845,7 +845,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Apply Product Filters
|
* Apply Product Filters
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
@ -870,7 +870,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add Client Filter
|
* Add Client Filter
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param mixed $clients
|
* @param mixed $clients
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
@ -893,7 +893,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add Vendor Filter
|
* Add Vendor Filter
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $vendors
|
* @param string $vendors
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
@ -917,7 +917,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* AddProjectFilter
|
* AddProjectFilter
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $projects
|
* @param string $projects
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
@ -941,7 +941,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add Category Filter
|
* Add Category Filter
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $expense_categories
|
* @param string $expense_categories
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
@ -966,7 +966,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add Payment Status Filters
|
* Add Payment Status Filters
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $status
|
* @param string $status
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
@ -1024,10 +1024,10 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add RecurringInvoice Status Filter
|
* Add RecurringInvoice Status Filter
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $status
|
* @param string $status
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
*/
|
*/
|
||||||
protected function addRecurringInvoiceStatusFilter(Builder $query, string $status): Builder
|
protected function addRecurringInvoiceStatusFilter(Builder $query, string $status): Builder
|
||||||
{
|
{
|
||||||
@ -1067,7 +1067,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add QuoteStatus Filter
|
* Add QuoteStatus Filter
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $status
|
* @param string $status
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
@ -1133,7 +1133,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add PurchaseOrder Status Filter
|
* Add PurchaseOrder Status Filter
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $status
|
* @param string $status
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
@ -1183,7 +1183,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add Invoice Status Filter
|
* Add Invoice Status Filter
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $status
|
* @param string $status
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
@ -1249,7 +1249,7 @@ class BaseExport
|
|||||||
/**
|
/**
|
||||||
* Add Date Range
|
* Add Date Range
|
||||||
*
|
*
|
||||||
* @param Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param ?string $table_name
|
* @param ?string $table_name
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
|
@ -278,12 +278,12 @@ class RotessaPaymentDriver extends BaseDriver
|
|||||||
return $this->company_gateway->getConfigField('testMode') ? 'https://sandbox-api.rotessa.com/v1/' : 'https://api.rotessa.com/v1/';
|
return $this->company_gateway->getConfigField('testMode') ? 'https://sandbox-api.rotessa.com/v1/' : 'https://api.rotessa.com/v1/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processPaymentViewData(array $data)
|
public function processPaymentViewData(array $data): array
|
||||||
{
|
{
|
||||||
return $this->payment_method->paymentData($data);
|
return $this->payment_method->paymentData($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function livewirePaymentView(array $data)
|
public function livewirePaymentView(array $data): string
|
||||||
{
|
{
|
||||||
return $this->payment_method->livewirePaymentView($data);
|
return $this->payment_method->livewirePaymentView($data);
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class Bancontact
|
class Bancontact implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -37,32 +38,7 @@ class Bancontact
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => 'eur',
|
|
||||||
'payment_method_types' => ['bancontact'],
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::BANCONTACT,
|
|
||||||
],
|
|
||||||
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.bancontact.pay', $data);
|
return render('gateways.stripe.bancontact.pay', $data);
|
||||||
}
|
}
|
||||||
@ -143,4 +119,41 @@ class Bancontact
|
|||||||
|
|
||||||
throw new PaymentFailed('Failed to process the payment.', 500);
|
throw new PaymentFailed('Failed to process the payment.', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['return_url'] = $this->buildReturnUrl();
|
||||||
|
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
||||||
|
$data['client'] = $this->stripe->client;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
|
'amount' => $data['stripe_amount'],
|
||||||
|
'currency' => 'eur',
|
||||||
|
'payment_method_types' => ['bancontact'],
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $this->stripe->getDescription(false),
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::BANCONTACT,
|
||||||
|
],
|
||||||
|
|
||||||
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.bancontact.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,13 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
use App\Utils\Number;
|
use App\Utils\Number;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Stripe\PaymentIntent;
|
use Stripe\PaymentIntent;
|
||||||
|
|
||||||
class BankTransfer
|
class BankTransfer implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
@ -38,37 +39,7 @@ class BankTransfer
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
|
||||||
'currency' => $this->stripe->client->currency()->code,
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer()->id,
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'payment_method_types' => ['customer_balance'],
|
|
||||||
'payment_method_data' => [
|
|
||||||
'type' => 'customer_balance',
|
|
||||||
],
|
|
||||||
'payment_method_options' => [
|
|
||||||
'customer_balance' => [
|
|
||||||
'funding_type' => 'bank_transfer',
|
|
||||||
'bank_transfer' => $this->resolveBankType()
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::DIRECT_DEBIT,
|
|
||||||
],
|
|
||||||
], $this->stripe->stripe_connect_auth);
|
|
||||||
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency())]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['client_secret'] = $intent ? $intent->client_secret : false;
|
|
||||||
|
|
||||||
return render('gateways.stripe.bank_transfer.pay', $data);
|
return render('gateways.stripe.bank_transfer.pay', $data);
|
||||||
}
|
}
|
||||||
@ -317,4 +288,46 @@ class BankTransfer
|
|||||||
|
|
||||||
throw new PaymentFailed('Failed to process the payment.', 500);
|
throw new PaymentFailed('Failed to process the payment.', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
|
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
||||||
|
'currency' => $this->stripe->client->currency()->code,
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer()->id,
|
||||||
|
'description' => $this->stripe->getDescription(false),
|
||||||
|
'payment_method_types' => ['customer_balance'],
|
||||||
|
'payment_method_data' => [
|
||||||
|
'type' => 'customer_balance',
|
||||||
|
],
|
||||||
|
'payment_method_options' => [
|
||||||
|
'customer_balance' => [
|
||||||
|
'funding_type' => 'bank_transfer',
|
||||||
|
'bank_transfer' => $this->resolveBankType()
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::DIRECT_DEBIT,
|
||||||
|
],
|
||||||
|
], $this->stripe->stripe_connect_auth);
|
||||||
|
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency())]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data['return_url'] = $this->buildReturnUrl();
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['client_secret'] = $intent ? $intent->client_secret : false;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.bank_transfer.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
@ -19,6 +19,7 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\Common\MethodInterface;
|
use App\PaymentDrivers\Common\MethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
@ -29,7 +30,7 @@ use Stripe\ApplePayDomain;
|
|||||||
use Stripe\Exception\ApiErrorException;
|
use Stripe\Exception\ApiErrorException;
|
||||||
use Stripe\PaymentIntent;
|
use Stripe\PaymentIntent;
|
||||||
|
|
||||||
class BrowserPay implements MethodInterface
|
class BrowserPay implements MethodInterface, LivewireMethodInterface
|
||||||
{
|
{
|
||||||
protected StripePaymentDriver $stripe;
|
protected StripePaymentDriver $stripe;
|
||||||
|
|
||||||
@ -64,7 +65,8 @@ class BrowserPay implements MethodInterface
|
|||||||
return redirect()->route('client.payment_methods.index');
|
return redirect()->route('client.payment_methods.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function paymentView(array $data): View
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
{
|
{
|
||||||
$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()),
|
||||||
@ -93,6 +95,13 @@ class BrowserPay implements MethodInterface
|
|||||||
'requestPayerEmail' => true,
|
'requestPayerEmail' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function paymentView(array $data): View
|
||||||
|
{
|
||||||
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
return render('gateways.stripe.browser_pay.pay', $data);
|
return render('gateways.stripe.browser_pay.pay', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +162,7 @@ class BrowserPay implements MethodInterface
|
|||||||
$this->stripe->client->company,
|
$this->stripe->client->company,
|
||||||
);
|
);
|
||||||
|
|
||||||
return redirect()->route('client.payments.show', ['payment' => $payment->hashed_id]);
|
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,4 +240,9 @@ class BrowserPay implements MethodInterface
|
|||||||
|
|
||||||
return str_replace(['https://', '/public'], '', $domain);
|
return str_replace(['https://', '/public'], '', $domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.browser_pay.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class Charge
|
|||||||
{
|
{
|
||||||
if ($cgt->gateway_type_id == GatewayType::BANK_TRANSFER) {
|
if ($cgt->gateway_type_id == GatewayType::BANK_TRANSFER) {
|
||||||
return (new ACH($this->stripe))->tokenBilling($cgt, $payment_hash);
|
return (new ACH($this->stripe))->tokenBilling($cgt, $payment_hash);
|
||||||
} elseif($cgt->gateway_type_id == GatewayType::ACSS) {
|
} elseif ($cgt->gateway_type_id == GatewayType::ACSS) {
|
||||||
return (new ACSS($this->stripe))->tokenBilling($cgt, $payment_hash);
|
return (new ACSS($this->stripe))->tokenBilling($cgt, $payment_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,8 +82,8 @@ class Charge
|
|||||||
if ($cgt->gateway_type_id == GatewayType::BACS) {
|
if ($cgt->gateway_type_id == GatewayType::BACS) {
|
||||||
$data['payment_method_types'] = ['bacs_debit'];
|
$data['payment_method_types'] = ['bacs_debit'];
|
||||||
}
|
}
|
||||||
if($cgt->gateway_type_id == GatewayType::CREDIT_CARD){
|
if ($cgt->gateway_type_id == GatewayType::CREDIT_CARD) {
|
||||||
$data['payment_method_types'] = ["card","link"];
|
$data['payment_method_types'] = ["card","link"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should improve token billing with client not present */
|
/* Should improve token billing with client not present */
|
||||||
|
@ -19,12 +19,13 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\Stripe\Jobs\UpdateCustomer;
|
use App\PaymentDrivers\Stripe\Jobs\UpdateCustomer;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
use Stripe\PaymentIntent;
|
use Stripe\PaymentIntent;
|
||||||
use Stripe\PaymentMethod;
|
use Stripe\PaymentMethod;
|
||||||
|
|
||||||
class CreditCard
|
class CreditCard implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
public $stripe;
|
public $stripe;
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ class CreditCard
|
|||||||
return redirect()->route('client.payment_methods.index');
|
return redirect()->route('client.payment_methods.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentData(array $data): array
|
||||||
{
|
{
|
||||||
$description = $this->stripe->getDescription(false);
|
$description = $this->stripe->getDescription(false);
|
||||||
|
|
||||||
@ -77,9 +78,21 @@ class CreditCard
|
|||||||
$data['intent'] = $this->stripe->createPaymentIntent($payment_intent_data);
|
$data['intent'] = $this->stripe->createPaymentIntent($payment_intent_data);
|
||||||
$data['gateway'] = $this->stripe;
|
$data['gateway'] = $this->stripe;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function paymentView(array $data)
|
||||||
|
{
|
||||||
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
return render('gateways.stripe.credit_card.pay', $data);
|
return render('gateways.stripe.credit_card.pay', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.credit_card.pay_livewire';
|
||||||
|
}
|
||||||
|
|
||||||
public function paymentResponse(PaymentResponseRequest $request)
|
public function paymentResponse(PaymentResponseRequest $request)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$this->stripe->init();
|
||||||
@ -160,7 +173,7 @@ class CreditCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('client.payments.show', ['payment' => $payment->hashed_id]);
|
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processUnsuccessfulPayment($server_response)
|
public function processUnsuccessfulPayment($server_response)
|
||||||
|
@ -18,9 +18,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class EPS
|
class EPS implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -37,31 +38,7 @@ class EPS
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => 'eur',
|
|
||||||
'payment_method_types' => ['eps'],
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::EPS,
|
|
||||||
],
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.eps.pay', $data);
|
return render('gateways.stripe.eps.pay', $data);
|
||||||
}
|
}
|
||||||
@ -142,4 +119,40 @@ class EPS
|
|||||||
|
|
||||||
throw new PaymentFailed('Failed to process the payment.', 500);
|
throw new PaymentFailed('Failed to process the payment.', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['return_url'] = $this->buildReturnUrl();
|
||||||
|
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
||||||
|
$data['client'] = $this->stripe->client;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
|
'amount' => $data['stripe_amount'],
|
||||||
|
'currency' => 'eur',
|
||||||
|
'payment_method_types' => ['eps'],
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $this->stripe->getDescription(false),
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::EPS,
|
||||||
|
],
|
||||||
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.eps.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class FPX
|
class FPX implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -38,31 +39,7 @@ class FPX
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => $this->stripe->client->getCurrencyCode(),
|
|
||||||
'payment_method_types' => ['fpx'],
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::FPX,
|
|
||||||
],
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.fpx.pay', $data);
|
return render('gateways.stripe.fpx.pay', $data);
|
||||||
}
|
}
|
||||||
@ -143,4 +120,40 @@ class FPX
|
|||||||
|
|
||||||
throw new PaymentFailed('Failed to process the payment.', 400);
|
throw new PaymentFailed('Failed to process the payment.', 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['return_url'] = $this->buildReturnUrl();
|
||||||
|
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
||||||
|
$data['client'] = $this->stripe->client;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
|
'amount' => $data['stripe_amount'],
|
||||||
|
'currency' => $this->stripe->client->getCurrencyCode(),
|
||||||
|
'payment_method_types' => ['fpx'],
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $this->stripe->getDescription(false),
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::FPX,
|
||||||
|
],
|
||||||
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.fpx.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
@ -18,9 +18,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class GIROPAY
|
class GIROPAY implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -37,31 +38,7 @@ class GIROPAY
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => 'eur',
|
|
||||||
'payment_method_types' => ['giropay'],
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::GIROPAY,
|
|
||||||
],
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.giropay.pay', $data);
|
return render('gateways.stripe.giropay.pay', $data);
|
||||||
}
|
}
|
||||||
@ -176,6 +153,6 @@ class GIROPAY
|
|||||||
|
|
||||||
public function livewirePaymentView(array $data): string
|
public function livewirePaymentView(array $data): string
|
||||||
{
|
{
|
||||||
return 'gateways.stripe.giropay.pay_livewire';
|
return 'gateways.giropay.pay_livewire';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class Klarna
|
class Klarna implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -37,33 +38,7 @@ class Klarna
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$description = $this->stripe->getDescription(false);
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => $this->stripe->client->getCurrencyCode(),
|
|
||||||
'payment_method_types' => ['klarna'],
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $description,
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::KLARNA,
|
|
||||||
],
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.klarna.pay', $data);
|
return render('gateways.stripe.klarna.pay', $data);
|
||||||
}
|
}
|
||||||
@ -142,4 +117,42 @@ class Klarna
|
|||||||
|
|
||||||
throw new PaymentFailed(ctrans('texts.gateway_error'), 500);
|
throw new PaymentFailed(ctrans('texts.gateway_error'), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['return_url'] = $this->buildReturnUrl();
|
||||||
|
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
||||||
|
$data['client'] = $this->stripe->client;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
|
||||||
|
$description = $this->stripe->getDescription(false);
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
|
'amount' => $data['stripe_amount'],
|
||||||
|
'currency' => $this->stripe->client->getCurrencyCode(),
|
||||||
|
'payment_method_types' => ['klarna'],
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $description,
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::KLARNA,
|
||||||
|
],
|
||||||
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.klarna.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class PRZELEWY24
|
class PRZELEWY24 implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -37,31 +38,7 @@ class PRZELEWY24
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => 'eur',
|
|
||||||
'payment_method_types' => ['p24'],
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::PRZELEWY24,
|
|
||||||
],
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.przelewy24.pay', $data);
|
return render('gateways.stripe.przelewy24.pay', $data);
|
||||||
}
|
}
|
||||||
@ -142,4 +119,40 @@ class PRZELEWY24
|
|||||||
|
|
||||||
throw new PaymentFailed('Failed to process the payment.', 500);
|
throw new PaymentFailed('Failed to process the payment.', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['return_url'] = $this->buildReturnUrl();
|
||||||
|
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
||||||
|
$data['client'] = $this->stripe->client;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
|
'amount' => $data['stripe_amount'],
|
||||||
|
'currency' => 'eur',
|
||||||
|
'payment_method_types' => ['p24'],
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $this->stripe->getDescription(false),
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::PRZELEWY24,
|
||||||
|
],
|
||||||
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.przelewy24.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
@ -19,9 +19,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class SEPA
|
class SEPA implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -47,33 +48,7 @@ class SEPA
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$data['gateway'] = $this->stripe;
|
$data = $this->paymentData($data);
|
||||||
$data['payment_method_id'] = GatewayType::SEPA;
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
$data['payment_hash'] = $this->stripe->payment_hash->hash;
|
|
||||||
|
|
||||||
$intent_data = [
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => 'eur',
|
|
||||||
'payment_method_types' => ['sepa_debit'],
|
|
||||||
'setup_future_usage' => 'off_session',
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::SEPA,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create($intent_data, array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.sepa.pay', $data);
|
return render('gateways.stripe.sepa.pay', $data);
|
||||||
}
|
}
|
||||||
@ -176,4 +151,42 @@ class SEPA
|
|||||||
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['payment_method_id'] = GatewayType::SEPA;
|
||||||
|
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
||||||
|
$data['client'] = $this->stripe->client;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
$data['payment_hash'] = $this->stripe->payment_hash->hash;
|
||||||
|
|
||||||
|
$intent_data = [
|
||||||
|
'amount' => $data['stripe_amount'],
|
||||||
|
'currency' => 'eur',
|
||||||
|
'payment_method_types' => ['sepa_debit'],
|
||||||
|
'setup_future_usage' => 'off_session',
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $this->stripe->getDescription(false),
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::SEPA,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create($intent_data, array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.sepa.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
@ -18,9 +18,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class SOFORT
|
class SOFORT implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -37,31 +38,7 @@ class SOFORT
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => 'eur',
|
|
||||||
'payment_method_types' => ['sofort'],
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::SOFORT,
|
|
||||||
],
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.sofort.pay', $data);
|
return render('gateways.stripe.sofort.pay', $data);
|
||||||
}
|
}
|
||||||
@ -137,4 +114,40 @@ class SOFORT
|
|||||||
|
|
||||||
throw new PaymentFailed('Failed to process the payment.', 500);
|
throw new PaymentFailed('Failed to process the payment.', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['return_url'] = $this->buildReturnUrl();
|
||||||
|
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
||||||
|
$data['client'] = $this->stripe->client;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
|
'amount' => $data['stripe_amount'],
|
||||||
|
'currency' => 'eur',
|
||||||
|
'payment_method_types' => ['sofort'],
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $this->stripe->getDescription(false),
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::SOFORT,
|
||||||
|
],
|
||||||
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.sofort.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class iDeal
|
class iDeal implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -37,31 +38,7 @@ class iDeal
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['return_url'] = $this->buildReturnUrl();
|
|
||||||
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
$data['client'] = $this->stripe->client;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
|
||||||
'amount' => $data['stripe_amount'],
|
|
||||||
'currency' => 'eur',
|
|
||||||
'payment_method_types' => ['ideal'],
|
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
'description' => $this->stripe->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::IDEAL,
|
|
||||||
],
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
|
||||||
$this->stripe->payment_hash->save();
|
|
||||||
|
|
||||||
return render('gateways.stripe.ideal.pay', $data);
|
return render('gateways.stripe.ideal.pay', $data);
|
||||||
}
|
}
|
||||||
@ -142,4 +119,40 @@ class iDeal
|
|||||||
|
|
||||||
throw new PaymentFailed('Failed to process the payment.', 500);
|
throw new PaymentFailed('Failed to process the payment.', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['return_url'] = $this->buildReturnUrl();
|
||||||
|
$data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
||||||
|
$data['client'] = $this->stripe->client;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
|
||||||
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
|
'amount' => $data['stripe_amount'],
|
||||||
|
'currency' => 'eur',
|
||||||
|
'payment_method_types' => ['ideal'],
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $this->stripe->getDescription(false),
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::IDEAL,
|
||||||
|
],
|
||||||
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.ideal.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user