Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
payment_gateway.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/page/page.inc';
18 
30 class Payment_Gateway extends Page
31 {
32 
33 
57  function create(&$link)
58  {
59  if ($this->attr('short_name') == '') {
60  $this->setAttrValue('short_name', $this->attr('name'));
61  }
62  return parent::create($link);
63 
64  }//end create()
65 
66 
77  function _createAdditional(&$link)
78  {
79  if (!parent::_createAdditional($link)) return FALSE;
80 
81  // set an initial web path
82  $initial_path = strtolower($this->attr('name'));
83  require_once SQ_INCLUDE_PATH.'/general_occasional.inc';
84  $valid_paths = make_valid_web_paths(Array($initial_path));
85  $good_paths = $GLOBALS['SQ_SYSTEM']->am->webPathsInUse($link['asset'], $valid_paths, $this->id, TRUE);
86  return $this->saveWebPaths($good_paths);
87 
88  }//end _createAdditional()
89 
90 
101  protected function _getName($short_name=FALSE, $contextid=NULL)
102  {
103  // No context specified, using the current context
104  if ($contextid === NULL) {
105  $contextid = $GLOBALS['SQ_SYSTEM']->getContextId();
106  }//end if
107 
108  // Obtain the attribute value for Name from the specified Context
109  $attr = ($short_name) ? 'short_name' : 'name';
110  $values = $GLOBALS['SQ_SYSTEM']->am->getAttributeValuesByName($attr, $this->type(), Array($this->id), $contextid);
111  if (empty($values) === TRUE) {
112  return parent::_getName($short_name, $contextid);
113  } else {
114  return $values[$this->id];
115  }
116 
117  }//end _getName()
118 
119 
127  protected function appendPendingOrderAuditLog($msg)
128  {
129  if (isset($_SESSION['sq_local_cart_contents']['pending_order_id'])) {
130  $pending_order_id = $_SESSION['sq_local_cart_contents']['pending_order_id'];
131  $pending_order = $GLOBALS['SQ_SYSTEM']->am->getAsset($pending_order_id);
132 
133  $pending_order->appendAuditLog($msg);
134  }
135  }
136 
137 
145  protected function setPendingOrderMerchantReference($ref_no)
146  {
147  if (isset($_SESSION['sq_local_cart_contents']['pending_order_id'])) {
148  $pending_order = $GLOBALS['SQ_SYSTEM']->am->getAsset($_SESSION['sq_local_cart_contents']['pending_order_id']);
149 
150  $pending_order->setAttrValue('ecom_ref_no', $ref_no);
151  $pending_order->appendAuditLog(translate('ecom_ref_num_recorded_before_processing'));
152  }
153 
154  }//end setPendingOrderMerchantReference()
155 
156 
157 }//end class
158 
159 ?>