Skip to content

Commit

Permalink
Added new request fields for optional integration data and subscripti… (
Browse files Browse the repository at this point in the history
#81)

* Added new e-Commerce request fields: PMLIST, EXCLPMLIST, CREDITDEBIT and USERID

* Added new request fields for optional integration data and subscription manager, added support for numbered request fields (ITEMID1, ITEMID2 etc)

* Added new e-Commerce request field: CATALOGURL
  • Loading branch information
maciejzgadzaj authored and jelte committed Jan 16, 2017
1 parent 0ea3914 commit 3133a34
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions lib/Ogone/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,41 @@ abstract class AbstractRequest implements Request

protected $ogoneFields = array(
'pspid', 'orderid', 'com', 'amount', 'currency', 'language', 'cn', 'email',
'cardno', 'cvc', 'ed', 'ownerzip', 'owneraddress', 'ownercty', 'ownertown',
'ownertelno', 'homeurl', 'accepturl', 'declineurl', 'exceptionurl', 'cancelurl', 'backurl',
'cardno', 'cvc', 'ed', 'ownerzip', 'owneraddress', 'ownercty', 'ownertown', 'ownertelno',
'homeurl', 'catalogurl', 'accepturl', 'declineurl', 'exceptionurl', 'cancelurl', 'backurl',
'complus', 'paramplus', 'pm', 'brand', 'title', 'bgcolor', 'txtcolor', 'tblbgcolor',
'tbltxtcolor', 'buttonbgcolor', 'buttontxtcolor', 'logo', 'fonttype', 'tp', 'paramvar',
'alias', 'aliasoperation', 'aliasusage', 'aliaspersistedafteruse', 'device', 'pmlisttype',
'ecom_payment_card_verification', 'operation', 'withroot', 'remote_addr', 'rtimeout',
'pmlist', 'exclpmlist', 'creditdebit', 'userid',
// DirectLink with 3-D Secure: Extra request parameters.
// https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/directlink-3-d/3-d-transaction-flow-via-directlink#extrarequestparameters
'flag3d', 'http_accept', 'http_user_agent', 'win3ds',
// Optional integration data: Delivery and Invoicing data.
// https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/additional-data/delivery-and-invoicing-data
'civility', 'cuid', 'ecom_billto_postal_city', 'ecom_billto_postal_countrycode',
'ecom_billto_postal_name_first', 'ecom_billto_postal_name_last', 'ecom_billto_postal_postalcode',
'ecom_billto_postal_street_line1', 'ecom_billto_postal_street_number', 'ecom_shipto_dob',
'ecom_shipto_online_email', 'ecom_shipto_postal_city', 'ecom_shipto_postal_countrycode',
'ecom_shipto_postal_name_first', 'ecom_shipto_postal_name_last', 'ecom_shipto_postal_name_prefix',
'ecom_shipto_postal_postalcode', 'ecom_shipto_postal_state', 'ecom_shipto_postal_street_line1',
'ecom_shipto_postal_street_number', 'ordershipcost', 'ordershipmeth', 'ordershiptaxcode',
// Optional integration data: Order data ("ITEM" parameters).
// https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/additional-data/order-data
'itemattributes*', 'itemcategory*', 'itemcomments*', 'itemdesc*', 'itemdiscount*',
'itemid*', 'itemname*', 'itemprice*', 'itemquant*', 'itemquantorig*',
'itemunitofmeasure*', 'itemvat*', 'itemvatcode*', 'itemweight*',
// Optional integration data: Travel data.
// https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/additional-data/travel-data
'datatype', 'aiairname', 'aitinum', 'aitidate', 'aiconjti', 'aipasname',
'aiextrapasname*', 'aichdet', 'aiairtax', 'aivatamnt', 'aivatappl', 'aitypch',
'aieycd', 'aiirst', 'aiorcity*', 'aiorcityl*', 'aidestcity*', 'aidestcityl*',
'aistopov*', 'aicarrier*', 'aibookind*', 'aiflnum*', 'aifldate*', 'aiclass*',
// Subscription Manager.
// https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/subscription-manager/via-e-commerce-and-directlink#input
'subscription_id', 'sub_amount', 'sub_com', 'sub_orderid', 'sub_period_unit',
'sub_period_number', 'sub_period_moment', 'sub_startdate', 'sub_enddate',
'sub_status', 'sub_comment',
);

/** @return string */
Expand Down Expand Up @@ -187,7 +215,9 @@ public function __call($method, $args)
{
if (substr($method, 0, 3) == 'set') {
$field = strtolower(substr($method, 3));
if (in_array($field, $this->ogoneFields)) {
// Also search for numbered fields, like ITEMID1, ITEMID2 etc.
$numbered_field = preg_replace('/\d+$/', '*', $field);
if (in_array($field, $this->ogoneFields) || in_array($numbered_field, $this->ogoneFields)) {
$this->parameters[$field] = $args[0];
return;
}
Expand Down

0 comments on commit 3133a34

Please sign in to comment.