Exemplo n.º 1
0
 static function TempTokenFromPlan($plan)
 {
     $temptoken = new aecTempToken();
     $temptoken->getComposite();
     if (empty($temptoken->content)) {
         $content = array();
         $content['usage'] = $plan['id'];
         $content['processor'] = $plan['gw'][0]->processor_name;
         if (isset($plan['gw'][0]->recurring)) {
             $content['recurring'] = $plan['gw'][0]->recurring;
         }
         $temptoken->create($content);
     } elseif (empty($temptoken->content['usage']) || $temptoken->content['usage'] !== $plan['id']) {
         $temptoken->content['usage'] = $plan['id'];
         $temptoken->content['processor'] = $plan['gw'][0]->processor_name;
         if (isset($plan['gw'][0]->recurring)) {
             $temptoken->content['recurring'] = $plan['gw'][0]->recurring;
         }
         $temptoken->storeload();
     }
 }
Exemplo n.º 2
0
 public function saveToToken($vars)
 {
     $temptoken = new aecTempToken();
     $temptoken->getComposite();
     $existing = false;
     if (!empty($temptoken->content['usage'])) {
         $existing = true;
     }
     $content = array();
     $content['usage'] = $vars['usage'];
     $content['processor'] = $vars['processor'];
     $content['recurring'] = $vars['recurring'];
     if (empty($temptoken->id)) {
         $temptoken->create($content);
     } else {
         if (is_array($temptoken->content)) {
             $temptoken->content = array_merge($temptoken->content, $content);
         } else {
             $temptoken->content = $content;
         }
     }
     $temptoken->storeload();
     return $existing;
 }