Odyssey
Public Member Functions | Protected Attributes | List of all members
updIPAYBPSTrustedMaster Class Reference
Inheritance diagram for updIPAYBPSTrustedMaster:

Public Member Functions

 up ()
 
 down ()
 

Protected Attributes

 $trusted_table = "cutrustedmaster"
 
 $trusted_default
 

Detailed Description

Updates trusted master to include override options for IPAYBPS

Definition at line 13 of file 2019111200_updIPAYBPSTrustedMaster.php.

Member Function Documentation

◆ down()

updIPAYBPSTrustedMaster::down ( )

No Down

Returns
void

Definition at line 197 of file 2019111200_updIPAYBPSTrustedMaster.php.

197  {
198 
199  }

◆ up()

updIPAYBPSTrustedMaster::up ( )

See if IPAYBPS exists, if so, update it to force the override entries and updated default values

Since trustedid is unique key to table, counting on only one IPAYBPS entry

Returns
void

Definition at line 161 of file 2019111200_updIPAYBPSTrustedMaster.php.

161  {
162 
163  if ($this->hasTable($this->trusted_table)) {
164 
165  $def = $this->trusted_default;
166  $sql = "select * from {$this->trusted_table} where trustedid = '{$def['trustedid']}'";
167 
168  # note appears that fetchRow always returns count of 1, even if no row is found.
169  # using fetchAll even though I expect max 1 record (trustedid is unique key)
170 
171  $trusted_row = $this->fetchAll($sql);
172 
173  if (count($trusted_row) > 0) {
174  $sql = "update {$this->trusted_table} set trustedfields = E'"
175  . json_encode($def['trustedfields'])
176  . "' where trustedid = '{$def['trustedid']}'";
177 
178  echo " updating {$def['trustedid']} trusted master\n";
179  $this->query($sql);
180 
181  } else {
182 
183  $sql = "insert into {$this->trusted_table} (trustedid, trustedvendor, trustedtype, hcuinterface, trustedfields)"
184  . " values('{$def['trustedid']}', '{$def['trustedvendor']}', '{$def['trustedtype']}',"
185  . " E'{$def['hcuinterface']}', E'" . json_encode($def['trustedfields']) . "')";
186 
187  echo " inserting {$def['trustedid']} trusted master\n";
188  $this->query($sql);
189  }
190  }
191  }

The documentation for this class was generated from the following file: