@@ -102,6 +102,11 @@ public function isAuthenticated(): bool
102102 return !!$ this ->access_token ;
103103 }
104104
105+ public function getHost (): ?string
106+ {
107+ return $ this ->host ;
108+ }
109+
105110 public function login (string $ code , string $ code_verifier , string $ redirect_uri ): AuthToken
106111 {
107112 if (is_null ($ this ->client_id ) || is_null ($ this ->client_secret )) {
@@ -316,19 +321,19 @@ public function getFullWptPlanSet(): PlanListSet
316321 return new Plan ($ options );
317322 }, $ results ->getData ()['wptPlan ' ] ?? []);
318323
319- $ current_plans = array_filter ($ all_plans , function (Plan $ plan ) {
320- /** This is a bit of a hack for now. These are our approved plans for new
321- * customers to be able to use. We will better handle this from the backend
322- * */
323- return strtolower ($ plan ->getId ()) == 'ap5 ' ||
324- strtolower ($ plan ->getId ()) == 'ap6 ' ||
325- strtolower ($ plan ->getId ()) == 'ap7 ' ||
326- strtolower ($ plan ->getId ()) == 'ap8 ' ||
327- strtolower ($ plan ->getId ()) == 'mp5 ' ||
328- strtolower ($ plan ->getId ()) == 'mp6 ' ||
329- strtolower ($ plan ->getId ()) == 'mp7 ' ||
330- strtolower ($ plan ->getId ()) == 'mp8 ' ;
331- });
324+ $ current_plans = array_filter ($ all_plans , function (Plan $ plan ) {
325+ /** This is a bit of a hack for now. These are our approved plans for new
326+ * customers to be able to use. We will better handle this from the backend
327+ * */
328+ return strtolower ($ plan ->getId ()) == 'ap5 ' ||
329+ strtolower ($ plan ->getId ()) == 'ap6 ' ||
330+ strtolower ($ plan ->getId ()) == 'ap7 ' ||
331+ strtolower ($ plan ->getId ()) == 'ap8 ' ||
332+ strtolower ($ plan ->getId ()) == 'mp5 ' ||
333+ strtolower ($ plan ->getId ()) == 'mp6 ' ||
334+ strtolower ($ plan ->getId ()) == 'mp7 ' ||
335+ strtolower ($ plan ->getId ()) == 'mp8 ' ;
336+ });
332337 $ set = new PlanListSet ();
333338 $ set ->setAllPlans (new PlanList (...$ all_plans ));
334339 $ set ->setCurrentPlans (new PlanList (...$ current_plans ));
@@ -1070,18 +1075,18 @@ public function updatePlan(string $subscription_id, string $next_plan_handle, bo
10701075 public function updatePaymentMethod (string $ token , ShippingAddress $ address ): bool
10711076 {
10721077 $ gql = (new Mutation ('wptUpdateSubscriptionPayment ' ))
1073- ->setVariables ([
1074- new Variable ('paymentToken ' , 'String ' , true ),
1075- new Variable ('shippingAddress ' , 'ChargifyAddressInputType ' , true )
1076- ])
1077- ->setArguments ([
1078- 'paymentToken ' => '$paymentToken ' ,
1079- 'shippingAddress ' => '$shippingAddress '
1080- ]);
1078+ ->setVariables ([
1079+ new Variable ('paymentToken ' , 'String ' , true ),
1080+ new Variable ('shippingAddress ' , 'ChargifyAddressInputType ' , true )
1081+ ])
1082+ ->setArguments ([
1083+ 'paymentToken ' => '$paymentToken ' ,
1084+ 'shippingAddress ' => '$shippingAddress '
1085+ ]);
10811086
10821087 $ variables = [
1083- 'paymentToken ' => $ token ,
1084- 'shippingAddress ' => $ address ->toArray ()
1088+ 'paymentToken ' => $ token ,
1089+ 'shippingAddress ' => $ address ->toArray ()
10851090 ];
10861091
10871092 $ results = $ this ->graphql_client ->runQuery ($ gql , true , $ variables );
0 commit comments