Esempio n. 1
0
 function ChargeRecurring($client_id, $gateway, $order_id, $token, $amount)
 {
     $CI =& get_instance();
     if (empty($token)) {
         $response['reason'] = 'Token not passed to ChargeRecurring.';
         $response['success'] = FALSE;
         return $response;
     }
     if (!isset($this->object_loaded)) {
         $this->loadObject($gateway);
     }
     $tran = new Java("com.edgil.ecco.eccoapi.MonetaryTransactionData");
     $tran->setMerchantId($gateway['merchant_id']);
     $tran->setOEPId($gateway['oep_id']);
     $this->ECCOClient->certifyECCO($this->pass, $this->pass, $this->alias, "ECCO");
     $status = $this->ECCOClient->logon($gateway['login_id'], $gateway['password']);
     if ($status != $this->ECCOStatusCodes->SUCCESS) {
         $response = $CI->response->TransactionResponse(2, array('reason' => 'Login Error'));
         return $response;
     }
     $tran->setToken($token);
     $tran->setTransactionId($order_id);
     $tran->setAmount($amount);
     $status = $this->ECCOClient->requestAuthorization($tran);
     if ($status == $this->ECCOStatusCodes->SUCCESS) {
         $CI->load->model('order_authorization_model');
         $CI->order_authorization_model->SaveAuthorization($order_id, '', "'" . $tran->getAuthorizationCode() . "'");
         $CI->charge_model->SetStatus($order_id, 1);
         $status = $this->ECCOClient->requestMarkForCapture($tran);
         $response['success'] = TRUE;
     } else {
         $response['success'] = FALSE;
     }
     $this->ECCOClient->logoff();
     return $response;
 }