/**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_Gateways_IDealAdvanced_Transaction $transaction
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $transaction = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Transaction();
     $transaction->id = Pronamic_WP_Pay_XML_Security::filter($xml->id);
     $transaction->payment_url = Pronamic_WP_Pay_XML_Security::filter($xml->payment_url);
     return $transaction;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_Gateways_IDealAdvanced_Transaction $transaction
  */
 public static function parse(SimpleXMLElement $xml, $transaction = null)
 {
     if (!$transaction instanceof Pronamic_WP_Pay_Gateways_IDealAdvancedV3_Transaction) {
         $transaction = new Pronamic_WP_Pay_Gateways_IDealAdvancedV3_Transaction();
     }
     if ($xml->transactionID) {
         $transaction->set_id(Pronamic_WP_Pay_XML_Security::filter($xml->transactionID));
     }
     if ($xml->purchaseID) {
         $transaction->set_purchase_id(Pronamic_WP_Pay_XML_Security::filter($xml->purchaseID));
     }
     if ($xml->status) {
         $transaction->set_status(Pronamic_WP_Pay_XML_Security::filter($xml->status));
     }
     if ($xml->consumerName) {
         $transaction->set_consumer_name(Pronamic_WP_Pay_XML_Security::filter($xml->consumerName));
     }
     if ($xml->consumerIBAN) {
         $transaction->set_consumer_iban(Pronamic_WP_Pay_XML_Security::filter($xml->consumerIBAN));
     }
     if ($xml->consumerBIC) {
         $transaction->set_consumer_bic(Pronamic_WP_Pay_XML_Security::filter($xml->consumerBIC));
     }
     return $transaction;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_Gateways_IDealAdvanced_Transaction $transaction
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionResponseMessage();
     $message->result = Pronamic_WP_Pay_XML_Security::filter($xml['result']);
     $message->transaction = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_TransactionParser::parse($xml->transaction);
     return $message;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $list = array();
     foreach ($xml->issuer as $issuer) {
         $id = Pronamic_WP_Pay_XML_Security::filter($issuer->issuerid, FILTER_SANITIZE_STRING);
         $name = Pronamic_WP_Pay_XML_Security::filter($issuer->bankname, FILTER_SANITIZE_STRING);
         $list[$id] = $name;
     }
     return $list;
 }
 /**
  * Parse
  *
  * @param SimpleXMLElement $xml
  * @return Pronamic_Gateways_IDealAdvanced_Directory
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $country = new Pronamic_WP_Pay_Gateways_IDealAdvancedV3_Country();
     $country->set_name(Pronamic_WP_Pay_XML_Security::filter($xml->countryNames));
     foreach ($xml->Issuer as $element) {
         $issuer = Pronamic_WP_Pay_Gateways_IDealAdvancedV3_XML_IssuerParser::parse($element);
         $country->add_issuer($issuer);
     }
     return $country;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_Gateways_IDealAdvanced_Transaction $transaction
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_StatusResponseMessage();
     $message->result = Pronamic_WP_Pay_XML_Security::filter($xml['result']);
     // E-wallet
     if ($xml->ewallet) {
         $ewallet = new stdClass();
         $ewallet->id = Pronamic_WP_Pay_XML_Security::filter($xml->ewallet->id);
         $ewallet->status = Pronamic_WP_Pay_XML_Security::filter($xml->ewallet->status);
         $ewallet->created = Pronamic_WP_Pay_XML_Security::filter($xml->ewallet->created);
         $ewallet->modified = Pronamic_WP_Pay_XML_Security::filter($xml->ewallet->modified);
         $ewallet->reason_code = Pronamic_WP_Pay_XML_Security::filter($xml->ewallet->reasoncode);
         $ewallet->reason = Pronamic_WP_Pay_XML_Security::filter($xml->ewallet->reason);
         $message->ewallet = $ewallet;
     }
     // Customer
     if ($xml->customer) {
         $customer = new stdClass();
         $customer->currency = Pronamic_WP_Pay_XML_Security::filter($xml->customer->currency);
         $customer->amount = Pronamic_WP_Pay_XML_Security::filter($xml->customer->amount);
         $customer->exchange_rate = Pronamic_WP_Pay_XML_Security::filter($xml->customer->exchange_rate);
         $customer->first_name = Pronamic_WP_Pay_XML_Security::filter($xml->customer->firstname);
         $customer->last_name = Pronamic_WP_Pay_XML_Security::filter($xml->customer->lastname);
         $customer->last_name = Pronamic_WP_Pay_XML_Security::filter($xml->customer->lastname);
         $customer->city = Pronamic_WP_Pay_XML_Security::filter($xml->customer->city);
         $customer->state = Pronamic_WP_Pay_XML_Security::filter($xml->customer->state);
         $customer->country = Pronamic_WP_Pay_XML_Security::filter($xml->customer->country);
         $message->customer = $customer;
     }
     // Transaction
     if ($xml->transaction) {
         $transaction = new stdClass();
         $transaction->id = Pronamic_WP_Pay_XML_Security::filter($xml->transaction->id);
         $transaction->currency = Pronamic_WP_Pay_XML_Security::filter($xml->transaction->currency);
         $transaction->amount = Pronamic_WP_Pay_XML_Security::filter($xml->transaction->amount);
         $transaction->description = Pronamic_WP_Pay_XML_Security::filter($xml->transaction->description);
         $transaction->var1 = Pronamic_WP_Pay_XML_Security::filter($xml->transaction->var1);
         $transaction->var2 = Pronamic_WP_Pay_XML_Security::filter($xml->transaction->var2);
         $transaction->var3 = Pronamic_WP_Pay_XML_Security::filter($xml->transaction->var3);
         $transaction->items = Pronamic_WP_Pay_XML_Security::filter($xml->transaction->items);
         $message->transaction = $transaction;
     }
     // Payment details
     if ($xml->paymentdetails) {
         $payment_details = new stdClass();
         $payment_details->type = Pronamic_WP_Pay_XML_Security::filter($xml->paymentdetails->type);
         $payment_details->account_iban = Pronamic_WP_Pay_XML_Security::filter($xml->paymentdetails->accountiban);
         $payment_details->account_bic = Pronamic_WP_Pay_XML_Security::filter($xml->paymentdetails->accountbic);
         $payment_details->account_id = Pronamic_WP_Pay_XML_Security::filter($xml->paymentdetails->accountid);
         $payment_details->account_holder_name = Pronamic_WP_Pay_XML_Security::filter($xml->paymentdetails->accountholdername);
         $payment_details->external_transaction_id = Pronamic_WP_Pay_XML_Security::filter($xml->paymentdetails->externaltransactionid);
         $message->payment_details = $payment_details;
     }
     return $message;
 }
 /**
  * Parse
  *
  * @param SimpleXMLElement $xml
  * @return Pronamic_Gateways_IDealAdvanced_Directory
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $directory = new Pronamic_WP_Pay_Gateways_IDealAdvancedV3_Directory();
     $timestamp = Pronamic_WP_Pay_XML_Security::filter($xml->directoryDateTimestamp);
     $directory->set_date(new DateTime($timestamp));
     foreach ($xml->Country as $element) {
         $country = Pronamic_WP_Pay_Gateways_IDealAdvancedV3_XML_CountryParser::parse($element);
         $directory->add_country($country);
     }
     return $directory;
 }
 /**
  * Parse
  *
  * @param SimpleXMLElement $xml
  * @return Pronamic_WP_Pay_Gateways_IDealAdvanced_Directory
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $directory = new Pronamic_WP_Pay_Gateways_IDealAdvanced_Directory();
     $timestamp = Pronamic_WP_Pay_XML_Security::filter($xml->directoryDateTimeStamp);
     $directory->setDate(new DateTime($timestamp));
     foreach ($xml->Issuer as $element) {
         $issuer = Pronamic_WP_Pay_Gateways_IDealAdvanced_XML_IssuerParser::parse($element);
         $directory->addIssuer($issuer);
     }
     return $directory;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_Gateways_IDealAdvanced_Transaction $transaction
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_IDealIssuersResponseMessage();
     $message->issuers = array();
     foreach ($xml->issuers->issuer as $issuer) {
         $code = Pronamic_WP_Pay_XML_Security::filter($issuer->code);
         $description = Pronamic_WP_Pay_XML_Security::filter($issuer->description);
         $message->issuers[$code] = $description;
     }
     return $message;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_Gateways_IDealAdvanced_Transaction $transaction
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_GatewaysResponseMessage();
     // @todo
     $message->gateways = array();
     foreach ($xml->gateways->gateway as $gateway) {
         $id = Pronamic_WP_Pay_XML_Security::filter($gateway->id);
         $description = Pronamic_WP_Pay_XML_Security::filter($gateway->description);
         $message->gateways[$id] = $description;
     }
     return $message;
 }
 /**
  * Parse the specified XML element into an acquirer error response
  *
  * @param SimpleXMLElement $xml
  */
 public function parse(SimpleXMLElement $xml)
 {
     $error = null;
     if ('Error' === $xml->getName()) {
         $error = new Pronamic_WP_Pay_Gateways_IDealAdvancedV3_Error();
         $error->set_code(Pronamic_WP_Pay_XML_Security::filter($xml->errorCode));
         $error->set_message(Pronamic_WP_Pay_XML_Security::filter($xml->errorMessage));
         $error->set_detail(Pronamic_WP_Pay_XML_Security::filter($xml->errorDetail));
         $error->set_suggested_action(Pronamic_WP_Pay_XML_Security::filter($xml->suggestedAction));
         $error->set_consumer_message(Pronamic_WP_Pay_XML_Security::filter($xml->consumerMessage));
     }
     return $error;
 }
 /**
  * Parse
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_Gateways_IDealAdvanced_Issuer $issuer
  */
 public static function parse(SimpleXMLElement $xml, $issuer = null)
 {
     if (!$issuer instanceof Pronamic_WP_Pay_Gateways_IDealAdvancedV3_Issuer) {
         $issuer = new Pronamic_WP_Pay_Gateways_IDealAdvancedV3_Issuer();
     }
     if ($xml->issuerID) {
         $issuer->set_id(Pronamic_WP_Pay_XML_Security::filter($xml->issuerID));
     }
     if ($xml->issuerName) {
         $issuer->set_name(Pronamic_WP_Pay_XML_Security::filter($xml->issuerName));
     }
     if ($xml->issuerAuthenticationURL) {
         $issuer->set_authentication_url(Pronamic_WP_Pay_XML_Security::filter($xml->issuerAuthenticationURL));
     }
     return $issuer;
 }
 /**
  * Parse
  *
  * @param SimpleXMLElement $xml
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $issuer = new Pronamic_WP_Pay_Gateways_IDealAdvanced_Issuer();
     if ($xml->issuerID) {
         $issuer->setId(Pronamic_WP_Pay_XML_Security::filter($xml->issuerID));
     }
     if ($xml->issuerName) {
         $issuer->setName(Pronamic_WP_Pay_XML_Security::filter($xml->issuerName));
     }
     if ($xml->issuerList) {
         $issuer->setList(Pronamic_WP_Pay_XML_Security::filter($xml->issuerList));
     }
     if ($xml->issuerAuthenticationURL) {
         $issuer->authenticationUrl = Pronamic_WP_Pay_XML_Security::filter($xml->issuerAuthenticationURL);
     }
     return $issuer;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_Gateways_IDealAdvanced_Transaction $transaction
  */
 public static function parse(SimpleXMLElement $xml)
 {
     // Message
     $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionResponseMessage();
     // Result
     $message->result = Pronamic_WP_Pay_XML_Security::filter($xml['result']);
     // Transaction
     $message->transaction = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_TransactionParser::parse($xml->transaction);
     // Gateway info
     if ($xml->gatewayinfo) {
         $message->gateway_info = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_GatewayInfo();
         $message->gateway_info->redirect_url = Pronamic_WP_Pay_XML_Security::filter($xml->gatewayinfo->redirecturl);
         $message->gateway_info->ext_var = Pronamic_WP_Pay_XML_Security::filter($xml->gatewayinfo->extvar);
         $message->gateway_info->issuer_id = Pronamic_WP_Pay_XML_Security::filter($xml->gatewayinfo->issuerid);
     }
     return $message;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $payment_info = new Pronamic_WP_Pay_Gateways_PayDutch_PaymentInfo();
     $payment_info->test = Pronamic_WP_Pay_XML_Security::filter($xml->test, FILTER_VALIDATE_BOOLEAN);
     $payment_info->id = Pronamic_WP_Pay_XML_Security::filter($xml->id, FILTER_SANITIZE_STRING);
     $payment_info->description = Pronamic_WP_Pay_XML_Security::filter($xml->description, FILTER_SANITIZE_STRING);
     $payment_info->amount = Pronamic_WP_Pay_Gateways_PayDutch_Client::parse_amount(Pronamic_WP_Pay_XML_Security::filter($xml->amount, FILTER_SANITIZE_STRING));
     $payment_info->state = Pronamic_WP_Pay_XML_Security::filter($xml->state, FILTER_SANITIZE_STRING);
     $payment_info->reference = Pronamic_WP_Pay_XML_Security::filter($xml->reference, FILTER_SANITIZE_STRING);
     $payment_info->methodcode = Pronamic_WP_Pay_XML_Security::filter($xml->methodcode, FILTER_SANITIZE_STRING);
     $payment_info->methodname = Pronamic_WP_Pay_XML_Security::filter($xml->methodname, FILTER_SANITIZE_STRING);
     $payment_info->consumername = Pronamic_WP_Pay_XML_Security::filter($xml->consumername, FILTER_SANITIZE_STRING);
     $payment_info->consumercity = Pronamic_WP_Pay_XML_Security::filter($xml->consumercity, FILTER_SANITIZE_STRING);
     $payment_info->consumeraccount = Pronamic_WP_Pay_XML_Security::filter($xml->consumeraccount, FILTER_SANITIZE_STRING);
     $payment_info->consumercountry = Pronamic_WP_Pay_XML_Security::filter($xml->consumercountry, FILTER_SANITIZE_STRING);
     $payment_info->created = Pronamic_WP_Pay_XML_Security::filter($xml->created, FILTER_SANITIZE_STRING);
     return $payment_info;
 }
 /**
  * Parse
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_WP_Pay_Gateways_IDealBasic_Notification $notification
  * @return Pronamic_WP_Pay_Gateways_IDealBasic_Notification
  */
 public static function parse(SimpleXMLElement $xml, $notification = null)
 {
     if (null === $notification) {
         $notification = new Pronamic_WP_Pay_Gateways_IDealBasic_Notification();
     }
     if ($xml->createDateTimeStamp) {
         $notification->set_date(new DateTime(Pronamic_WP_Pay_XML_Security::filter($xml->createDateTimeStamp)));
     }
     if ($xml->transactionID) {
         $notification->set_transaction_id(Pronamic_WP_Pay_XML_Security::filter($xml->transactionID));
     }
     if ($xml->purchaseID) {
         $notification->set_purchase_id(Pronamic_WP_Pay_XML_Security::filter($xml->purchaseID));
     }
     if ($xml->status) {
         $notification->set_status(Pronamic_WP_Pay_XML_Security::filter($xml->status));
     }
     return $notification;
 }
 public static function parse(SimpleXMLElement $xml)
 {
     $transaction = new Pronamic_WP_Pay_Gateways_Sisow_Transaction();
     // Transaction request
     if (isset($xml->trxid)) {
         $transaction->id = Pronamic_WP_Pay_XML_Security::filter($xml->trxid);
     }
     if (isset($xml->issuerurl)) {
         $transaction->issuer_url = urldecode(Pronamic_WP_Pay_XML_Security::filter($xml->issuerurl));
     }
     // Status response
     if (isset($xml->status)) {
         $transaction->status = Pronamic_WP_Pay_XML_Security::filter($xml->status);
     }
     if (isset($xml->amount)) {
         $transaction->amount = Pronamic_WP_Util::cents_to_amount(Pronamic_WP_Pay_XML_Security::filter($xml->amount));
     }
     if (isset($xml->purchaseid)) {
         $transaction->purchase_id = Pronamic_WP_Pay_XML_Security::filter($xml->purchaseid);
     }
     if (isset($xml->description)) {
         $transaction->description = Pronamic_WP_Pay_XML_Security::filter($xml->description);
     }
     if (isset($xml->entrancecode)) {
         $transaction->entrance_code = Pronamic_WP_Pay_XML_Security::filter($xml->entrancecode);
     }
     if (isset($xml->issuerid)) {
         $transaction->issuer_id = Pronamic_WP_Pay_XML_Security::filter($xml->issuerid);
     }
     if (isset($xml->timestamp)) {
         $transaction->timestamp = new DateTime(Pronamic_WP_Pay_XML_Security::filter($xml->timestamp));
     }
     if (isset($xml->consumername)) {
         $transaction->consumer_name = Pronamic_WP_Pay_XML_Security::filter($xml->consumername);
     }
     if (isset($xml->consumeraccount)) {
         $transaction->consumer_account = Pronamic_WP_Pay_XML_Security::filter($xml->consumeraccount);
     }
     if (isset($xml->consumercity)) {
         $transaction->consumer_city = Pronamic_WP_Pay_XML_Security::filter($xml->consumercity);
     }
     return $transaction;
 }
