web/website/integrations/azuriom/subscribe-flow-test.php

6 lines
1.4 KiB
PHP

<?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";}