@@ -17,9 +17,8 @@ discard block |
||
17 | 17 | // handle POST from FoxyCart API transaction |
18 | 18 | if ((isset($_POST["FoxyData"]) OR isset($_POST['FoxySubscriptionData']))) { |
19 | 19 | $FoxyData_encrypted = (isset($_POST["FoxyData"])) ? |
20 | - urldecode($_POST["FoxyData"]) : |
|
21 | - urldecode($_POST["FoxySubscriptionData"]); |
|
22 | - $FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(),$FoxyData_encrypted); |
|
20 | + urldecode($_POST["FoxyData"]) : urldecode($_POST["FoxySubscriptionData"]); |
|
21 | + $FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted); |
|
23 | 22 | self::handleDataFeed($FoxyData_encrypted, $FoxyData_decrypted); |
24 | 23 | |
25 | 24 | // extend to allow for additional integrations with Datafeed |
@@ -27,14 +26,14 @@ discard block |
||
27 | 26 | |
28 | 27 | return 'foxy'; |
29 | 28 | |
30 | - } else { |
|
29 | + }else { |
|
31 | 30 | |
32 | 31 | return "No FoxyData or FoxySubscriptionData received."; |
33 | 32 | |
34 | 33 | } |
35 | 34 | } |
36 | 35 | |
37 | - public function handleDataFeed($encrypted, $decrypted){ |
|
36 | + public function handleDataFeed($encrypted, $decrypted) { |
|
38 | 37 | //handle encrypted & decrypted data |
39 | 38 | $orders = new SimpleXMLElement($decrypted); |
40 | 39 | |
@@ -43,12 +42,11 @@ discard block |
||
43 | 42 | |
44 | 43 | if (isset($order->id)) { |
45 | 44 | ($transaction = Order::get()->filter('Order_ID', $order->id)->First()) ? |
46 | - $transaction : |
|
47 | - $transaction = Order::create(); |
|
45 | + $transaction : $transaction = Order::create(); |
|
48 | 46 | } |
49 | 47 | |
50 | 48 | // save base order info |
51 | - $transaction->Order_ID = (int) $order->id; |
|
49 | + $transaction->Order_ID = (int)$order->id; |
|
52 | 50 | $transaction->Response = $decrypted; |
53 | 51 | |
54 | 52 | // record transaction as order |
@@ -103,7 +101,7 @@ discard block |
||
103 | 101 | if (isset($order->customer_email) && $order->is_anonymous == 0) { |
104 | 102 | |
105 | 103 | // if Customer is existing member, associate with current order |
106 | - if(Member::get()->filter('Email', $order->customer_email)->First()) { |
|
104 | + if (Member::get()->filter('Email', $order->customer_email)->First()) { |
|
107 | 105 | |
108 | 106 | $customer = Member::get()->filter('Email', $order->customer_email)->First(); |
109 | 107 | |
@@ -116,7 +114,7 @@ discard block |
||
116 | 114 | $customer->write(); |
117 | 115 | */ |
118 | 116 | |
119 | - } else { |
|
117 | + }else { |
|
120 | 118 | |
121 | 119 | // set PasswordEncryption to 'none' so imported, encrypted password is not encrypted again |
122 | 120 | Config::inst()->update('Security', 'password_encryption_algorithm', 'none'); |
@@ -227,24 +225,24 @@ discard block |
||
227 | 225 | // get current member if logged in. If not, create a 'fake' user with Customer_ID = 0 |
228 | 226 | // fake user will redirect to FC checkout, ask customer to log in |
229 | 227 | // to do: consider a login/registration form here if not logged in |
230 | - if($Member = Member::currentUser()) { |
|
228 | + if ($Member = Member::currentUser()) { |
|
231 | 229 | $Member = Member::currentUser(); |
232 | - } else { |
|
230 | + }else { |
|
233 | 231 | $Member = new Member(); |
234 | 232 | $Member->Customer_ID = 0; |
235 | 233 | } |
236 | 234 | |
237 | - $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey()); |
|
235 | + $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey()); |
|
238 | 236 | |
239 | 237 | $config = SiteConfig::current_site_config(); |
240 | 238 | if ($config->CustomSSL) { |
241 | 239 | $link = FoxyCart::getFoxyCartStoreName(); |
242 | - } else { |
|
243 | - $link = FoxyCart::getFoxyCartStoreName() . '.foxycart.com'; |
|
240 | + }else { |
|
241 | + $link = FoxyCart::getFoxyCartStoreName().'.foxycart.com'; |
|
244 | 242 | } |
245 | 243 | |
246 | - $redirect_complete = 'https://' . $link . '/checkout?fc_auth_token=' . $auth_token . |
|
247 | - '&fcsid=' . $fcsid . '&fc_customer_id=' . $Member->Customer_ID . '×tamp=' . $timestampNew; |
|
244 | + $redirect_complete = 'https://'.$link.'/checkout?fc_auth_token='.$auth_token. |
|
245 | + '&fcsid='.$fcsid.'&fc_customer_id='.$Member->Customer_ID.'×tamp='.$timestampNew; |
|
248 | 246 | |
249 | 247 | $this->redirect($redirect_complete); |
250 | 248 |