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]);
}
}
}
?>
+43
View File
@@ -0,0 +1,43 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_cancel_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_cancel_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_cancel_params($ref, 27455, "EUR");
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Cancel successful<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
+57
View File
@@ -0,0 +1,57 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_capture_request.php';
// This is the transaction ID obtained from the preauthorization response
$tx_id = $_GET["tx_id"];
// The order ID must be unique -> generate a random number for this example
$orderReference = rand(1, 15000000000);
$req = new ipl_capture_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_capture_params($tx_id, 27455, "EUR", $orderReference, "12345612");
$req->set_payment_info_params(true, true);
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if (!$req->has_error()) {
echo "Account holder: " . $req->get_account_holder() . "<br />";
echo "Account number: " . $req->get_account_number() . "<br />";
echo "Bank code: " . $req->get_bank_code() . "<br />";
echo "Bank name: " . $req->get_bank_name() . "<br />";
echo "Invoice reference: " . $req->get_invoice_reference() . "<br />";
echo "<input type=\"button\" value=\"Update order\" onclick=\"window.location.href='updateorder.php?tx_id=$tx_id&ref=$orderReference'\" />";
echo "<input type=\"button\" value=\"Invoice\" onclick=\"window.location.href='invoicecreated.php?ref=$orderReference'\" />";
echo "<input type=\"button\" value=\"Edit cart content\" onclick=\"window.location.href='edit.php?ref=$orderReference'\" />";
echo "<input type=\"button\" value=\"Full cancel\" onclick=\"window.location.href='cancel.php?ref=$orderReference'\" />";
}
else {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
+44
View File
@@ -0,0 +1,44 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_edit_cart_content_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_edit_cart_content_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_total(500, 595, "Express-Versand", 500, 650, 5300, 7905, "EUR", $ref);
$req->add_article("article003", 3, "Kaffetasse 07/11", "", 1200, 1950);
$req->add_article("article004", 2, "Kuchenteller 007", "", 850, 1000);
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Edit cart content successful<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
+61
View File
@@ -0,0 +1,61 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
$validateError = (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') && (
empty($_POST['api-url-base']) || empty($_POST['mid']) ||
empty($_POST['pid']) || empty($_POST['security-key']));
if ($validateError == false) {
$_SESSION['api-url-base'] = $_POST['api-url-base'];
$_SESSION['mid'] = $_POST['mid'];
$_SESSION['pid'] = $_POST['pid'];
$_SESSION['security-key'] = $_POST['md5'] ? $_POST['security-key'] : md5($_POST['security-key']);
}
if (empty($_SESSION['api-url-base']) || empty($_SESSION['mid']) || empty($_SESSION['pid']) || empty($_SESSION)) {
echo "Please insert your credentials that you received from Billpay:<br/>";
echo "<form method='POST'>";
echo "<table><tr>";
echo "<td>API Url Base</td><td><input type='text' name='api-url-base' style='width:250px' value='https://test-api.billpay.de/xml/offline' /></td>";
echo "</tr><tr>";
echo "<td>Merchant ID</td><td><input type='text' name='mid' style='width:50px' /></td>";
echo "</tr><tr>";
echo "<td>Portal ID</td><td><input type='text' name='pid' style='width:50px' /></td>";
echo "</tr><tr>";
echo "<td>Security Key</td><td><input type='text' name='security-key' />";
echo "<div><input type='radio' name='md5' value='0' checked /> Plain <input type='radio' name='md5' value='1' /> MD5 </div> </td>";
echo "</tr></table>";
if ($validateError) {
echo "<span style='color:red; font-weight:bold'>Please provide values for all fields</span><br />";
}
echo "<input type='submit' />";
echo "</form>";
}
else {
$startPage = 'preauth.php';
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if (!strstr($url, 'index.php')) {
$rev = strrev($url);
if ($rev[0] != '/') {
$url .= '/';
}
$url .= $startPage;
}
else {
$url = str_replace('index.php', $startPage, $url);
}
header ("HTTP/1.1 303 See other");
header ("Location: $url");
exit();
}
?>
@@ -0,0 +1,62 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_invoice_created_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_invoice_created_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_invoice_params(27455, "EUR", $ref, 5);
$req->set_payment_info_params(true, true);
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if (!$req->has_error()) {
echo "Account holder: " . $req->get_account_holder() . "<br />";
echo "Account number: " . $req->get_account_number() . "<br />";
echo "Bank code: " . $req->get_bank_code() . "<br />";
echo "Bank name: " . $req->get_bank_name() . "<br />";
echo "Invoice reference: " . $req->get_invoice_reference() . "<br />";
echo "Invoice due date: " . $req->get_invoice_duedate() . "<br />";
echo "Activation performed: " . ($req->get_activation_performed() ? "Yes" : "No") . "<br />";
if (count($req->get_dues()) > 0) {
echo "Hire purchase payment:<br />";
$pos = 0;
foreach ($req->get_dues() as $due) {
echo (++$pos).") date: ".$due['date'].", amount: ".$due['value']."<br />";
}
}
echo "<input type=\"button\" value=\"Edit cart content\" onclick=\"window.location.href='edit.php?ref=" . $ref . "'\" />";
echo "<input type=\"button\" value=\"Full cancel\" onclick=\"window.location.href='cancel.php?ref=" . $ref . "'\" />";
}
else {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
@@ -0,0 +1,50 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_module_config_request.php';
$req = new ipl_module_config_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_locale("DEU", "EUR", "de");
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Module config request successful<br />";
echo "Direct debit allowed: " . $req->is_direct_debit_allowed() . "<br />";
echo "Invoice allowed: " . $req->is_invoice_allowed() . "<br />";
echo "Invoice business allowed: " . $req->is_invoicebusiness_allowed() . "<br />";
echo "Limit direct debit: " . $req->get_static_limit_direct_debit() . "<br />";
echo "Limit invoice: " . $req->get_static_limit_invoice() . "<br />";
echo "Limit hire purchase: " . $req->get_static_limit_hire_purchase() . "<br />";
echo "Min value direct debit: " . $req->get_direct_debit_min_value() . "<br />";
echo "Min value invoice: " . $req->get_invoice_min_value() . "<br />";
echo "Min value hire purchase: " . $req->get_hire_purchase_min_value() . "<br />";
echo "Available terms: " . implode(", ", $req->get_terms());
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
@@ -0,0 +1,48 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_partialcancel_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_partialcancel_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_cancel_params($ref, 0, 0, 0, 0, "EUR");
$req->add_canceled_article("article001", 1);
$req->add_canceled_article("article002", 1);
if ($req->is_transaction_credit_order()) {
print_r($req->get_due_update());
}
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Partial cancel successful<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
+67
View File
@@ -0,0 +1,67 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_preauthorize_request.php';
// Generate a random suffix to create unique customer
$randSuffix = rand(1, 15000000000);
$req = new ipl_preauthorize_request($_SESSION['api-url-base'], IPL_CORE_PAYMENT_TYPE_INVOICE);
// UN-COMMENT THIS FOR A DIRECT DEBIT REQUEST
//$req = new ipl_preauthorize_request($_SESSION['api-url-base'], IPL_CORE_PAYMENT_TYPE_DIRECT_DEBIT);
// UN-COMMENT THIS FOR A RATE PAYMENT REQUEST
//$req = new ipl_preauthorize_request($_SESSION['api-url-base'], IPL_CORE_PAYMENT_TYPE_RATE_PAYMENT);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_customer_details("123456", "e", "Herr", "", "Herbert $randSuffix", "Billpay $randSuffix",
"Teststrasse $randSuffix", "123", "", "12345", "Teststadt $randSuffix", "DEU", "testing@billpay.de",
"0302333459", "01775112389", "19850911", "de", "85.214.7.23", "p");
$req->set_shipping_details(true);
// UN-COMMENT THIS FOR A DIRECT DEBIT REQUEST OR RATE PAYMENT
//$req->set_bank_account("Herbert_$randSuffix Tester_$randSuffix", "4973024088", "10050000");
// UN-COMMENT THIS FOR A RATE PAYMENT REQUEST
//$req->set_rate_request(6, 28599);
$req->set_total(500, 595, "Express-Versand", 500, 650, 17800, 27455, "EUR", "");
$req->add_article("article001", 12, "Kaffetasse 08/15", "Eine Kaffetasse aus Porzellan", 1200, 1950);
$req->add_article("article002", 4, "Kuchenteller 07-11", "Kuchenteller - weiss", 850, 1000);
$req->add_order_history("1233343321", "20080101 10:23:30", 12300, "EUR", 4, 0);
$req->set_terms_accepted(true);
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
}
echo "Status: " . $req->get_status() . "<br />";
if (!$req->has_error()) {
echo "TX ID: " . $req->get_bptid() . "<br />";
echo "<input type=\"button\" value=\"Capture\" onclick=\"window.location.href='capture.php?tx_id=" . $req->get_bptid() . "'\" />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
+48
View File
@@ -0,0 +1,48 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_calculate_rates_request.php';
$req = new ipl_calculate_rates_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_rate_request_params(26805, 27455);
$req->set_locale("DEU", "EUR", "de");
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
}
else {
echo 'Response data:<br />';
echo '<pre>';
print_r($req->get_options());
echo '</pre>';
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
}
?>
+62
View File
@@ -0,0 +1,62 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*
* This request should be used in case the merchant-side unique order ID for
* the order is only known AFTER the capture request has already been sent.
* In this case the billpay transation id (tx_id) that is obtained from the
* result of the preauthorize request should be used as a "temporary order id" in
* the capture request. The update order request should be sent after the order
* is created and therefor the order id is known.
*
* Please note that it is absolutely necessary that no user action takes place
* between the capture request and the update order request!
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/ipl_update_order_request.php';
// This is the order reference from the capture request
$tx_id = $_GET["tx_id"];
$ref = $_GET["ref"];
$refUpdated = $ref . '_foo';
// The order ID must be unique -> generate a random number for this example
$orderReference = rand(1, 15000000000);
$req = new ipl_update_order_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_update_params($tx_id, $refUpdated);
$req->add_id_update("article001", "article001_mod");
$req->add_id_update("article002", "article002_mod");
$internalError = $req->send();
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if (!$req->has_error()) {
echo "Update order successful!<br />";
echo "<input type=\"button\" value=\"Invoice\" onclick=\"window.location.href='invoicecreated.php?ref=$refUpdated'\" />";
}
else {
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
+40
View File
@@ -0,0 +1,40 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php4/api/ipl_validation_request.php';
$req = new ipl_validation_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_customer_details("123456", "e", "Herr", "", "Tamlin", "Wallder",
"Wanderweg", "6", "", "24857", "Borgwedel",
"DEU", "demo@billpay.de", "0302333459", "01775112389",
"19850911", "de", "85.214.7.22");
$req->set_shipping_details(true);
if ($internalError) {
echo "Internal error occured!<br />";
echo "Error code: " . $internalError['error_code'] . "<br />";
echo "Error message: " . $internalError['error_message'];
}
else {
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
?>
+41
View File
@@ -0,0 +1,41 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_cancel_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_cancel_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_cancel_params($ref, 27455, "EUR");
try {
$req->send();
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Cancel successful<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
+55
View File
@@ -0,0 +1,55 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_capture_request.php';
// This is the transaction ID obtained from the preauthorization response
$tx_id = $_GET["tx_id"];
// The order ID must be unique -> generate a random number for this example
$orderReference = rand(1, 15000000000);
$req = new ipl_capture_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_capture_params($tx_id, 27455, "EUR", $orderReference, "12345612");
$req->set_payment_info_params(true, true);
try {
$req->send();
if (!$req->has_error()) {
echo "Account holder: " . $req->get_account_holder() . "<br />";
echo "Account number: " . $req->get_account_number() . "<br />";
echo "Bank code: " . $req->get_bank_code() . "<br />";
echo "Bank name: " . $req->get_bank_name() . "<br />";
echo "Invoice reference: " . $req->get_invoice_reference() . "<br />";
echo "<input type=\"button\" value=\"Update order\" onclick=\"window.location.href='updateorder.php?tx_id=$tx_id&ref=$orderReference'\" />";
echo "<input type=\"button\" value=\"Invoice\" onclick=\"window.location.href='invoicecreated.php?ref=$orderReference'\" />";
echo "<input type=\"button\" value=\"Edit cart content\" onclick=\"window.location.href='edit.php?ref=$orderReference'\" />";
echo "<input type=\"button\" value=\"Full cancel\" onclick=\"window.location.href='cancel.php?ref=$orderReference'\" />";
}
else {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
+42
View File
@@ -0,0 +1,42 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_edit_cart_content_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_edit_cart_content_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_total(500, 595, "Express-Versand", 500, 650, 5300, 7905, "EUR", $ref);
$req->add_article("article003", 3, "Kaffetasse 07/11", "", 1200, 1950);
$req->add_article("article004", 2, "Kuchenteller 007", "", 850, 1000);
try {
$req->send();
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Edit cart content successful<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
+61
View File
@@ -0,0 +1,61 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
$validateError = (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') && (
empty($_POST['api-url-base']) || empty($_POST['mid']) ||
empty($_POST['pid']) || empty($_POST['security-key']));
if ($validateError == false) {
$_SESSION['api-url-base'] = $_POST['api-url-base'];
$_SESSION['mid'] = $_POST['mid'];
$_SESSION['pid'] = $_POST['pid'];
$_SESSION['security-key'] = $_POST['md5'] ? $_POST['security-key'] : md5($_POST['security-key']);
}
if (empty($_SESSION['api-url-base']) || empty($_SESSION['mid']) || empty($_SESSION['pid']) || empty($_SESSION)) {
echo "Please insert your credentials that you received from Billpay:<br/>";
echo "<form method='POST'>";
echo "<table><tr>";
echo "<td>API Url Base</td><td><input type='text' name='api-url-base' style='width:250px' value='https://test-api.billpay.de/xml/offline' /></td>";
echo "</tr><tr>";
echo "<td>Merchant ID</td><td><input type='text' name='mid' style='width:50px' /></td>";
echo "</tr><tr>";
echo "<td>Portal ID</td><td><input type='text' name='pid' style='width:50px' /></td>";
echo "</tr><tr>";
echo "<td>Security Key</td><td><input type='text' name='security-key' />";
echo "<div><input type='radio' name='md5' value='0' checked /> Plain <input type='radio' name='md5' value='1' /> MD5 </div> </td>";
echo "</tr></table>";
if ($validateError) {
echo "<span style='color:red; font-weight:bold'>Please provide values for all fields</span><br />";
}
echo "<input type='submit' />";
echo "</form>";
}
else {
$startPage = 'preauth.php';
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if (!strstr($url, 'index.php')) {
$rev = strrev($url);
if ($rev[0] != '/') {
$url .= '/';
}
$url .= $startPage;
}
else {
$url = str_replace('index.php', $startPage, $url);
}
header ("HTTP/1.1 303 See other");
header ("Location: $url");
exit();
}
?>
@@ -0,0 +1,59 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_invoice_created_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_invoice_created_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_invoice_params(27455, "EUR", $ref, 5);
$req->set_payment_info_params(true, true);
try {
$req->send();
if (!$req->has_error()) {
echo "Account holder: " . $req->get_account_holder() . "<br />";
echo "Account number: " . $req->get_account_number() . "<br />";
echo "Bank code: " . $req->get_bank_code() . "<br />";
echo "Bank name: " . $req->get_bank_name() . "<br />";
echo "Invoice reference: " . $req->get_invoice_reference() . "<br />";
echo "Invoice due date: " . $req->get_invoice_duedate() . "<br />";
echo "Activation performed: " . ($req->get_activation_performed() ? "Yes" : "No") . "<br />";
if (count($req->get_dues()) > 0) {
echo "Hire purchase payment:<br />";
$pos = 0;
foreach ($req->get_dues() as $due) {
echo (++$pos).") date: ".$due['date'].", amount: ".$due['value']."<br />";
}
}
echo "<input type=\"button\" value=\"Edit cart content\" onclick=\"window.location.href='edit.php?ref=" . $ref . "'\" />";
echo "<input type=\"button\" value=\"Full cancel\" onclick=\"window.location.href='cancel.php?ref=" . $ref . "'\" />";
}
else {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
@@ -0,0 +1,48 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_module_config_request.php';
$req = new ipl_module_config_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_locale("DEU", "EUR", "de");
try {
$req->send();
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Module config request successful<br />";
echo "Direct debit allowed: " . $req->is_direct_debit_allowed() . "<br />";
echo "Invoice allowed: " . $req->is_invoice_allowed() . "<br />";
echo "Invoice business allowed: " . $req->is_invoicebusiness_allowed() . "<br />";
echo "Limit direct debit: " . $req->get_static_limit_direct_debit() . "<br />";
echo "Limit invoice: " . $req->get_static_limit_invoice() . "<br />";
echo "Limit hire purchase: " . $req->get_static_limit_hire_purchase() . "<br />";
echo "Min value direct debit: " . $req->get_direct_debit_min_value() . "<br />";
echo "Min value invoice: " . $req->get_invoice_min_value() . "<br />";
echo "Min value hire purchase: " . $req->get_hire_purchase_min_value() . "<br />";
echo "Available terms: " . implode(", ", $req->get_terms());
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
@@ -0,0 +1,46 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_partialcancel_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_partialcancel_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_cancel_params($ref, 0, 0, 0, 0, "EUR");
$req->add_canceled_article("article001", 1);
$req->add_canceled_article("article002", 1);
if ($req->is_transaction_credit_order()) {
print_r($req->get_due_update());
}
try {
$req->send();
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Partial cancel successful<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
+64
View File
@@ -0,0 +1,64 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_preauthorize_request.php';
// Generate a random suffix to create unique customer
$randSuffix = rand(1, 15000000000);
$req = new ipl_preauthorize_request($_SESSION['api-url-base'], IPL_CORE_PAYMENT_TYPE_INVOICE);
// UN-COMMENT THIS FOR A DIRECT DEBIT REQUEST
//$req = new ipl_preauthorize_request($_SESSION['api-url-base'], IPL_CORE_PAYMENT_TYPE_DIRECT_DEBIT);
// UN-COMMENT THIS FOR A RATE PAYMENT REQUEST
//$req = new ipl_preauthorize_request($_SESSION['api-url-base'], IPL_CORE_PAYMENT_TYPE_RATE_PAYMENT);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_customer_details("123456", "e", "Herr", "", "Herbert $randSuffix", "Billpay $randSuffix",
"Teststrasse $randSuffix", "123", "", "12345", "Teststadt $randSuffix", "DEU", "testing@billpay.de",
"0302333459", "01775112389", "19850911", "de", "85.214.7.23", "p");
$req->set_shipping_details(true);
// UN-COMMENT THIS FOR A DIRECT DEBIT REQUEST OR RATE PAYMENT
//$req->set_bank_account("Herbert_$randSuffix Tester_$randSuffix", "4973024088", "10050000");
// UN-COMMENT THIS FOR A RATE PAYMENT REQUEST
//$req->set_rate_request(6, 28599);
$req->set_total(500, 595, "Express-Versand", 500, 650, 17800, 27455, "EUR", "");
$req->add_article("article001", 12, "Kaffetasse 08/15", "Eine Kaffetasse aus Porzellan", 1200, 1950);
$req->add_article("article002", 4, "Kuchenteller 07-11", "Kuchenteller - weiss", 850, 1000);
$req->add_order_history("1233343321", "20080101 10:23:30", 12300, "EUR", 4, 0);
$req->set_terms_accepted(true);
try {
$req->send();
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
}
echo "Status: " . $req->get_status() . "<br />";
if (!$req->has_error()) {
echo "TX ID: " . $req->get_bptid() . "<br />";
echo "<input type=\"button\" value=\"Capture\" onclick=\"window.location.href='capture.php?tx_id=" . $req->get_bptid() . "'\" />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
+43
View File
@@ -0,0 +1,43 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_calculate_rates_request.php';
$req = new ipl_calculate_rates_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_rate_request_params(26805, 27455);
$req->set_locale("DEU", "EUR", "de");
try {
$req->send();
if (!$req->has_error()) {
echo 'Response data:<br />';
echo '<pre>';
print_r($req->get_options());
echo '</pre>';
}
else {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
+60
View File
@@ -0,0 +1,60 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*
* This request should be used in case the merchant-side unique order ID for
* the order is only known AFTER the capture request has already been sent.
* In this case the billpay transation id (tx_id) that is obtained from the
* result of the preauthorize request should be used as a "temporary order id" in
* the capture request. The update order request should be sent after the order
* is created and therefor the order id is known.
*
* Please note that it is absolutely necessary that no user action takes place
* between the capture request and the update order request!
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_update_order_request.php';
// This is the order reference from the capture request
$tx_id = $_GET["tx_id"];
$ref = $_GET["ref"];
$refUpdated = $ref . '_foo';
// The order ID must be unique -> generate a random number for this example
$orderReference = rand(1, 15000000000);
$req = new ipl_update_order_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_update_params($tx_id, $refUpdated);
$req->add_id_update("article001", "article001_mod");
$req->add_id_update("article002", "article002_mod");
try {
$req->send();
if ($req->has_error()) {
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Update order successful!<br />";
echo "<input type=\"button\" value=\"Invoice\" onclick=\"window.location.href='invoicecreated.php?ref=$refUpdated'\" />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
+40
View File
@@ -0,0 +1,40 @@
<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_validation_request.php';
$req = new ipl_validation_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_customer_details("123456", "e", "Herr", "", "Tamlin", "Wallder",
"Wanderweg", "6", "", "24857", "Borgwedel",
"DEU", "demo@billpay.de", "0302333459", "01775112389",
"19850911", "de", "85.214.7.22");
$req->set_shipping_details(true);
try {
$req->send();
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>