Add PayPal checkout provider
This commit is contained in:
@@ -74,6 +74,8 @@ class CheckoutSessionService
|
||||
$session->status = CheckoutSession::STATUS_DRAFT;
|
||||
$session->lemonsqueezy_checkout_id = null;
|
||||
$session->lemonsqueezy_order_id = null;
|
||||
$session->paypal_order_id = null;
|
||||
$session->paypal_capture_id = null;
|
||||
$session->provider_metadata = [];
|
||||
$session->failure_reason = null;
|
||||
$session->coupon()->dissociate();
|
||||
@@ -117,10 +119,20 @@ class CheckoutSessionService
|
||||
{
|
||||
$provider = strtolower($provider);
|
||||
|
||||
if (! in_array($provider, [
|
||||
CheckoutSession::PROVIDER_LEMONSQUEEZY,
|
||||
CheckoutSession::PROVIDER_FREE,
|
||||
], true)) {
|
||||
$configuredProviders = config('checkout.providers', []);
|
||||
if (! is_array($configuredProviders) || $configuredProviders === []) {
|
||||
$configuredProviders = [
|
||||
CheckoutSession::PROVIDER_LEMONSQUEEZY,
|
||||
CheckoutSession::PROVIDER_PAYPAL,
|
||||
CheckoutSession::PROVIDER_FREE,
|
||||
];
|
||||
}
|
||||
|
||||
if (! in_array(CheckoutSession::PROVIDER_FREE, $configuredProviders, true)) {
|
||||
$configuredProviders[] = CheckoutSession::PROVIDER_FREE;
|
||||
}
|
||||
|
||||
if (! in_array($provider, $configuredProviders, true)) {
|
||||
throw new RuntimeException("Unsupported checkout provider [{$provider}]");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user