Exemple #18
0
 /**
  * Order direct
  *
  * @param array $data
  */
 public function order_direct(array $data = array())
 {
     $order_response = false;
     $result = Pronamic_WP_Pay_Util::remote_get_body($this->api_url, 200, array('method' => 'POST', 'sslverify' => false, 'body' => $data));
     if (is_wp_error($result)) {
         $this->error = $result;
     } else {
         $xml = Pronamic_WP_Pay_Util::simplexml_load_string($result);
         if (is_wp_error($xml)) {
             $this->error = $xml;
         } else {
             $order_response = Pronamic_WP_Pay_Gateways_Ogone_OrderResponseParser::parse($xml);
             if (!empty($order_response->nc_error)) {
                 $ogone_error = new Pronamic_WP_Pay_Gateways_Ogone_Error(Pronamic_WP_Pay_XML_Security::filter($order_response->nc_error), Pronamic_WP_Pay_XML_Security::filter($order_response->nc_error_plus));
                 $this->error = new WP_Error('ogone_error', (string) $ogone_error, $ogone_error);
             }
         }
     }
     return $order_response;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  * @param Pronamic_WP_Pay_Gateways_Ogone_DirectLink_OrderResponse $order_response
  */
 public static function parse(SimpleXMLElement $xml, $order_response = null)
 {
     if (!$order_response instanceof Pronamic_WP_Pay_Gateways_Ogone_DirectLink_OrderResponse) {
         $order_response = new Pronamic_WP_Pay_Gateways_Ogone_DirectLink_OrderResponse();
     }
     $order_response->order_id = Pronamic_WP_Pay_XML_Security::filter($xml['orderID']);
     $order_response->pay_id = Pronamic_WP_Pay_XML_Security::filter($xml['PAYID']);
     $order_response->nc_status = Pronamic_WP_Pay_XML_Security::filter($xml[Pronamic_WP_Pay_Gateways_Ogone_Parameters::NC_STATUS]);
     $order_response->nc_error = Pronamic_WP_Pay_XML_Security::filter($xml[Pronamic_WP_Pay_Gateways_Ogone_Parameters::NC_ERROR]);
     $order_response->nc_error_plus = Pronamic_WP_Pay_XML_Security::filter($xml[Pronamic_WP_Pay_Gateways_Ogone_Parameters::NC_ERROR_PLUS]);
     $order_response->acceptance = Pronamic_WP_Pay_XML_Security::filter($xml['ACCEPTANCE']);
     $order_response->status = Pronamic_WP_Pay_XML_Security::filter($xml[Pronamic_WP_Pay_Gateways_Ogone_Parameters::STATUS]);
     $order_response->eci = Pronamic_WP_Pay_XML_Security::filter($xml['ECI']);
     $order_response->amount = Pronamic_WP_Pay_XML_Security::filter($xml[Pronamic_WP_Pay_Gateways_Ogone_Parameters::AMOUNT]);
     $order_response->currency = Pronamic_WP_Pay_XML_Security::filter($xml[Pronamic_WP_Pay_Gateways_Ogone_Parameters::CURRENCY]);
     $order_response->pm = Pronamic_WP_Pay_XML_Security::filter($xml['PM']);
     $order_response->brand = Pronamic_WP_Pay_XML_Security::filter($xml['BRAND']);
     if ($xml->HTML_ANSWER) {
         $order_response->html_answer = base64_decode(Pronamic_WP_Pay_XML_Security::filter($xml->HTML_ANSWER));
     }
     return $order_response;
 }
 /**
  * Parse iDEAL Advanced error from the specified XML element
  *
  * @param SimpleXMLElement $xml
  * @return Pronamic_WP_Pay_Gateways_IDealAdvanced_Error
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $error = new Pronamic_WP_Pay_Gateways_IDealAdvanced_Error();
     if ($xml->errorCode) {
         $error->set_code(Pronamic_WP_Pay_XML_Security::filter($xml->errorCode));
     }
     if ($xml->errorMessage) {
         $error->set_message(Pronamic_WP_Pay_XML_Security::filter($xml->errorMessage));
     }
     if ($xml->errorDetail) {
         $error->set_detail(Pronamic_WP_Pay_XML_Security::filter($xml->errorDetail));
     }
     if ($xml->suggestedAction) {
         $error->set_suggested_action(Pronamic_WP_Pay_XML_Security::filter($xml->suggestedAction));
     }
     if ($xml->suggestedExpirationPeriod) {
         $error->set_suggested_expiration_period(Pronamic_WP_Pay_XML_Security::filter($xml->suggestedExpirationPeriod));
     }
     if ($xml->consumerMessage) {
         $error->set_consumer_message(Pronamic_WP_Pay_XML_Security::filter($xml->consumerMessage));
     }
     return $error;
 }
 /**
  * Parse the specified XML element into an iDEAL transaction object
  *
  * @param SimpleXMLElement $xml
  */
 public static function parse(SimpleXMLElement $xml)
 {
     $transaction = new Pronamic_WP_Pay_Gateways_IDealAdvanced_Transaction();
     if ($xml->transactionID) {
         $transaction->setId(Pronamic_WP_Pay_XML_Security::filter($xml->transactionID));
     }
     if ($xml->purchaseID) {
         $transaction->setPurchaseId(Pronamic_WP_Pay_XML_Security::filter($xml->purchaseID));
     }
     if ($xml->status) {
         $transaction->setStatus(Pronamic_WP_Pay_XML_Security::filter($xml->status));
     }
     if ($xml->consumerName) {
         $transaction->setConsumerName(Pronamic_WP_Pay_XML_Security::filter($xml->consumerName));
     }
     if ($xml->consumerAccountNumber) {
         $transaction->setConsumerAccountNumber(Pronamic_WP_Pay_XML_Security::filter($xml->consumerAccountNumber));
     }
     if ($xml->consumerCity) {
         $transaction->setConsumerCity(Pronamic_WP_Pay_XML_Security::filter($xml->consumerCity));
     }
     return $transaction;
 }
Exemple #22
0
 /**
  * Get order status
  */
 public function get_order_status($order_id)
 {
     $return = null;
     // API user ID and password
     $user_id = $this->get_user_id();
     $password = $this->get_password();
     if ('' === $user_id || '' === $password) {
         return $return;
     }
     $result = Pronamic_WP_Pay_Util::remote_get_body($this->get_direct_query_url(), 200, array('method' => 'POST', 'body' => array(Pronamic_WP_Pay_Gateways_Ogone_Parameters::ORDERID => $order_id, Pronamic_WP_Pay_Gateways_Ogone_Parameters::PSPID => $this->data->get_field(Pronamic_WP_Pay_Gateways_Ogone_Parameters::PSPID), Pronamic_WP_Pay_Gateways_Ogone_Parameters::USER_ID => $user_id, Pronamic_WP_Pay_Gateways_Ogone_Parameters::PASSWORD => $password), 'timeout' => 30));
     $xml = Pronamic_WP_Pay_Util::simplexml_load_string($result);
     if (!is_wp_error($xml)) {
         $order_response = Pronamic_WP_Pay_Gateways_Ogone_OrderResponseParser::parse($xml);
         $status = Pronamic_WP_Pay_XML_Security::filter($order_response->status);
         $return = Pronamic_WP_Pay_Gateways_Ogone_Statuses::transform($status);
     }
     return $return;
 }
Exemple #23
0
 /**
  * Get payment methods
  *
  * @return array
  */
 public function get_payment_methods()
 {
     $response = $this->send_request('methods/', 'GET');
     if (false === $response) {
         return false;
     }
     $payment_methods = array();
     if (isset($response->data)) {
         foreach ($response->data as $payment_method) {
             $id = Pronamic_WP_Pay_XML_Security::filter($payment_method->id);
             $name = Pronamic_WP_Pay_XML_Security::filter($payment_method->description);
             $payment_methods[$id] = $name;
         }
     }
     return $payment_methods;
 }
 /**
  * Get issuers
  *
  * @return array
  */
 public function get_issuers()
 {
     $issuers = false;
     $response = $this->send_request('ideal/issuers/', 'GET');
     $response_code = wp_remote_retrieve_response_code($response);
     if (200 === $response_code) {
         $body = wp_remote_retrieve_body($response);
         // NULL is returned if the json cannot be decoded or if the encoded data is deeper than the recursion limit.
         $result = json_decode($body);
         if (null !== $result) {
             $issuers = array();
             foreach ($result as $issuer) {
                 $id = Pronamic_WP_Pay_XML_Security::filter($issuer->id);
                 $name = Pronamic_WP_Pay_XML_Security::filter($issuer->name);
                 $issuers[$id] = $name;
             }
         }
     } else {
         $body = wp_remote_retrieve_body($response);
         $ing_result = json_decode($body);
         $error_msg = $ing_result->error->value;
         if (401 === $response_code) {
             // An unauthorized API call has nothing to do with the browser of the user in our case, remove to prevent confusion.
             $error_msg = str_replace("You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.", '', $error_msg);
             // The default error message for an unauthorized API call does not mention the API key in any way.
             $error_msg .= ' Please check the API key.';
         }
         $this->error = new WP_Error('ing_kassa_compleet_error', $error_msg, $ing_result->error);
     }
     return $issuers;
 }
Exemple #25
0
 /**
  * Create transaction.
  *
  * @since 1.0.0
  * @version 1.0.5
  */
 public function create_transaction($amount, $currency, $bank_id, $description, $return_url)
 {
     $result = false;
     $parameters = array('Amount' => number_format($amount, 2, '.', ''), 'Currency' => $currency, 'Bank' => $bank_id, 'Description' => substr($description, 0, 30), 'Return' => $return_url);
     $document = $this->get_document(Pronamic_WP_Pay_Gateways_Qantani_Actions::IDEAL_EXECUTE, $parameters);
     $response = $this->send_request($document->saveXML());
     if (is_wp_error($response)) {
         $this->error = $response;
     } else {
         $xml = Pronamic_WP_Util::simplexml_load_string($response);
         if (is_wp_error($xml)) {
             $this->error = $xml;
         } else {
             if (Pronamic_WP_Pay_Gateways_Qantani_ResponseStatuses::OK === Pronamic_WP_Pay_XML_Security::filter($xml->Status)) {
                 $xml_response = $xml->Response;
                 $result = new stdClass();
                 $result->transaction_id = Pronamic_WP_Pay_XML_Security::filter($xml_response->TransactionID);
                 $result->code = Pronamic_WP_Pay_XML_Security::filter($xml_response->Code);
                 $result->bank_url = Pronamic_WP_Pay_XML_Security::filter($xml_response->BankURL);
                 $result->acquirer = Pronamic_WP_Pay_XML_Security::filter($xml_response->Acquirer);
             } else {
                 $error_id = Pronamic_WP_Pay_XML_Security::filter($xml->Error->ID);
                 $error_description = Pronamic_WP_Pay_XML_Security::filter($xml->Error->Description);
                 $error = new Pronamic_WP_Pay_Gateways_Qantani_Error($error_id, $error_description);
                 $this->error = new WP_Error('qantani_error', (string) $error, $error);
             }
         }
     }
     return $result;
 }
 public static function parse(SimpleXMLElement $xml)
 {
     $error = new Pronamic_WP_Pay_Gateways_Sisow_Error(Pronamic_WP_Pay_XML_Security::filter($xml->errorcode), Pronamic_WP_Pay_XML_Security::filter($xml->errormessage));
     return $error;
 }
 /**
  * Check payment with the specified transaction ID
  *
  * @param string $transaction_id
  * @return stdClass
  */
 public function check_payment($transaction_id)
 {
     $result = false;
     $parameters = array('transaction_id' => $transaction_id);
     $result = $this->send_request(Pronamic_WP_Pay_Gateways_Mollie_IDeal_Actions::CHECK, $parameters);
     if (false !== $result) {
         $xml = Pronamic_WP_Util::simplexml_load_string($result);
         if (is_wp_error($xml)) {
             $this->error = $xml;
         } else {
             $order = new stdClass();
             $order->transaction_id = Pronamic_WP_Pay_XML_Security::filter($xml->order->transaction_id);
             $order->amount = Pronamic_WP_Pay_XML_Security::filter($xml->order->amount);
             $order->currency = Pronamic_WP_Pay_XML_Security::filter($xml->order->currency);
             $order->payed = Pronamic_WP_Pay_XML_Security::filter($xml->order->payed, FILTER_VALIDATE_BOOLEAN);
             $order->status = Pronamic_WP_Pay_XML_Security::filter($xml->order->status);
             $order->consumer = new stdClass();
             $order->consumer->name = Pronamic_WP_Pay_XML_Security::filter($xml->order->consumer->consumerName);
             $order->consumer->account = Pronamic_WP_Pay_XML_Security::filter($xml->order->consumer->consumerAccount);
             $order->consumer->city = Pronamic_WP_Pay_XML_Security::filter($xml->order->consumer->consumerCity);
             $result = $order;
         }
     }
     return $result;
 }
Exemple #28
0
 /**
  * Get issuers
  *
  * @return array
  */
 public function get_issuers()
 {
     $issuers = false;
     $url = self::URL_ISSUERS_XML;
     $data = self::remote_get($url);
     if (false !== $data) {
         $xml = Pronamic_WP_Util::simplexml_load_string($data);
         if (is_wp_error($xml)) {
             $this->error = $xml;
         } else {
             $issuers = array();
             foreach ($xml->issuer as $xml_issuer) {
                 $id = Pronamic_WP_Pay_XML_Security::filter($xml_issuer['id']);
                 $name = Pronamic_WP_Pay_XML_Security::filter($xml_issuer);
                 $issuers[$id] = $name;
             }
         }
     }
     return $issuers;
 }
Exemple #29
0
 /**
  * Get issuers
  *
  * @return array
  */
 public function get_issuers()
 {
     // Request
     $result = $this->send_request('v4', 'Transaction', 'getService', 'json', array('token' => $this->token, 'serviceId' => $this->service_id, 'paymentMethodId' => Pronamic_WP_Pay_Gateways_PayNL_PaymentMethods::IDEAL));
     if (!$result) {
         return false;
     }
     // Country option list
     if (!isset($result->countryOptionList)) {
         $this->error = new WP_Error('pay_nl_error', __('Unknown Pay.nl error.', 'pronamic_ideal'), $result);
         return false;
     }
     // Ok
     $issuers = array();
     foreach ($result->countryOptionList as $countries) {
         foreach ($countries->paymentOptionList as $payment_method) {
             if (Pronamic_WP_Pay_Gateways_PayNL_PaymentMethods::IDEAL === $payment_method->id) {
                 foreach ($payment_method->paymentOptionSubList as $issuer) {
                     $id = Pronamic_WP_Pay_XML_Security::filter($issuer->id);
                     $name = Pronamic_WP_Pay_XML_Security::filter($issuer->name);
                     $issuers[$id] = $name;
                 }
             }
         }
     }
     return $issuers;
 }