Completed
Push — master ( cfffae...fa5fd4 )
by Nic
05:44
created
src/Model/FoxyStripeClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@
 block discarded – undo
262 262
         if ($client) {
263 263
             if ($category = $this->getCategory($data['code'])) {
264 264
                 $result = $client->patch($category, $data);
265
-            } else {
265
+            }else {
266 266
                 $result = $client->post($this->getItemCategoriesURL(), $data);
267 267
             }
268 268
             $errors = array_merge($errors, $client->getErrors($result));
Please login to merge, or discard this patch.
src/Model/Order.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $this->parseOrderDetails($response);
212 212
 
213 213
             return true;
214
-        } else {
214
+        }else {
215 215
             return false;
216 216
         }
217 217
     }
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
     {
224 224
         foreach ($response->transactions->transaction as $transaction) {
225 225
             // Record transaction data from FoxyCart Datafeed:
226
-            $this->Store_ID = (int) $transaction->store_id;
227
-            $this->TransactionDate = (string) $transaction->transaction_date;
228
-            $this->ProductTotal = (float) $transaction->product_total;
229
-            $this->TaxTotal = (float) $transaction->tax_total;
230
-            $this->ShippingTotal = (float) $transaction->shipping_total;
231
-            $this->OrderTotal = (float) $transaction->order_total;
232
-            $this->ReceiptURL = (string) $transaction->receipt_url;
233
-            $this->OrderStatus = (string) $transaction->status;
226
+            $this->Store_ID = (int)$transaction->store_id;
227
+            $this->TransactionDate = (string)$transaction->transaction_date;
228
+            $this->ProductTotal = (float)$transaction->product_total;
229
+            $this->TaxTotal = (float)$transaction->tax_total;
230
+            $this->ShippingTotal = (float)$transaction->shipping_total;
231
+            $this->OrderTotal = (float)$transaction->order_total;
232
+            $this->ReceiptURL = (string)$transaction->receipt_url;
233
+            $this->OrderStatus = (string)$transaction->status;
234 234
 
235 235
             $this->extend('handleOrderInfo', $order, $response);
236 236
         }
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
                 if (Member::get()->filter('Email', $transaction->customer_email)->First()) {
250 250
                     $customer = Member::get()->filter('Email', $transaction->customer_email)->First();
251 251
                     // if new customer, create account with data from FoxyCart
252
-                } else {
252
+                }else {
253 253
                     // set PasswordEncryption to 'none' so imported, encrypted password is not encrypted again
254 254
                     Config::modify()->set(Security::class, 'password_encryption_algorithm', 'none');
255 255
 
256 256
                     // create new Member, set password info from FoxyCart
257 257
                     $customer = Member::create();
258
-                    $customer->Customer_ID = (int) $transaction->customer_id;
259
-                    $customer->FirstName = (string) $transaction->customer_first_name;
260
-                    $customer->Surname = (string) $transaction->customer_last_name;
261
-                    $customer->Email = (string) $transaction->customer_email;
262
-                    $customer->Password = (string) $transaction->customer_password;
263
-                    $customer->Salt = (string) $transaction->customer_password_salt;
258
+                    $customer->Customer_ID = (int)$transaction->customer_id;
259
+                    $customer->FirstName = (string)$transaction->customer_first_name;
260
+                    $customer->Surname = (string)$transaction->customer_last_name;
261
+                    $customer->Email = (string)$transaction->customer_email;
262
+                    $customer->Password = (string)$transaction->customer_password;
263
+                    $customer->Salt = (string)$transaction->customer_password_salt;
264 264
                     $customer->PasswordEncryption = 'none';
265 265
 
266 266
                     // record member record
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
             foreach ($transaction->transaction_details->transaction_detail as $detail) {
298 298
                 $OrderDetail = OrderDetail::create();
299 299
 
300
-                $OrderDetail->Quantity = (int) $detail->product_quantity;
301
-                $OrderDetail->ProductName = (string) $detail->product_name;
302
-                $OrderDetail->ProductCode = (string) $detail->product_code;
303
-                $OrderDetail->ProductImage = (string) $detail->image;
304
-                $OrderDetail->ProductCategory = (string) $detail->category_code;
300
+                $OrderDetail->Quantity = (int)$detail->product_quantity;
301
+                $OrderDetail->ProductName = (string)$detail->product_name;
302
+                $OrderDetail->ProductCode = (string)$detail->product_code;
303
+                $OrderDetail->ProductImage = (string)$detail->image;
304
+                $OrderDetail->ProductCategory = (string)$detail->category_code;
305 305
                 $priceModifier = 0;
306 306
 
307 307
                 // parse OrderOptions
@@ -309,14 +309,14 @@  discard block
 block discarded – undo
309 309
                     // Find product via product_id custom variable
310 310
                     if ($option->product_option_name == 'product_id') {
311 311
                         // if product is found, set relation to OrderDetail
312
-                        $OrderProduct = ProductPage::get()->byID((int) $option->product_option_value);
312
+                        $OrderProduct = ProductPage::get()->byID((int)$option->product_option_value);
313 313
                         if ($OrderProduct) {
314 314
                             $OrderDetail->ProductID = $OrderProduct->ID;
315 315
                         }
316
-                    } else {
316
+                    }else {
317 317
                         $OrderOption = OrderOption::create();
318
-                        $OrderOption->Name = (string) $option->product_option_name;
319
-                        $OrderOption->Value = (string) $option->product_option_value;
318
+                        $OrderOption->Name = (string)$option->product_option_name;
319
+                        $OrderOption->Value = (string)$option->product_option_value;
320 320
                         $OrderOption->write();
321 321
                         $OrderDetail->OrderOptions()->add($OrderOption);
322 322
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
                     }
325 325
                 }
326 326
 
327
-                $OrderDetail->Price = (float) $detail->product_price + (float) $priceModifier;
327
+                $OrderDetail->Price = (float)$detail->product_price + (float)$priceModifier;
328 328
 
329 329
                 // extend OrderDetail parsing, allowing for recording custom fields from FoxyCart
330 330
                 $this->extend('handleOrderItem', $order, $response, $OrderDetail);
Please login to merge, or discard this patch.
src/Controller/FoxyStripeController.php 1 patch
Spacing   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
         // handle POST from FoxyCart API transaction
44 44
         if ((isset($_POST['FoxyData']) or isset($_POST['FoxySubscriptionData']))) {
45 45
             $FoxyData_encrypted = (isset($_POST['FoxyData'])) ?
46
-                urldecode($_POST['FoxyData']) :
47
-                urldecode($_POST['FoxySubscriptionData']);
46
+                urldecode($_POST['FoxyData']) : urldecode($_POST['FoxySubscriptionData']);
48 47
             $FoxyData_decrypted = \rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted);
49 48
 
50 49
             // parse the response and save the order
@@ -54,7 +53,7 @@  discard block
 block discarded – undo
54 53
             $this->extend('addIntegrations', $FoxyData_encrypted);
55 54
 
56 55
             return 'foxy';
57
-        } else {
56
+        }else {
58 57
             return 'No FoxyData or FoxySubscriptionData received.';
59 58
         }
60 59
     }
