@@ -43,6 +43,9 @@ |
||
| 43 | 43 | self::setSecret(FoxyCart::getStoreKey()); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | + /** |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 46 | 49 | public static function getSecret(){ |
| 47 | 50 | return FoxyCart::getStoreKey(); |
| 48 | 51 | } |
@@ -269,7 +269,9 @@ |
||
| 269 | 269 | self::$log[] = '<strong>Options:</strong> <pre>'.htmlspecialchars(print_r($options, true)).'</pre>'; |
| 270 | 270 | unset( $form_part_signed ); |
| 271 | 271 | foreach ($options as $option) { |
| 272 | - if( !isset($form_part_signed) ) $form_part_signed = $list[0]; |
|
| 272 | + if( !isset($form_part_signed) ) { |
|
| 273 | + $form_part_signed = $list[0]; |
|
| 274 | + } |
|
| 273 | 275 | $option_signed = preg_replace( |
| 274 | 276 | '%'.preg_quote($option[1]).preg_quote($option[2]).preg_quote($option[1]).'%', |
| 275 | 277 | $option[1].self::fc_hash_value($code, $list[2], $option[2], 'value', FALSE).$option[1], |
@@ -81,13 +81,17 @@ discard block |
||
| 81 | 81 | public static function getCustomer($Member = null) { |
| 82 | 82 | |
| 83 | 83 | // throw error if no $Member Object |
| 84 | - if (!isset($Member)) trigger_error('No Member set', E_USER_ERROR); |
|
| 84 | + if (!isset($Member)) { |
|
| 85 | + trigger_error('No Member set', E_USER_ERROR); |
|
| 86 | + } |
|
| 85 | 87 | |
| 86 | 88 | // grab customer record from API |
| 87 | 89 | |
| 88 | 90 | $foxyData = array(); |
| 89 | 91 | $foxyData["api_action"] = "customer_get"; |
| 90 | - if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 92 | + if ($Member->Customer_ID) { |
|
| 93 | + $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 94 | + } |
|
| 91 | 95 | $foxyData["customer_email"] = $Member->Email; |
| 92 | 96 | |
| 93 | 97 | return self::getAPIRequest($foxyData); |
@@ -102,7 +106,9 @@ discard block |
||
| 102 | 106 | $foxyData = array(); |
| 103 | 107 | $foxyData["api_action"] = "customer_save"; |
| 104 | 108 | // customer_id will be 0 if created in SilverStripe. |
| 105 | - if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 109 | + if ($Member->Customer_ID) { |
|
| 110 | + $foxyData["customer_id"] = $Member->Customer_ID; |
|
| 111 | + } |
|
| 106 | 112 | $foxyData["customer_email"] = $Member->Email; |
| 107 | 113 | $foxyData["customer_password_hash"] = $Member->Password; |
| 108 | 114 | $foxyData["customer_password_salt"] = $Member->Salt; |
@@ -41,14 +41,18 @@ |
||
| 41 | 41 | |
| 42 | 42 | $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
| 43 | 43 | $versionsPostPublish = array(); |
| 44 | - foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 44 | + foreach($versions as $versionRow) { |
|
| 45 | + $versionsPostPublish[] = $versionRow; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $product2->delete(); |
| 47 | 49 | $this->assertTrue(!$product2->isPublished()); |
| 48 | 50 | |
| 49 | 51 | $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
| 50 | 52 | $versionsPostDelete = array(); |
| 51 | - foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 53 | + foreach($versions as $versionRow) { |
|
| 54 | + $versionsPostDelete[] = $versionRow; |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | $this->assertTrue($versionsPostPublish == $versionsPostDelete); |
| 54 | 58 | |
@@ -38,6 +38,9 @@ |
||
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + /** |
|
| 42 | + * @param string $encrypted |
|
| 43 | + */ |
|
| 41 | 44 | public function handleDataFeed($encrypted, $decrypted){ |
| 42 | 45 | |
| 43 | 46 | $orders = new SimpleXMLElement($decrypted); |
@@ -90,6 +90,9 @@ discard block |
||
| 90 | 90 | return $obj; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + /** |
|
| 94 | + * @return string |
|
| 95 | + */ |
|
| 93 | 96 | public function getDecryptedResponse() { |
| 94 | 97 | $decrypted = urldecode($this->Response); |
| 95 | 98 | return rc4crypt::decrypt(FoxyCart::getStoreKey(), $decrypted); |
@@ -120,6 +123,9 @@ discard block |
||
| 120 | 123 | } |
| 121 | 124 | } |
| 122 | 125 | |
| 126 | + /** |
|
| 127 | + * @param SimpleXMLElement $response |
|
| 128 | + */ |
|
| 123 | 129 | public function parseOrderInfo($response) { |
| 124 | 130 | |
| 125 | 131 | foreach ($response->transactions->transaction as $transaction) { |
@@ -138,6 +144,9 @@ discard block |
||
| 138 | 144 | } |
| 139 | 145 | } |
| 140 | 146 | |
| 147 | + /** |
|
| 148 | + * @param SimpleXMLElement $response |
|
| 149 | + */ |
|
| 141 | 150 | public function parseOrderCustomer($response) { |
| 142 | 151 | |
| 143 | 152 | foreach ($response->transactions->transaction as $transaction) { |
@@ -179,6 +188,9 @@ discard block |
||
| 179 | 188 | } |
| 180 | 189 | } |
| 181 | 190 | |
| 191 | + /** |
|
| 192 | + * @param SimpleXMLElement $response |
|
| 193 | + */ |
|
| 182 | 194 | public function parseOrderDetails($response) { |
| 183 | 195 | |
| 184 | 196 | // remove previous OrderDetails and OrderOptions so we don't end up with duplicates |
@@ -211,7 +211,9 @@ |
||
| 211 | 211 | |
| 212 | 212 | // if product is found, set relation to OrderDetail |
| 213 | 213 | $OrderProduct = ProductPage::get()->byID((int) $option->product_option_value); |
| 214 | - if ($OrderProduct) $OrderDetail->ProductID = $OrderProduct->ID; |
|
| 214 | + if ($OrderProduct) { |
|
| 215 | + $OrderDetail->ProductID = $OrderProduct->ID; |
|
| 216 | + } |
|
| 215 | 217 | |
| 216 | 218 | } else { |
| 217 | 219 | |