public static function active($params = array(), $format = 'json')
 {
     if (array_key_exists("sale_id", $params)) {
         $result = Twocheckout_Sale::retrieve($params);
         $array = Twocheckout_Util::return_resp($result, 'array');
         if (!array_key_exists('errors', $array)) {
             $lineitemData = Twocheckout_Util::get_recurring_lineitems($array);
             if (isset($lineitemData[0])) {
                 if ($format == 'array') {
                     return Twocheckout_Util::return_resp($lineitemData, $format);
                 } else {
                     return Twocheckout_Util::return_resp($lineitemData, 'force_json');
                 }
             } else {
                 $result = Twocheckout_Message::message('Notice', 'No recurring lineitems.');
                 return Twocheckout_Util::return_resp($result, $format);
             }
         } else {
             return Twocheckout_Util::return_resp($result, $format);
         }
     } else {
         $result = Twocheckout_Message::message('Error', 'You must pass a sale_id to use this method.');
         return Twocheckout_Util::return_resp($result, $format);
     }
 }
 public function check($insMessage, $secretWord, $format = 'json')
 {
     $hashSid = $insMessage['vendor_id'];
     $hashOrder = $insMessage['sale_id'];
     $hashInvoice = $insMessage['invoice_id'];
     $StringToHash = strtoupper(md5($hashOrder . $hashSid . $hashInvoice . $secretWord));
     if ($StringToHash != $insMessage['md5_hash']) {
         $result = Twocheckout_Message::message('Fail', 'Hash Mismatch');
     } else {
         $result = Twocheckout_Message::message('Success', 'Hash Matched');
     }
     return Twocheckout_Util::return_resp($result, $format);
 }
Пример #3
0
 public static function check($params = array(), $secretWord, $format = 'json')
 {
     $hashSecretWord = $secretWord;
     $hashSid = $params['sid'];
     $hashTotal = $params['total'];
     $hashOrder = $params['order_number'];
     $StringToHash = strtoupper(md5($hashSecretWord . $hashSid . $hashOrder . $hashTotal));
     if ($StringToHash != $params['key']) {
         $result = Twocheckout_Message::message('Fail', 'Hash Mismatch');
     } else {
         $result = Twocheckout_Message::message('Success', 'Hash Matched');
     }
     return Twocheckout_Util::return_resp($result, $format);
 }
Пример #4
0
 public static function check($params = array(), $secretWord)
 {
     $hashSecretWord = $secretWord;
     $hashSid = $params['sid'];
     $hashTotal = $params['total'];
     //Two checkout uses order number as 1 in test orders for generating hash
     $hashOrder = 'Y' == $params['demo'] ? 1 : $params['order_number'];
     $StringToHash = strtoupper(md5($hashSecretWord . $hashSid . $hashOrder . $hashTotal));
     if ($StringToHash != $params['key']) {
         $result = Twocheckout_Message::message('Fail', 'Hash Mismatch');
     } else {
         $result = Twocheckout_Message::message('Success', 'Hash Matched');
     }
     return Twocheckout_Util::returnResponse($result);
 }
Пример #5
0
 public static function active($params = array())
 {
     if (array_key_exists("sale_id", $params)) {
         $result = Twocheckout_Sale::retrieve($params);
         if (!is_array($result)) {
             $result = Twocheckout_Util::returnResponse($result, 'array');
         }
         $lineitemData = Twocheckout_Util::getRecurringLineitems($result);
         if (isset($lineitemData[0])) {
             $result = Twocheckout_Message::message('OK', $lineitemData);
             return Twocheckout_Util::returnResponse($result);
         } else {
             throw new Twocheckout_Error("No active recurring lineitems.");
         }
     } else {
         throw new Twocheckout_Error("You must pass a sale_id to use this method.");
     }
 }
Пример #6
0
 public static function active($params = array(), $format = 'json')
 {
     if (array_key_exists("sale_id", $params)) {
         $result = Twocheckout_Sale::retrieve($params);
         $array = Twocheckout_Util::return_resp($result, 'array');
         $lineitemData = Twocheckout_Util::get_recurring_lineitems($array);
         if (isset($lineitemData[0])) {
             $result = Twocheckout_Message::message('OK', $lineitemData);
             if ($format == 'array') {
                 return Twocheckout_Util::return_resp($result, $format);
             } else {
                 return Twocheckout_Util::return_resp($result, 'force_json');
             }
         } else {
             throw new Twocheckout_Error("No active recurring lineitems.");
         }
     } else {
         throw new Twocheckout_Error("You must pass a sale_id to use this method.");
     }
 }