Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
payment_gateway_dps.inc
1 <?php
18 require_once dirname(__FILE__).'/../../payment_gateway/payment_gateway.inc';
19 require_once dirname(__FILE__).'/dps_processor.inc';
20 
21 
33 {
34 
39  private $_pass_through_vars = NULL;
40 
47  function __construct($assetid=0)
48  {
49  parent::__construct($assetid);
50 
51  }//end constructor
52 
53 
64  function _createAdditional(&$link)
65  {
66  if (!parent::_createAdditional($link)) return FALSE;
67 
68  return ($this->_createBodycopy('display_format', translate('default_bodycopy_content')));
69 
70  }//end _createAdditional()
71 
72 
82  function _createBodycopy($link_value, $content)
83  {
84  $GLOBALS['SQ_SYSTEM']->am->includeAsset('bodycopy');
85  $bodycopy = new Bodycopy();
86  $copy_link = Array('asset' => &$this, 'link_type' => SQ_LINK_TYPE_2, 'is_dependant' => 1, 'is_exclusive' => 1, 'value' => $link_value);
87 
88  $bodycopy->setAttrValue('name', ucwords(str_replace('_',' ', $link_value)));
89  $args = Array('content' => $content);
90  if ($bodycopy->create($copy_link, $args)) {
91  $child_bodycopy = $GLOBALS['SQ_SYSTEM']->am->getLink($bodycopy->id, SQ_LINK_TYPE_2, 'bodycopy_div');
92  $GLOBALS['SQ_SYSTEM']->am->releaseLock($child_bodycopy['minorid'], 'attributes');
93  return TRUE;
94  }
95  return FALSE;
96 
97  }//end _createBodycopy()
98 
99 
107  function _getAllowedLinks()
108  {
109  $page_links = parent::_getAllowedLinks();
110  $page_links[SQ_LINK_TYPE_2]['bodycopy'] = Array('card' => 2, 'exclusive' => TRUE);
111  return $page_links;
112 
113  }//end _getAllowedLinks()
114 
115 
130  {
131  $keywords = parent::getAvailableKeywords();
132 
133  $keywords['card_number'] = 'Card Number';
134  $keywords['card_name'] = 'Name on Card';
135  $keywords['card_start_month'] = 'Card Start Month';
136  $keywords['card_start_year'] = 'Card Start Year';
137  $keywords['card_expiry_month'] = 'Card Expiry Month';
138  $keywords['card_expiry_year'] = 'Card Expiry Year';
139  $keywords['card_issue_number'] = 'Card Issue Number';
140  $keywords['card_cv2'] = 'Card CV2';
141 
142  $keywords['street_address1'] = 'Address Line 1';
143  $keywords['street_address2'] = 'Address Line 2';
144  $keywords['street_address3'] = 'Address Line 3';
145  $keywords['street_address4'] = 'Address Line 4';
146  $keywords['postcode'] = 'Postcode';
147 
148  $keywords['transaction_amount'] = 'Transaction Amount';
149  $keywords['transaction_currency'] = 'Transaction Currency';
150  $keywords['processing_error'] = 'Processing Error (empty if no error)';
151  $keywords['submit_button'] = 'Submit Button';
152  $keywords['cancel_button'] = 'Cancel Button';
153  $keywords['reset_button'] = 'Reset Button';
154 
155 
156  return $keywords;
157 
158  }//end getAvailableKeywords()
159 
160 
171  function onRequestKeywords(&$broadcaster, $vars=Array())
172  {
173  $keywords = $this->getAvailableKeywords();
174  $vars['keywords'] = array_merge($vars['keywords'], $keywords);
175 
176  }//end onRequestKeywords()
177 
178 
185  function printBody()
186  {
187  //this page is redirected to by the child iframe with unknown reference error
188  if (array_get_index($_GET, 'unknown_referer', FALSE)) {
189  trigger_error('Unknown caller reference');
190  exit;
191  }
192 
193  //this page is redirected to by the child iframe with an error message
194  if (array_get_index($_GET, 'error_message', FALSE)) {
195  $this->_setError($_GET['error_message']);
196  }
197 
198  $success = FALSE;
199 
200 
201  $amount = array_get_index($_SESSION,'SQ_ECOM_AMOUNT', 0);
202  $card_info = array_get_index($_REQUEST, $this->getPrefix().'_card', FALSE);
203  $action = array_get_index($_REQUEST, $this->getPrefix().'_action', FALSE);
204 
205 
206  if ($action == 'Cancel') {
207  $this->returnToCaller('CANCEL');
208 
209  } else if (empty($amount)) {
210  unset($_SESSION['SQ_ECOM_AMOUNT']);
211  $this->_unsetCurrency();
212  //clear pass through variables
213  if (isset($_SESSION['SQ_ECOM_PASS_THROUGH_VARS'])) {
214  unset($_SESSION['SQ_ECOM_PASS_THROUGH_VARS']);
215  }
216 
217  $this->appendPendingOrderAuditLog(translate('ecom_payment_no_amount'));
218 
219  $this->returnToCaller('SUCCESS');
220 
221  } else if ($card_info) {
222  $this->appendPendingOrderAuditLog(translate('ecom_payment_attempted_gateway_contacted'));
223 
224  $success = $this->processPayment($card_info);
225  }
226 
227  //if transaction is accepted, redirect the user to the success page
228  if ($success === 1) {
229  unset($_SESSION['SQ_ECOM_AMOUNT']);
230  $this->_unsetCurrency();
231  //clear pass through variables
232  if (isset($_SESSION['SQ_ECOM_PASS_THROUGH_VARS'])) {
233  unset($_SESSION['SQ_ECOM_PASS_THROUGH_VARS']);
234  }
235  //broadcast payment completed trigger event before return
236  if (isset($_SESSION['SQ_ECOM_PAYMENT_COMPLETED_BROADCASTER_ASSETID'])) {
237  $broadcaster = $GLOBALS['SQ_SYSTEM']->am->getAsset($_SESSION['SQ_ECOM_PAYMENT_COMPLETED_BROADCASTER_ASSETID']);
238  if (!empty($broadcaster)) {
239  //put all returned variables in $_SESSION['SQ_ECOM_RESPONSE'] to $_POST array so that the listening trigger can use them
240  $response = array_get_index($_SESSION, 'SQ_ECOM_RESPONSE', FALSE);
241  if ($response) {
242  $_POST['transaction_reference'] = $response['TRANSACTION'];
243  $_POST['transaction_time'] = $response['TIME'];
244  $_POST['transaction_status'] = $response['STATUS'];
245  $_POST['transaction_card_number'] = $response['CARDNO'];
246  $_POST['transaction_amount'] = $response['AMOUNT'];
247  $_POST['transaction_currency'] = $response['CURRENCY'];
248  }
249  $GLOBALS['SQ_SYSTEM']->broadcastTriggerEvent('trigger_event_ecommerce_payment_completed', $broadcaster);
250  }
251  }
252 
253  $this->appendPendingOrderAuditLog(translate('ecom_payment_succeeded'));
254 
255  $this->returnToCaller('SUCCESS');
256  } else {
257  if ($card_info) {
258  $this->appendPendingOrderAuditLog(translate('ecom_payment_declined'));
259  }
260  }
261 
262  //print default bodycopy
263  $this->printBodycopy('display_format');
264 
265  }//end printBody()
266 
267 
274  function printBodycopy($link_value)
275  {
276  $bodycopy = $this->getBodycopy($link_value);
277  if (is_null($bodycopy)) return;
278 
279  $keywords = $bodycopy->getKeywords();
280  $replacements = Array();
281  foreach ($keywords as $word) {
282  $replacements[$word] = $this->getKeywordReplacement($word);
283  }
284  $bodycopy->setKeywordReplacements($replacements);
285 
286  //OUTPUT HERE
287  if ($link_value == 'display_format') {
288  //the default body copy with card input
289  $datapath = sq_web_path('data').'/asset_types/payment_gateway_datacash/files';
290  $card = $this->getPrefix().'_card';
291 
292  if ($this->attr('test_mode')) {
293  echo '<h2 class="gateway-test-mode" style="color: white; background-color: #C00; padding: 5px">TEST MODE</h2>';
294  }
295 
296  ?>
297  <script src="<?php echo $datapath; ?>/loader.js"></script>
298  <script>
299  var Loader = new Loader('<?php echo $card; ?>','#FFFFFF','Processing Transaction...','<?php echo $datapath; ?>/loader.gif');
300  Loader.print();
301  </script>
302  <form method="post" action="<?php echo $this->getURL(); ?>" onsubmit="Loader.show();">
303  <?php
304  $bodycopy->printBody();
305  echo '</form>';
306  } else {
307  //the card holder verification bodycopy
308  $bodycopy->printBody();
309  }
310 
311  }//end printBodycopy()
312 
313 
320  function getBodycopy($link_value)
321  {
322  $link = $GLOBALS['SQ_SYSTEM']->am->getLink($this->id, SQ_LINK_TYPE_2, 'bodycopy', TRUE, $link_value);
323  if (empty($link)) return NULL;
324  $bodycopy = $GLOBALS['SQ_SYSTEM']->am->getAsset($link['minorid'], $link['minor_type_code']);
325  return $bodycopy;
326 
327  }//end getBodycopy()
328 
329 
338  function processPayment($card_info)
339  {
340  if (!$card_info) return FALSE;
341 
342  //clean input
343  foreach($card_info as $key => $value){
344  $card_info[$key] = htmlentities($value);
345  }
346 
347  $amount = $_SESSION['SQ_ECOM_AMOUNT'];
348 
349  $processor = new Dps_Processor($this->attr('client'), $this->attr('password'), $this->attr('test_mode'));
350 
351  //SET AMOUNT
352  if (empty($amount)) {
353  $this->_setError($this->attr('amount_not_specified_error'));
354  } else {
355  $processor->setAmount($amount);
356  $processor->setCurrency($this->_getCurrency());
357  }
358 
359 
360  //SET CARD NUMBER
361  if (empty($card_info['number'])) {
362  $this->_setError($this->attr('card_number_not_specified_error'));
363  } else {
364  $card_info['number'] = str_replace(Array(' ', "\t"), '', $card_info['number']);
365  $processor->setCardNumber($card_info['number']);
366  }
367 
368  //SET CARD NAME
369  if (!empty($card_info['name'])) {
370  $processor->setCardName($card_info['name']);
371  }
372 
373  //SET CARD EXPIRY DATE
374  if ($this->_isValidDate(array_get_index($card_info, 'expiry_month', ''), array_get_index($card_info, 'expiry_year', ''))) {
375  $processor->setCardExpiryDate($card_info['expiry_month'], $card_info['expiry_year']);
376  } else {
377  $this->_setError($this->attr('expiry_date_invalid_error'));
378  }
379 
380  //SET CARD START DATE IF SPECIFIED BECAUSE START DATE IS ONLY REQUIRED FOR SOME CARD TYPES, E.G. SOLO
381  if (!empty($card_info['start_month']) || !empty($card_info['start_year'])) {
382  if ($this->_isValidDate(array_get_index($card_info, 'start_month', ''), array_get_index($card_info, 'start_year', ''))) {
383  $processor->setCardStartDate($card_info['start_month'], $card_info['start_year']);
384  } else {
385  $this->_setError($this->attr('start_date_invalid_error'));
386  }
387  }
388 
389  //SET CARD ISSUE NUMBER, IF SPECIFIED
390  if (!empty($card_info['issue_number'])) {
391  if ($this->_isValidIssueNumber($card_info['issue_number'])) {
392  $processor->setCardIssueNumber($card_info['issue_number']);
393  } else {
394  $this->_setError($this->attr('issue_number_invalid_error'));
395  }
396  }
397 
398  //SET CARD CV2, IF SPECIFIED
399  if($this->attr('cv2_standard_policy') != 0){
400  if (!empty($card_info['cv2']) && $this->_isValidCV2($card_info['cv2'])) {
401  $processor->setCardCV2($card_info['cv2']);
402  } else {
403  $this->_setError($this->attr('card_cv2_invalid_error'));
404  }
405  }
406 
407  $addr = '';
408  //SET STREET ADDRESS (1 - 4)
409  for ($i = 1; $i < 5; $i++) {
410  if (!empty($card_info['street_address'.$i])) {
411  $addr .= $card_info['street_address'.$i]."\n";
412  }
413  }
414  if(!empty($addr))
415  $processor->setStreetAddress($addr);
416 
417 
418  //SET POSTCODE
419  if (!empty($card_info['postcode'])) {
420  $addr .= $card_info['postcode']." ";
421  $processor->setPostcode($card_info['postcode']);
422  }
423 
424 
425  //SET AVS
426  $policy = $this->attr('avs_standard_policy');
427  $processor->setStandardPolicy($policy);
428  if ($policy != 0) {
429  if (empty($card_info['street_address1']) && empty($card_info['street_address2']) && empty($card_info['street_address3']) && empty($card_info['street_address4'])) {
430  $this->_setError($this->attr('street_address_not_specified_error'));
431  }
432 
433  if (empty($card_info['postcode'])) {
434  $this->_setError($this->attr('postcode_not_specified_error'));
435  }
436  }
437 
438  //CHECK IF THERE IS ERROR BEFORE SENDING DATA TO DATACASH SERVER, RETURN FALSE
439  if ($this->isError()) {
440  return FALSE;
441  }
442 
443  $success = $processor->process();
444 
445  //GET RESPONSE
446  $response = $processor->getResponse();
447 
448  //if success is 1 (payment is accepted) or 2 (redirect)
449  if ($success) {
450  //store the last 4 digits of card number to display it later in Form Ecommerce or Delivery Method through the Session variable SQ_ECOM_RESPONSE
451  $_SESSION['SQ_ECOM_FORMATTED_CARD_NUMBER'] = $this->_getFormattedCardNumber($card_info['number']);
452  //store the billing address to store in the Order asset of Form Ecommerce
453  $_SESSION['SQ_ECOM_ORDER_BILLING_ADDR'] = $addr;
454  }
455 
456  $this->_setTransactionResult($success, $response);
457 
458 
459  return $success;
460 
461  }//end processPayment()
462 
463 
473  private function _setTransactionResult($success, $response)
474  {
475  if ($success === FALSE) {
476  $this->_setError($response['STATUS']);
477  } else { //success = 1
478  if ($this->attr('test_mode')) {
479  $response['STATUS'] = '!!!ATTENTION!!! TEST MODE (transaction not performed) -- '.$response['STATUS'];
480  }
481 
482  $card_no = '';
483  if (isset($_SESSION['SQ_ECOM_FORMATTED_CARD_NUMBER'])) {
484  $card_no = $_SESSION['SQ_ECOM_FORMATTED_CARD_NUMBER'];
485  unset($_SESSION['SQ_ECOM_FORMATTED_CARD_NUMBER']);
486  }
487 
488  $response['CARDNO'] = $card_no;
489  $response['AMOUNT'] = $_SESSION['SQ_ECOM_AMOUNT'];
490  $response['CURRENCY'] = $this->_getCurrency();
491 
492  $billing_addr = '';
493  if (isset($_SESSION['SQ_ECOM_ORDER_BILLING_ADDR'])) {
494  $billing_addr = $_SESSION['SQ_ECOM_ORDER_BILLING_ADDR'];
495  unset($_SESSION['SQ_ECOM_ORDER_BILLING_ADDR']);
496  }
497  $response['BILLING_ADDR'] = $billing_addr;
498 
499  $_SESSION['SQ_ECOM_RESPONSE'] = $response;
500  }
501 
502  }//end _setTransactionResult()
503 
504 
513  private function _getFormattedCardNumber($card_number)
514  {
515  $card_no = $card_number;
516  $card_len = strlen($card_no);
517  if ($card_len == 16) {
518  $card_no = '****-****-****-'.substr($card_no, -4);
519  } else {
520  $card_no = str_pad(substr($card_no, -4), $card_len, '*', STR_PAD_LEFT);
521  }
522 
523  return $card_no;
524 
525  }//end _getFormattedCardNumber()
526 
527 
536  function returnToCaller($state='SUCCESS')
537  {
538  $back_url = NULL;
539 
540  if ($state == 'SUCCESS') {
541  $back_url = array_get_index($_SESSION, 'SQ_ECOM_SUCCESS_URL');
542  } else if ($state == 'CANCEL') {
543  $back_url = array_get_index($_SESSION, 'SQ_ECOM_CANCEL_URL');
544  }
545 
546  unset($_SESSION['SQ_ECOM_SUCCESS_URL']);
547  unset($_SESSION['SQ_ECOM_CANCEL_URL']);
548 
549  if (is_null($back_url)) {
550  trigger_error('Unknown caller reference');
551  } else {
552  header('Location: '.$back_url);
553  exit;
554  }
555 
556  }//end returnToCaller()
557 
558 
567  private function _redirectParent($url)
568  {
569  $string = <<<HEREDOC
570 <script type="text/javascript">
571  if (parent != self) {
572  parent.location = "{$url}";
573  }
574 </script>
575 HEREDOC;
576 
577  echo $string;
578  exit;
579 
580  }//end _redirectParent()
581 
582 
590  {
591  $prefix = $this->getPrefix();
592  $card = $prefix.'_card';
593 
594  // set variables for test mode
595  if ($this->attr('test_mode')) {
596  $test_card_numbers = Dps_Processor::getTestCardNumbers();
597  $card_number = '<select name="'.$card.'[number]">';
598  foreach ($test_card_numbers as $number => $label) {
599  $card_number .= '<option value="'.$number.'" >'.$label.'</option>';
600  }
601  $card_number .= '</select>';
602  } else {
603  $card_number = '<input name="'.$card.'[number]" autocomplete="off" />';
604  }
605 
606  return $card_number;
607 
608  }//end getCardNumberKeywordReplacement()
609 
610 
618  {
619 
620  $card = $this->getPrefix().'_card';
621  $string = '<input name="'.$card.'[name]" autocomplete="off" />';
622  return $string;
623 
624  }//end getCardNameKeywordReplacement()
625 
626 
634  {
635  $card = $this->getPrefix().'_card';
636 
637  $string = '<input name="'.$card.'[start_month]" size="2" autocomplete="off" />';
638 
639  return $string;
640 
641  }//end getCardStartMonthKeywordReplacement()
642 
643 
651  {
652  $card = $this->getPrefix().'_card';
653 
654  $string = '<input name="'.$card.'[start_year]" size="2" autocomplete="off" />';
655 
656  return $string;
657 
658  }//end getCardStartYearKeywordReplacement()
659 
660 
668  {
669  $card = $this->getPrefix().'_card';
670 
671  $string = '<input name="'.$card.'[expiry_month]" size="2" autocomplete="off" />';
672 
673  return $string;
674 
675  }//end getCardExpiryMonthKeywordReplacement()
676 
677 
685  {
686  $card = $this->getPrefix().'_card';
687 
688  $string = '<input name="'.$card.'[expiry_year]" size="2" autocomplete="off" />';
689 
690  return $string;
691 
692  }//end getCardExpiryYearKeywordReplacement()
693 
694 
702  {
703  $card = $this->getPrefix().'_card';
704 
705  $string = '<input name="'.$card.'[issue_number]" size="4" autocomplete="off" />';
706 
707  return $string;
708 
709  }//end getCardIssueNumberKeywordReplacement()
710 
711 
719  {
720  $card = $this->getPrefix().'_card';
721 
722  $string = '<input name="'.$card.'[cv2]" size="4" autocomplete="off" />';
723 
724  return $string;
725 
726  }//end getCardCv2KeywordReplacement()
727 
728 
736  {
737  ob_start();
738  $card = $this->getPrefix().'_card';
739  text_box($card.'[street_address1]', $this->_getDefaultInputFromPassThroughAttribute('addr1_var_name'));
740 
741  return ob_get_clean();
742 
743  }//end getStreetAddress1KeywordReplacement()
744 
745 
753  {
754  ob_start();
755  $card = $this->getPrefix().'_card';
756  text_box($card.'[street_address2]', $this->_getDefaultInputFromPassThroughAttribute('addr2_var_name'));
757 
758  return ob_get_clean();
759 
760  }//end getStreetAddress2KeywordReplacement()
761 
762 
770  {
771  ob_start();
772  $card = $this->getPrefix().'_card';
773  text_box($card.'[street_address3]', $this->_getDefaultInputFromPassThroughAttribute('addr3_var_name'));
774 
775  return ob_get_clean();
776 
777  }//end getStreetAddress3KeywordReplacement()
778 
779 
787  {
788  ob_start();
789  $card = $this->getPrefix().'_card';
790  text_box($card.'[street_address4]', $this->_getDefaultInputFromPassThroughAttribute('addr4_var_name'));
791 
792  return ob_get_clean();
793 
794  }//end getStreetAddress4KeywordReplacement()
795 
796 
804  {
805  ob_start();
806  $card = $this->getPrefix().'_card';
807  text_box($card.'[postcode]', $this->_getDefaultInputFromPassThroughAttribute('postcode_var_name'));
808 
809  return ob_get_clean();
810 
811  }//end getPostcodeKeywordReplacement()
812 
813 
821  {
822  $amount = array_get_index($_SESSION,'SQ_ECOM_AMOUNT', 0);
823 
824  return $amount;
825 
826  }//end getTransactionAmountKeywordReplacement()
827 
828 
836  {
837  return $this->_getCurrency();
838 
839  }//end getTransactionAmountKeywordReplacement()
840 
841 
849  {
850  if ($this->isError()) {
851  return '<span class="payment-gateway-transaction-error">'.$this->getErrorMessage().'</span>';
852  }
853 
854  return '';
855 
856  }//end getProcessingErrorKeywordReplacement()
857 
858 
866  {
867  $button_text = $this->attr('submit_text');
868  if (empty($button_text)) $button_text = 'Submit';
869 
870  return '<input type="submit" value="'.$button_text.'" />';
871 
872  }//end getSubmitButtonKeywordReplacement()
873 
874 
882  {
883  $button_text = $this->attr('reset_text');
884  if (empty($button_text)) $button_text = 'Reset';
885 
886  return '<input type="reset" value="'.$button_text.'" />';
887 
888  }//end getResetButtonKeywordReplacement()
889 
890 
898  {
899  $button_text = $this->attr('cancel_text');
900  if (empty($button_text)) $button_text = 'Cancel';
901 
902  return '<input type="submit" name="'.$this->getPrefix().'_action" value="'.$button_text.'" />';
903 
904  }//end getCancelButtonKeywordReplacement()
905 
906 
907 
915  private function _setError($err_message)
916  {
917  $this->_tmp['is_error'] = TRUE;
918  $this->_tmp['error_message'][] = $err_message;
919 
920  }//end _setError()
921 
922 
931  private function _isValidDate($month, $year)
932  {
933  $valid = FALSE;
934 
935  $two_digits_pattern = '/^\d{2}$/';
936  //month and year must have 2 digit pattern mm/yy
937  if (preg_match($two_digits_pattern, $month) && preg_match($two_digits_pattern, $year)) {
938  //month must be in 1 and 12
939  if ((0 < $month) && ($month < 13)) {
940  $valid = TRUE;
941  }
942  }
943 
944  return $valid;
945 
946  }//end _isValidDate()
947 
948 
957  private function _isValidIssueNumber($issue_no)
958  {
959  $valid = FALSE;
960 
961  $pattern = '/^\d{1,4}$/';
962  //issue number must be one to four digits long
963  if (preg_match($pattern, $issue_no)) {
964  $valid = TRUE;
965  }
966 
967  return $valid;
968 
969  }//end _isValidIssueNumber()
970 
971 
980  private function _isValidCV2($cv2)
981  {
982  $valid = FALSE;
983 
984  $pattern = '/^\d{3,4}$/';
985  //cv2 must be three or four (AMEX card only) digits long
986  if (preg_match($pattern, $cv2)) {
987  $valid = TRUE;
988  }
989 
990  return $valid;
991 
992  }//end _isValidCV2()
993 
994 
995  private function _getPassThroughVariable($var_name, $default)
996  {
997  if (is_null($this->_pass_through_vars)) {
998  $this->_pass_through_vars = array_get_index($_SESSION, 'SQ_ECOM_PASS_THROUGH_VARS', Array());
999  }
1000 
1001  return array_get_index($this->_pass_through_vars, $var_name, $default);
1002 
1003  }//end _getPassThroughVariable()
1004 
1005 
1006  private function _getDefaultInputFromPassThroughAttribute($attr_name)
1007  {
1008  $result = '';
1009  $var_name = $this->attr($attr_name);
1010  if (!empty($var_name)) {
1011  $result = $this->_getPassThroughVariable($var_name, '');
1012  }
1013 
1014  return $result;
1015 
1016  }//end _getDefaultInputFromPassThroughAttribute()
1017 
1018 
1025  private function _getCurrency()
1026  {
1027  return isset($_SESSION['SQ_ECOM_CURRENCY'])? $_SESSION['SQ_ECOM_CURRENCY'] : $this->attr('currency');
1028 
1029  }//end _getCurrency()
1030 
1031 
1038  private function _unsetCurrency()
1039  {
1040  if (isset($_SESSION['SQ_ECOM_CURRENCY'])) {
1041  unset($_SESSION['SQ_ECOM_CURRENCY']);
1042  }
1043 
1044  }//end _unsetCurrency()
1045 
1046 
1053  public function isError()
1054  {
1055  return array_get_index($this->_tmp, 'is_error', FALSE);
1056 
1057  }//end isError()
1058 
1059 
1066  public function getErrorMessage()
1067  {
1068  $err_message = '';
1069  $errors = array_get_index($this->_tmp, 'error_message', Array());
1070  foreach ($errors as $error) {
1071  $err_message .= "<li>$error </li>";
1072  }
1073 
1074  return '<ul>'.$err_message.'</ul>';
1075 
1076  }//end getErrorMessage()
1077 
1078 
1079 }//end class
1080 
1081 ?>