Initial import: Carteasy Shop (Dev-Stand)
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_calculate_rates_request extends ipl_xml_request {
|
||||
|
||||
private $_rate_params = array();
|
||||
private $options;
|
||||
|
||||
private $_locale = array();
|
||||
|
||||
public function get_options() {
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
public function set_rate_request_params($baseamount, $carttotalgross) {
|
||||
$this->_rate_params['baseamount'] = $baseamount;
|
||||
$this->_rate_params['carttotalgross'] = $carttotalgross;
|
||||
}
|
||||
|
||||
public function set_locale($country, $currency, $language) {
|
||||
$this->_locale['country'] = $country;
|
||||
$this->_locale['currency'] = $currency;
|
||||
$this->_locale['language'] = $language;
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
return ipl_core_send_calculate_rates_request(
|
||||
$this->_ipl_request_url,
|
||||
$this->_default_params,
|
||||
$this->_rate_params,
|
||||
$this->_locale
|
||||
);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
$this->options = $data['options'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_cancel_request extends ipl_xml_request {
|
||||
|
||||
private $_cancel_params = array();
|
||||
|
||||
public function set_cancel_params($reference, $cart_total_gross, $currency) {
|
||||
$this->_cancel_params['reference'] = $reference;
|
||||
$this->_cancel_params['carttotalgross'] = $cart_total_gross;
|
||||
$this->_cancel_params['currency'] = $currency;
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
return ipl_core_send_cancel_request($this->_ipl_request_url, $this->_default_params, $this->_cancel_params);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_capture_request extends ipl_xml_request {
|
||||
|
||||
private $_capture_params = array();
|
||||
private $_payment_info_params = array();
|
||||
|
||||
// bank account
|
||||
private $account_holder;
|
||||
private $account_number;
|
||||
private $bank_code;
|
||||
private $bank_name;
|
||||
private $invoice_reference;
|
||||
private $invoice_duedate;
|
||||
|
||||
private $standard_information_pdf;
|
||||
private $email_attachment_pdf;
|
||||
|
||||
private $payment_info_html;
|
||||
private $payment_info_plain;
|
||||
|
||||
public function get_account_holder() {
|
||||
return $this->account_holder;
|
||||
}
|
||||
public function get_account_number() {
|
||||
return $this->account_number;
|
||||
}
|
||||
public function get_bank_code() {
|
||||
return $this->bank_code;
|
||||
}
|
||||
public function get_bank_name() {
|
||||
return $this->bank_name;
|
||||
}
|
||||
public function get_invoice_reference() {
|
||||
return $this->invoice_reference;
|
||||
}
|
||||
public function get_invoice_duedate() {
|
||||
return $this->invoice_duedate;
|
||||
}
|
||||
public function get_standard_information_pdf() {
|
||||
return $this->standard_information_pdf;
|
||||
}
|
||||
public function get_email_attachment_pdf() {
|
||||
return $this->email_attachment_pdf;
|
||||
}
|
||||
public function get_payment_info_html() {
|
||||
return $this->payment_info_html;
|
||||
}
|
||||
public function get_payment_info_plain() {
|
||||
return $this->payment_info_plain;
|
||||
}
|
||||
|
||||
public function set_capture_params($bptid, $cart_total_gross, $currency, $reference, $customer_id) {
|
||||
$this->_capture_params['bptid'] = $bptid;
|
||||
$this->_capture_params['carttotalgross'] = $cart_total_gross;
|
||||
$this->_capture_params['currency'] = $currency;
|
||||
$this->_capture_params['reference'] = $reference;
|
||||
$this->_capture_params['customerid'] = $customer_id;
|
||||
}
|
||||
|
||||
public function set_payment_info_params($showhtmlinfo, $showplaininfo) {
|
||||
$this->_payment_info_params['htmlinfo'] = $showhtmlinfo ? "1" : "0";
|
||||
$this->_payment_info_params['plaininfo'] = $showplaininfo ? "1" : "0";
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
return ipl_core_send_capture_request($this->_ipl_request_url, $this->_default_params, $this->_capture_params, $this->_payment_info_params);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_edit_cart_content_request extends ipl_xml_request {
|
||||
private $_totals = array();
|
||||
private $_article_data = array();
|
||||
|
||||
private $due_update;
|
||||
private $number_of_rates;
|
||||
|
||||
public function get_due_update() {
|
||||
return $this->due_update;
|
||||
}
|
||||
|
||||
public function get_number_of_rates() {
|
||||
return $this->number_of_rates;
|
||||
}
|
||||
|
||||
public function add_article($articleid, $articlequantity, $articlename, $articledescription,
|
||||
$article_price, $article_price_gross) {
|
||||
$article = array();
|
||||
$article['articleid'] = $articleid;
|
||||
$article['articlequantity'] = $articlequantity;
|
||||
$article['articlename'] = $articlename;
|
||||
$article['articledescription'] = $articledescription;
|
||||
$article['articleprice'] = $article_price;
|
||||
$article['articlepricegross'] = $article_price_gross;
|
||||
|
||||
$this->_article_data[] = $article;
|
||||
}
|
||||
|
||||
|
||||
public function set_total($rebate, $rebate_gross, $shipping_name, $shipping_price,
|
||||
$shipping_price_gross, $cart_total_price, $cart_total_price_gross,
|
||||
$currency, $reference) {
|
||||
$this->_totals['shippingname'] = $shipping_name;
|
||||
$this->_totals['shippingprice'] = $shipping_price;
|
||||
$this->_totals['shippingpricegross'] = $shipping_price_gross;
|
||||
$this->_totals['rebate'] = $rebate;
|
||||
$this->_totals['rebategross'] = $rebate_gross;
|
||||
$this->_totals['carttotalprice'] = $cart_total_price;
|
||||
$this->_totals['carttotalpricegross'] = $cart_total_price_gross;
|
||||
$this->_totals['currency'] = $currency;
|
||||
$this->_totals['reference'] = $reference;
|
||||
}
|
||||
|
||||
|
||||
protected function _send() {
|
||||
$attributes = array();
|
||||
return ipl_core_send_edit_cart_content_request(
|
||||
$this->_ipl_request_url,
|
||||
$this->_default_params,
|
||||
$this->_totals,
|
||||
$this->_article_data
|
||||
);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _process_error_response_xml($data) {
|
||||
if (key_exists('status', $data)) {
|
||||
$this->status = $data['status'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_invoice_created_request extends ipl_xml_request {
|
||||
|
||||
private $_invoice_params = array();
|
||||
private $_payment_info_params = array();
|
||||
|
||||
// bank account
|
||||
private $account_holder;
|
||||
private $account_number;
|
||||
private $bank_code;
|
||||
private $bank_name;
|
||||
private $invoice_reference;
|
||||
private $invoice_duedate;
|
||||
private $activation_performed;
|
||||
|
||||
private $payment_info_html;
|
||||
private $payment_info_plain;
|
||||
|
||||
private $dues = array();
|
||||
|
||||
public function get_account_holder() {
|
||||
return $this->account_holder;
|
||||
}
|
||||
public function get_account_number() {
|
||||
return $this->account_number;
|
||||
}
|
||||
public function get_bank_code() {
|
||||
return $this->bank_code;
|
||||
}
|
||||
public function get_bank_name() {
|
||||
return $this->bank_name;
|
||||
}
|
||||
public function get_invoice_reference() {
|
||||
return $this->invoice_reference;
|
||||
}
|
||||
public function get_invoice_duedate() {
|
||||
return $this->invoice_duedate;
|
||||
}
|
||||
public function get_activation_performed() {
|
||||
return $this->activation_performed;
|
||||
}
|
||||
public function get_payment_info_html() {
|
||||
return $this->payment_info_html;
|
||||
}
|
||||
public function get_payment_info_plain() {
|
||||
return $this->payment_info_plain;
|
||||
}
|
||||
|
||||
public function get_dues() {
|
||||
return $this->dues;
|
||||
}
|
||||
|
||||
public function set_invoice_params($carttotalgross, $currency, $reference, $delayindays = 0) {
|
||||
$this->_invoice_params['carttotalgross'] = $carttotalgross;
|
||||
$this->_invoice_params['currency'] = $currency;
|
||||
$this->_invoice_params['reference'] = $reference;
|
||||
$this->_invoice_params['delayindays'] = $delayindays;
|
||||
}
|
||||
|
||||
public function set_payment_info_params($showhtmlinfo, $showplaininfo) {
|
||||
$this->_payment_info_params['htmlinfo'] = $showhtmlinfo ? "1" : "0";
|
||||
$this->_payment_info_params['plaininfo'] = $showplaininfo ? "1" : "0";
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
return ipl_core_send_invoice_request($this->_ipl_request_url, $this->_default_params, $this->_invoice_params, $this->_payment_info_params);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_module_config_request extends ipl_xml_request {
|
||||
|
||||
private $invoicestatic = 0;
|
||||
private $invoicebusinessstatic = 0;
|
||||
private $directdebitstatic = 0;
|
||||
private $hirepurchasestatic = 0;
|
||||
|
||||
private $invoicemin = 0;
|
||||
private $invoicebusinessmin = 0;
|
||||
private $directdebitmin = 0;
|
||||
private $hirepurchasemin = 0;
|
||||
|
||||
private $active = false;
|
||||
private $invoiceallowed = false;
|
||||
private $invoicebusinessallowed = false;
|
||||
private $directdebitallowed = false;
|
||||
private $hirepurchaseallowed = false;
|
||||
|
||||
private $terms = array();
|
||||
|
||||
private $_locale = array();
|
||||
|
||||
public function is_active() {
|
||||
return $this->active;
|
||||
}
|
||||
public function is_invoice_allowed() {
|
||||
return $this->invoiceallowed;
|
||||
}
|
||||
public function is_invoicebusiness_allowed() {
|
||||
return $this->invoicebusinessallowed;
|
||||
}
|
||||
public function is_direct_debit_allowed() {
|
||||
return $this->directdebitallowed;
|
||||
}
|
||||
public function is_hire_purchase_allowed() {
|
||||
return $this->hirepurchaseallowed;
|
||||
}
|
||||
public function get_invoice_min_value() {
|
||||
return $this->invoicemin;
|
||||
}
|
||||
public function get_invoicebusiness_min_value() {
|
||||
return $this->invoicebusinessmin;
|
||||
}
|
||||
public function get_direct_debit_min_value() {
|
||||
return $this->directdebitmin;
|
||||
}
|
||||
public function get_hire_purchase_min_value() {
|
||||
return $this->hirepurchasemin;
|
||||
}
|
||||
public function get_static_limit_invoice() {
|
||||
return $this->invoicestatic;
|
||||
}
|
||||
public function get_static_limit_invoicebusiness() {
|
||||
return $this->invoicebusinessstatic;
|
||||
}
|
||||
public function get_static_limit_direct_debit() {
|
||||
return $this->directdebitstatic;
|
||||
}
|
||||
public function get_static_limit_hire_purchase() {
|
||||
return $this->hirepurchasestatic;
|
||||
}
|
||||
public function get_terms() {
|
||||
return $this->terms;
|
||||
}
|
||||
|
||||
public function get_config_data() {
|
||||
return array(
|
||||
'is_active' => $this->is_active(),
|
||||
'is_allowed_invoice' => $this->is_invoice_allowed(),
|
||||
'is_allowed_invoicebusiness' => $this->is_invoicebusiness_allowed(),
|
||||
'is_allowed_directdebit' => $this->is_direct_debit_allowed(),
|
||||
'is_allowed_transactioncredit' => $this->is_hire_purchase_allowed(),
|
||||
'minvalue_invoice' => $this->get_invoice_min_value(),
|
||||
'minvalue_invoicebusiness' => $this->get_invoicebusiness_min_value(),
|
||||
'minvalue_directdebit' => $this->get_direct_debit_min_value(),
|
||||
'minvalue_transactioncredit' => $this->get_hire_purchase_min_value(),
|
||||
'maxvalue_invoice' => $this->get_static_limit_invoice(),
|
||||
'maxvalue_invoicebusiness' => $this->get_static_limit_invoicebusiness(),
|
||||
'maxvalue_directdebit' => $this->get_static_limit_direct_debit(),
|
||||
'maxvalue_transactioncredit' => $this->get_static_limit_hire_purchase()
|
||||
);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function set_locale($country, $currency, $language) {
|
||||
$this->_locale['country'] = $country;
|
||||
$this->_locale['currency'] = $currency;
|
||||
$this->_locale['language'] = $language;
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
return ipl_core_send_module_config_request(
|
||||
$this->_ipl_request_url,
|
||||
$this->_default_params,
|
||||
$this->_locale
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_partialcancel_request extends ipl_xml_request {
|
||||
|
||||
private $_cancel_params = array();
|
||||
private $_canceled_articles = array();
|
||||
|
||||
private $due_update;
|
||||
private $number_of_rates;
|
||||
|
||||
public function is_transaction_credit_order() {
|
||||
return $this->due_update;
|
||||
}
|
||||
|
||||
public function get_due_update() {
|
||||
return $this->due_update;
|
||||
}
|
||||
|
||||
public function get_number_of_rates() {
|
||||
return $this->number_of_rates;
|
||||
}
|
||||
|
||||
public function set_cancel_params($reference, $rebatedecrease, $rebatedecreasegross, $shippingdecrease, $shippingdecreasegross, $currency) {
|
||||
$this->_cancel_params['reference'] = $reference;
|
||||
$this->_cancel_params['rebatedecrease'] = $rebatedecrease;
|
||||
$this->_cancel_params['rebatedecreasegross'] = $rebatedecreasegross;
|
||||
$this->_cancel_params['shippingdecrease'] = $shippingdecrease;
|
||||
$this->_cancel_params['shippingdecreasegross'] = $shippingdecreasegross;
|
||||
$this->_cancel_params['currency'] = $currency;
|
||||
}
|
||||
|
||||
public function add_canceled_article($articleid, $articlequantity) {
|
||||
$article = array();
|
||||
$article['articleid'] = $articleid;
|
||||
$article['articlequantity'] = $articlequantity;
|
||||
|
||||
$this->_canceled_articles[] = $article;
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
return ipl_core_send_partialcancel_request(
|
||||
$this->_ipl_request_url,
|
||||
$this->_default_params,
|
||||
$this->_cancel_params,
|
||||
$this->_canceled_articles
|
||||
);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_preauthorize_request extends ipl_xml_request {
|
||||
private $_customer_details = array();
|
||||
private $_shippping_details = array();
|
||||
private $_totals = array();
|
||||
private $_bank_account = array();
|
||||
private $_rate_request_data = array();
|
||||
|
||||
private $_article_data = array();
|
||||
private $_order_history_data = array();
|
||||
private $_company_details = array();
|
||||
|
||||
private $_payment_info_params = array();
|
||||
|
||||
private $_payment_type;
|
||||
|
||||
private $status;
|
||||
private $bptid;
|
||||
|
||||
private $corrected_street;
|
||||
private $corrected_street_no;
|
||||
private $corrected_zip;
|
||||
private $corrected_city;
|
||||
private $corrected_country;
|
||||
|
||||
// parameters needed for auto-capture
|
||||
private $account_holder;
|
||||
private $account_number;
|
||||
private $bank_code;
|
||||
private $bank_name;
|
||||
private $invoice_reference;
|
||||
private $invoice_duedate;
|
||||
|
||||
private $_terms_accepted = false;
|
||||
private $_capture_request_necessary = true;
|
||||
private $_expected_days_till_shipping = 0;
|
||||
|
||||
private $standard_information_pdf;
|
||||
private $email_attachment_pdf;
|
||||
|
||||
private $payment_info_html;
|
||||
private $payment_info_plain;
|
||||
|
||||
// ctr
|
||||
function __construct($ipl_request_url, $payment_type) {
|
||||
$this->_payment_type = $payment_type;
|
||||
parent::__construct($ipl_request_url);
|
||||
}
|
||||
|
||||
public function get_terms_accepted() {
|
||||
return $this->_terms_accepted;
|
||||
}
|
||||
public function set_terms_accepted($val) {
|
||||
$this->_terms_accepted = $val;
|
||||
}
|
||||
public function set_expected_days_till_shipping($val) {
|
||||
$this->_expected_days_till_shipping = $val;
|
||||
}
|
||||
public function set_capture_request_necessary($val) {
|
||||
$this->_capture_request_necessary = $val;
|
||||
}
|
||||
|
||||
public function get_expected_days_till_shipping() {
|
||||
return $this->_expected_days_till_shipping;
|
||||
}
|
||||
public function get_capture_request_nesessary() {
|
||||
return $this->_capture_request_necessary;
|
||||
}
|
||||
public function get_payment_type() {
|
||||
return $this->_payment_type;
|
||||
}
|
||||
public function get_status() {
|
||||
return $this->status;
|
||||
}
|
||||
public function get_bptid() {
|
||||
return $this->bptid;
|
||||
}
|
||||
public function get_corrected_street() {
|
||||
return $this->corrected_street;
|
||||
}
|
||||
public function get_corrected_street_no() {
|
||||
return $this->corrected_street_no;
|
||||
}
|
||||
public function get_corrected_zip() {
|
||||
return $this->corrected_zip;
|
||||
}
|
||||
public function get_corrected_city() {
|
||||
return $this->corrected_city;
|
||||
}
|
||||
public function get_corrected_country() {
|
||||
return $this->corrected_country;
|
||||
}
|
||||
public function get_account_holder() {
|
||||
return $this->account_holder;
|
||||
}
|
||||
public function get_account_number() {
|
||||
return $this->account_number;
|
||||
}
|
||||
public function get_bank_code() {
|
||||
return $this->bank_code;
|
||||
}
|
||||
public function get_bank_name() {
|
||||
return $this->bank_name;
|
||||
}
|
||||
public function get_invoice_reference() {
|
||||
return $this->invoice_reference;
|
||||
}
|
||||
public function get_invoice_duedate() {
|
||||
return $this->invoice_duedate;
|
||||
}
|
||||
public function get_standard_information_pdf() {
|
||||
return $this->standard_information_pdf;
|
||||
}
|
||||
public function get_email_attachment_pdf() {
|
||||
return $this->email_attachment_pdf;
|
||||
}
|
||||
public function get_payment_info_html() {
|
||||
return $this->payment_info_html;
|
||||
}
|
||||
public function get_payment_info_plain() {
|
||||
return $this->payment_info_plain;
|
||||
}
|
||||
|
||||
public function set_customer_details($customer_id, $customer_type, $salutation, $title,
|
||||
$first_name, $last_name, $street, $street_no, $address_addition, $zip,
|
||||
$city, $country, $email, $phone, $cell_phone, $birthday, $language, $ip, $customerGroup) {
|
||||
|
||||
$this->_customer_details['customerid'] = $customer_id;
|
||||
$this->_customer_details['customertype'] = $customer_type;
|
||||
$this->_customer_details['salutation'] = $salutation;
|
||||
$this->_customer_details['title'] = $title;
|
||||
$this->_customer_details['firstName'] = $first_name;
|
||||
$this->_customer_details['lastName'] = $last_name;
|
||||
$this->_customer_details['street'] = $street;
|
||||
$this->_customer_details['streetNo'] = $street_no;
|
||||
$this->_customer_details['addressAddition'] = $address_addition;
|
||||
$this->_customer_details['zip'] = $zip;
|
||||
$this->_customer_details['city'] = $city;
|
||||
$this->_customer_details['country'] = $country;
|
||||
$this->_customer_details['email'] = $email;
|
||||
$this->_customer_details['phone'] = $phone;
|
||||
$this->_customer_details['cellPhone'] = $cell_phone;
|
||||
$this->_customer_details['birthday'] = $birthday;
|
||||
$this->_customer_details['language'] = $language;
|
||||
$this->_customer_details['ip'] = $ip;
|
||||
$this->_customer_details['customerGroup'] = $customerGroup;
|
||||
}
|
||||
|
||||
|
||||
public function set_shipping_details($use_billing_address, $salutation=null, $title=null, $first_name=null, $last_name=null,
|
||||
$street=null, $street_no=null, $address_addition=null, $zip=null, $city=null, $country=null, $phone=null, $cell_phone=null) {
|
||||
|
||||
$this->_shippping_details['useBillingAddress'] = $use_billing_address ? '1' : '0';
|
||||
$this->_shippping_details['salutation'] = $salutation;
|
||||
$this->_shippping_details['title'] = $title;
|
||||
$this->_shippping_details['firstName'] = $first_name;
|
||||
$this->_shippping_details['lastName'] = $last_name;
|
||||
$this->_shippping_details['street'] = $street;
|
||||
$this->_shippping_details['streetNo'] = $street_no;
|
||||
$this->_shippping_details['addressAddition'] = $address_addition;
|
||||
$this->_shippping_details['zip'] = $zip;
|
||||
$this->_shippping_details['city'] = $city;
|
||||
$this->_shippping_details['country'] = $country;
|
||||
$this->_shippping_details['phone'] = $phone;
|
||||
$this->_shippping_details['cellPhone'] = $cell_phone;
|
||||
}
|
||||
|
||||
public function add_article($articleid, $articlequantity, $articlename, $articledescription,
|
||||
$article_price, $article_price_gross) {
|
||||
$article = array();
|
||||
$article['articleid'] = $articleid;
|
||||
$article['articlequantity'] = $articlequantity;
|
||||
$article['articlename'] = $articlename;
|
||||
$article['articledescription'] = $articledescription;
|
||||
$article['articleprice'] = $article_price;
|
||||
$article['articlepricegross'] = $article_price_gross;
|
||||
|
||||
$this->_article_data[] = $article;
|
||||
}
|
||||
|
||||
|
||||
public function add_order_history($horderid, $hdate, $hamount, $hcurrency, $hpaymenttype, $hstatus) {
|
||||
$histOrder = array();
|
||||
$histOrder['horderid'] = $horderid;
|
||||
$histOrder['hdate'] = $hdate;
|
||||
$histOrder['hamount'] = $hamount;
|
||||
$histOrder['hcurrency'] = $hcurrency;
|
||||
$histOrder['hpaymenttype'] = $hpaymenttype;
|
||||
$histOrder['hstatus'] = $hstatus;
|
||||
|
||||
$this->_order_history_data[] = $histOrder;
|
||||
}
|
||||
|
||||
|
||||
public function set_total($rebate, $rebate_gross, $shipping_name, $shipping_price,
|
||||
$shipping_price_gross, $cart_total_price, $cart_total_price_gross,
|
||||
$currency, $reference) {
|
||||
$this->_totals['shippingname'] = $shipping_name;
|
||||
$this->_totals['shippingprice'] = $shipping_price;
|
||||
$this->_totals['shippingpricegross'] = $shipping_price_gross;
|
||||
$this->_totals['rebate'] = $rebate;
|
||||
$this->_totals['rebategross'] = $rebate_gross;
|
||||
$this->_totals['carttotalprice'] = $cart_total_price;
|
||||
$this->_totals['carttotalpricegross'] = $cart_total_price_gross;
|
||||
$this->_totals['currency'] = $currency;
|
||||
$this->_totals['reference'] = $reference;
|
||||
}
|
||||
|
||||
public function set_bank_account($account_holder, $account_number, $sort_code) {
|
||||
$this->_bank_account['accountholder'] = $account_holder;
|
||||
$this->_bank_account['accountnumber'] = $account_number;
|
||||
$this->_bank_account['sortcode'] = $sort_code;
|
||||
}
|
||||
|
||||
public function set_company_details($name, $legalForm, $registerNumber, $holderName, $taxNumber) {
|
||||
$this->_company_details['name'] = $name;
|
||||
$this->_company_details['legalForm'] = $legalForm;
|
||||
$this->_company_details['registerNumber'] = $registerNumber;
|
||||
$this->_company_details['holderName'] = $holderName;
|
||||
$this->_company_details['taxNumber'] = $taxNumber;
|
||||
}
|
||||
|
||||
public function set_rate_request($rate_count, $total_amount) {
|
||||
$this->_rate_request_data['ratecount'] = $rate_count;
|
||||
$this->_rate_request_data['totalamount'] = $total_amount;
|
||||
}
|
||||
|
||||
public function set_payment_info_params($showhtmlinfo, $showplaininfo) {
|
||||
$this->_payment_info_params['htmlinfo'] = $showhtmlinfo ? "1" : "0";
|
||||
$this->_payment_info_params['plaininfo'] = $showplaininfo ? "1" : "0";
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
$attributes = array();
|
||||
$attributes['tcaccepted'] = $this->_terms_accepted;
|
||||
$attributes['expecteddaystillshipping'] = $this->_expected_days_till_shipping;
|
||||
$attributes['capturerequestnecessary'] = $this->_capture_request_necessary;
|
||||
$attributes['paymenttype'] = $this->_payment_type;
|
||||
|
||||
return ipl_core_send_preauthorize_request(
|
||||
$this->_ipl_request_url,
|
||||
$attributes,
|
||||
$this->_default_params,
|
||||
$this->_customer_details,
|
||||
$this->_shippping_details,
|
||||
$this->_bank_account,
|
||||
$this->_totals,
|
||||
$this->_article_data,
|
||||
$this->_order_history_data,
|
||||
$this->_rate_request_data,
|
||||
$this->_company_details,
|
||||
$this->_payment_info_params
|
||||
);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _process_error_response_xml($data) {
|
||||
if (key_exists('status', $data)) {
|
||||
$this->status = $data['status'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_update_order_request extends ipl_xml_request {
|
||||
|
||||
private $_update_params = array();
|
||||
private $_id_update_list = array();
|
||||
|
||||
public function set_update_params($bptid, $reference) {
|
||||
$this->_update_params['bptid'] = $bptid;
|
||||
$this->_update_params['reference'] = $reference;
|
||||
}
|
||||
|
||||
public function add_id_update($articleid, $updateid) {
|
||||
$idUpdate = array();
|
||||
|
||||
$idUpdate['articleid'] = $articleid;
|
||||
$idUpdate['updateid'] = $updateid;
|
||||
$this->_id_update_list[] = $idUpdate;
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
return ipl_core_send_update_order_request(
|
||||
$this->_ipl_request_url,
|
||||
$this->_default_params,
|
||||
$this->_update_params,
|
||||
$this->_id_update_list
|
||||
);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/ipl_xml_request.php');
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_validation_request extends ipl_xml_request {
|
||||
|
||||
private $_customer_details = array();
|
||||
private $_shippping_details = array();
|
||||
|
||||
public function set_customer_details($customer_id, $customer_type, $salutation, $title,
|
||||
$first_name, $last_name, $street, $street_no, $address_addition, $zip,
|
||||
$city, $country, $email, $phone, $cell_phone, $birthday, $language, $ip) {
|
||||
|
||||
$this->_customer_details['customerid'] = $customer_id;
|
||||
$this->_customer_details['customertype'] = $customer_type;
|
||||
$this->_customer_details['salutation'] = $salutation;
|
||||
$this->_customer_details['title'] = $title;
|
||||
$this->_customer_details['firstName'] = $first_name;
|
||||
$this->_customer_details['lastName'] = $last_name;
|
||||
$this->_customer_details['street'] = $street;
|
||||
$this->_customer_details['streetNo'] = $street_no;
|
||||
$this->_customer_details['addressAddition'] = $address_addition;
|
||||
$this->_customer_details['zip'] = $zip;
|
||||
$this->_customer_details['city'] = $city;
|
||||
$this->_customer_details['country'] = $country;
|
||||
$this->_customer_details['email'] = $email;
|
||||
$this->_customer_details['phone'] = $phone;
|
||||
$this->_customer_details['cellPhone'] = $cell_phone;
|
||||
$this->_customer_details['birthday'] = $birthday;
|
||||
$this->_customer_details['language'] = $language;
|
||||
$this->_customer_details['ip'] = $ip;
|
||||
}
|
||||
|
||||
|
||||
public function set_shipping_details($use_billing_address, $salutation=null, $title=null, $first_name=null, $last_name=null,
|
||||
$street=null, $street_no=null, $address_addition=null, $zip=null, $city=null, $country=null, $phone=null, $cell_phone=null) {
|
||||
|
||||
$this->_shippping_details['useBillingAddress'] = $use_billing_address ? '1' : '0';
|
||||
$this->_shippping_details['salutation'] = $salutation;
|
||||
$this->_shippping_details['title'] = $title;
|
||||
$this->_shippping_details['firstName'] = $first_name;
|
||||
$this->_shippping_details['lastName'] = $last_name;
|
||||
$this->_shippping_details['street'] = $street;
|
||||
$this->_shippping_details['streetNo'] = $street_no;
|
||||
$this->_shippping_details['addressAddition'] = $address_addition;
|
||||
$this->_shippping_details['zip'] = $zip;
|
||||
$this->_shippping_details['city'] = $city;
|
||||
$this->_shippping_details['country'] = $country;
|
||||
$this->_shippping_details['phone'] = $phone;
|
||||
$this->_shippping_details['cellPhone'] = $cell_phone;
|
||||
}
|
||||
|
||||
protected function _send() {
|
||||
return ipl_core_send_validation_request($this->_ipl_request_url, $this->_default_params, $this->_customer_details, $this->_shippping_details);
|
||||
}
|
||||
|
||||
protected function _process_response_xml($data) {
|
||||
// Nothing to do here
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @author Jan Wehrs (jan.wehrs@billpay.de)
|
||||
* @copyright Copyright 2010 Billpay GmbH
|
||||
* @license commercial
|
||||
*/
|
||||
class ipl_xml_request {
|
||||
|
||||
private $request_xml = '';
|
||||
private $response_xml = '';
|
||||
|
||||
protected $_ipl_request_url = '';
|
||||
protected $_default_params = array();
|
||||
protected $_status_info = array();
|
||||
|
||||
private $_username;
|
||||
private $_password;
|
||||
|
||||
|
||||
public function has_error() {
|
||||
return $this->_status_info['error_code'] > 0;
|
||||
}
|
||||
|
||||
public function get_error_code() {
|
||||
return $this->_status_info['error_code'];
|
||||
}
|
||||
|
||||
public function get_customer_error_message() {
|
||||
return $this->_status_info['customer_message'];
|
||||
}
|
||||
|
||||
public function get_merchant_error_message() {
|
||||
return $this->_status_info['merchant_message'];
|
||||
}
|
||||
|
||||
public function get_request_xml() {
|
||||
return $this->request_xml;
|
||||
}
|
||||
|
||||
public function get_response_xml() {
|
||||
return $this->response_xml;
|
||||
}
|
||||
|
||||
function __construct($ipl_request_url) {
|
||||
$this->_ipl_request_url = $ipl_request_url;
|
||||
}
|
||||
|
||||
public function set_default_params($mid, $pid, $bpsecure) {
|
||||
$this->_default_params['mid'] = $mid;
|
||||
$this->_default_params['pid'] = $pid;
|
||||
$this->_default_params['bpsecure'] = $bpsecure;
|
||||
}
|
||||
|
||||
public function set_basic_auth_params($username, $password) {
|
||||
$this->_username = $username;
|
||||
$this->_password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* This must be overridden in deriving class
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
protected function _send() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This must be overridden in deriving class
|
||||
* @return unknown
|
||||
*/
|
||||
protected function _process_response_xml($data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This must be overridden in deriving class
|
||||
* @return unknown
|
||||
*/
|
||||
protected function _process_error_response_xml($data) {
|
||||
}
|
||||
|
||||
|
||||
public function send() {
|
||||
$res = $this->_send();
|
||||
|
||||
if (!$res || ipl_core_has_internal_error()) {
|
||||
$errorMsg = ipl_core_get_internal_error_msg();
|
||||
|
||||
if (!empty($errorMsg)) {
|
||||
throw new Exception($errorMsg);
|
||||
}
|
||||
else {
|
||||
throw new Exception('Internal error with unkown cause occured.');
|
||||
}
|
||||
}
|
||||
|
||||
// Get status info data structure
|
||||
$this->_status_info = ipl_core_get_api_error_info();
|
||||
|
||||
$this->request_xml = $res[0];
|
||||
$this->response_xml = $res[1];
|
||||
|
||||
if (!ipl_core_has_api_error()) {
|
||||
$this->_process_response_xml($res[2]);
|
||||
}
|
||||
else {
|
||||
$this->_process_error_response_xml($res[2]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user