Merge pull request 'Finish embedded Council Subscribe flow —363' (#23) from dev/MC:dev/ticket-363-council-scheduler into checkpoint/alpha-1.0.0.3
Reviewed-on: unimatrix/MC#23
This commit is contained in:
commit
319fa04fcc
2 changed files with 23 additions and 0 deletions
17
website/integrations/azuriom/native-subscribe-flow.patch
Normal file
17
website/integrations/azuriom/native-subscribe-flow.patch
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
--- a/plugins/shop/src/Controllers/SubscriptionController.php
|
||||
+++ b/plugins/shop/src/Controllers/SubscriptionController.php
|
||||
@@ -37,13 +37,7 @@
|
||||
->filter(fn (Gateway $gateway) => $gateway->isSupported())
|
||||
->filter(fn (Gateway $gateway) => $gateway->paymentMethod()->supportsSubscriptions());
|
||||
|
||||
- // If there is only one payment gateway, redirect to it directly
|
||||
- if ($gateways->count() === 1) {
|
||||
- $gateway = $gateways->first();
|
||||
-
|
||||
- return $gateway->paymentMethod()->startSubscription($user, $package);
|
||||
- }
|
||||
-
|
||||
+ // Subscription provider selection must stay inside the storefront too.
|
||||
return view('shop::payments.pay', [
|
||||
'gateways' => $gateways,
|
||||
'route' => fn (string $gateway) => route('shop.subscriptions.subscribe', [
|
||||
6
website/integrations/azuriom/subscribe-flow-test.php
Normal file
6
website/integrations/azuriom/subscribe-flow-test.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
namespace Azuriom\Http\Controllers {class Controller{}}
|
||||
namespace Illuminate\Http {class Request{}}
|
||||
namespace Azuriom\Plugin\Shop\Enums {enum PurchaseStatus{case Subscribed;case Available;function isAvailable(){return true;}}}
|
||||
namespace Azuriom\Plugin\Shop\Models {class Gateway{static function enabled(){return new \G;}}class Package{public $is_enabled=true;function isSubscription(){return true;}function purchaseStatus(){return \Azuriom\Plugin\Shop\Enums\PurchaseStatus::Available;}}class Subscription{}}
|
||||
namespace {class G{function get(){return $this;}function filter($f){return $this;}function count(){return 1;}function first(){throw new \Exception('Selection must not start provider');}}function abort_if($v,$s){if($v)throw new \Exception('HTTP'.$s);}function shop_user(){return null;}function use_site_money(){return false;}function view($n,$d){return [$n,$d];}function route($n,$d){return [$n,$d];}require $argv[1];$p=new \Azuriom\Plugin\Shop\Models\Package;$result=(new \Azuriom\Plugin\Shop\Controllers\SubscriptionController)->selectGateway(new \Illuminate\Http\Request,$p);assert($result[0]==='shop::payments.pay');$url=$result[1]['route']('stripe');if($result[0]!=='shop::payments.pay'||$url[0]!=='shop.subscriptions.subscribe'||$url[1]['package']!==$p||$url[1]['gateway']!=='stripe')throw new Exception('Wrong subscription selection');echo "Single-provider selection and bound subscription route verified without provider/payment calls.\n";}
|
||||
Loading…
Reference in a new issue

Staff