Ejegg has uploaded a new change for review. https://gerrit.wikimedia.org/r/281684
Change subject: Merge master into deployment ...................................................................... Merge master into deployment 5f449a8 Localisation updates from https://translatewiki.net. f29c669 move worldpay payment methods 2a61782 Remove deprecated parameters 5500300 gateway_adapter&loadConfig() 2a591d3 Shorter selector for .hidden a9e56e6 Move currencies to config c571dce Compress PNGs using zopflipng 0060512 Astropay: remove Banco de Chile from CL/BT 62a0f7d Astropay: WebPay as main processor for credit cards CL d97ad0a Encapsulate Worldpay staging logic d32731a Move Worldpay currencies to config 7f05102 Random cleanups 93eaf6b Move var_map to config 96b7e7e Move data constraints to config d8edb4b Add another method to GatewayType interface bedb0d9 Change MX dummy fiscal number to 13 digits Removed tests Change-Id: I309ef5fbca903deb53f511b07ac58d14ba1e737e --- M DonationInterface.php M adyen_gateway/adyen.adapter.php A adyen_gateway/config/currencies.yaml A adyen_gateway/config/var_map.yaml M amazon_gateway/amazon.adapter.php A amazon_gateway/config/currencies.yaml M astropay_gateway/astropay.adapter.php A astropay_gateway/config/currencies.yaml A astropay_gateway/config/data_constraints.yaml M astropay_gateway/config/payment_submethods.yaml A astropay_gateway/config/var_map.yaml M gateway_common/DonationData.php M gateway_common/FiscalNumber.php M gateway_common/GatewayType.php M gateway_common/gateway.adapter.php M gateway_common/i18n/interface/ba.json M gateway_common/i18n/interface/ksh.json M gateway_common/i18n/interface/qqq.json M gateway_forms/includes/alipay.png D gateway_forms/includes/bank-banco_de_chile.png M gateway_forms/includes/bank-banco_do_brasil.png M gateway_forms/includes/bank-bradesco.png M gateway_forms/includes/bank-caixa.png M gateway_forms/includes/bank-hsbc.png M gateway_forms/includes/bank-itau.png M gateway_forms/includes/bank-santander.png M gateway_forms/includes/bank-webpay.png M gateway_forms/includes/card-amex-lg.png M gateway_forms/includes/card-argencard.png M gateway_forms/includes/card-cabal.png M gateway_forms/includes/card-cmr.png M gateway_forms/includes/card-magna.png M gateway_forms/includes/card-mc-lg.png M gateway_forms/includes/card-mercadolivre.png M gateway_forms/includes/card-naranja.png M gateway_forms/includes/card-nativa.png M gateway_forms/includes/card-presto.png M gateway_forms/includes/card-servipag.png M gateway_forms/includes/card-shopping.png M gateway_forms/includes/cash-banamex.png M gateway_forms/includes/cash-bancomer.png M gateway_forms/includes/cash-davivienda.png M gateway_forms/includes/cash-efecty.png M gateway_forms/includes/cash-oxxo.png M gateway_forms/includes/cash-pago-efectivo.png M gateway_forms/includes/cash-pago-facil.png M gateway_forms/includes/cash-provencia-pagos.png M gateway_forms/includes/cash-rapipago.png M gateway_forms/includes/cash-red-pagos.png M gateway_forms/includes/paypal.png M gateway_forms/includes/questionmark.png M gateway_forms/includes/wmlogo_blue.png M gateway_forms/includes/yandex.png M gateway_forms/mustache/forms.css M gateway_forms/rapidhtml/css/images/button-disabled.png M gateway_forms/rapidhtml/css/images/button-down.png M gateway_forms/rapidhtml/css/images/button-off-green.png M gateway_forms/rapidhtml/css/images/close.png M gateway_forms/rapidhtml/css/images/ui-bg_highlight-soft_100_ffffff_1x100.png M globalcollect_gateway/GlobalCollectOrphanRectifier.php A globalcollect_gateway/config/currencies.yaml A globalcollect_gateway/config/data_constraints.yaml A globalcollect_gateway/config/var_map.yaml M globalcollect_gateway/globalcollect.adapter.php A paypal_gateway/config/currencies.yaml A paypal_gateway/config/var_map.yaml M paypal_gateway/paypal.adapter.php M special/GatewayFormChooser.php A worldpay_gateway/WorldpayAccountName.php A worldpay_gateway/WorldpayCurrency.php A worldpay_gateway/WorldpayEmail.php A worldpay_gateway/WorldpayMethodCodec.php A worldpay_gateway/WorldpayNarrativeStatement.php A worldpay_gateway/WorldpayReturnto.php A worldpay_gateway/config/currencies.yaml A worldpay_gateway/config/data_constraints.yaml A worldpay_gateway/config/payment_methods.yaml A worldpay_gateway/config/payment_submethods.yaml A worldpay_gateway/config/var_map.yaml M worldpay_gateway/worldpay.adapter.php 80 files changed, 1,275 insertions(+), 1,233 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/84/281684/1 diff --git a/DonationInterface.php b/DonationInterface.php index 0169a74..a7dde58 100644 --- a/DonationInterface.php +++ b/DonationInterface.php @@ -120,6 +120,12 @@ $wgAutoloadClasses['WorldpayGateway'] = __DIR__ . '/worldpay_gateway/worldpay_gateway.body.php'; $wgAutoloadClasses['WorldpayGatewayResult'] = __DIR__ . '/worldpay_gateway/worldpay_resultswitcher.body.php'; $wgAutoloadClasses['WorldpayAdapter'] = __DIR__ . '/worldpay_gateway/worldpay.adapter.php'; +$wgAutoloadClasses['WorldpayAccountName'] = __DIR__ . '/worldpay_gateway/WorldpayAccountName.php'; +$wgAutoloadClasses['WorldpayCurrency'] = __DIR__ . '/worldpay_gateway/WorldpayCurrency.php'; +$wgAutoloadClasses['WorldpayEmail'] = __DIR__ . '/worldpay_gateway/WorldpayEmail.php'; +$wgAutoloadClasses['WorldpayMethodCodec'] = __DIR__ . '/worldpay_gateway/WorldpayMethodCodec.php'; +$wgAutoloadClasses['WorldpayNarrativeStatement'] = __DIR__ . '/worldpay_gateway/WorldpayNarrativeStatement.php'; +$wgAutoloadClasses['WorldpayReturnto'] = __DIR__ . '/worldpay_gateway/WorldpayReturnto.php'; $wgAPIModules['di_wp_validate'] = 'WorldpayValidateApi'; $wgAutoloadClasses['WorldpayValidateApi'] = __DIR__ . '/worldpay_gateway/worldpay.api.php'; diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php index 3b5e30a..1dd74a0 100644 --- a/adyen_gateway/adyen.adapter.php +++ b/adyen_gateway/adyen.adapter.php @@ -45,9 +45,6 @@ ); } - function defineDataConstraints() { - } - function defineErrorMap() { $this->error_map = array( 'internal-0000' => 'donate_interface-processing-error', // Failed failed pre-process checks. @@ -67,41 +64,6 @@ public function defineDataTransformers() { $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() { @@ -268,214 +230,6 @@ $transaction = parent::getStompTransaction(); $transaction['risk_score'] = $this->risk_score; return $transaction; - } - - public function getCurrencies( $options = array() ) { - // See http://www.adyen.com/platform/all-countries-all-currencies/ - // This should be the list of all global "acceptance currencies". Not - // finding that list, I've used everything for which we keep - // conversion rates. - // TODO: do we need to filter by country/method? - $currencies = array( - 'ADF', // Andorran Franc - 'ADP', // Andorran Peseta - 'AED', // Utd. Arab Emir. Dirham - 'AFA', // Afghanistan Afghani - 'AFN', // Afghanistan Afghani - 'ALL', // Albanian Lek - 'AMD', // Armenian Dram - 'ANG', // NL Antillian Guilder - 'AOA', // Angolan Kwanza - 'AON', // Angolan Old Kwanza - 'ARS', // Argentinian peso - 'ATS', // Austrian Schilling - 'AUD', // Australian Dollar - 'AWG', // Aruban Florin - 'AZM', // Azerbaijan Old Manat - 'AZN', // Azerbaijan New Manat - 'BAM', // Bosnian Mark - 'BBD', // Barbadian dollar - 'BDT', // Bangladeshi Taka - 'BEF', // Belgian Franc - 'BGL', // Bulgarian Old Lev - 'BGN', // Bulgarian Lev - 'BHD', // Bahraini Dinar - 'BIF', // Burundi Franc - 'BMD', // Bermudian Dollar - 'BND', // Brunei Dollar - 'BOB', // Bolivian Boliviano - 'BRL', // Brazilian Real - 'BSD', // Bahamian Dollar - 'BTN', // Bhutan Ngultrum - 'BWP', // Botswana Pula - 'BYR', // Belarusian Ruble - 'BZD', // Belize Dollar - 'CAD', // Canadian Dollar - 'CDF', // Congolese Franc - 'CHF', // Swiss Franc - 'CLP', // Chilean Peso - 'CNY', // Chinese Yuan Renminbi - 'COP', // Colombian Peso - 'CRC', // Costa Rican Colon - 'CUC', // Cuban Convertible Peso - 'CUP', // Cuban Peso - 'CVE', // Cape Verde Escudo - 'CYP', // Cyprus Pound - 'CZK', // Czech Koruna - 'DEM', // German Mark - 'DJF', // Djibouti Franc - 'DKK', // Danish Krone - 'DOP', // Dominican R. Peso - 'DZD', // Algerian Dinar - 'ECS', // Ecuador Sucre - 'EEK', // Estonian Kroon - 'EGP', // Egyptian Pound - 'ESP', // Spanish Peseta - 'ETB', // Ethiopian Birr - 'EUR', // Euro - 'FIM', // Finnish Markka - 'FJD', // Fiji Dollar - 'FKP', // Falkland Islands Pound - 'FRF', // French Franc - 'GBP', // British Pound - 'GEL', // Georgian Lari - 'GHC', // Ghanaian Cedi - 'GHS', // Ghanaian New Cedi - 'GIP', // Gibraltar Pound - 'GMD', // Gambian Dalasi - 'GNF', // Guinea Franc - 'GRD', // Greek Drachma - 'GTQ', // Guatemalan Quetzal - 'GYD', // Guyanese Dollar - 'HKD', // Hong Kong Dollar - 'HNL', // Honduran Lempira - 'HRK', // Croatian Kuna - 'HTG', // Haitian Gourde - 'HUF', // Hungarian Forint - 'IDR', // Indonesian Rupiah - 'IEP', // Irish Punt - 'ILS', // Israeli New Shekel - 'INR', // Indian Rupee - 'IQD', // Iraqi Dinar - 'IRR', // Iranian Rial - 'ISK', // Iceland Krona - 'ITL', // Italian Lira - 'JMD', // Jamaican Dollar - 'JOD', // Jordanian Dinar - 'JPY', // Japanese Yen - 'KES', // Kenyan Shilling - 'KGS', // Kyrgyzstanian Som - 'KHR', // Cambodian Riel - 'KMF', // Comoros Franc - 'KPW', // North Korean Won - 'KRW', // South Korean won - 'KWD', // Kuwaiti Dinar - 'KYD', // Cayman Islands Dollar - 'KZT', // Kazakhstani Tenge - 'LAK', // Lao Kip - 'LBP', // Lebanese Pound - 'LKR', // Sri Lankan Rupee - 'LRD', // Liberian Dollar - 'LSL', // Lesotho Loti - 'LTL', // Lithuanian Litas - 'LUF', // Luxembourg Franc - 'LVL', // Latvian Lats - 'LYD', // Libyan Dinar - 'MAD', // Moroccan Dirham - 'MDL', // Moldovan Leu - 'MGA', // Malagasy Ariary - 'MGF', // Malagasy Franc - 'MKD', // Macedonian Denar - 'MMK', // Myanmar Kyat - 'MNT', // Mongolian Tugrik - 'MOP', // Macau Pataca - 'MRO', // Mauritanian Ouguiya - 'MTL', // Maltese Lira - 'MUR', // Mauritius Rupee - 'MVR', // Maldive Rufiyaa - 'MWK', // Malawi Kwacha - 'MXN', // Mexican Peso - 'MYR', // Malaysian Ringgit - 'MZM', // Mozambique Metical - 'MZN', // Mozambique New Metical - 'NAD', // Namibia Dollar - 'NGN', // Nigerian Naira - 'NIO', // Nicaraguan Cordoba Oro - 'NLG', // Dutch Guilder - 'NOK', // Norwegian Kroner - 'NPR', // Nepalese Rupee - 'NZD', // New Zealand Dollar - 'OMR', // Omani Rial - 'PAB', // Panamanian Balboa - 'PEN', // Peruvian Nuevo Sol - 'PGK', // Papua New Guinea Kina - 'PHP', // Philippine Peso - 'PKR', // Pakistani Rupee - 'PLN', // Polish Złoty - 'PTE', // Portuguese Escudo - 'PYG', // Paraguay Guarani - 'QAR', // Qatari Rial - 'ROL', // Romanian Lei - 'RON', // Romanian New Lei - 'RSD', // Serbian Dinar - 'RUB', // Russian Rouble - 'RWF', // Rwandan Franc - 'SAR', // Saudi Riyal - 'SBD', // Solomon Islands Dollar - 'SCR', // Seychelles Rupee - 'SDD', // Sudanese Dinar - 'SDG', // Sudanese Pound - 'SDP', // Sudanese Old Pound - 'SEK', // Swedish Krona - 'SGD', // Singapore Dollar - 'SHP', // St. Helena Pound - 'SIT', // Slovenian Tolar - 'SKK', // Slovak Koruna - 'SLL', // Sierra Leone Leone - 'SOS', // Somali Shilling - 'SRD', // Suriname Dollar - 'SRG', // Suriname Guilder - 'STD', // Sao Tome/Principe Dobra - 'SVC', // El Salvador Colon - 'SYP', // Syrian Pound - 'SZL', // Swaziland Lilangeni - 'THB', // Thai Baht - 'TJS', // Tajikistani Somoni - 'TMM', // Turkmenistan Manat - 'TMT', // Turkmenistan New Manat - 'TND', // Tunisian Dinar - 'TOP', // Tonga Pa'anga - 'TRL', // Turkish Old Lira - 'TRY', // Turkish Lira - 'TTD', // Trinidad/Tobago Dollar - 'TWD', // New Taiwan dollar - 'TZS', // Tanzanian Shilling - 'UAH', // Ukrainian hryvnia - 'UGX', // Uganda Shilling - 'USD', // U.S. dollar - 'UYU', // Uruguayan Peso - 'UZS', // Uzbekistan Som - 'VEB', // Venezuelan Bolivar - 'VEF', // Venezuelan Bolivar Fuerte - 'VND', // Vietnamese Dong - 'VUV', // Vanuatu Vatu - 'WST', // Samoan Tala - 'XAF', // Central African CFA franc - 'XAG', // Silver (oz.) - 'XAU', // Gold (oz.) - 'XCD', // East Caribbean Dollar - 'XEU', // ECU - 'XOF', // West African CFA franc - 'XPD', // Palladium (oz.) - 'XPF', // CFP Franc - 'XPT', // Platinum (oz.) - 'YER', // Yemeni Rial - 'YUN', // Yugoslav Dinar - 'ZAR', // South African Rand - 'ZMK', // Zambian Kwacha - 'ZWD', // Zimbabwe Dollar - ); - return $currencies; } //@TODO: Determine why this is being overloaded here. diff --git a/adyen_gateway/config/currencies.yaml b/adyen_gateway/config/currencies.yaml new file mode 100644 index 0000000..fdef3c6 --- /dev/null +++ b/adyen_gateway/config/currencies.yaml @@ -0,0 +1,201 @@ +# See http://www.adyen.com/platform/all-countries-all-currencies/ +# This should be the list of all global "acceptance currencies". Not +# finding that list, I've used everything for which we keep +# conversion rates. +- ADF # Andorran Franc +- ADP # Andorran Peseta +- AED # Utd. Arab Emir. Dirham +- AFA # Afghanistan Afghani +- AFN # Afghanistan Afghani +- ALL # Albanian Lek +- AMD # Armenian Dram +- ANG # NL Antillian Guilder +- AOA # Angolan Kwanza +- AON # Angolan Old Kwanza +- ARS # Argentinian peso +- ATS # Austrian Schilling +- AUD # Australian Dollar +- AWG # Aruban Florin +- AZM # Azerbaijan Old Manat +- AZN # Azerbaijan New Manat +- BAM # Bosnian Mark +- BBD # Barbadian dollar +- BDT # Bangladeshi Taka +- BEF # Belgian Franc +- BGL # Bulgarian Old Lev +- BGN # Bulgarian Lev +- BHD # Bahraini Dinar +- BIF # Burundi Franc +- BMD # Bermudian Dollar +- BND # Brunei Dollar +- BOB # Bolivian Boliviano +- BRL # Brazilian Real +- BSD # Bahamian Dollar +- BTN # Bhutan Ngultrum +- BWP # Botswana Pula +- BYR # Belarusian Ruble +- BZD # Belize Dollar +- CAD # Canadian Dollar +- CDF # Congolese Franc +- CHF # Swiss Franc +- CLP # Chilean Peso +- CNY # Chinese Yuan Renminbi +- COP # Colombian Peso +- CRC # Costa Rican Colon +- CUC # Cuban Convertible Peso +- CUP # Cuban Peso +- CVE # Cape Verde Escudo +- CYP # Cyprus Pound +- CZK # Czech Koruna +- DEM # German Mark +- DJF # Djibouti Franc +- DKK # Danish Krone +- DOP # Dominican R. Peso +- DZD # Algerian Dinar +- ECS # Ecuador Sucre +- EEK # Estonian Kroon +- EGP # Egyptian Pound +- ESP # Spanish Peseta +- ETB # Ethiopian Birr +- EUR # Euro +- FIM # Finnish Markka +- FJD # Fiji Dollar +- FKP # Falkland Islands Pound +- FRF # French Franc +- GBP # British Pound +- GEL # Georgian Lari +- GHC # Ghanaian Cedi +- GHS # Ghanaian New Cedi +- GIP # Gibraltar Pound +- GMD # Gambian Dalasi +- GNF # Guinea Franc +- GRD # Greek Drachma +- GTQ # Guatemalan Quetzal +- GYD # Guyanese Dollar +- HKD # Hong Kong Dollar +- HNL # Honduran Lempira +- HRK # Croatian Kuna +- HTG # Haitian Gourde +- HUF # Hungarian Forint +- IDR # Indonesian Rupiah +- IEP # Irish Punt +- ILS # Israeli New Shekel +- INR # Indian Rupee +- IQD # Iraqi Dinar +- IRR # Iranian Rial +- ISK # Iceland Krona +- ITL # Italian Lira +- JMD # Jamaican Dollar +- JOD # Jordanian Dinar +- JPY # Japanese Yen +- KES # Kenyan Shilling +- KGS # Kyrgyzstanian Som +- KHR # Cambodian Riel +- KMF # Comoros Franc +- KPW # North Korean Won +- KRW # South Korean won +- KWD # Kuwaiti Dinar +- KYD # Cayman Islands Dollar +- KZT # Kazakhstani Tenge +- LAK # Lao Kip +- LBP # Lebanese Pound +- LKR # Sri Lankan Rupee +- LRD # Liberian Dollar +- LSL # Lesotho Loti +- LTL # Lithuanian Litas +- LUF # Luxembourg Franc +- LVL # Latvian Lats +- LYD # Libyan Dinar +- MAD # Moroccan Dirham +- MDL # Moldovan Leu +- MGA # Malagasy Ariary +- MGF # Malagasy Franc +- MKD # Macedonian Denar +- MMK # Myanmar Kyat +- MNT # Mongolian Tugrik +- MOP # Macau Pataca +- MRO # Mauritanian Ouguiya +- MTL # Maltese Lira +- MUR # Mauritius Rupee +- MVR # Maldive Rufiyaa +- MWK # Malawi Kwacha +- MXN # Mexican Peso +- MYR # Malaysian Ringgit +- MZM # Mozambique Metical +- MZN # Mozambique New Metical +- NAD # Namibia Dollar +- NGN # Nigerian Naira +- NIO # Nicaraguan Cordoba Oro +- NLG # Dutch Guilder +- NOK # Norwegian Kroner +- NPR # Nepalese Rupee +- NZD # New Zealand Dollar +- OMR # Omani Rial +- PAB # Panamanian Balboa +- PEN # Peruvian Nuevo Sol +- PGK # Papua New Guinea Kina +- PHP # Philippine Peso +- PKR # Pakistani Rupee +- PLN # Polish Złoty +- PTE # Portuguese Escudo +- PYG # Paraguay Guarani +- QAR # Qatari Rial +- ROL # Romanian Lei +- RON # Romanian New Lei +- RSD # Serbian Dinar +- RUB # Russian Rouble +- RWF # Rwandan Franc +- SAR # Saudi Riyal +- SBD # Solomon Islands Dollar +- SCR # Seychelles Rupee +- SDD # Sudanese Dinar +- SDG # Sudanese Pound +- SDP # Sudanese Old Pound +- SEK # Swedish Krona +- SGD # Singapore Dollar +- SHP # St. Helena Pound +- SIT # Slovenian Tolar +- SKK # Slovak Koruna +- SLL # Sierra Leone Leone +- SOS # Somali Shilling +- SRD # Suriname Dollar +- SRG # Suriname Guilder +- STD # Sao Tome/Principe Dobra +- SVC # El Salvador Colon +- SYP # Syrian Pound +- SZL # Swaziland Lilangeni +- THB # Thai Baht +- TJS # Tajikistani Somoni +- TMM # Turkmenistan Manat +- TMT # Turkmenistan New Manat +- TND # Tunisian Dinar +- TOP # Tonga Paanga +- TRL # Turkish Old Lira +- TRY # Turkish Lira +- TTD # Trinidad/Tobago Dollar +- TWD # New Taiwan dollar +- TZS # Tanzanian Shilling +- UAH # Ukrainian hryvnia +- UGX # Uganda Shilling +- USD # U.S. dollar +- UYU # Uruguayan Peso +- UZS # Uzbekistan Som +- VEB # Venezuelan Bolivar +- VEF # Venezuelan Bolivar Fuerte +- VND # Vietnamese Dong +- VUV # Vanuatu Vatu +- WST # Samoan Tala +- XAF # Central African CFA franc +- XAG # Silver (oz.) +- XAU # Gold (oz.) +- XCD # East Caribbean Dollar +- XEU # ECU +- XOF # West African CFA franc +- XPD # Palladium (oz.) +- XPF # CFP Franc +- XPT # Platinum (oz.) +- YER # Yemeni Rial +- YUN # Yugoslav Dinar +- ZAR # South African Rand +- ZMK # Zambian Kwacha +- ZWD # Zimbabwe Dollar 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..53930be 100644 --- a/amazon_gateway/amazon.adapter.php +++ b/amazon_gateway/amazon.adapter.php @@ -74,19 +74,12 @@ ); } - 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(); } function defineReturnValueMap() {} - - function defineDataConstraints() {} function defineOrderIDMeta() { $this->order_id_meta = array( @@ -419,13 +412,6 @@ $response['Error']['Code'] ); } - } - - public function getCurrencies( $options = array() ) { - // See https://payments.amazon.com/sdui/sdui/about?nodeId=73479#feat_countries - return array( - 'USD', - ); } /** diff --git a/amazon_gateway/config/currencies.yaml b/amazon_gateway/config/currencies.yaml new file mode 100644 index 0000000..fb1fcea --- /dev/null +++ b/amazon_gateway/config/currencies.yaml @@ -0,0 +1,2 @@ +# See https://payments.amazon.com/sdui/sdui/about?nodeId=73479#feat_countries +- USD diff --git a/astropay_gateway/astropay.adapter.php b/astropay_gateway/astropay.adapter.php index f1e60c2..599efc9 100644 --- a/astropay_gateway/astropay.adapter.php +++ b/astropay_gateway/astropay.adapter.php @@ -43,29 +43,6 @@ $this->accountInfo = $this->account_config; } - function defineDataConstraints() { - $this->dataConstraints = array( - 'x_login' => array( 'type' => 'alphanumeric', 'length' => 10, ), - 'x_trans_key' => array( 'type' => 'alphanumeric', 'length' => 10, ), - 'x_invoice' => array( 'type' => 'alphanumeric', 'length' => 20, ), - 'x_amount' => array( 'type' => 'numeric', ), - 'x_currency' => array( 'type' => 'alphanumeric', 'length' => 3, ), - 'x_bank' => array( 'type' => 'alphanumeric', 'length' => 3, ), - 'x_country' => array( 'type' => 'alphanumeric', 'length' => 2, ), - 'x_description' => array( 'type' => 'alphanumeric', 'length' => 200, ), - 'x_iduser' => array( 'type' => 'alphanumeric', 'length' => 20, ), - 'x_cpf' => array( 'type' => 'alphanumeric', 'length' => 30, ), - 'x_name' => array( 'type' => 'alphanumeric', ), - 'x_email' => array( 'type' => 'alphanumeric', ), - 'x_bdate' => array( 'type' => 'date', 'length' => 8, ), - 'x_address' => array( 'type' => 'alphanumeric', ), - 'x_zip' => array( 'type' => 'alphanumeric', 'length' => 10, ), - 'x_city' => array( 'type' => 'alphanumeric', ), - 'x_state' => array( 'type' => 'alphanumeric', 'length' => 2, ), - 'country_code' => array( 'type' => 'alphanumeric', 'length' => 2, ), - ); - } - function defineErrorMap() { $this->error_map = array( 'internal-0000' => 'donate_interface-processing-error', // Failed pre-process checks. @@ -74,34 +51,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(); @@ -339,22 +288,10 @@ if ( !$country ) { throw new InvalidArgumentException( 'Need to specify country if not yet set in unstaged data' ); } - $currencies = array( - 'AR' => 'ARS', // Argentinian peso - 'BO' => 'BOB', // Bolivian Boliviano - 'BR' => 'BRL', // Brazilian Real - 'BZ' => 'BZD', // Belize Dollar - 'CL' => 'CLP', // Chilean Peso - 'CO' => 'COP', // Colombian Peso - 'MX' => 'MXN', // Mexican Peso - 'PE' => 'PEN', // Peruvian Nuevo Sol - 'US' => 'USD', // U.S. dollar - 'UY' => 'UYU', // Uruguayan Peso - ); - if ( !isset( $currencies[$country] ) ) { + if ( !isset( $this->config['currencies'][$country] ) ) { throw new OutOfBoundsException( "No supported currencies for $country" ); } - return (array)$currencies[$country]; + return (array)$this->config['currencies'][$country]; } /** diff --git a/astropay_gateway/config/currencies.yaml b/astropay_gateway/config/currencies.yaml new file mode 100644 index 0000000..42d0cd5 --- /dev/null +++ b/astropay_gateway/config/currencies.yaml @@ -0,0 +1,10 @@ +AR: ARS # Argentinian peso +BO: BOB # Bolivian Boliviano +BR: BRL # Brazilian Real +BZ: BZD # Belize Dollar +CL: CLP # Chilean Peso +CO: COP # Colombian Peso +MX: MXN # Mexican Peso +PE: PEN # Peruvian Nuevo Sol +US: USD # U.S. dollar +UY: UYU # Uruguayan Peso diff --git a/astropay_gateway/config/data_constraints.yaml b/astropay_gateway/config/data_constraints.yaml new file mode 100644 index 0000000..2ac59be --- /dev/null +++ b/astropay_gateway/config/data_constraints.yaml @@ -0,0 +1,49 @@ +x_login: + type: alphanumeric + length: 10 +x_trans_key: + type: alphanumeric + length: 10 +x_invoice: + type: alphanumeric + length: 20 +x_amount: + type: numeric +x_currency: + type: alphanumeric + length: 3 +x_bank: + type: alphanumeric + length: 3 +x_country: + type: alphanumeric + length: 2 +x_description: + type: alphanumeric + length: 200 +x_iduser: + type: alphanumeric + length: 20 +x_cpf: + type: alphanumeric + length: 30 +x_name: + type: alphanumeric +x_email: + type: alphanumeric +x_bdate: + type: date + length: 8 +x_address: + type: alphanumeric +x_zip: + type: alphanumeric + length: 10 +x_city: + type: alphanumeric +x_state: + type: alphanumeric + length: 2 +country_code: + type: alphanumeric + length: 2 diff --git a/astropay_gateway/config/payment_submethods.yaml b/astropay_gateway/config/payment_submethods.yaml index 3237b7e..141de6d 100644 --- a/astropay_gateway/config/payment_submethods.yaml +++ b/astropay_gateway/config/payment_submethods.yaml @@ -5,7 +5,7 @@ countries: AR: true BR: true - CL: true +# CL: true #waiting on Astropay MX: true CO: true logo: card-visa-lg.png @@ -16,17 +16,17 @@ countries: AR: true BR: true - CL: true +# CL: true #waiting on Astropay MX: true CO: true logo: card-mc-lg.png -magna: - bank_code: MG - label: Magna - group: cc - countries: - CL: true - logo: card-magna.png +#magna: #waiting on Astropay +# bank_code: MG +# label: Magna +# group: cc +# countries: +# CL: true +# logo: card-magna.png amex: bank_code: AE label: 'American Express' @@ -34,7 +34,7 @@ countries: BR: true AR: true - CL: true +# CL: true #waiting on Astropay CO: true logo: card-amex-lg.png visa-debit: @@ -66,7 +66,7 @@ group: cc countries: BR: true - CL: true +# CL: true #waiting on Astropay CO: true logo: card-dinersclub-lg.png hiper: @@ -125,20 +125,20 @@ countries: AR: true logo: card-argencard.png -cmr: - bank_code: CM - label: CMR - group: cc - countries: - CL: true - logo: card-cmr.png -presto: - bank_code: PR - label: Presto - group: cc - countries: - CL: true - logo: card-presto.png +#cmr: #waiting on Astropay +# bank_code: CM +# label: CMR +# group: cc +# countries: +# CL: true +# logo: card-cmr.png +#presto: #waiting on Astropay +# bank_code: PR +# label: Presto +# group: cc +# countries: +# CL: true #waiting on Astropay +# logo: card-presto.png webpay: bank_code: WP label: Webpay @@ -148,13 +148,6 @@ countries: CL: true logo: bank-webpay.png -banco_de_chile: - bank_code: BX - label: 'Banco de Chile' - group: bt - countries: - CL: true - logo: bank-banco_de_chile.png banco_do_brasil: bank_code: BB label: 'Banco do Brasil' 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/DonationData.php b/gateway_common/DonationData.php index da1160b..b426952 100644 --- a/gateway_common/DonationData.php +++ b/gateway_common/DonationData.php @@ -91,8 +91,6 @@ 'currency_code', 'payment_method', 'payment_submethod', - 'paymentmethod', //used by the FormChooser (and the newest banners) for some reason. - 'submethod', //same as above. Ideally, the newer banners would stop using these vars and go back to the old ones... 'issuer_id', 'order_id', 'subscr_id', @@ -596,39 +594,10 @@ // payment_method and payment_submethod are currently preferred within DonationInterface if ( $this->isSomething( 'payment_method' ) ) { $method = $this->getVal( 'payment_method' ); - - //but they can come in a little funny. - $exploded = explode( '.', $method ); - if ( count( $exploded ) > 1 ) { - $method = $exploded[0]; - $submethod = $exploded[1]; - } } if ( $this->isSomething( 'payment_submethod' ) ) { - if ( $submethod != '' ) { - //squak a little if they don't match, and pick one. - if ( $submethod != $this->getVal( 'payment_submethod' ) ) { - $message = "Submethod normalization conflict!: "; - $message .= 'payment_submethod = ' . $this->getVal( 'payment_submethod' ); - $message .= ", and exploded payment_method = '$submethod'. Going with the first option."; - $this->logger->debug( $message ); - } - } $submethod = $this->getVal( 'payment_submethod' ); - } - - if ( $this->isSomething( 'paymentmethod' ) ) { //gross. Why did we do this? - //...okay. So, if we have this value, we've likely just come in from the form chooser, - //which has just used *this* value to choose a form with. - //so, go ahead and prefer this version, and then immediately nuke it. - $method = $this->getVal( 'paymentmethod' ); - $this->expunge( 'paymentmethod' ); - } - - if ( $this->isSomething( 'submethod' ) ) { //same deal - $submethod = $this->getVal( 'submethod' ); - $this->expunge( 'submethod' ); } $this->setVal( 'payment_method', $method ); diff --git a/gateway_common/FiscalNumber.php b/gateway_common/FiscalNumber.php index 3fe8cec..4796f02 100644 --- a/gateway_common/FiscalNumber.php +++ b/gateway_common/FiscalNumber.php @@ -11,8 +11,9 @@ $adapter->getIdentifier() === 'astropay' ) { // Not validated, but currently required by the AstroPay API + // Needs to be 13 digits // TODO: Remove this when they fix it - $stagedData['fiscal_number'] = '111122223333444455'; + $stagedData['fiscal_number'] = '1111222233334'; } } else { $stagedData['fiscal_number'] = preg_replace( '/[^a-zA-Z0-9]/', '', $unstagedData['fiscal_number'] ); diff --git a/gateway_common/GatewayType.php b/gateway_common/GatewayType.php index 074a8a3..b840d5b 100644 --- a/gateway_common/GatewayType.php +++ b/gateway_common/GatewayType.php @@ -245,6 +245,13 @@ public function getPaymentMethodMeta( $payment_method = null ); /** + * Get the name of the currently selected payment submethod + * + * @return string + */ + public function getPaymentSubmethod(); + + /** * Get metadata for the specified payment submethod * * @param string|null $payment_submethod Defaults to the current submethod @@ -254,7 +261,7 @@ public function getPaymentSubmethodMeta( $payment_submethod = null ); /** - * Define payment methods + * Get the entire list of payment submethod definitions * * Not all payment submethods are available within an adapter * @@ -362,4 +369,27 @@ * @return mixed|false Data requested, or false if it is not set. */ function getOrderIDMeta( $key = false ); + + /** + * Establish an 'edit' token to help prevent CSRF, etc. + * + * We use this in place of $wgUser->editToken() b/c currently + * $wgUser->editToken() is broken (apparently by design) for + * anonymous users. Using $wgUser->editToken() currently exposes + * a security risk for non-authenticated users. Until this is + * resolved in $wgUser, we'll use our own methods for token + * handling. + * + * Public so the api can get to it. + * + * @return string + */ + function token_getSaltedSessionToken(); + + /** + * Get settings loaded from adapter's config directory + * @param string|null $key setting to retrieve, or null for all + * @return mixed the setting requested, or the config array + */ + public function getConfig( $key = null ); } diff --git a/gateway_common/gateway.adapter.php b/gateway_common/gateway.adapter.php index ecef421..8f74e78 100644 --- a/gateway_common/gateway.adapter.php +++ b/gateway_common/gateway.adapter.php @@ -31,6 +31,11 @@ abstract class GatewayAdapter implements GatewayType, LogPrefixProvider { /** + * config tree + */ + protected $config = array(); + + /** * $dataConstraints provides information on how to handle variables. * * <code> @@ -250,6 +255,7 @@ // The following needs to be set up before we initialize DonationData. // TODO: move the rest of the initialization here + $this->loadConfig(); $this->defineOrderIDMeta(); $this->defineDataConstraints(); $this->definePaymentMethods(); @@ -295,14 +301,47 @@ return $this->request; } - public function definePaymentMethods() { + public function loadConfig() { $yaml = new Parser(); foreach ( glob( $this->getBasedir() . "/config/*.yaml" ) as $path ) { $pieces = explode( "/", $path ); $key = substr( array_pop( $pieces ), 0, -5 ); - # TODO should put this in structured config rather than a member - # variable, but this plays along with the current code. - $this->$key = $yaml->parse( file_get_contents( $path ) ); + $this->config[$key] = $yaml->parse( file_get_contents( $path ) ); + } + } + + public function getConfig( $key = null ) { + if ( $key === null ) { + return $this->config; + } + if ( array_key_exists( $key, $this->config ) ) { + return $this->config[$key]; + } + return null; + } + + // For legacy support. + // TODO replace with access to config structure + public function definePaymentMethods() { + // All adapters have payment_method(s) + $this->payment_methods = $this->config['payment_methods']; + // Some (Pay Pal) do not have any submethods. + if ( isset( $this->config['payment_submethods'] ) ) { + $this->payment_submethods = $this->config['payment_submethods']; + } + } + + // TODO: see comment on definePaymentMethods + public function defineVarMap() { + if ( isset( $this->config['var_map'] ) ) { + $this->var_map = $this->config['var_map']; + } + } + + // TODO: see comment on definePaymentMethods + public function defineDataConstraints() { + if ( isset( $this->config['data_constraints'] ) ) { + $this->dataConstraints = $this->config['data_constraints']; } } @@ -1104,7 +1143,7 @@ * Sets the transaction you are about to send to the payment gateway. This * will throw an exception if you try to set it to something that has no * transaction definition. - * @param type $transaction_name This is a specific transaction type like + * @param string $transaction_name This is a specific transaction type like * 'INSERT_ORDERWITHPAYMENT' (if you're GlobalCollect) that maps to a * first-level key in the $transactions array. * @throws UnexpectedValueException @@ -1166,18 +1205,16 @@ return $this->payment_methods; } - /** - * Get the payment submethod - * - * @return string - */ public function getPaymentSubmethod() { - return $this->getData_Unstaged_Escaped( 'payment_submethod' ); } public function getPaymentSubmethods() { return $this->payment_submethods; + } + + public function getCurrencies( $options = array() ) { + return $this->config['currencies']; } /** @@ -2866,13 +2903,7 @@ // Now compare session with current request parameters // Reset submethod when method changes to avoid form mismatch errors if ( !empty( $oldData['payment_method'] ) && !empty( $oldData['payment_submethod'] ) ) { - // Cut down version of the normalization from DonationData - $newMethod = null; - foreach( array( 'payment_method', 'paymentmethod' ) as $key ) { - if ( $this->request->getVal( $key ) ) { - $newMethod = $this->request->getVal( $key ); - } - } + $newMethod = $this->request->getVal( 'payment_method' ); if ( $newMethod ) { $parts = explode( '.', $newMethod ); $newMethod = $parts[0]; @@ -2995,20 +3026,6 @@ return md5( $token . $padding ); } - /** - * Establish an 'edit' token to help prevent CSRF, etc. - * - * We use this in place of $wgUser->editToken() b/c currently - * $wgUser->editToken() is broken (apparently by design) for - * anonymous users. Using $wgUser->editToken() currently exposes - * a security risk for non-authenticated users. Until this is - * resolved in $wgUser, we'll use our own methods for token - * handling. - * - * Public so the api can get to it. - * - * @return string - */ public function token_getSaltedSessionToken() { // make sure we have a session open for tracking a CSRF-prevention token $this->session_ensure(); @@ -3075,7 +3092,7 @@ * token_getSaltedSessionToken() will start off the process if this is a * first load, and there's no saved token in the session yet. * @staticvar string $match - * @return type + * @return bool */ protected function token_checkTokens() { static $match = null; //because we only want to do this once per load. diff --git a/gateway_common/i18n/interface/ba.json b/gateway_common/i18n/interface/ba.json index a43ef43..0d6df0a 100644 --- a/gateway_common/i18n/interface/ba.json +++ b/gateway_common/i18n/interface/ba.json @@ -11,7 +11,8 @@ "Аҡҡашҡа", "Мухамадеева", "Азат Хәлилов", - "З. ӘЙЛЕ" + "З. ӘЙЛЕ", + "Айбикә" ] }, "donate_interface": "Викимедиа Фондына ярҙам", @@ -393,6 +394,14 @@ "apihelp-donate-param-street": "Адрестың беренсе юлы.", "apihelp-donate-param-street_supplemental": "Адрестың икенсе юлы.", "apihelp-donate-param-city": "Ҡала.", + "apihelp-donate-param-zip": "Почта индексы", + "apihelp-donate-param-emailAdd": "Электрон почта адресы", + "apihelp-donate-param-country": "Илдең коды", + "apihelp-donate-param-card_num": "Кредит картаһының номеры", + "apihelp-donate-param-card_type": "Кредит картаһының төрө", + "apihelp-donate-param-expiration": "Һуңғы ҡулланыу ваҡыты:", + "apihelp-donate-param-cvv": "CVV хәүефһеҙлеге коды", + "apihelp-donate-param-payment_method": "Ҡулланылған түләү ысулы", "apihelp-donate-param-language": "Тел коды.", "apihelp-donate-example-1": "Хәйриә ярҙамы индерергә" } diff --git a/gateway_common/i18n/interface/ksh.json b/gateway_common/i18n/interface/ksh.json index 0a27a03..1622139 100644 --- a/gateway_common/i18n/interface/ksh.json +++ b/gateway_common/i18n/interface/ksh.json @@ -206,14 +206,14 @@ "donate_interface-error-msg-genaricrequired": "Dat kamm_er nit fottlohße", "donate_interface-error-msg-country-calc": "Fähler - mer künne Ding Schpände em Momang nit aannämme.", "donate_interface-error-msg-fiscal_number": "de Steuernommer enn.", - "donate_interface-error-msg-fiscal_number-ar": "<i lang=\"en\">DNI</i>", + "donate_interface-error-msg-fiscal_number-ar": "<i lang=\"es\" xml:lang=\"es\" dir=\"es\" title=\"(Documento Nacional de Identidad)\">DNI</i>", "donate_interface-error-msg-fiscal_number-bo": "<i lang=\"en\">NIT</i>", - "donate_interface-error-msg-fiscal_number-br": "<i lang=\"en\">CPF/CNPJ</i>", + "donate_interface-error-msg-fiscal_number-br": "<i lang=\"br\" xml:lang=\"br\" dir=\"br\" title=\"(Cadastro de Pessoas Físicas) / (Cadastro Nacional de Pessoas Jurídicas)\">CPF/CNPJ</i>", "donate_interface-error-msg-fiscal_number-cl": "<i lang=\"en\">RUT</i>", - "donate_interface-error-msg-fiscal_number-co": "<i lang=\"en\">CC</i>", - "donate_interface-error-msg-fiscal_number-mx": "<i lang=\"en\">CURP/RFC/IFE</i>", - "donate_interface-error-msg-fiscal_number-pe": "<i lang=\"en\">DNI</i>", - "donate_interface-error-msg-fiscal_number-uy": "<i lang=\"en\">CI</i>", + "donate_interface-error-msg-fiscal_number-co": "<i lang=\"es\" xml:lang=\"es\" dir=\"es\" title=\"(Cédula de Ciudadanía)\">CC</i>", + "donate_interface-error-msg-fiscal_number-mx": "<i lang=\"es\" xml:lang=\"es\" dir=\"es\" title=\"(Clave Única de Registro de Población) / (Registro Federal de Contribuyentes) / (Instituto Federal Electoral)\">CURP/RFC/IFE</i>", + "donate_interface-error-msg-fiscal_number-pe": "<i lang=\"es\" xml:lang=\"es\" dir=\"es\" title=\"(Documento Nacional de Identidad)\">DNI</i>", + "donate_interface-error-msg-fiscal_number-uy": "<i lang=\"es\" xml:lang=\"es\" dir=\"es\" title=\"(Cédula de Identidad)\">CI</i>", "donate_interface-donate-error-try-a-different-card": "Bess_esu jood_un donn et [$1 med en ander Kreditkaate probeere], uder [$2 nämm en ander Müjjeleschkeit zom Spände], uder schriiv ons_en <i lang=\"en\">e-mail</i> aan di Adräß: $3.", "donate_interface-donate-error-try-a-different-card-html": "Bes esu johd un versöhg et med ene annder Kaad udder <a href=\"$1\">donn obb enem anndere Wääsch jät jävve</a> udder schriiv en <i lang=\"en\" lang=\"xml:en\" dir=\"ltr\" title=\"de eläktrohnesche Poß\">e-mail</i> aan <a href=\"mailto:$2\">$2</a>", "donate_interface-donate-error-try-again-html": "Bes esu johd un <a href=\"$1\">versöhg norr-ens</i> udder donn <a href=\"$2\">donn obb enem anndere Wääsch jät jävve</a> udder schriiv en <i lang=\"en\" lang=\"xml:en\" dir=\"ltr\" title=\"de eläktrohnesche Poß\">e-mail</i> aan <a href=\"mailto:$3\">$3</a>", diff --git a/gateway_common/i18n/interface/qqq.json b/gateway_common/i18n/interface/qqq.json index 983886f..e409354 100644 --- a/gateway_common/i18n/interface/qqq.json +++ b/gateway_common/i18n/interface/qqq.json @@ -236,7 +236,7 @@ "donate_interface-error-msg-fiscal_number": "{{Identical|Fiscal number}}\n\nGeneric term for the donor's tax identification number, known variously as a VAT identification number, business number, etc. Country-specific variants should be given a new message key with a hyphen and the country code appended.", "donate_interface-error-msg-fiscal_number-ar": "{{Identical|DNI}}\n\nArgentina-specific term for the fiscal number or tax id. This is the DNI (Documento Nacional de Identidad) number assigned by the Argentine government.", "donate_interface-error-msg-fiscal_number-bo": "{{Identical|NIT}}\n\nBolivia-specific term for the fiscal number or tax id. This is the NIT (Número de Identificación Tributaria) assigned by the Bolivian government.", - "donate_interface-error-msg-fiscal_number-br": "{{Identical|CPF/CNPJ}}\n\nBrazil-specific term for the fiscal number. This is the CPF (Cadastro de Pessoas Físicas) or CNPJ (Cadastro Nacional de Pessoas Jurídicas) number issued by the government of Brazil. Probably only needs to be translated into Portuguese, Spanish, Italian, and German.", + "donate_interface-error-msg-fiscal_number-br": "{{Identical|CPF/CNPJ}}\n\nBrazil-specific term for the fiscal number. This is the CPF (Cadastro de Pessoas Físicas) or CNPJ (Cadastro Nacional de Pessoas Jurídicas) number issued by the government of Brazil. Probably only needs to be translated into Portuguese, Spanish, Italian, and the languages used in Germany.", "donate_interface-error-msg-fiscal_number-cl": "{{Identical|RUT}}\n\nChile-specific term for the fiscal number or tax id. This is the RUL (Rol Único Tributario) assigned by the Chilean government.", "donate_interface-error-msg-fiscal_number-co": "{{Identical|CC}}\n\nColombia-specific term for the fiscal number or tax id. This is the CC (Cédula de Ciudadanía) number assigned by the Colombian government.", "donate_interface-error-msg-fiscal_number-mx": "{{Identical|CURP/RFC/IFE}}\n\nMexico-specific term for the fiscal number or tax id. This is the CURP (Clave Única de Registro de Población), RFC (Registro Federal de Contribuyentes) or IFE (Instituto Federal Electoral) number assigned by the Mexican government.", diff --git a/gateway_forms/includes/alipay.png b/gateway_forms/includes/alipay.png index f770f66..2dbc3ec 100644 --- a/gateway_forms/includes/alipay.png +++ b/gateway_forms/includes/alipay.png Binary files differ diff --git a/gateway_forms/includes/bank-banco_de_chile.png b/gateway_forms/includes/bank-banco_de_chile.png deleted file mode 100644 index 9e6500c..0000000 --- a/gateway_forms/includes/bank-banco_de_chile.png +++ /dev/null Binary files differ diff --git a/gateway_forms/includes/bank-banco_do_brasil.png b/gateway_forms/includes/bank-banco_do_brasil.png index a39e477..68ea402 100644 --- a/gateway_forms/includes/bank-banco_do_brasil.png +++ b/gateway_forms/includes/bank-banco_do_brasil.png Binary files differ diff --git a/gateway_forms/includes/bank-bradesco.png b/gateway_forms/includes/bank-bradesco.png index c80f2b1..40c056f 100644 --- a/gateway_forms/includes/bank-bradesco.png +++ b/gateway_forms/includes/bank-bradesco.png Binary files differ diff --git a/gateway_forms/includes/bank-caixa.png b/gateway_forms/includes/bank-caixa.png index 411a736..70df4e7 100644 --- a/gateway_forms/includes/bank-caixa.png +++ b/gateway_forms/includes/bank-caixa.png Binary files differ diff --git a/gateway_forms/includes/bank-hsbc.png b/gateway_forms/includes/bank-hsbc.png index 9ebb386..17f6765 100644 --- a/gateway_forms/includes/bank-hsbc.png +++ b/gateway_forms/includes/bank-hsbc.png Binary files differ diff --git a/gateway_forms/includes/bank-itau.png b/gateway_forms/includes/bank-itau.png index d3b1ed8..2c618b4 100644 --- a/gateway_forms/includes/bank-itau.png +++ b/gateway_forms/includes/bank-itau.png Binary files differ diff --git a/gateway_forms/includes/bank-santander.png b/gateway_forms/includes/bank-santander.png index 6f58942..8051544 100644 --- a/gateway_forms/includes/bank-santander.png +++ b/gateway_forms/includes/bank-santander.png Binary files differ diff --git a/gateway_forms/includes/bank-webpay.png b/gateway_forms/includes/bank-webpay.png index ab03ba3..a9308cd 100644 --- a/gateway_forms/includes/bank-webpay.png +++ b/gateway_forms/includes/bank-webpay.png Binary files differ diff --git a/gateway_forms/includes/card-amex-lg.png b/gateway_forms/includes/card-amex-lg.png index 6ea5e6a..3eb0cb0 100644 --- a/gateway_forms/includes/card-amex-lg.png +++ b/gateway_forms/includes/card-amex-lg.png Binary files differ diff --git a/gateway_forms/includes/card-argencard.png b/gateway_forms/includes/card-argencard.png index 1681254..10a6867 100644 --- a/gateway_forms/includes/card-argencard.png +++ b/gateway_forms/includes/card-argencard.png Binary files differ diff --git a/gateway_forms/includes/card-cabal.png b/gateway_forms/includes/card-cabal.png index 2a54e3c..7f73dc0 100644 --- a/gateway_forms/includes/card-cabal.png +++ b/gateway_forms/includes/card-cabal.png Binary files differ diff --git a/gateway_forms/includes/card-cmr.png b/gateway_forms/includes/card-cmr.png index 63b6845..17d18e6 100644 --- a/gateway_forms/includes/card-cmr.png +++ b/gateway_forms/includes/card-cmr.png Binary files differ diff --git a/gateway_forms/includes/card-magna.png b/gateway_forms/includes/card-magna.png index 620039e..07b43fb 100644 --- a/gateway_forms/includes/card-magna.png +++ b/gateway_forms/includes/card-magna.png Binary files differ diff --git a/gateway_forms/includes/card-mc-lg.png b/gateway_forms/includes/card-mc-lg.png index 17015ee..f1597b9 100644 --- a/gateway_forms/includes/card-mc-lg.png +++ b/gateway_forms/includes/card-mc-lg.png Binary files differ diff --git a/gateway_forms/includes/card-mercadolivre.png b/gateway_forms/includes/card-mercadolivre.png index fe5b2ff..2820d5d 100644 --- a/gateway_forms/includes/card-mercadolivre.png +++ b/gateway_forms/includes/card-mercadolivre.png Binary files differ diff --git a/gateway_forms/includes/card-naranja.png b/gateway_forms/includes/card-naranja.png index 7b488fe..0bccd38 100644 --- a/gateway_forms/includes/card-naranja.png +++ b/gateway_forms/includes/card-naranja.png Binary files differ diff --git a/gateway_forms/includes/card-nativa.png b/gateway_forms/includes/card-nativa.png index fedacef..c790050 100644 --- a/gateway_forms/includes/card-nativa.png +++ b/gateway_forms/includes/card-nativa.png Binary files differ diff --git a/gateway_forms/includes/card-presto.png b/gateway_forms/includes/card-presto.png index d4506fc..258a801 100644 --- a/gateway_forms/includes/card-presto.png +++ b/gateway_forms/includes/card-presto.png Binary files differ diff --git a/gateway_forms/includes/card-servipag.png b/gateway_forms/includes/card-servipag.png index de9b0bf..47ee0eb 100644 --- a/gateway_forms/includes/card-servipag.png +++ b/gateway_forms/includes/card-servipag.png Binary files differ diff --git a/gateway_forms/includes/card-shopping.png b/gateway_forms/includes/card-shopping.png index 7a8217b..db3da1c 100644 --- a/gateway_forms/includes/card-shopping.png +++ b/gateway_forms/includes/card-shopping.png Binary files differ diff --git a/gateway_forms/includes/cash-banamex.png b/gateway_forms/includes/cash-banamex.png index 1ac55ba..bc77e99 100644 --- a/gateway_forms/includes/cash-banamex.png +++ b/gateway_forms/includes/cash-banamex.png Binary files differ diff --git a/gateway_forms/includes/cash-bancomer.png b/gateway_forms/includes/cash-bancomer.png index 791a518..30d15f4 100644 --- a/gateway_forms/includes/cash-bancomer.png +++ b/gateway_forms/includes/cash-bancomer.png Binary files differ diff --git a/gateway_forms/includes/cash-davivienda.png b/gateway_forms/includes/cash-davivienda.png index db9a74b..76c569c 100644 --- a/gateway_forms/includes/cash-davivienda.png +++ b/gateway_forms/includes/cash-davivienda.png Binary files differ diff --git a/gateway_forms/includes/cash-efecty.png b/gateway_forms/includes/cash-efecty.png index eaaec90..25392b6 100644 --- a/gateway_forms/includes/cash-efecty.png +++ b/gateway_forms/includes/cash-efecty.png Binary files differ diff --git a/gateway_forms/includes/cash-oxxo.png b/gateway_forms/includes/cash-oxxo.png index e3ed1d5..d9ae25c 100644 --- a/gateway_forms/includes/cash-oxxo.png +++ b/gateway_forms/includes/cash-oxxo.png Binary files differ diff --git a/gateway_forms/includes/cash-pago-efectivo.png b/gateway_forms/includes/cash-pago-efectivo.png index 6c0007b..0e56df4 100644 --- a/gateway_forms/includes/cash-pago-efectivo.png +++ b/gateway_forms/includes/cash-pago-efectivo.png Binary files differ diff --git a/gateway_forms/includes/cash-pago-facil.png b/gateway_forms/includes/cash-pago-facil.png index d0476c7..f7a4579 100644 --- a/gateway_forms/includes/cash-pago-facil.png +++ b/gateway_forms/includes/cash-pago-facil.png Binary files differ diff --git a/gateway_forms/includes/cash-provencia-pagos.png b/gateway_forms/includes/cash-provencia-pagos.png index 5e7c48e..6f78b10 100644 --- a/gateway_forms/includes/cash-provencia-pagos.png +++ b/gateway_forms/includes/cash-provencia-pagos.png Binary files differ diff --git a/gateway_forms/includes/cash-rapipago.png b/gateway_forms/includes/cash-rapipago.png index 2ed1682..57665e4 100644 --- a/gateway_forms/includes/cash-rapipago.png +++ b/gateway_forms/includes/cash-rapipago.png Binary files differ diff --git a/gateway_forms/includes/cash-red-pagos.png b/gateway_forms/includes/cash-red-pagos.png index a60e309..15d01c0 100644 --- a/gateway_forms/includes/cash-red-pagos.png +++ b/gateway_forms/includes/cash-red-pagos.png Binary files differ diff --git a/gateway_forms/includes/paypal.png b/gateway_forms/includes/paypal.png index 02645d5..3d3c7d1 100644 --- a/gateway_forms/includes/paypal.png +++ b/gateway_forms/includes/paypal.png Binary files differ diff --git a/gateway_forms/includes/questionmark.png b/gateway_forms/includes/questionmark.png index f9e9edc..3a665b9 100644 --- a/gateway_forms/includes/questionmark.png +++ b/gateway_forms/includes/questionmark.png Binary files differ diff --git a/gateway_forms/includes/wmlogo_blue.png b/gateway_forms/includes/wmlogo_blue.png index e6819a5..92ba47d 100644 --- a/gateway_forms/includes/wmlogo_blue.png +++ b/gateway_forms/includes/wmlogo_blue.png Binary files differ diff --git a/gateway_forms/includes/yandex.png b/gateway_forms/includes/yandex.png index 7d052f8..0ebd7d8 100644 --- a/gateway_forms/includes/yandex.png +++ b/gateway_forms/includes/yandex.png Binary files differ diff --git a/gateway_forms/mustache/forms.css b/gateway_forms/mustache/forms.css index 1f8e34c..e06069d 100644 --- a/gateway_forms/mustache/forms.css +++ b/gateway_forms/mustache/forms.css @@ -367,8 +367,8 @@ -webkit-box-shadow: inset 0 1px 4px rgba(0,0,1,.5); box-shadow: inset 0 1px 4px rgba(0,0,1,.5); } -.amount_header span.hidden, input.hidden, .amount_header select.hidden { - display: none; +.hidden { + display: none !important; } #overlay { z-index: 999; diff --git a/gateway_forms/rapidhtml/css/images/button-disabled.png b/gateway_forms/rapidhtml/css/images/button-disabled.png index 516e33f..c58085b 100644 --- a/gateway_forms/rapidhtml/css/images/button-disabled.png +++ b/gateway_forms/rapidhtml/css/images/button-disabled.png Binary files differ diff --git a/gateway_forms/rapidhtml/css/images/button-down.png b/gateway_forms/rapidhtml/css/images/button-down.png index 0c1d530..fc1055d 100644 --- a/gateway_forms/rapidhtml/css/images/button-down.png +++ b/gateway_forms/rapidhtml/css/images/button-down.png Binary files differ diff --git a/gateway_forms/rapidhtml/css/images/button-off-green.png b/gateway_forms/rapidhtml/css/images/button-off-green.png index 8a4777b..b4933c2 100644 --- a/gateway_forms/rapidhtml/css/images/button-off-green.png +++ b/gateway_forms/rapidhtml/css/images/button-off-green.png Binary files differ diff --git a/gateway_forms/rapidhtml/css/images/close.png b/gateway_forms/rapidhtml/css/images/close.png index 2c706ec..e6a8796 100644 --- a/gateway_forms/rapidhtml/css/images/close.png +++ b/gateway_forms/rapidhtml/css/images/close.png Binary files differ diff --git a/gateway_forms/rapidhtml/css/images/ui-bg_highlight-soft_100_ffffff_1x100.png b/gateway_forms/rapidhtml/css/images/ui-bg_highlight-soft_100_ffffff_1x100.png index 14d847b..b7bd43f 100644 --- a/gateway_forms/rapidhtml/css/images/ui-bg_highlight-soft_100_ffffff_1x100.png +++ b/gateway_forms/rapidhtml/css/images/ui-bg_highlight-soft_100_ffffff_1x100.png Binary files differ diff --git a/globalcollect_gateway/GlobalCollectOrphanRectifier.php b/globalcollect_gateway/GlobalCollectOrphanRectifier.php index 005bc54..7903d69 100644 --- a/globalcollect_gateway/GlobalCollectOrphanRectifier.php +++ b/globalcollect_gateway/GlobalCollectOrphanRectifier.php @@ -201,9 +201,10 @@ /** * Gets the global setting for the key passed in. - * @param type $key + * @param string $key * * FIXME: Reuse GatewayAdapter::getGlobal. + * @return mixed */ protected static function getOrphanGlobal( $key ){ global $wgDonationInterfaceOrphanCron; diff --git a/globalcollect_gateway/config/currencies.yaml b/globalcollect_gateway/config/currencies.yaml new file mode 100644 index 0000000..647c3cf --- /dev/null +++ b/globalcollect_gateway/config/currencies.yaml @@ -0,0 +1,85 @@ +- AED # UAE dirham +- ARS # Argentinian peso +- AUD # Australian dollar +- BBD # Barbadian dollar +- BDT # Bagladesh taka +- BGN # Bulgarian lev +- BHD # Bahraini dinar +- BMD # Bermudian dollar +- BND # Brunei dollar +- BOB # Bolivia boliviano +- BRL # Brazilian real +# - Removed temporarily for WellsFargo (28/06/13) - BSD # Bahamian dollar +- BZD # Belize dollar +- CAD # Canadian dollar +- CHF # Swiss franc +- CLP # Chilean deso +- CNY # Chinese yuan renminbi +- COP # Colombia columb +- CRC # Costa Rican colon +- CZK # Czech koruna +- DKK # Danish krone +- DOP # Dominican peso +- DZD # Algerian dinar +- EEK # Estonian kroon +- EGP # Egyptian pound +- EUR # Euro +- GBP # British pound +- GTQ # Guatemala quetzal +- HKD # Hong Kong dollar +- HNL # Honduras lempira +- HRK # Croatian kuna +- HUF # Hungarian forint +- IDR # Indonesian rupiah +- ILS # Israeli shekel +- INR # Indian rupee +- JMD # Jamaican dollar +- JOD # Jordanian dinar +- JPY # Japanese yen +- KES # Kenyan shilling +- KRW # South Korean won +# - Removed temporarily for WellsFargo (28/06/13) - KYD # Cayman Islands dollar +- KZT # Kazakhstani tenge +- LBP # Lebanese pound +- LKR # Sri Lankan rupee +- LTL # Lithuanian litas +- LVL # Latvian lats +- MAD # Moroccan dirham +- MKD # Macedonia denar +- MUR # Mauritius rupee +- MVR # Maldives rufiyaa +- MXN # Mexican peso +- MYR # Malaysian ringgit +- NIO # Nicaragua Cordoba +- NOK # Norwegian krone +- NZD # New Zealand dollar +- OMR # Omani rial +- PAB # Panamanian balboa +- PEN # Peru nuevo sol +- PHP # Philippine peso +- PKR # Pakistani rupee +- PLN # Polish złoty +# - Removed temporarily for WellsFargo (23/05/13) - PYG # Paraguayan guaraní +- QAR # Qatari rial +- RON # Romanian leu +- RUB # Russian ruble +- SAR # Saudi riyal +- SEK # Swedish krona +- SGD # Singapore dollar +- SVC # Salvadoran colón +- THB # Thai baht +- TJS # Tajikistani Somoni +- TND # Tunisan dinar +- TRY # Turkish lira +- TTD # Trinidad and Tobago dollar +- TWD # New Taiwan dollar +- UAH # Ukrainian hryvnia +- UYU # Uruguayan peso +- USD # U.S. dollar +# - Removed temporarily for WellsFargo (28/06/13) - UZS # Uzbekistani som +# - removed temporarily (Worldpay) - VND # Vietnamese dong +- VEF # Venezuelan bolívar +- XAF # Central African CFA franc +- XCD # East Caribbean dollar +# - Removed temporarily for WellsFargo (28/06/13) - XOF # West African CFA franc +- ZAR # South African rand diff --git a/globalcollect_gateway/config/data_constraints.yaml b/globalcollect_gateway/config/data_constraints.yaml new file mode 100644 index 0000000..e435831 --- /dev/null +++ b/globalcollect_gateway/config/data_constraints.yaml @@ -0,0 +1,208 @@ +# General fields +# ACCOUNTHOLDER: AN50 +account_holder: + type: alphanumeric + length: 50 +# ACCOUNTNAME: AN35 +account_name: + type: alphanumeric + length: 35 +# ACCOUNTNUMBER: AN30 +account_number: + type: alphanumeric + length: 30 +# ADDRESSLINE1E: AN35 +address_line_1e: + type: alphanumeric + length: 35 +# ADDRESSLINE2: AN35 +address_line_2: + type: alphanumeric + length: 35 +# ADDRESSLINE3: AN35 +address_line_3: + type: alphanumeric + length: 35 +# ADDRESSLINE4: AN35 +address_line_4: + type: alphanumeric + length: 35 +# ATTEMPTID: N5 +attempt_id: + type: numeric + length: 5 +# Did not find this one +# AUTHORISATIONID: AN18 +authorization_id: + type: alphanumeric + length: 18 +# AMOUNT: N12 +amount: + type: numeric + length: 12 +# BANKACCOUNTNUMBER: AN50 +bank_account_number: + type: alphanumeric + length: 50 +# BANKAGENZIA: AN30 +bank_agenzia: + type: alphanumeric + length: 30 +# BANKCHECKDIGIT: AN2 +bank_check_digit: + type: alphanumeric + length: 2 +# BANKCODE: N5 +bank_code: + type: numeric + length: 5 +# BANKFILIALE: AN30 +bank_filiale: + type: alphanumeric + length: 30 +# BANKNAME: AN40 +bank_name: + type: alphanumeric + length: 40 +# BRANCHCODE: N5 +branch_code: + type: numeric + length: 5 +# CITY: AN40 +city: + type: alphanumeric + length: 40 +# COUNTRYCODE: AN2 +country: + type: alphanumeric + length: 2 +# COUNTRYCODEBANK: AN2 +country_code_bank: + type: alphanumeric + length: 2 +# COUNTRYDESCRIPTION: AN50 +country_description: + type: alphanumeric + length: 50 +# CUSTOMERBANKCITY: AN50 +customer_bank_city: + type: alphanumeric + length: 50 +# CUSTOMERBANKSTREET: AN30 +customer_bank_street: + type: alphanumeric + length: 30 +# CUSTOMERBANKNUMBER: N5 +customer_bank_number: + type: numeric + length: 5 +# CUSTOMERBANKZIP: AN10 +customer_bank_zip: + type: alphanumeric + length: 10 +# CREDITCARDNUMBER: N19 +card_num: + type: numeric + length: 19 +# CURRENCYCODE: AN3 +currency_code: + type: alphanumeric + length: 3 +# CVV: N4 +cvv: + type: numeric + length: 4 +# DATECOLLECT: D8 YYYYMMDD +date_collect: + type: date + length: 8 +# DIRECTDEBITTEXT: AN50 +direct_debit_text: + type: alphanumeric + length: 50 +# DOMICILIO: AN30 +domicilio: + type: alphanumeric + length: 30 +# EFFORTID: N5 +effort_id: + type: numeric + length: 5 +# EMAIL: AN70 +email: + type: alphanumeric + length: 70 +# EXPIRYDATE: N4 MMYY +expiration: + type: numeric + length: 4 +# FIRSTNAME: AN15 +fname: + type: alphanumeric + length: 15 +# IBAN: AN50 (AN21 on direct debit) +iban: + type: alphanumeric + length: 50 +# IPADDRESS: AN32 +user_ip: + type: alphanumeric + length: 32 +# ISSUERID: N4 +issuer_id: + type: numeric + length: 4 +# LANGUAGECODE: AN2 +language: + type: alphanumeric + length: 2 +# ORDERID: N10 +order_id: + type: numeric + length: 10 +# PAYMENTPRODUCTID +payment_product: + type: numeric + length: 5 +# PAYMENTREFERENCE: AN20 +payment_reference: + type: alphanumeric + length: 20 +# PROVINCIA: AN30 +provincia: + type: alphanumeric + length: 30 +# RETURNURL: AN512 +returnto: + type: alphanumeric + length: 512 +# SPECIALID: AN255 +special_id: + type: alphanumeric + length: 255 +# STATE: AN35 +state: + type: alphanumeric + length: 35 +# STREET: AN50 +street: + type: alphanumeric + length: 50 +# SURNAME: AN35 +lname: + type: alphanumeric + length: 35 +# SWIFTCODE: AN255 +# This is AN11 for several payment types we are not dealing with yet. +swift_code: + type: alphanumeric + length: 255 +# TRANSACTIONTYPE: AN2 +transaction_type: + type: alphanumeric + length: 2 +# ZIP: AN10 +zip: + type: alphanumeric + length: 10 + 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..f91ebab 100644 --- a/globalcollect_gateway/globalcollect.adapter.php +++ b/globalcollect_gateway/globalcollect.adapter.php @@ -59,173 +59,6 @@ } /** - * Define dataConstraints - */ - public function defineDataConstraints() { - - $this->dataConstraints = array( - - // General fields - - //'ACCOUNTHOLDER' => 'account_holder', AN50 - 'account_holder' => array( 'type' => 'alphanumeric', 'length' => 50, ), - - //'ACCOUNTNAME' => 'account_name' AN35 - 'account_name' => array( 'type' => 'alphanumeric', 'length' => 35, ), - - //'ACCOUNTNUMBER' => 'account_number' AN30 - 'account_number' => array( 'type' => 'alphanumeric', 'length' => 30, ), - - //'ADDRESSLINE1E' => 'address_line_1e' AN35 - 'address_line_1e' => array( 'type' => 'alphanumeric', 'length' => 35, ), - - //'ADDRESSLINE2' => 'address_line_2' AN35 - 'address_line_2' => array( 'type' => 'alphanumeric', 'length' => 35, ), - - //'ADDRESSLINE3' => 'address_line_3' AN35 - 'address_line_3' => array( 'type' => 'alphanumeric', 'length' => 35, ), - - //'ADDRESSLINE4' => 'address_line_4' AN35 - 'address_line_4' => array( 'type' => 'alphanumeric', 'length' => 35, ), - - //'ATTEMPTID' => 'attempt_id' N5 - 'attempt_id' => array( 'type' => 'numeric', 'length' => 5, ), - - // Did not find this one - //'AUTHORISATIONID' => 'authorization_id' AN18 - 'authorization_id' => array( 'type' => 'alphanumeric', 'length' => 18, ), - - //'AMOUNT' => 'amount' N12 - 'amount' => array( 'type' => 'numeric', 'length' => 12, ), - - //'BANKACCOUNTNUMBER' => 'bank_account_number' AN50 - 'bank_account_number' => array( 'type' => 'alphanumeric', 'length' => 50, ), - - //'BANKAGENZIA' => 'bank_agenzia' AN30 - 'bank_agenzia' => array( 'type' => 'alphanumeric', 'length' => 30, ), - - //'BANKCHECKDIGIT' => 'bank_check_digit' AN2 - 'bank_check_digit' => array( 'type' => 'alphanumeric', 'length' => 2, ), - - //'BANKCODE' => 'bank_code' N5 - 'bank_code' => array( 'type' => 'numeric', 'length' => 5, ), - - //'BANKFILIALE' => 'bank_filiale' AN30 - 'bank_filiale' => array( 'type' => 'alphanumeric', 'length' => 30, ), - - //'BANKNAME' => 'bank_name' AN40 - 'bank_name' => array( 'type' => 'alphanumeric', 'length' => 40, ), - - //'BRANCHCODE' => 'branch_code' N5 - 'branch_code' => array( 'type' => 'numeric', 'length' => 5, ), - - //'CITY' => 'city' AN40 - 'city' => array( 'type' => 'alphanumeric', 'length' => 40, ), - - //'COUNTRYCODE' => 'country' AN2 - 'country' => array( 'type' => 'alphanumeric', 'length' => 2, ), - - //'COUNTRYCODEBANK' => 'country_code_bank' AN2 - 'country_code_bank' => array( 'type' => 'alphanumeric', 'length' => 2, ), - - //'COUNTRYDESCRIPTION' => 'country_description' AN50 - 'country_description' => array( 'type' => 'alphanumeric', 'length' => 50, ), - - //'CUSTOMERBANKCITY' => 'customer_bank_city' AN50 - 'customer_bank_city' => array( 'type' => 'alphanumeric', 'length' => 50, ), - - //'CUSTOMERBANKSTREET' => 'customer_bank_street' AN30 - 'customer_bank_street' => array( 'type' => 'alphanumeric', 'length' => 30, ), - - //'CUSTOMERBANKNUMBER' => 'customer_bank_number' N5 - 'customer_bank_number' => array( 'type' => 'numeric', 'length' => 5, ), - - //'CUSTOMERBANKZIP' => 'customer_bank_zip' AN10 - 'customer_bank_zip' => array( 'type' => 'alphanumeric', 'length' => 10, ), - - //'CREDITCARDNUMBER' => 'card_num' N19 - 'card_num' => array( 'type' => 'numeric', 'length' => 19, ), - - //'CURRENCYCODE' => 'currency_code' AN3 - 'currency_code' => array( 'type' => 'alphanumeric', 'length' => 3, ), - - //'CVV' => 'cvv' N4 - 'cvv' => array( 'type' => 'numeric', 'length' => 4, ), - - //'DATECOLLECT' => 'date_collect' D8 YYYYMMDD - 'date_collect' => array( 'type' => 'date', 'length' => 8, ), - - //'DIRECTDEBITTEXT' => 'direct_debit_text' AN50 - 'direct_debit_text' => array( 'type' => 'alphanumeric', 'length' => 50, ), - - //'DOMICILIO' => 'domicilio' AN30 - 'domicilio' => array( 'type' => 'alphanumeric', 'length' => 30, ), - - //'EFFORTID' => 'effort_id' N5 - 'effort_id' => array( 'type' => 'numeric', 'length' => 5, ), - - //'EMAIL' => 'email' AN70 - 'email' => array( 'type' => 'alphanumeric', 'length' => 70, ), - - //'EXPIRYDATE' => 'expiration' N4 MMYY - 'expiration' => array( 'type' => 'numeric', 'length' => 4, ), - - //'FIRSTNAME' => 'fname' AN15 - 'fname' => array( 'type' => 'alphanumeric', 'length' => 15, ), - - //'IBAN' => 'iban' AN50 - // IBAN is AN21 on direct debit - 'iban' => array( 'type' => 'alphanumeric', 'length' => 50, ), - - //'IPADDRESS' => 'user_ip' AN32 - 'user_ip' => array( 'type' => 'alphanumeric', 'length' => 32, ), - - //'ISSUERID' => 'issuer_id' N4 - 'issuer_id' => array( 'type' => 'numeric', 'length' => 4, ), - - //'LANGUAGECODE' => 'language' AN2 - 'language' => array( 'type' => 'alphanumeric', 'length' => 2, ), - - //'ORDERID' => 'order_id' N10 - 'order_id' => array( 'type' => 'numeric', 'length' => 10, ), - - //PAYMENTPRODUCTID - 'payment_product' => array( 'type' => 'numeric', 'length' => 5, ), - - //'PAYMENTREFERENCE' => 'payment_reference' AN20 - 'payment_reference' => array( 'type' => 'alphanumeric', 'length' => 20, ), - - //'PROVINCIA' => 'provincia' AN30 - 'provincia' => array( 'type' => 'alphanumeric', 'length' => 30, ), - - //'RETURNURL' => 'returnto' AN512 - 'returnto' => array( 'type' => 'alphanumeric', 'length' => 512, ), - - //'SPECIALID' => 'special_id' AN255 - 'special_id' => array( 'type' => 'alphanumeric', 'length' => 255, ), - - //'STATE' => 'state' AN35 - 'state' => array( 'type' => 'alphanumeric', 'length' => 35, ), - - //'STREET' => 'street' AN50 - 'street' => array( 'type' => 'alphanumeric', 'length' => 50, ), - - //'SURNAME' => 'lname' AN35 - 'lname' => array( 'type' => 'alphanumeric', 'length' => 35, ), - - //'SWIFTCODE' => 'swift_code' AN255 - // This is AN11 for several payment types we are not dealing with yet. - 'swift_code' => array( 'type' => 'alphanumeric', 'length' => 255, ), - - //'TRANSACTIONTYPE' => 'transaction_type' AN2 - 'transaction_type' => array( 'type' => 'alphanumeric', 'length' => 2, ), - - //'ZIP' => 'zip' AN10 - 'zip' => array( 'type' => 'alphanumeric', 'length' => 10, ), - ); - } - - /** * Define error_map * * @todo @@ -276,73 +109,6 @@ //'dbv-330' => 'globalcollect_gateway-response-dbv-330', // Check digit format is incorrect //'dbv-340' => 'globalcollect_gateway-response-dbv-340', // Branch code not submitted - ); - } - - /** - * 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 ); } @@ -1610,104 +1376,6 @@ } return $return; - } - - /** - * Gets all the currency codes appropriate for this gateway - * @param array $options data to filter on - * @return array of currency codes - * TODO: filter on country/method using form settings - */ - public function getCurrencies( $options = array() ) { - // If you update this list, also update the list in the exchange_rates drupal module. - $currencies = array( - 'AED', // UAE dirham - 'ARS', // Argentinian peso - 'AUD', // Australian dollar - 'BBD', // Barbadian dollar - 'BDT', // Bagladesh taka - 'BGN', // Bulgarian lev - 'BHD', // Bahraini dinar - 'BMD', // Bermudian dollar - 'BND', // Brunei dollar - 'BOB', // Bolivia boliviano - 'BRL', // Brazilian real -// - Removed temporarily for WellsFargo (28/06/13) 'BSD', // Bahamian dollar - 'BZD', // Belize dollar - 'CAD', // Canadian dollar - 'CHF', // Swiss franc - 'CLP', // Chilean deso - 'CNY', // Chinese yuan renminbi - 'COP', // Colombia columb - 'CRC', // Costa Rican colon - 'CZK', // Czech koruna - 'DKK', // Danish krone - 'DOP', // Dominican peso - 'DZD', // Algerian dinar - 'EEK', // Estonian kroon - 'EGP', // Egyptian pound - 'EUR', // Euro - 'GBP', // British pound - 'GTQ', // Guatemala quetzal - 'HKD', // Hong Kong dollar - 'HNL', // Honduras lempira - 'HRK', // Croatian kuna - 'HUF', // Hungarian forint - 'IDR', // Indonesian rupiah - 'ILS', // Israeli shekel - 'INR', // Indian rupee - 'JMD', // Jamaican dollar - 'JOD', // Jordanian dinar - 'JPY', // Japanese yen - 'KES', // Kenyan shilling - 'KRW', // South Korean won -// - Removed temporarily for WellsFargo (28/06/13) 'KYD', // Cayman Islands dollar - 'KZT', // Kazakhstani tenge - 'LBP', // Lebanese pound - 'LKR', // Sri Lankan rupee - 'LTL', // Lithuanian litas - 'LVL', // Latvian lats - 'MAD', // Moroccan dirham - 'MKD', // Macedonia denar - 'MUR', // Mauritius rupee - 'MVR', // Maldives rufiyaa - 'MXN', // Mexican peso - 'MYR', // Malaysian ringgit - 'NIO', // Nicaragua Cordoba - 'NOK', // Norwegian krone - 'NZD', // New Zealand dollar - 'OMR', // Omani rial - 'PAB', // Panamanian balboa - 'PEN', // Peru nuevo sol - 'PHP', // Philippine peso - 'PKR', // Pakistani rupee - 'PLN', // Polish złoty -// - Removed temporarily for WellsFargo (23/05/13) 'PYG', // Paraguayan guaraní - 'QAR', // Qatari rial - 'RON', // Romanian leu - 'RUB', // Russian ruble - 'SAR', // Saudi riyal - 'SEK', // Swedish krona - 'SGD', // Singapore dollar - 'SVC', // Salvadoran colón - 'THB', // Thai baht - 'TJS', // Tajikistani Somoni - 'TND', // Tunisan dinar - 'TRY', // Turkish lira - 'TTD', // Trinidad and Tobago dollar - 'TWD', // New Taiwan dollar - 'UAH', // Ukrainian hryvnia - 'UYU', // Uruguayan peso - 'USD', // U.S. dollar -// - Removed temporarily for WellsFargo (28/06/13) 'UZS', // Uzbekistani som -// - removed temporarily (Worldpay) 'VND', // Vietnamese dong - 'VEF', // Venezuelan bolívar - 'XAF', // Central African CFA franc - 'XCD', // East Caribbean dollar -// - Removed temporarily for WellsFargo (28/06/13) 'XOF', // West African CFA franc - 'ZAR', // South African rand - ); - return $currencies; } /** diff --git a/paypal_gateway/config/currencies.yaml b/paypal_gateway/config/currencies.yaml new file mode 100644 index 0000000..51369e9 --- /dev/null +++ b/paypal_gateway/config/currencies.yaml @@ -0,0 +1,27 @@ +# see https://www.x.com/developers/paypal/documentation-tools/api/currency-codes +# TODO: Investigate per-country support at this URL +# https://developer.paypal.com/docs/classic/api/currency_codes/#creditcard +- AUD +# - BRL # in-country only... it seems to work but I'm respecting the docs +- CAD +- CZK +- DKK +- EUR +- HKD +- HUF +- ILS +- JPY # no fractions +# - MYR # in-country only +- MXN +- NOK +- NZD +- PHP +- PLN +- GBP +# - SGD # Only available for singaporian entities +- SEK +- CHF +- TWD # no fractions +- THB +# - TRY # in-country only +- USD 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..6c2d359 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(); } @@ -72,8 +58,7 @@ function processResponse( $response ) { $this->transaction_response->setCommunicationStatus( true ); } - function defineDataConstraints() { - } + function defineOrderIDMeta() { $this->order_id_meta = array( 'generate' => false, @@ -227,37 +212,5 @@ $this->finalizeInternalStatus( FinalStatus::COMPLETE ); return $result; } - } - - public function getCurrencies( $options = array() ) { - // see https://www.x.com/developers/paypal/documentation-tools/api/currency-codes - // TODO: Investigate per-country support at this URL - // https://developer.paypal.com/docs/classic/api/currency_codes/#creditcard - return array( - 'AUD', - // 'BRL', // in-country only... it seems to work but I'm respecting the docs - 'CAD', - 'CZK', - 'DKK', - 'EUR', - 'HKD', - 'HUF', - 'ILS', - 'JPY', // no fractions - // 'MYR', // in-country only - 'MXN', - 'NOK', - 'NZD', - 'PHP', - 'PLN', - 'GBP', - /* 'SGD', // Only available for singaporian entities */ - 'SEK', - 'CHF', - 'TWD', // no fractions - 'THB', - // 'TRY', // in-country only - 'USD', - ); } } diff --git a/special/GatewayFormChooser.php b/special/GatewayFormChooser.php index 5512412..dcdb472 100644 --- a/special/GatewayFormChooser.php +++ b/special/GatewayFormChooser.php @@ -38,27 +38,20 @@ } $request = $this->getRequest(); - // Check multiple query string parameters, return the value of the - // first we find, or null if none have a value. - $getValForParams = function( $params ) use ( $request ) { - $params = ( array ) $params; - $val = null; - do { - $val = $request->getVal( array_shift( $params ), null ); - if ( $val === '' ) { - $val = null; - } - } while ( $val === null && !empty( $params ) ); + // Get a query string parameter or null if blank + $getValOrNull = function( $paramName ) use ( $request ) { + $val = $request->getVal( $paramName, null ); + if ( $val === '' ) { + $val = null; + } return $val; }; - $country = $getValForParams( 'country' ); - // Many banner links use non-standard names for the next three - // parameters. Prefer the standard names, but allow the old ones. - $currency = $getValForParams( array( 'currency_code', 'currency' ) ); - $paymentMethod = $getValForParams( array( 'payment_method', 'paymentmethod' ) ); - $paymentSubMethod = $getValForParams( array( 'payment_submethod', 'submethod' ) ); - $gateway = $getValForParams( 'gateway' ); + $country = $getValOrNull( 'country' ); + $currency = $getValOrNull( 'currency_code' ); + $paymentMethod = $getValOrNull( 'payment_method' ); + $paymentSubMethod = $getValOrNull( 'payment_submethod' ); + $gateway = $getValOrNull( 'gateway' ); $recurring = $this->getRequest()->getVal( 'recurring', false ); // FIXME: This is clearly going to go away before we deploy this bizniss. @@ -90,7 +83,7 @@ // Pass any other params that are set. We do not skip ffname or form_name because // we wish to retain the query string override. - $excludeKeys = array( 'paymentmethod', 'submethod', 'title', 'recurring' ); + $excludeKeys = array( 'title', 'recurring' ); foreach ( $this->getRequest()->getValues() as $key => $value ) { // Skip the required variables if ( !in_array( $key, $excludeKeys ) ) { @@ -173,7 +166,7 @@ } // set the default redirect - return self::getTitleFor( $specialpage )->getLocalUrl( $params ); + return self::getTitleFor( $specialpage )->getLocalURL( $params ); } /** @@ -364,7 +357,7 @@ /** * Checks to see if the ffname supplied is a valid form for the rest of the supplied params. - * @param type $ffname The form name to check. + * @param string $ffname The form name to check. * @param string $country Optional country code filter * @param string $currency Optional currency code filter * @param string $payment_method Optional payment method filter diff --git a/worldpay_gateway/WorldpayAccountName.php b/worldpay_gateway/WorldpayAccountName.php new file mode 100644 index 0000000..8f6e380 --- /dev/null +++ b/worldpay_gateway/WorldpayAccountName.php @@ -0,0 +1,10 @@ +<?php + +class WorldpayAccountName extends DonorFullName { + public function stage( GatewayType $adapter, $unstagedData, &$stagedData ) { + parent::stage( $adapter, $unstagedData, $stagedData ); + + // FIXME: how about we just use the generic field name. + $stagedData['wp_acctname'] = $stagedData['full_name']; + } +} diff --git a/worldpay_gateway/WorldpayCurrency.php b/worldpay_gateway/WorldpayCurrency.php new file mode 100644 index 0000000..86612f5 --- /dev/null +++ b/worldpay_gateway/WorldpayCurrency.php @@ -0,0 +1,11 @@ +<?php + +class WorldpayCurrency implements StagingHelper { + public function stage( GatewayType $adapter, $unstagedData, &$stagedData ) { + $currency = $unstagedData['currency_code']; + $codes = $adapter->getConfig( 'currencies' ); + if ( array_key_exists( $currency, $codes ) ) { + $stagedData['iso_currency_id'] = $codes[$currency]; + } + } +} diff --git a/worldpay_gateway/WorldpayEmail.php b/worldpay_gateway/WorldpayEmail.php new file mode 100644 index 0000000..f235284 --- /dev/null +++ b/worldpay_gateway/WorldpayEmail.php @@ -0,0 +1,11 @@ +<?php + +class WorldpayEmail implements StagingHelper { + /** + * Provide email search in the Worldpay console by hiding garishly mangled email in a bizarre field + */ + public function stage( GatewayType $adapter, $unstagedData, &$stagedData ) { + $alphanumeric = preg_replace('/[^0-9a-zA-Z]/', ' ', $stagedData['email']); + $stagedData['merchant_reference_2'] = $alphanumeric; + } +} diff --git a/worldpay_gateway/WorldpayMethodCodec.php b/worldpay_gateway/WorldpayMethodCodec.php new file mode 100644 index 0000000..3d28a9e --- /dev/null +++ b/worldpay_gateway/WorldpayMethodCodec.php @@ -0,0 +1,24 @@ +<?php + +class WorldpayMethodCodec implements UnstagingHelper { + public function unstage( GatewayType $adapter, $stagedData, &$unstagedData ) { + if ( empty( $stagedData['payment_method'] ) || empty( $stagedData['payment_submethod'] ) ) { + return; + } + $paymentMethod = $stagedData['payment_method']; + $paymentSubmethod = $stagedData['payment_submethod']; + if ( $paymentMethod == 'cc' ) { + $unstagedData['payment_submethod'] = + $this->get_payment_method_name_from_api_name( $adapter, $paymentSubmethod ); + } + } + + protected function get_payment_method_name_from_api_name ( GatewayType $adapter, $api_name ) { + foreach ( $adapter->getPaymentSubmethods() as $name => $info ) { + if ( $api_name === $info['api_name'] ) { + return $name; + } + } + return null; + } +} diff --git a/worldpay_gateway/WorldpayNarrativeStatement.php b/worldpay_gateway/WorldpayNarrativeStatement.php new file mode 100644 index 0000000..90d7a5d --- /dev/null +++ b/worldpay_gateway/WorldpayNarrativeStatement.php @@ -0,0 +1,10 @@ +<?php + +class WorldpayNarrativeStatement implements StagingHelper { + public function stage( GatewayType $adapter, $unstagedData, &$stagedData ) { + $stagedData['narrative_statement_1'] = WmfFramework::formatMessage( + 'donate_interface-statement', + $unstagedData['contribution_tracking_id'] + ); + } +} diff --git a/worldpay_gateway/WorldpayReturnto.php b/worldpay_gateway/WorldpayReturnto.php new file mode 100644 index 0000000..5a7821b --- /dev/null +++ b/worldpay_gateway/WorldpayReturnto.php @@ -0,0 +1,50 @@ +<?php + +class WorldpayReturnto implements StagingHelper { + public function stage( GatewayType $adapter, $unstagedData, &$stagedData ) { + global $wgServer, $wgArticlePath; + + // Rebuild the url with the token param. + + $arr_url = parse_url( + $wgServer . str_replace( + '$1', + 'Special:WorldpayGatewayResult', + $wgArticlePath + ) + ); + + $query = ''; + $first = true; + if ( isset( $arr_url['query'] ) ) { + parse_str( $arr_url['query'], $arr_query ); + } + // Worldpay decodes encoded URL unsafe characters in XML before storage, + // and sends them back that way in the return header. So anything you + // want to be returned encoded must be double-encoded[1], for example + // %2526 will get returned as %26 and decoded to &, while %26 will get + // returned as & and treated as a query string separator. + + // Additionally a properly encoded & will make their server respond + // MessageCode 302 (which means 'unavailable') unless it is wrapped in + // CDATA tags because godonlyknows + $arr_query['token'] = rawurlencode( $adapter->token_getSaltedSessionToken() ); + if ( !empty( $unstagedData['ffname'] ) ) { + $arr_query['ffname'] = rawurlencode( $unstagedData['ffname'] ); + } + if ( !empty( $unstagedData['amount'] ) ) { + $arr_query['amount'] = rawurlencode( $unstagedData['amount'] ); + } + foreach ( $arr_query as $key => $val ) { + $query .= ( $first ? '?' : '&' ) . $key . '=' . $val; + $first = false; + } + + $stagedData['returnto'] = rawurlencode( // [1] + $arr_url['scheme'] . '://' . + $arr_url['host'] . + $arr_url['path'] . + $query + ); + } +} diff --git a/worldpay_gateway/config/currencies.yaml b/worldpay_gateway/config/currencies.yaml new file mode 100644 index 0000000..fd1e9ca --- /dev/null +++ b/worldpay_gateway/config/currencies.yaml @@ -0,0 +1,123 @@ +# ISO Currency code letters to numbers (from appendix B of the +# integration manual). These are also apparently all the currencies +# that Worldpay can support. +AED: 784 +ALL: 8 +ANG: 532 +ARS: 32 +AUD: 36 +AWG: 533 +AZN: 944 +BAM: 977 +BBD: 52 +BDT: 50 +BGN: 975 +BHD: 48 +BMD: 60 +BND: 96 +BOB: 68 +BRL: 986 +BSD: 44 +BWP: 72 +BZD: 84 +CAD: 124 +CHF: 756 +CLP: 152 +CNY: 156 +COP: 170 +CRC: 188 +CUP: 192 +CZK: 203 +DJF: 262 +DKK: 208 +DOP: 214 +DZD: 12 +EGP: 818 +ERN: 232 +ETB: 230 +EUR: 978 +FJD: 242 +GBP: 826 +GEL: 981 +GIP: 292 +GTQ: 320 +GYD: 328 +HKD: 344 +HNL: 340 +HRK: 191 +HTG: 332 +HUF: 348 +IDR: 360 +ILS: 376 +INR: 356 +IQD: 368 +JMD: 388 +JOD: 400 +JPY: 392 +KES: 404 +KHR: 116 +KRW: 410 +KWD: 414 +KYD: 136 +KZT: 398 +LBP: 422 +LKR: 144 +LSL: 426 +LTL: 440 +LVL: 428 +MAD: 504 +MKD: 807 +MNT: 496 +MOP: 446 +MRO: 478 +MUR: 480 +MVR: 462 +MWK: 454 +MXN: 484 +MYR: 458 +MZN: 943 +NAD: 516 +NGN: 566 +NIO: 558 +NOK: 578 +NPR: 524 +NZD: 554 +OMR: 512 +PAB: 590 +PEN: 604 +PGK: 598 +PHP: 608 +PKR: 586 +PLN: 985 +PYG: 600 +QAR: 634 +RON: 946 +RSD: 941 +RUB: 643 +RWF: 646 +SAR: 682 +SCR: 690 +SEK: 752 +SGD: 702 +SLL: 694 +SVC: 222 +SYP: 760 +SZL: 748 +THB: 764 +TND: 788 +TRY: 949 +TTD: 780 +TWD: 901 +TZS: 834 +UAH: 980 +USD: 840 +UYU: 858 +UZS: 860 +VEF: 937 +XAF: 950 +XCD: 951 +XOF: 952 +XPF: 953 +YER: 886 +ZAR: 710 +ZMK: 894 diff --git a/worldpay_gateway/config/data_constraints.yaml b/worldpay_gateway/config/data_constraints.yaml new file mode 100644 index 0000000..8a2f917 --- /dev/null +++ b/worldpay_gateway/config/data_constraints.yaml @@ -0,0 +1,74 @@ +# AcctName +wp_acctname: + type: alphanumeric + length: 30 +# Address1 +street: + type: alphanumeric + length: 60 +# Amount +amount: + type: numeric +# CardId +wp_card_id: + type: numeric +# City +city: + type: alphanumeric + length: 60 +# CountryCode +country: + type: alphanumeric + length: 2 +# CurrencyId +iso_currency_id: + type: numeric +# CVN +cvv: + type: numeric +# Email +email: + type: alphanumeric + length: 50 +# FirstName +fname: + type: alphanumeric + length: 60 +# LastName +lname: + type: alphanumeric + length: 60 +# OrderNumber +order_id: + type: alphanumeric + length: 35 +# OTTRegion +region_code: + type: numeric +# OTTResultURL +returnto: + type: alphanumeric + length: 255 +# PTTID +wp_pttid: + type: numeric +# REMOTE_ADDR +user_ip: + type: alphanumeric + length: 100 +# StateCode +state: + type: alphanumeric + length: 60 +# ZipCode +zip: + type: alphanumeric + length: 30 +# MerchantReference2 +merchant_reference_2: + type: alphanumeric + length: 60 +# NarrativeStatement1 +narrative_statement_1: + type: alphanumeric + length: 50 diff --git a/worldpay_gateway/config/payment_methods.yaml b/worldpay_gateway/config/payment_methods.yaml new file mode 100644 index 0000000..ac4b7fd --- /dev/null +++ b/worldpay_gateway/config/payment_methods.yaml @@ -0,0 +1,7 @@ +cc: + label: 'Credit Cards' + validation: + name: true + email: true + address: false + amount: true diff --git a/worldpay_gateway/config/payment_submethods.yaml b/worldpay_gateway/config/payment_submethods.yaml new file mode 100644 index 0000000..78aeeda --- /dev/null +++ b/worldpay_gateway/config/payment_submethods.yaml @@ -0,0 +1,69 @@ +cb: + api_name: CB + countries: + FR: true + group: cc + logo: card-cb.png +visa: + api_name: VI + countries: + FR: true + group: cc + logo: card-visa.png +mc: + api_name: MC + countries: + FR: true + group: cc + logo: card-mc.png +amex: + api_name: AX + countries: + FR: true + group: cc + logo: card-amex.png +visa-beneficial: + api_name: BE + countries: { } + group: cc + logo: card-visa-beneficial.png +diners: + api_name: DC + countries: { } + group: cc + logo: card-diners.png +discover: + api_name: DI + countries: { } + group: cc + logo: card-discover.png +jcb: + api_name: JC + countries: { } + group: cc + logo: card-jcb.png +maestro: + api_name: MA + countries: { } + group: cc + logo: card-maestro.png +mc-debit: + api_name: MD + countries: { } + group: cc + logo: card-mc-debit.png +solo: + api_name: SW + countries: { } + group: cc + logo: card-solo.png +visa-debit: + api_name: VD + countries: { } + group: cc + logo: card-visa-debit.png +visa-electron: + api_name: VE + countries: { } + group: cc + logo: card-visa-electron.png 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 cd4cca9..f496d13 100644 --- a/worldpay_gateway/worldpay.adapter.php +++ b/worldpay_gateway/worldpay.adapter.php @@ -34,186 +34,6 @@ 'OTTResultURL' ); - // TODO we should store these keys in a config file - // TODO the way the cards are ordered on the page is the order of this - // array. make that a "weight" that could be controlled by a url param - static $CARD_INFO = array( - 'cb' => array( // Carte Bleu - 'api_name' => 'CB', - 'countries' => array( 'FR' => true ), - ), - 'visa' => array( - 'api_name' => 'VI', - 'countries' => array( 'FR' => true ), - ), - 'mc' => array( - 'api_name' => 'MC', - 'countries' => array( 'FR' => true ), - ), - 'amex' => array( - 'api_name' => 'AX', - 'countries' => array( 'FR' => true ), - ), - 'visa-beneficial' => array( - 'api_name' => 'BE', - ), - 'diners' => array( - 'api_name' => 'DC', - ), - 'discover' => array( - 'api_name' => 'DI', - ), - 'jcb' => array( - 'api_name' => 'JC', - ), - 'maestro' => array( - 'api_name' => 'MA', - ), - 'mc-debit' => array( - 'api_name' => 'MD', - ), - 'solo' => array( - 'api_name' => 'SW' - ), - 'visa-debit' => array( - 'api_name' => 'VD', - ), - 'visa-electron' => array( - 'api_name' => 'VE', - ), - '' /* TODO wat */ => array( - 'api_name' => 'XX', - ), - ); - - /** - * @var string[] ISO Currency code letters to numbers (from appendix B of the - * integration manual). These are also apparently all the currencies that - * Worldpay can support. - */ - static $CURRENCY_CODES = array( - 'AED' => 784, - 'ALL' => 8, - 'ANG' => 532, - 'ARS' => 32, - 'AUD' => 36, - 'AWG' => 533, - 'AZN' => 944, - 'BAM' => 977, - 'BBD' => 52, - 'BDT' => 50, - 'BGN' => 975, - 'BHD' => 48, - 'BMD' => 60, - 'BND' => 96, - 'BOB' => 68, - 'BRL' => 986, - 'BSD' => 44, - 'BWP' => 72, - 'BZD' => 84, - 'CAD' => 124, - 'CHF' => 756, - 'CLP' => 152, - 'CNY' => 156, - 'COP' => 170, - 'CRC' => 188, - 'CUP' => 192, - 'CZK' => 203, - 'DJF' => 262, - 'DKK' => 208, - 'DOP' => 214, - 'DZD' => 12, - 'EGP' => 818, - 'ERN' => 232, - 'ETB' => 230, - 'EUR' => 978, - 'FJD' => 242, - 'GBP' => 826, - 'GEL' => 981, - 'GIP' => 292, - 'GTQ' => 320, - 'GYD' => 328, - 'HKD' => 344, - 'HNL' => 340, - 'HRK' => 191, - 'HTG' => 332, - 'HUF' => 348, - 'IDR' => 360, - 'ILS' => 376, - 'INR' => 356, - 'IQD' => 368, - 'JMD' => 388, - 'JOD' => 400, - 'JPY' => 392, - 'KES' => 404, - 'KHR' => 116, - 'KRW' => 410, - 'KWD' => 414, - 'KYD' => 136, - 'KZT' => 398, - 'LBP' => 422, - 'LKR' => 144, - 'LSL' => 426, - 'LTL' => 440, - 'LVL' => 428, - 'MAD' => 504, - 'MKD' => 807, - 'MNT' => 496, - 'MOP' => 446, - 'MRO' => 478, - 'MUR' => 480, - 'MVR' => 462, - 'MWK' => 454, - 'MXN' => 484, - 'MYR' => 458, - 'MZN' => 943, - 'NAD' => 516, - 'NGN' => 566, - 'NIO' => 558, - 'NOK' => 578, - 'NPR' => 524, - 'NZD' => 554, - 'OMR' => 512, - 'PAB' => 590, - 'PEN' => 604, - 'PGK' => 598, - 'PHP' => 608, - 'PKR' => 586, - 'PLN' => 985, - 'PYG' => 600, - 'QAR' => 634, - 'RON' => 946, - 'RSD' => 941, - 'RUB' => 643, - 'RWF' => 646, - 'SAR' => 682, - 'SCR' => 690, - 'SEK' => 752, - 'SGD' => 702, - 'SLL' => 694, - 'SVC' => 222, - 'SYP' => 760, - 'SZL' => 748, - 'THB' => 764, - 'TND' => 788, - 'TRY' => 949, - 'TTD' => 780, - 'TWD' => 901, - 'TZS' => 834, - 'UAH' => 980, - 'USD' => 840, - 'UYU' => 858, - 'UZS' => 860, - 'VEF' => 937, - 'XAF' => 950, - 'XCD' => 951, - 'XOF' => 952, - 'XPF' => 953, - 'YER' => 886, - 'ZAR' => 710, - 'ZMK' => 894, - ); - public function __construct( $options = array ( ) ) { parent::__construct( $options ); } @@ -265,102 +85,6 @@ ); } - function defineDataConstraints() { - $this->dataConstraints = array( - // AcctName - 'wp_acctname' => array( 'type' => 'alphanumeric', 'length' => 30 ), - - // Address1 - 'street' => array( 'type' => 'alphanumeric', 'length' => 60 ), - - // Amount - 'amount' => array( 'type' => 'numeric' ), - - // CardId - 'wp_card_id' => array( 'type' => 'numeric' ), - - // City - 'city' => array( 'type' => 'alphanumeric', 'length' => 60 ), - - // CountryCode - 'country' => array( 'type' => 'alphanumeric', 'length' => 2 ), - - // CurrencyId - 'iso_currency_id' => array( 'type' => 'numeric' ), - - // CVN - 'cvv' => array( 'type' => 'numeric' ), - - // Email - 'email' => array( 'type' => 'alphanumeric', 'length' => 50 ), - - // FirstName - 'fname' => array( 'type' => 'alphanumeric', 'length' => 60 ), - - // LastName - 'lname' => array( 'type' => 'alphanumeric', 'length' => 60 ), - - // OrderNumber - 'order_id' => array( 'type' => 'alphanumeric', 'length' => 35 ), - - // OTTRegion - 'region_code' => array( 'type' => 'numeric' ), - - // OTTResultURL - 'returnto' => array( 'type' => 'alphanumeric', 'length' => 255 ), - - // PTTID - 'wp_pttid' => array( 'type' => 'numeric' ), - - // REMOTE_ADDR - 'user_ip' => array( 'type' => 'alphanumeric', 'length' => 100 ), - - // StateCode - 'state' => array( 'type' => 'alphanumeric', 'length' => 60 ), - - // ZipCode - 'zip' => array( 'type' => 'alphanumeric', 'length' => 30 ), - - // MerchantReference2 - 'merchant_reference_2' => array( 'type' => 'alphanumeric', 'length' => 60 ), - - // NarrativeStatement1 - 'narrative_statement_1' => array( 'type' => 'alphanumeric', 'length' => 50 ), - ); - } - - function definePaymentMethods() { - $this->payment_methods = array(); - $this->payment_methods['cc'] = array( - 'label' => 'Credit Cards', - 'validation' => array( - 'name' => true, - 'email' => true - ), - ); - - $this->payment_submethods = array(); - - foreach( self::$CARD_INFO as $name => $info ) { - - $countries = array(); - if ( isset( $info['countries'] ) ) { - $countries = $info['countries']; - } - $this->payment_submethods[$name] = array( - 'countries' => $countries, - 'group' => 'cc', - 'validation' => array( - 'name' => true, - 'email' => true, - 'address' => false, - 'amount' => true, - ), - 'logo' => "card-{$name}.png", - ); - } - } - /** * Worldpay doesn't check order numbers until settlement at * which point it's too late to do much about it. So; our order @@ -381,7 +105,7 @@ } public function getCurrencies( $options = array() ) { - return array_keys( self::$CURRENCY_CODES ); + return array_keys( $this->config['currencies'] ); } function defineTransactions() { @@ -770,49 +494,15 @@ $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(); - } - - private function get_payment_method_name_from_api_name ( $api_name ) { - foreach ( self::$CARD_INFO as $name => $info ) { - if ( $api_name === $info['api_name'] ) { - return $name; - } - } - return null; + $this->data_transformers = array_merge( parent::getCoreDataTransformers(), array( + new WorldpayAccountName(), + new WorldpayCurrency(), + new WorldpayEmail(), + new WorldpayMethodCodec(), + new WorldpayNarrativeStatement(), + new WorldpayReturnto(), + ) ); } /** @@ -829,6 +519,9 @@ && in_array( $this->staged_data['wp_storeid'], $this->account_config['SpecialSnowflakeStoreIDs'] ); } + public function getBasedir() { + return __DIR__; + } public function doPayment() { return PaymentResult::fromResults( $this->do_transaction( 'QueryAuthorizeDeposit' ), @@ -1111,85 +804,6 @@ parent::regenerateOrderID(); $order_id = $this->getData_Unstaged_Escaped( 'order_id' ); $this->set_transaction_order_ids( $order_id ); - } - - protected function stage_returnto() { - global $wgServer, $wgArticlePath; - - // Rebuild the url with the token param. - - $arr_url = parse_url( - $wgServer . str_replace( - '$1', - 'Special:WorldpayGatewayResult', - $wgArticlePath - ) - ); - - $query = ''; - $first = true; - if ( isset( $arr_url['query'] ) ) { - parse_str( $arr_url['query'], $arr_query ); - } - // Worldpay decodes encoded URL unsafe characters in XML before storage, - // and sends them back that way in the return header. So anything you - // want to be returned encoded must be double-encoded[1], for example - // %2526 will get returned as %26 and decoded to &, while %26 will get - // returned as & and treated as a query string separator. - - // Additionally a properly encoded & will make their server respond - // MessageCode 302 (which means 'unavailable') unless it is wrapped in - // CDATA tags because godonlyknows - $arr_query['token'] = rawurlencode( $this->token_getSaltedSessionToken() ); - $arr_query['ffname'] = rawurlencode( $this->getData_Unstaged_Escaped( 'ffname' ) ); - $arr_query['amount'] = rawurlencode( $this->getData_Unstaged_Escaped( 'amount' ) ); - foreach ( $arr_query as $key => $val ) { - $query .= ( $first ? '?' : '&' ) . $key . '=' . $val; - $first = false; - } - - $this->staged_data['returnto'] = rawurlencode( // [1] - $arr_url['scheme'] . '://' . - $arr_url['host'] . - $arr_url['path'] . - $query - ); - } - - protected function stage_wp_acctname() { - $this->staged_data['wp_acctname'] = implode( ' ', array( - $this->getData_Unstaged_Escaped( 'fname' ), - $this->getData_Unstaged_Escaped( 'lname' ) - )); - } - - protected function stage_iso_currency_id() { - $currency = $this->getData_Unstaged_Escaped( 'currency_code' ); - if ( array_key_exists( $currency, self::$CURRENCY_CODES ) ) { - $this->staged_data['iso_currency_id'] = self::$CURRENCY_CODES[$currency]; - } - } - - protected function unstage_payment_submethod() { - $paymentMethod = $this->getData_Staged( 'payment_method' ); - $paymentSubmethod = $this->getData_Staged( 'payment_submethod' ); - if ( $paymentMethod == 'cc' ) { - $this->unstaged_data['payment_submethod'] = - $this->get_payment_method_name_from_api_name( $paymentSubmethod ); - } - } - - protected function stage_merchant_reference_2() { - $email = $this->getData_Staged( 'email' ); - $alphanumeric = preg_replace('/[^0-9a-zA-Z]/', ' ', $email); - $this->staged_data['merchant_reference_2'] = $alphanumeric; - } - - protected function stage_narrative_statement_1() { - $this->staged_data['narrative_statement_1'] = WmfFramework::formatMessage( - 'donate_interface-statement', - $this->getData_Unstaged_Escaped( 'contribution_tracking_id' ) - ); } /** -- To view, visit https://gerrit.wikimedia.org/r/281684 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I309ef5fbca903deb53f511b07ac58d14ba1e737e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: deployment Gerrit-Owner: Ejegg <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
