Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/280783
Change subject: Move var_map to config
......................................................................
Move var_map to config
Thanks for handing out the whittling knives, cwd!
Change-Id: I5ab795d58bd9b5ae83bc827c9205d44f66cf32ec
---
M adyen_gateway/adyen.adapter.php
A adyen_gateway/config/var_map.yaml
M amazon_gateway/amazon.adapter.php
M astropay_gateway/astropay.adapter.php
A astropay_gateway/config/var_map.yaml
M gateway_common/gateway.adapter.php
A globalcollect_gateway/config/var_map.yaml
M globalcollect_gateway/globalcollect.adapter.php
A paypal_gateway/config/var_map.yaml
M paypal_gateway/paypal.adapter.php
A worldpay_gateway/config/var_map.yaml
M worldpay_gateway/worldpay.adapter.php
12 files changed, 147 insertions(+), 181 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/83/280783/1
diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php
index 3b5e30a..c3bea70 100644
--- a/adyen_gateway/adyen.adapter.php
+++ b/adyen_gateway/adyen.adapter.php
@@ -69,41 +69,6 @@
$this->data_transformers = parent::getCoreDataTransformers();
}
- /**
- * Define var_map
- */
- function defineVarMap() {
- $this->var_map = array(
- 'allowedMethods' => 'allowed_methods',
- 'billingAddress.city' => 'city',
- 'billingAddress.country' => 'country',
- 'billingAddress.postalCode' => 'zip',
- 'billingAddress.stateOrProvince' => 'state',
- 'billingAddress.street' => 'street',
- 'billingAddressType' => 'billing_address_type',
- 'blockedMethods' => 'blocked_methods',
- 'card.cardHolderName' => 'full_name',
- 'currencyCode' => 'currency_code',
- 'deliveryAddressType' => 'delivery_address_type',
- 'merchantAccount' => 'merchant_account',
- 'merchantReference' => 'order_id',
- 'merchantReturnData' => 'return_data',
- 'merchantSig' => 'hpp_signature',
- 'offset' => 'risk_score',
- 'orderData' => 'order_data',
- 'paymentAmount' => 'amount',
- 'pspReference' => 'gateway_txn_id',
- 'recurringContract' => 'recurring_type',
- 'sessionValidity' => 'session_expiration',
- 'shipBeforeDate' => 'expiration',
- 'shopperEmail' => 'email',
- 'shopperLocale' => 'language',
- 'shopperReference' => 'customer_id',
- 'shopperStatement' => 'statement_template',
- 'skinCode' => 'skin_code',
- );
- }
-
function defineReturnValueMap() {
$this->return_value_map = array(
'authResult' => 'result',
diff --git a/adyen_gateway/config/var_map.yaml
b/adyen_gateway/config/var_map.yaml
new file mode 100644
index 0000000..ce01b4a
--- /dev/null
+++ b/adyen_gateway/config/var_map.yaml
@@ -0,0 +1,27 @@
+allowedMethods: allowed_methods
+billingAddress.city: city
+billingAddress.country: country
+billingAddress.postalCode: zip
+billingAddress.stateOrProvince: state
+billingAddress.street: street
+billingAddressType: billing_address_type
+blockedMethods: blocked_methods
+card.cardHolderName: full_name
+currencyCode: currency_code
+deliveryAddressType: delivery_address_type
+merchantAccount: merchant_account
+merchantReference: order_id
+merchantReturnData: return_data
+merchantSig: hpp_signature
+offset: risk_score
+orderData: order_data
+paymentAmount: amount
+pspReference: gateway_txn_id
+recurringContract: recurring_type
+sessionValidity: session_expiration
+shipBeforeDate: expiration
+shopperEmail: email
+shopperLocale: language
+shopperReference: customer_id
+shopperStatement: statement_template
+skinCode: skin_code
diff --git a/amazon_gateway/amazon.adapter.php
b/amazon_gateway/amazon.adapter.php
index 8f043e0..33987ea 100644
--- a/amazon_gateway/amazon.adapter.php
+++ b/amazon_gateway/amazon.adapter.php
@@ -74,11 +74,6 @@
);
}
- function defineVarMap() {
- // TODO: maybe use this for mapping gatway data to API call
parameters
- $this->var_map = array();
- }
-
function defineAccountInfo() {
// We use account_config instead
$this->accountInfo = array();
diff --git a/astropay_gateway/astropay.adapter.php
b/astropay_gateway/astropay.adapter.php
index f1e60c2..7368fbd 100644
--- a/astropay_gateway/astropay.adapter.php
+++ b/astropay_gateway/astropay.adapter.php
@@ -75,34 +75,6 @@
function defineStagedVars() {}
- /**
- * Define var_map
- */
- function defineVarMap() {
- $this->var_map = array(
- 'x_login' => 'merchant_id',
- 'x_trans_key' => 'merchant_password',
- 'x_invoice' => 'order_id',
- 'x_amount' => 'amount',
- 'x_currency' => 'currency_code',
- 'x_bank' => 'bank_code',
- 'x_country' => 'country',
- 'x_description' => 'description',
- 'x_iduser' => 'donor_id',
- 'x_cpf' => 'fiscal_number',
- 'x_name' => 'full_name',
- 'x_email' => 'email',
- // We've been told bdate is non-mandatory, despite the
docs
- 'x_bdate' => 'birth_date',
- 'x_address' => 'street',
- 'x_zip' => 'zip',
- 'x_city' => 'city',
- 'x_state' => 'state',
- 'x_document' => 'gateway_txn_id',
- 'country_code' => 'country',
- );
- }
-
function defineReturnValueMap() {
$this->return_value_map = array();
// 6: Transaction not found in the system
diff --git a/astropay_gateway/config/var_map.yaml
b/astropay_gateway/config/var_map.yaml
new file mode 100644
index 0000000..1592144
--- /dev/null
+++ b/astropay_gateway/config/var_map.yaml
@@ -0,0 +1,20 @@
+x_login: merchant_id
+x_trans_key: merchant_password
+x_invoice: order_id
+x_amount: amount
+x_currency: currency_code
+x_bank: bank_code
+x_country: country
+x_description: description
+x_iduser: donor_id
+x_cpf: fiscal_number
+x_name: full_name
+x_email: email
+# We've been told bdate is non-mandatory, despite the docs
+x_bdate: birth_date
+x_address: street
+x_zip: zip
+x_city: city
+x_state: state
+x_document: gateway_txn_id
+country_code: country
diff --git a/gateway_common/gateway.adapter.php
b/gateway_common/gateway.adapter.php
index dae98bd..e3b312e 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -321,6 +321,13 @@
}
}
+ // TODO: see comment on definePaymentMethods
+ public function defineVarMap() {
+ if ( isset( $this->config['var_map'] ) ) {
+ $this->var_map = $this->config['var_map'];
+ }
+ }
+
/**
* Determine which account to use for this session
*/
diff --git a/globalcollect_gateway/config/var_map.yaml
b/globalcollect_gateway/config/var_map.yaml
new file mode 100644
index 0000000..87362a6
--- /dev/null
+++ b/globalcollect_gateway/config/var_map.yaml
@@ -0,0 +1,56 @@
+# TODO: RETURNURL - Find out where the returnto URL is supposed to be coming
from.
+ACCOUNTHOLDER: account_holder
+ACCOUNTNAME: account_name
+ACCOUNTNUMBER: account_number
+ADDRESSLINE1E: address_line_1e # dd:CH
+ADDRESSLINE2: address_line_2 # dd:CH
+ADDRESSLINE3: address_line_3 # dd:CH
+ADDRESSLINE4: address_line_4 # dd:CH
+ATTEMPTID: attempt_id
+AUTHORISATIONID: authorization_id
+AMOUNT: amount
+BANKACCOUNTNUMBER: bank_account_number
+BANKAGENZIA: bank_agenzia # dd:IT
+BANKCHECKDIGIT: bank_check_digit
+BANKCODE: bank_code
+BANKFILIALE: bank_filiale # dd:IT
+BANKNAME: bank_name
+BRANCHCODE: branch_code
+CITY: city
+COUNTRYCODE: country
+COUNTRYCODEBANK: country_code_bank
+COUNTRYDESCRIPTION: country_description
+CUSTOMERBANKCITY: customer_bank_city # dd
+CUSTOMERBANKSTREET: customer_bank_street # dd
+CUSTOMERBANKNUMBER: customer_bank_number # dd
+CUSTOMERBANKZIP: customer_bank_zip # dd
+CREDITCARDNUMBER: card_num
+CURRENCYCODE: currency_code
+CVV: cvv
+DATECOLLECT: date_collect
+DESCRIPTOR: descriptor # eWallets
+DIRECTDEBITTEXT: direct_debit_text
+DOMICILIO: domicilio # dd:ES
+EFFORTID: effort_id
+EMAIL: email
+EXPIRYDATE: expiration
+FIRSTNAME: fname
+IBAN: iban
+IPADDRESS: server_ip
+IPADDRESSCUSTOMER: user_ip
+ISSUERID: issuer_id
+LANGUAGECODE: language
+MERCHANTREFERENCE: contribution_tracking_id # new as of Feb 2014. See also the
staging function.
+ORDERID: order_id
+PAYMENTPRODUCTID: payment_product
+PAYMENTREFERENCE: payment_reference
+PROVINCIA: provincia # dd:ES
+RETURNURL: returnto
+SPECIALID: special_id
+STATE: state
+STREET: street
+SURNAME: lname
+SWIFTCODE: swift_code
+TRANSACTIONTYPE: transaction_type # dd:GB,NL
+ZIP: zip
+FISCALNUMBER: fiscal_number # Boletos
diff --git a/globalcollect_gateway/globalcollect.adapter.php
b/globalcollect_gateway/globalcollect.adapter.php
index 44f7149..936b02c 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -280,73 +280,6 @@
}
/**
- * Define var_map
- *
- * @todo
- * - RETURNURL: Find out where the returnto URL is supposed to be
coming from.
- */
- public function defineVarMap() {
-
- $this->var_map = array(
- 'ACCOUNTHOLDER' => 'account_holder',
- 'ACCOUNTNAME' => 'account_name',
- 'ACCOUNTNUMBER' => 'account_number',
- 'ADDRESSLINE1E' => 'address_line_1e', //dd:CH
- 'ADDRESSLINE2' => 'address_line_2', //dd:CH
- 'ADDRESSLINE3' => 'address_line_3', //dd:CH
- 'ADDRESSLINE4' => 'address_line_4', //dd:CH
- 'ATTEMPTID' => 'attempt_id',
- 'AUTHORISATIONID' => 'authorization_id',
- 'AMOUNT' => 'amount',
- 'BANKACCOUNTNUMBER' => 'bank_account_number',
- 'BANKAGENZIA' => 'bank_agenzia', // dd:IT
- 'BANKCHECKDIGIT' => 'bank_check_digit',
- 'BANKCODE' => 'bank_code',
- 'BANKFILIALE' => 'bank_filiale', // dd:IT
- 'BANKNAME' => 'bank_name',
- 'BRANCHCODE' => 'branch_code',
- 'CITY' => 'city',
- 'COUNTRYCODE' => 'country',
- 'COUNTRYCODEBANK' => 'country_code_bank',
- 'COUNTRYDESCRIPTION'=> 'country_description',
- 'CUSTOMERBANKCITY' => 'customer_bank_city', // dd
- 'CUSTOMERBANKSTREET'=> 'customer_bank_street', // dd
- 'CUSTOMERBANKNUMBER'=> 'customer_bank_number', // dd
- 'CUSTOMERBANKZIP' => 'customer_bank_zip', // dd
- 'CREDITCARDNUMBER' => 'card_num',
- 'CURRENCYCODE' => 'currency_code',
- 'CVV' => 'cvv',
- 'DATECOLLECT' => 'date_collect',
- 'DESCRIPTOR' => 'descriptor', // eWallets
- 'DIRECTDEBITTEXT' => 'direct_debit_text',
- 'DOMICILIO' => 'domicilio', // dd:ES
- 'EFFORTID' => 'effort_id',
- 'EMAIL' => 'email',
- 'EXPIRYDATE' => 'expiration',
- 'FIRSTNAME' => 'fname',
- 'IBAN' => 'iban',
- 'IPADDRESS' => 'server_ip',
- 'IPADDRESSCUSTOMER' => 'user_ip',
- 'ISSUERID' => 'issuer_id',
- 'LANGUAGECODE' => 'language',
- 'MERCHANTREFERENCE' => 'contribution_tracking_id',
//new as of Feb 2014. See also the staging function.
- 'ORDERID' => 'order_id',
- 'PAYMENTPRODUCTID' => 'payment_product',
- 'PAYMENTREFERENCE' => 'payment_reference',
- 'PROVINCIA' => 'provincia', // dd:ES
- 'RETURNURL' => 'returnto',
- 'SPECIALID' => 'special_id',
- 'STATE' => 'state',
- 'STREET' => 'street',
- 'SURNAME' => 'lname',
- 'SWIFTCODE' => 'swift_code',
- 'TRANSACTIONTYPE' => 'transaction_type', //
dd:GB,NL
- 'ZIP' => 'zip',
- 'FISCALNUMBER' => 'fiscal_number', //Boletos
- );
- }
-
- /**
* Setting some GC-specific defaults.
* @param array $options These get extracted in the parent.
*/
diff --git a/paypal_gateway/config/var_map.yaml
b/paypal_gateway/config/var_map.yaml
new file mode 100644
index 0000000..d07df0e
--- /dev/null
+++ b/paypal_gateway/config/var_map.yaml
@@ -0,0 +1,9 @@
+amount: amount
+country: country
+currency_code: currency_code
+item_name: description
+return: return
+custom: contribution_tracking_id
+a3: amount
+srt: recurring_length
+lc: locale
diff --git a/paypal_gateway/paypal.adapter.php
b/paypal_gateway/paypal.adapter.php
index 5cbb053..2528495 100644
--- a/paypal_gateway/paypal.adapter.php
+++ b/paypal_gateway/paypal.adapter.php
@@ -50,20 +50,6 @@
);
}
- function defineVarMap() {
- $this->var_map = array(
- 'amount' => 'amount',
- 'country' => 'country',
- 'currency_code' => 'currency_code',
- 'item_name' => 'description',
- 'return' => 'return',
- 'custom' => 'contribution_tracking_id',
- 'a3' => 'amount',
- 'srt' => 'recurring_length',
- 'lc' => 'locale',
- );
- }
-
function defineAccountInfo() {
$this->accountInfo = array();
}
diff --git a/worldpay_gateway/config/var_map.yaml
b/worldpay_gateway/config/var_map.yaml
new file mode 100644
index 0000000..1d1b72d
--- /dev/null
+++ b/worldpay_gateway/config/var_map.yaml
@@ -0,0 +1,28 @@
+OrderNumber: order_id
+CustomerId: contribution_tracking_id
+OTTRegion: region_code
+OTTResultURL: returnto
+OTT: wp_one_time_token
+CardId: wp_card_id
+Amount: amount
+FirstName: fname
+LastName: lname
+Address1: street
+City: city
+StateCode: state
+ZipCode: zip
+CountryCode: country
+LAN: language
+Email: email
+REMOTE_ADDR: user_ip
+StoreID: wp_storeid
+CurrencyId: iso_currency_id
+AcctName: wp_acctname
+CVN: cvv
+PTTID: wp_pttid
+UserName: username
+UserPassword: user_password
+MerchantId: wp_merchant_id
+MerchantReference2: merchant_reference_2
+NarrativeStatement1: narrative_statement_1
+
diff --git a/worldpay_gateway/worldpay.adapter.php
b/worldpay_gateway/worldpay.adapter.php
index 1a64631..0dfd4df 100644
--- a/worldpay_gateway/worldpay.adapter.php
+++ b/worldpay_gateway/worldpay.adapter.php
@@ -696,38 +696,6 @@
$this->addCodeRange( 'AuthorizeAndDepositPayment',
'MessageCode', FinalStatus::FAILED, 2101, 2999 );
}
- function defineVarMap() {
- $this->var_map = array(
- 'OrderNumber' => 'order_id',
- 'CustomerId' => 'contribution_tracking_id',
- 'OTTRegion' => 'region_code',
- 'OTTResultURL' => 'returnto',
- 'OTT' => 'wp_one_time_token',
- 'CardId' => 'wp_card_id',
- 'Amount' => 'amount',
- 'FirstName' => 'fname',
- 'LastName' => 'lname',
- 'Address1' => 'street',
- 'City' => 'city',
- 'StateCode' => 'state',
- 'ZipCode' => 'zip',
- 'CountryCode' => 'country',
- 'LAN' => 'language',
- 'Email' => 'email',
- 'REMOTE_ADDR' => 'user_ip',
- 'StoreID' => 'wp_storeid',
- 'CurrencyId' => 'iso_currency_id',
- 'AcctName' => 'wp_acctname',
- 'CVN' => 'cvv',
- 'PTTID' => 'wp_pttid',
- 'UserName' => 'username',
- 'UserPassword' => 'user_password',
- 'MerchantId' => 'wp_merchant_id',
- 'MerchantReference2'=> 'merchant_reference_2',
- 'NarrativeStatement1'=> 'narrative_statement_1',
- );
- }
-
public function defineDataTransformers() {
$this->data_transformers = parent::getCoreDataTransformers();
}
--
To view, visit https://gerrit.wikimedia.org/r/280783
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ab795d58bd9b5ae83bc827c9205d44f66cf32ec
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits