Initial import: Carteasy Shop (Dev-Stand)

This commit is contained in:
Thomas Bartelt
2026-04-20 01:03:43 +02:00
commit d504f8a05d
3845 changed files with 761050 additions and 0 deletions
+156
View File
@@ -0,0 +1,156 @@
version 1.5.3
- edit cart content request implemented
version 1.5.2
- sample application extended -> start from index.php
- samples according to new data validation rules
version 1.5.1
- do not create empty tags
version 1.5.0
- new parameters for b2b added
version 1.4.0
- added support for parsing of html/plain text payment infos
- aggregate data in module config
- removed TERMS_AND_CONDITION_URL var from ipl_xml_request class
- added locale to module config, partial cancel and calculate rates
version 1.3.6
- support auto-capture for transaction credit
version 1.3.5
- bug fix: wrong order of pdf documents fixed
version 1.3.4
- b2b module config extension
version 1.3.3
- bug fix: parsing of pdf documents added
- sample api url base corrected
version 1.3.2
- removed parameter 'ratecount' for request 'calculateRates'
version 1.3.1
- handle curl errors with curl_error
- reference parameter re-added to preauth request (to be used for auto-capture)
version 1.3.0
- rebate/rebategross parameters re-added for preauthorize request
- shippingdecrease/shippingdecreasegross parameters added
- partial cancel for transaction credit implemented
version 1.2.6
- process activation_performed flag
version 1.2.5
- B2B implemented
version 1.2.1
- update of article ids implemented
version 1.1.9
- rebate/rebategross removed from preauth. send aggregated value in shipping/shippinggross fields from now on
version 1.1.8b
- use absolute path for include of ipl_xml_request in order to prevent failure due to open_basedir restriction
- server side minimum order values implemented
- bug fix: php4/ipl_module_config_request contained php5 specific code
- dues are returned with invoiceCreated response
version 1.1.8a
- module config request extended for hire purchase
- preauth request extended for rate payment (php4/php5)
- calculateRates request and samples for php4/php5 added
version 1.1.7
- invoice parameter 'delayindays' added
- connection timeout increased for socket and curl connections
version 1.1.6
- sample for update order request added
- support for php4 added (test with PHP 4.3.3)
- xmlParser lib added
- core lib code extracted (-> ipl_xml_api.php)
version 1.1.5
- auto capture for preauth request implemented
version 1.1.4
- capture_request_necessary parameter for preauth request added
- payment type parameter has no default value any more
version 1.1.3
- module config extended: provide static limit per payment method
- payment type constants added
version 1.1.2
- additional parameters added for module config (DARF ERST MIT API-VERSION 1.1.1 FREIGEGEBEN WERDEN)
version 1.1.1
- trim request url in order to avoid 404 if trailing whitespace is present
version 1.1.0
- new api call: update order
version 1.0.0
- major version increased
- made lib elv ready. payment type and bank account added. fully backwards compatible
version 0.2.3
- issue with CURLOPT_FOLLOWLOCATION fixed
current version 0.2.2
- parameter rebategross added to interface
version 0.2.1
- interface changed. rebatedescrease gross added
- check http status code and throw exception if != 200
- exception handling for url parsing added
version: 0.2.0
- use curl for http messaging (new system requirement!)
version: 0.1.5
- new request ipl_invoice_created_request added
version: 0.1.4
- new request ipl_module_config_request in order to fetch modul/shop-specific parameters such as static limit
version 0.1.3
File diff suppressed because it is too large Load Diff
@@ -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 {
var $_rate_params = array();
var $options;
var $_locale = array();
function get_options() {
return $this->options;
}
function set_rate_request_params($baseamount, $carttotalgross) {
$this->_rate_params['baseamount'] = $baseamount;
$this->_rate_params['carttotalgross'] = $carttotalgross;
}
function set_locale($country, $currency, $language) {
$this->_locale['country'] = $country;
$this->_locale['currency'] = $currency;
$this->_locale['language'] = $language;
}
function _send() {
return ipl_core_send_calculate_rates_request(
$this->_ipl_request_url,
$this->_default_params,
$this->_rate_params,
$this->_locale
);
}
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 {
var $_cancel_params = array();
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;
}
function _send() {
return ipl_core_send_cancel_request($this->_ipl_request_url, $this->_default_params, $this->_cancel_params);
}
function _process_response_xml($data) {
}
}
?>
@@ -0,0 +1,83 @@
<?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 {
var $_capture_params = array();
// bank account
var $account_holder;
var $account_number;
var $bank_code;
var $bank_name;
var $invoice_reference;
var $invoice_duedate;
var $standard_information_pdf;
var $email_attachment_pdf;
var $payment_info_html;
var $payment_info_plain;
function get_account_holder() {
return $this->account_holder;
}
function get_account_number() {
return $this->account_number;
}
function get_bank_code() {
return $this->bank_code;
}
function get_bank_name() {
return $this->bank_name;
}
function get_invoice_reference() {
return $this->invoice_reference;
}
function get_invoice_duedate() {
return $this->invoice_duedate;
}
function get_standard_information_pdf() {
return $this->standard_information_pdf;
}
function get_email_attachment_pdf() {
return $this->email_attachment_pdf;
}
function get_payment_info_html() {
return $this->payment_info_html;
}
function get_payment_info_plain() {
return $this->payment_info_plain;
}
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;
}
function set_payment_info_params($showhtmlinfo, $showplaininfo) {
$this->_payment_info_params['htmlinfo'] = $showhtmlinfo ? "1" : "0";
$this->_payment_info_params['plaininfo'] = $showplaininfo ? "1" : "0";
}
function _send() {
return ipl_core_send_capture_request($this->_ipl_request_url, $this->_default_params, $this->_capture_params, $this->_payment_info_params);
}
function _process_response_xml($data) {
foreach ($data as $key => $value) {
$this->$key = $value;
}
}
}
?>
@@ -0,0 +1,82 @@
<?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 {
var $_totals = array();
var $_article_data = array();
var $due_update;
var $number_of_rates;
function get_due_update() {
return $this->due_update;
}
function get_number_of_rates() {
return $this->number_of_rates;
}
// ctr
function ipl_edit_cart_content_request($ipl_request_url) {
parent::ipl_xml_request($ipl_request_url);
}
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;
}
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;
}
function _send() {
$attributes = array();
return ipl_core_send_edit_cart_content_request(
$this->_ipl_request_url,
$this->_default_params,
$this->_totals,
$this->_article_data
);
}
function _process_response_xml($data) {
foreach ($data as $key => $value) {
$this->$key = $value;
}
}
function _process_error_response_xml($data) {
if (key_exists('status', $data)) {
$this->status = $data['status'];
}
}
}
?>
@@ -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_invoice_created_request extends ipl_xml_request {
var $_invoice_params = array();
// bank account
var $account_holder;
var $account_number;
var $bank_code;
var $bank_name;
var $invoice_reference;
var $invoice_duedate;
var $activation_performed;
var $payment_info_html;
var $payment_info_plain;
var $dues;
function get_account_holder() {
return $this->account_holder;
}
function get_account_number() {
return $this->account_number;
}
function get_bank_code() {
return $this->bank_code;
}
function get_bank_name() {
return $this->bank_name;
}
function get_invoice_reference() {
return $this->invoice_reference;
}
function get_invoice_duedate() {
return $this->invoice_duedate;
}
function get_activation_performed() {
return $this->activation_performed;
}
function get_payment_info_html() {
return $this->payment_info_html;
}
function get_payment_info_plain() {
return $this->payment_info_plain;
}
function get_dues() {
return $this->dues;
}
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;
}
function set_payment_info_params($showhtmlinfo, $showplaininfo) {
$this->_payment_info_params['htmlinfo'] = $showhtmlinfo ? "1" : "0";
$this->_payment_info_params['plaininfo'] = $showplaininfo ? "1" : "0";
}
function _send() {
return ipl_core_send_invoice_request($this->_ipl_request_url, $this->_default_params, $this->_invoice_params, $this->_payment_info_params);
}
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 {
var $invoicestatic = 0;
var $directdebitstatic = 0;
var $hirepurchasestatic = 0;
var $invoicebusinessstatic = 0;
var $invoicemin = 0;
var $directdebitmin = 0;
var $hirepurchasemin = 0;
var $invoicebusinessmin = 0;
var $active = false;
var $invoiceallowed = false;
var $directdebitallowed = false;
var $hirepurchaseallowed = false;
var $invoicebusinessallowed = false;
var $terms = array();
var $_locale = array();
function is_active() {
return $this->active;
}
function is_invoice_allowed() {
return $this->invoiceallowed;
}
function is_invoicebusiness_allowed() {
return $this->invoicebusinessallowed;
}
function is_direct_debit_allowed() {
return $this->directdebitallowed;
}
function is_hire_purchase_allowed() {
return $this->hirepurchaseallowed;
}
function get_invoice_min_value() {
return $this->invoicemin;
}
function get_invoicebusiness_min_value() {
return $this->invoicebusinessmin;
}
function get_direct_debit_min_value() {
return $this->directdebitmin;
}
function get_hire_purchase_min_value() {
return $this->hirepurchasemin;
}
function get_static_limit_invoice() {
return $this->invoicestatic;
}
function get_static_limit_invoicebusiness() {
return $this->invoicebusinessstatic;
}
function get_static_limit_direct_debit() {
return $this->directdebitstatic;
}
function get_static_limit_hire_purchase() {
return $this->hirepurchasestatic;
}
function get_terms() {
return $this->terms;
}
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()
);
}
function _process_response_xml($data) {
foreach ($data as $key => $value) {
$this->$key = $value;
}
}
function set_locale($country, $currency, $language) {
$this->_locale['country'] = $country;
$this->_locale['currency'] = $currency;
$this->_locale['language'] = $language;
}
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 {
var $_cancel_params = array();
var $_canceled_articles = array();
var $due_update;
var $number_of_rates;
function is_transaction_credit_order() {
return $this->due_update;
}
function get_due_update() {
return $this->due_update;
}
function get_number_of_rates() {
return $this->number_of_rates;
}
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;
}
function add_canceled_article($articleid, $articlequantity) {
$article = array();
$article['articleid'] = $articleid;
$article['articlequantity'] = $articlequantity;
$this->_canceled_articles[] = $article;
}
function _send() {
return ipl_core_send_partialcancel_request(
$this->_ipl_request_url,
$this->_default_params,
$this->_cancel_params,
$this->_canceled_articles
);
}
function _process_response_xml($data) {
foreach ($data as $key => $value) {
$this->$key = $value;
}
}
}
?>
@@ -0,0 +1,276 @@
<?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 {
var $_customer_details = array();
var $_shippping_details = array();
var $_totals = array();
var $_bank_account = array();
var $_rate_request_data = array();
var $_article_data = array();
var $_order_history_data = array();
var $_company_details = array();
var $_payment_type;
var $status;
var $bptid;
var $corrected_street;
var $corrected_street_no;
var $corrected_zip;
var $corrected_city;
var $corrected_country;
// parameters needed for auto-capture
var $account_holder;
var $account_number;
var $bank_code;
var $bank_name;
var $invoice_reference;
var $invoice_duedate;
var $_terms_accepted = false;
var $_capture_request_necessary = true;
var $_expected_days_till_shipping = 0;
var $standard_information_pdf;
var $email_attachment_pdf;
var $payment_info_html;
var $payment_info_plain;
// ctr
function ipl_preauthorize_request($ipl_request_url, $payment_type) {
$this->_payment_type = $payment_type;
parent::ipl_xml_request($ipl_request_url);
}
function get_terms_accepted() {
return $this->_terms_accepted;
}
function set_terms_accepted($val) {
$this->_terms_accepted = $val;
}
function set_expected_days_till_shipping($val) {
$this->_expected_days_till_shipping = $val;
}
function set_capture_request_necessary($val) {
$this->_capture_request_necessary = $val;
}
function get_expected_days_till_shipping() {
return $this->_expected_days_till_shipping;
}
function get_capture_request_nesessary() {
return $this->_capture_request_necessary;
}
function get_payment_type() {
return $this->_payment_type;
}
function get_status() {
return $this->status;
}
function get_bptid() {
return $this->bptid;
}
function get_corrected_street() {
return $this->corrected_street;
}
function get_corrected_street_no() {
return $this->corrected_street_no;
}
function get_corrected_zip() {
return $this->corrected_zip;
}
function get_corrected_city() {
return $this->corrected_city;
}
function get_corrected_country() {
return $this->corrected_country;
}
function get_account_holder() {
return $this->account_holder;
}
function get_account_number() {
return $this->account_number;
}
function get_bank_code() {
return $this->bank_code;
}
function get_bank_name() {
return $this->bank_name;
}
function get_invoice_reference() {
return $this->invoice_reference;
}
function get_invoice_duedate() {
return $this->invoice_duedate;
}
function get_standard_information_pdf() {
return $this->standard_information_pdf;
}
function get_email_attachment_pdf() {
return $this->email_attachment_pdf;
}
function get_payment_info_html() {
return $this->payment_info_html;
}
function get_payment_info_plain() {
return $this->payment_info_plain;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
function set_rate_request($rate_count, $total_amount) {
$this->_rate_request_data['ratecount'] = $rate_count;
$this->_rate_request_data['totalamount'] = $total_amount;
}
function set_payment_info_params($showhtmlinfo, $showplaininfo) {
$this->_payment_info_params['htmlinfo'] = $showhtmlinfo ? "1" : "0";
$this->_payment_info_params['plaininfo'] = $showplaininfo ? "1" : "0";
}
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
);
}
function _process_response_xml($data) {
foreach ($data as $key => $value) {
$this->$key = $value;
}
}
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 {
var $_update_params = array();
var $_id_update_list = array();
function add_id_update($articleid, $updateid) {
$idUpdate = array();
$idUpdate['articleid'] = $articleid;
$idUpdate['updateid'] = $updateid;
$this->_id_update_list[] = $idUpdate;
}
function set_update_params($bptid, $reference) {
$this->_update_params['bptid'] = $bptid;
$this->_update_params['reference'] = $reference;
}
function _send() {
return ipl_core_send_update_order_request(
$this->_ipl_request_url,
$this->_default_params,
$this->_update_params,
$this->_id_update_list
);
}
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 {
var $_customer_details = array();
var $_shippping_details = array();
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;
}
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;
}
function _send() {
return ipl_core_send_validation_request($this->_ipl_request_url, $this->_default_params, $this->_customer_details, $this->_shippping_details);
}
function _process_response_xml($data) {
// Nothing to do here
}
}
?>
+110
View File
@@ -0,0 +1,110 @@
<?php
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
class ipl_xml_request {
var $request_xml = '';
var $response_xml = '';
var $_ipl_request_url = '';
var $_default_params = array();
var $_status_info = array();
var $_username;
var $_password;
function has_error() {
return $this->_status_info['error_code'] > 0;
}
function get_error_code() {
return $this->_status_info['error_code'];
}
function get_customer_error_message() {
return $this->_status_info['customer_message'];
}
function get_merchant_error_message() {
return $this->_status_info['merchant_message'];
}
function get_request_xml() {
return $this->request_xml;
}
function get_response_xml() {
return $this->response_xml;
}
function ipl_xml_request($ipl_request_url) {
$this->_ipl_request_url = $ipl_request_url;
}
function set_default_params($mid, $pid, $bpsecure) {
$this->_default_params['mid'] = $mid;
$this->_default_params['pid'] = $pid;
$this->_default_params['bpsecure'] = $bpsecure;
}
function set_basic_auth_params($username, $password) {
$this->_username = $username;
$this->_password = $password;
}
/**
* This must be overridden in deriving class
*
* @return unknown
*/
function _send() {
return false;
}
/**
* This must be overridden in deriving class
* @return unknown
*/
function _process_response_xml($data) {
}
/**
* This must be overridden in deriving class
* @return unknown
*/
function _process_error_response_xml($data) {
}
function get_internal_error_msg() {
return ipl_core_get_internal_error_msg();
}
function send() {
$res = $this->_send();
if (!$res || ipl_core_has_internal_error()) {
return array('error_code' => ipl_core_get_internal_error(),
'error_message' => ipl_core_get_internal_error_msg());
}
// 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]);
}
}
}
?>
@@ -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
}
}
?>
+113
View File
@@ -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]);
}
}
}
?>