Example #1
0
 /**
  *
  * @param string $transaction_id  with random id suffix e.g. "YOUR_SHOP_ORDER_ID---5187b98ac1c5e"
  * @return object  {transaction_id:string, random_suffix:string}
  */
 static function extractRandomId($transaction_id)
 {
     $o = new \stdClass();
     $o->transaction_id = '';
     $o->random_id = '';
     if (Config::hasIdSeparator()) {
         $parts = explode(Config::getIdSeparator(), $transaction_id);
         if (sizeof($parts) == 2) {
             list($o->transaction_id, $o->random_id) = $parts;
         } else {
             trigger_error("WARNING in \\Hypercharge\\Helper::extractRandomId(): no seperator found. transaction_id: '{$transaction_id}'");
             $o->transaction_id = $transaction_id;
         }
     } else {
         $o->transaction_id = $transaction_id;
     }
     return $o;
 }
 function testSetIdSeparatorShouldWorkWithString()
 {
     Config::setIdSeparator('<<<');
     $this->assertTrue(Config::hasIdSeparator());
     $this->assertEqual('<<<', Config::getIdSeparator());
 }