Ejemplo n.º 1
0
 /**
  * PHPMerchant_Billing_Gateway_PayPal::_commit()
  * 
  * @param mixed $action
  * @param mixed $request
  * @return PHPMerchant_Billing_Response
  */
 protected function _commit($action, $request)
 {
     $request = array_merge(array('x_login' => $this->_options['login'], 'x_tran_key' => $this->_options['password'], 'x_version' => self::API_VERSION, 'x_type' => $action, 'x_delim_data' => 'TRUE', 'x_delim_char' => '|', 'x_relay_response' => 'FALSE'), $request);
     $response = PHPMerchant_Utils::httpPost($this->_getEndpointUrl(), $request);
     $response = explode('|', $response);
     $success = in_array($response[0], array(self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_HELD));
     // Response Reason Text (ORDER: 4)
     $message = $response[3];
     $responseObject = new PHPMerchant_Billing_Response($success, $message, $response, array('test' => $this->isTest(), 'authorization' => $response[6], 'avs_result' => empty($response[5]) ? null : $response[5], 'cvv_result' => empty($response[38]) ? null : $response[38]));
     return $responseObject;
 }
Ejemplo n.º 2
0
 /**
  * PHPMerchant_Billing_Gateway_PayPal::_commit()
  * 
  * @param mixed $action
  * @param mixed $request
  * @return PHPMerchant_Billing_Response
  */
 protected function _commit($method, $request)
 {
     $request = array_merge(array('METHOD' => $method, 'VERSION' => '3.0', 'USER' => $this->_options['login'], 'PWD' => $this->_options['password'], 'SIGNATURE' => $this->_options['signature']), $request);
     $response = PHPMerchant_Utils::httpPost($this->_getEndpointUrl(), $request);
     $response = $this->_parseResponse($response);
     $success = $response['ACK'] == 'Success' || $response['ACK'] == 'SuccessWithWarning';
     $message = isset($response['L_LONGMESSAGE0']) ? $response['L_LONGMESSAGE0'] : $response['ACK'];
     $responseObject = new PHPMerchant_Billing_Response($success, $message, $response, array('test' => $this->isTest(), 'authorization' => self::_authorizationFrom($response), 'avs_result' => isset($response['AVSCODE']) ? array('code' => $response['AVSCODE']) : null, 'cvv_result' => isset($response['CVV2MATCH']) ? array('code' => $response['CVV2MATCH']) : null));
     return $responseObject;
 }