@@ -51,14 +51,16 @@ public function testSendsShopToBillingScreen(): void
51
51
);
52
52
}
53
53
54
- public function testShopAcceptsBilling (): void
54
+ public function testReactFrontendShopAcceptsBilling (): void
55
55
{
56
56
// Stub the responses
57
57
ApiStub::stubResponses ([
58
58
'post_recurring_application_charges ' ,
59
59
'post_recurring_application_charges_activate ' ,
60
60
]);
61
61
62
+ config (['shopify-app.frontend_engine ' => 'REACT ' ]);
63
+
62
64
// Create the shop and log them in
63
65
$ shop = factory ($ this ->model )->create ();
64
66
$ this ->auth ->login ($ shop );
@@ -87,6 +89,44 @@ public function testShopAcceptsBilling(): void
87
89
$ this ->assertNotNull ($ shop ->plan );
88
90
}
89
91
92
+ public function testBladeFrontendShopAcceptsBilling (): void
93
+ {
94
+ // Stub the responses
95
+ ApiStub::stubResponses ([
96
+ 'post_recurring_application_charges ' ,
97
+ 'post_recurring_application_charges_activate ' ,
98
+ ]);
99
+
100
+ config (['shopify-app.frontend_engine ' => 'BLADE ' ]);
101
+
102
+ // Create the shop and log them in
103
+ $ shop = factory ($ this ->model )->create ();
104
+ $ this ->auth ->login ($ shop );
105
+
106
+ // Make the plan
107
+ $ plan = factory (Util::getShopifyConfig ('models.plan ' , Plan::class))->states ('type_recurring ' )->create ();
108
+
109
+ // Run the call
110
+ $ response = $ this ->call (
111
+ 'get ' ,
112
+ "/billing/process/ {$ plan ->id }" ,
113
+ [
114
+ 'charge_id ' => 1 ,
115
+ 'shop ' => $ shop ->getDomain ()->toNative (),
116
+ ]
117
+ );
118
+
119
+ // Refresh the model
120
+ $ shop ->refresh ();
121
+
122
+ $ hostValue = urlencode (base64_encode ($ shop ->getDomain ()->toNative ().'/admin ' ));
123
+ // Assert we've redirected and shop has been updated
124
+ $ response ->assertRedirect ();
125
+ $ this ->assertFalse (Str::contains ($ response ->headers ->get ('Location ' ), '&host= ' .$ hostValue ));
126
+ $ this ->assertFalse (Str::contains ($ response ->headers ->get ('Location ' ), '&billing=success ' ));
127
+ $ this ->assertNotNull ($ shop ->plan );
128
+ }
129
+
90
130
public function testUsageChargeSuccess (): void
91
131
{
92
132
// Stub the responses
0 commit comments