@@ -137,7 +136,7 @@  discard block
 block discarded – undo
137 136
                 /* todo: make sure local password is updated if changed on FoxyCart
138 137
                 $this->updatePasswordFromData($customer, $order);
139 138
                 */
140
-            } else {
139
+            }else {
141 140
                 // create new Member, set password info from FoxyCart
142 141
                 $customer = Member::create();
143 142
                 $customer->Customer_ID = (int)$order->customer_id;
@@ -164,11 +163,11 @@  discard block
 block discarded – undo
164 163
         Security::config()->update('password_encryption_algorithm', 'none');
165 164
 
166 165
         $customer->PasswordEncryption = 'none';
167
-        $customer->Password = (string) $order->customer_password;
166
+        $customer->Password = (string)$order->customer_password;
168 167
         $customer->write();
169 168
 
170
-        $customer->PasswordEncryption = $this->getEncryption((string) $order->customer_password_hash_type);
171
-        $customer->Salt = (string) $order->customer_password_salt;
169
+        $customer->PasswordEncryption = $this->getEncryption((string)$order->customer_password_hash_type);
170
+        $customer->Salt = (string)$order->customer_password_salt;
172 171
 
173 172
         Security::config()->update('password_encryption_algorithm', $password_encryption_algorithm);
174 173
     }
@@ -259,7 +258,7 @@  discard block
 block discarded – undo
259 258
             }
260 259
 
261 260
             return ProductPage::get()
262
-                ->filter('ID', (int) $productOptions->product_option_value)
261
+                ->filter('ID', (int)$productOptions->product_option_value)
263 262
                 ->First();
264 263
         }
265 264
     }
@@ -309,18 +308,18 @@  discard block
 block discarded – undo
309 308
         // to do: consider a login/registration form here if not logged in
310 309
         if ($Member = Security::getCurrentUser()) {
311 310
             $Member = Security::getCurrentUser();
312
-        } else {
311
+        }else {
313 312
             $Member = new Member();
314 313
             $Member->Customer_ID = 0;
315 314
         }
316 315
 
317
-        $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey());
316
+        $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey());
318 317
 
319 318
         $config = FoxyStripeSetting::current_foxystripe_setting();
320 319
         if ($config->CustomSSL) {
321 320
             $link = FoxyCart::getFoxyCartStoreName();
322
-        } else {
323
-            $link = FoxyCart::getFoxyCartStoreName() . '.foxycart.com';
321
+        }else {
322
+            $link = FoxyCart::getFoxyCartStoreName().'.foxycart.com';
324 323
         }
325 324
 
326 325
         $redirect_complete = 'https://'.$link.'/checkout?fc_auth_token='.$auth_token.'&fcsid='.$fcsid.
Please login to merge, or discard this patch.