| @@ -34,9 +34,9 @@ | ||
| 34 | 34 | if( is_array( $data ) && ! empty( $data ) ) { |
| 35 | 35 | return $data; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $query = 'id, price, name, discounted_price, type, sites'; | |
| 38 | + $query = 'id, price, name, discounted_price, type, sites, coupon'; | |
| 39 | 39 | $response = $this->http()->query( |
| 40 | 40 | 'subscriptionPlans', |
| 41 | 41 | $query |
| 42 | 42 | )->post(); |
| @@ -60,8 +60,10 @@ | ||
| 60 | 60 | 'ip' => $_ip, |
| 61 | 61 | 'site_url' => $_site_url |
| 62 | 62 | ]; |
| 63 | 63 | |
| 64 | + $postArgs = []; | |
| 65 | + | |
| 64 | 66 | if ( $viaAPI ) { |
| 65 | 67 | $api_key = $this->get_param( 'api_key' ); |
| 66 | 68 | $funcArgs['api_key'] = $api_key; |
| 67 | 69 | |
| @@ -90,9 +92,9 @@ | ||
| 90 | 92 | $response = $this->http()->mutation( |
| 91 | 93 | $viaAPI ? 'connectWithApiKey' : 'connect', |
| 92 | 94 | $query, |
| 93 | 95 | $funcArgs |
| 94 | - )->post(); | |
| 96 | + )->post($postArgs); | |
| 95 | 97 | |
| 96 | 98 | if ( is_wp_error( $response ) ) { |
| 97 | 99 | return $response; |
| 98 | 100 | } |
| @@ -132,8 +134,10 @@ | ||
| 132 | 134 | |
| 133 | 135 | unset( $response['user']['reviews'] ); |
| 134 | 136 | $meta['reviews'] = $_reviews; |
| 135 | 137 | } |
| 138 | + | |
| 139 | + // No longer need to manage is_live_api state - API selection is now handled by TEMPLATELY_DEV_API constant | |
| 136 | 140 | |
| 137 | 141 | $this->utils( 'options' )->set( 'user', $response['user'] ); |
| 138 | 142 | $response['user']['meta'] = $this->user_meta( $meta ); |
| 139 | 143 | |