jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/391983 )
Change subject: Update donation-interface for PayPal EC debugging ...................................................................... Update donation-interface for PayPal EC debugging Change-Id: If5a30f0f841eb348bbe3acd37994973cf66c686c --- M composer/installed.json M wikimedia/donation-interface/DonationInterface.class.php M wikimedia/donation-interface/README.txt M wikimedia/donation-interface/amazon_gateway/amazon.adapter.php A wikimedia/donation-interface/astropay_gateway/i18n/cs.json M wikimedia/donation-interface/gateway_common/gateway.adapter.php M wikimedia/donation-interface/gateway_common/i18n/interface/be-tarask.json M wikimedia/donation-interface/gateway_common/i18n/interface/de.json M wikimedia/donation-interface/gateway_common/i18n/interface/el.json M wikimedia/donation-interface/gateway_common/i18n/interface/es.json M wikimedia/donation-interface/gateway_common/i18n/interface/et.json M wikimedia/donation-interface/gateway_common/i18n/interface/fr.json M wikimedia/donation-interface/gateway_common/i18n/interface/it.json M wikimedia/donation-interface/gateway_common/i18n/interface/jv.json M wikimedia/donation-interface/gateway_common/i18n/interface/lb.json M wikimedia/donation-interface/gateway_common/i18n/interface/sl.json M wikimedia/donation-interface/gateway_common/i18n/interface/zh-hans.json M wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonApiTest.php M wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonTest.php M wikimedia/donation-interface/tests/phpunit/DonationInterfaceApiTestCase.php M wikimedia/donation-interface/tests/phpunit/DonationInterfaceTestCase.php M wikimedia/donation-interface/tests/phpunit/TestConfiguration.php D wikimedia/donation-interface/tests/phpunit/includes/MockAmazonClient.php D wikimedia/donation-interface/tests/phpunit/includes/MockAmazonResponse.php D wikimedia/donation-interface/tests/phpunit/includes/test_gateway/TestingAmazonAdapter.php 25 files changed, 102 insertions(+), 294 deletions(-) Approvals: jenkins-bot: Verified Ejegg: Looks good to me, approved diff --git a/composer/installed.json b/composer/installed.json index d94b8df..196e534 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -2274,7 +2274,7 @@ "source": { "type": "git", "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/DonationInterface.git", - "reference": "81b12c1166d91c689b4b7a9dad0f845f97ccecc1" + "reference": "0b70d246f754b456d6f04180f9bb02f528910f0d" }, "require": { "addshore/psr-6-mediawiki-bagostuff-adapter": "0.1", @@ -2294,7 +2294,7 @@ "mediawiki/mediawiki-codesniffer": "0.11.0", "wikimedia/testing-access-wrapper": "~1.0" }, - "time": "2017-10-17T15:40:59+00:00", + "time": "2017-11-16T16:31:29+00:00", "type": "library", "installation-source": "source", "autoload": { diff --git a/wikimedia/donation-interface/DonationInterface.class.php b/wikimedia/donation-interface/DonationInterface.class.php index 84d72a3..44821e1 100644 --- a/wikimedia/donation-interface/DonationInterface.class.php +++ b/wikimedia/donation-interface/DonationInterface.class.php @@ -70,10 +70,7 @@ $wgAutoloadClasses['DonationInterfaceTestCase'] = $testDir . 'DonationInterfaceTestCase.php'; $wgAutoloadClasses['DonationInterfaceApiTestCase'] = $testDir . 'DonationInterfaceApiTestCase.php'; $wgAutoloadClasses['BaseIngenicoTestCase'] = $testDir . 'BaseIngenicoTestCase.php'; - $wgAutoloadClasses['MockAmazonClient'] = $testDir . 'includes/MockAmazonClient.php'; - $wgAutoloadClasses['MockAmazonResponse'] = $testDir . 'includes/MockAmazonResponse.php'; $wgAutoloadClasses['TestingAdyenAdapter'] = $testDir . 'includes/test_gateway/TestingAdyenAdapter.php'; - $wgAutoloadClasses['TestingAmazonAdapter'] = $testDir . 'includes/test_gateway/TestingAmazonAdapter.php'; $wgAutoloadClasses['TestingAstroPayAdapter'] = $testDir . 'includes/test_gateway/TestingAstroPayAdapter.php'; $wgAutoloadClasses['TestingDonationLogger'] = $testDir . 'includes/TestingDonationLogger.php'; $wgAutoloadClasses['TestingGatewayPage'] = $testDir . 'includes/TestingGatewayPage.php'; diff --git a/wikimedia/donation-interface/README.txt b/wikimedia/donation-interface/README.txt index c9f16e1..1781e10 100644 --- a/wikimedia/donation-interface/README.txt +++ b/wikimedia/donation-interface/README.txt @@ -223,22 +223,22 @@ '' => 100, //No code returned. All the points. ) -# $wgAmazonGatewayAccountInfo['example'] = array( -# 'SellerID' => '', // 13 or so uppercase letters -# 'ClientID' => '', // app or site-specific, starts with amznX.application -# 'ClientSecret' => '', // 64 hex characters -# 'MWSAccessKey' => '', // 20 alphanumeric characters -# 'MWSSecretKey' => '', // 40 base-64 encoded chars -# 'Region' => '', // 'de', 'jp', 'uk', or 'us' -# 'WidgetScriptURL' => 'https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js', -# // static-eu serves widgets for uk and de, but jp uses this awful URL: -# // https://origin-na.ssl-images-amazon.com/images/G/09/EP/offAmazonPayments/sandbox/prod/lpa/js/Widgets.js -# // remove 'sandbox/' from above URLs for production use -# 'ReturnURL' => '' -# // Sorry, devs, ReturnURL HAS to be https. -# // Also, it has to be whitelisted for your application at sellercentral.amazon.com -# // e.g. https://payments.wikimedia.org/index.php/Special:AmazonGateway -# ) +Amazon account info is mostly read from SmashPig configuration +FIXME: stop duplicating SellerID and ClientID +FIXME: actually use 'Region' +$wgAmazonGatewayAccountInfo['example'] = array( + 'SellerID' => '', // 13 or so uppercase letters + 'ClientID' => '', // app or site-specific, starts with amznX.application + 'Region' => '', // 'de', 'jp', 'uk', or 'us' + 'WidgetScriptURL' => 'https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js', + // static-eu serves widgets for uk and de, but jp uses this awful URL: + // https://origin-na.ssl-images-amazon.com/images/G/09/EP/offAmazonPayments/sandbox/prod/lpa/js/Widgets.js + // remove 'sandbox/' from above URLs for production use + 'ReturnURL' => '' + // Sorry, devs, ReturnURL HAS to be https. + // Also, it has to be whitelisted for your application at sellercentral.amazon.com + // e.g. https://payments.wikimedia.org/index.php/Special:AmazonGateway +) // This URL appears to be global and usable for both sandbox and non-sandbox $wgAmazonGatewayLoginScript = 'https://api-cdn.amazon.com/sdk/login1.js' diff --git a/wikimedia/donation-interface/amazon_gateway/amazon.adapter.php b/wikimedia/donation-interface/amazon_gateway/amazon.adapter.php index d4001e4..30914d5 100644 --- a/wikimedia/donation-interface/amazon_gateway/amazon.adapter.php +++ b/wikimedia/donation-interface/amazon_gateway/amazon.adapter.php @@ -3,6 +3,7 @@ use PayWithAmazon\PaymentsClient as PwaClient; use PayWithAmazon\PaymentsClientInterface as PwaClientInterface; use Psr\Log\LogLevel; +use SmashPig\Core\Context; /** * Wikimedia Foundation @@ -145,14 +146,7 @@ * @return PwaClientInterface */ protected function getPwaClient() { - return new PwaClient( array( - 'merchant_id' => $this->account_config['SellerID'], - 'access_key' => $this->account_config['MWSAccessKey'], - 'secret_key' => $this->account_config['MWSSecretKey'], - 'client_id' => $this->account_config['ClientID'], - 'region' => $this->account_config['Region'], - 'sandbox' => $this->getGlobal( 'Test' ), - ) ); + return Context::get()->getProviderConfiguration()->object( 'payments-client' ); } /** diff --git a/wikimedia/donation-interface/astropay_gateway/i18n/cs.json b/wikimedia/donation-interface/astropay_gateway/i18n/cs.json new file mode 100644 index 0000000..46046c2 --- /dev/null +++ b/wikimedia/donation-interface/astropay_gateway/i18n/cs.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Mormegil" + ] + }, + "astropay_gateway-desc": "Zpracování plateb přes AstroPay" +} diff --git a/wikimedia/donation-interface/gateway_common/gateway.adapter.php b/wikimedia/donation-interface/gateway_common/gateway.adapter.php index a4c82ef..7d11b22 100644 --- a/wikimedia/donation-interface/gateway_common/gateway.adapter.php +++ b/wikimedia/donation-interface/gateway_common/gateway.adapter.php @@ -1296,6 +1296,7 @@ $curl_opts = $this->getCurlBaseOpts(); $curl_opts[CURLOPT_HTTPHEADER] = $headers; $curl_opts[CURLOPT_POSTFIELDS] = $data; + $this->logger->debug( "Curl call for {$this->getCurrentTransaction()}: headers " . print_r( $headers, true ) . " data " . print_r( $data, true ) ); // Always capture the cURL output $curlDebugLog = fopen( 'php://temp', 'r+' ); @@ -3757,9 +3758,10 @@ } $this->logger->info( "Rectifying orphan: {$this->getData_Staged( 'order_id' )}" ); $civiId = $this->getData_Unstaged_Escaped( 'contribution_id' ); + $ctId = $this->getData_Unstaged_Escaped( 'contribution_tracking_id' ); if ( $civiId ) { $this->logger->error( - $normalized['contribution_tracking_id'] . + $ctId . ": Contribution tracking already has contribution_id $civiId. " . 'Stop confusing donors!' ); @@ -3768,11 +3770,11 @@ $params = $this->createDonorReturnParams(); $paymentResult = $this->processDonorReturn( $params ); if ( !$paymentResult->isFailed() ) { - $this->logger->info( $this->getData_Staged( 'contribution_tracking_id' ) . ': FINAL: Rectified' ); + $this->logger->info( $ctId . ': FINAL: Rectified' ); return $paymentResult; } else { $this->errorState->addErrors( $paymentResult->getErrors() ); - $this->logger->error( $this->getData_Staged( 'contribution_tracking_id' ) . ': ERRORS ' . print_r( $this->errorState, true ) ); + $this->logger->error( $ctId . ': ERRORS ' . print_r( $this->errorState, true ) ); } } return $paymentResult; diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/be-tarask.json b/wikimedia/donation-interface/gateway_common/i18n/interface/be-tarask.json index 88de33e..c87ce7e 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/be-tarask.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/be-tarask.json @@ -330,7 +330,7 @@ "donate_interface-translate-redlink1": "Дапамажыце перакласьці гэтую старонку.", "donate_interface-translate-redlink2": "Ці дашліце Ваш пераклад па адрасе translati...@wikimedia.org", "donate_interface-email-fallbackname": "прыяцель Фундацыі «Вікімэдыі»", - "donate_interface-email-subject": "Прыміце ўдзячнасьць ад Фундацыі «Вікімэдыя»", + "donate_interface-email-subject": "Мы тут дзеля вас. Дзякуем за тое, што вы з намі", "donate_interface-email-unsub-title": "Адмаўленьне ад падпіскі на паведамленьні Фундацыі «Вікімэдыя»", "donate_interface-email-unsub-button": "Адпісацца", "donate_interface-email-unsub-success": "Вы былі пасьпяховы выключаныя з нашага сьпісу распаўсюджаньня", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/de.json b/wikimedia/donation-interface/gateway_common/i18n/interface/de.json index 4ae4e24..04936f7 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/de.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/de.json @@ -12,7 +12,8 @@ "Tbleher", "Umherirrender", "Jrobell", - "Pcoombe" + "Pcoombe", + "Danielbeerbonn" ] }, "donate_interface": "Unterstützen Sie Wikimedia", @@ -371,7 +372,7 @@ "donate_interface-translate-redlink1": "Bei der Übersetzung dieser Seite mithelfen.", "donate_interface-translate-redlink2": "Oder senden Sie Ihre Übersetzung per E-Mail an translati...@wikimedia.org", "donate_interface-email-fallbackname": "Freund der Wikimedia Foundation", - "donate_interface-email-subject": "Die Wikimedia Foundation sagt Danke", + "donate_interface-email-subject": "Wir sind für Sie da. Vielen Dank, dass Sie für uns da sind", "donate_interface-email-unsub-title": "Wikimedia Foundation Abbestellung", "donate_interface-email-unsub-button": "Abbestellen", "donate_interface-email-unsub-success": "Sie wurden erfolgreich aus unserer Mailinglist entfernt", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/el.json b/wikimedia/donation-interface/gateway_common/i18n/interface/el.json index 996fc6c..0fc3421 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/el.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/el.json @@ -11,7 +11,8 @@ "ZaDiak", "Pcoombe", "Protnet", - "Geraki" + "Geraki", + "KATRINE1992" ] }, "donate_interface": "Υποστηρίξτε το Wikimedia", @@ -326,7 +327,7 @@ "donate_interface-translate-redlink1": "Βοηθείστε να μεταφράσουμε αυτή τη σελίδα", "donate_interface-translate-redlink2": "Ή στείλτε με email την μετάφρασή σας στο translati...@wikimedia.org", "donate_interface-email-fallbackname": "φίλος του Ιδρύματος Wikimedia", - "donate_interface-email-subject": "Ευχαριστούμε από το Ίδρυμα Wikimedia", + "donate_interface-email-subject": "Ευχαριστούμε από το Ίδρυμα Wikimedia. Ευχαριστούμε που είστε εδώ για μας", "donate_interface-email-unsub-title": "Κατάργηση εγγραφής στο Wikimedia Foundation", "donate_interface-email-unsub-button": "Κατάργηση εγγραφής", "donate_interface-email-unsub-success": "Έχετε με επιτυχία διαγραφεί από τη λίστα αλληλογραφίας μας", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/es.json b/wikimedia/donation-interface/gateway_common/i18n/interface/es.json index fa7b999..736aa1a 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/es.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/es.json @@ -35,7 +35,8 @@ "Ryo567", "Ncontinanza", "Indiralena", - "2axterix2" + "2axterix2", + "KATRINE1992" ] }, "donate_interface": "Apoya a Wikimedia", @@ -227,7 +228,7 @@ "donate_interface-error-msg-branch_code": "Código de sucursal", "donate_interface-error-msg-captcha": "El valor del captcha introducido es incorrecto. Por favor, inténtalo de nuevo.", "donate_interface-error-msg-captcha-please": "Para la seguridad de tu tarjeta de crédito, escribe los caracteres que ves arriba.", - "donate_interface-error-msg-cookies": "Habilita las cookies en tu navegador.", + "donate_interface-error-msg-cookies": "Activa las «cookies» en tu navegador.", "donate_interface-error-msg-country-calc": "Error. No es posible aceptar tu donación en este momento.", "donate_interface-error-msg-fiscal_number": "Escribe tu número fiscal", "donate_interface-error-msg-fiscal_number-ar": "Escribe tu DNI", @@ -400,7 +401,7 @@ "donate_interface-translate-redlink1": "Ayudar a traducir esta página.", "donate_interface-translate-redlink2": "O envía tu traducción a translati...@wikimedia.org", "donate_interface-email-fallbackname": "amigo de la Fundación Wikimedia", - "donate_interface-email-subject": "Gracias desde la Fundación Wikimedia", + "donate_interface-email-subject": "Estamos para servir. Gracias por acompañarnos", "donate_interface-email-unsub-title": "Cancelar la subscripción a la Fundación Wikimedia", "donate_interface-email-unsub-button": "Cancelar la suscripción", "donate_interface-email-unsub-success": "Has sido eliminado correctamente de nuestra lista de correo", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/et.json b/wikimedia/donation-interface/gateway_common/i18n/interface/et.json index aae1a1d..b76ee31 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/et.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/et.json @@ -323,7 +323,7 @@ "donate_interface-translate-redlink1": "Aita seda lehekülge tõlkida.", "donate_interface-translate-redlink2": "Või saada oma tõlge e-postiga aadressil translati...@wikimedia.org", "donate_interface-email-fallbackname": "Wikimedia Foundationi sõber", - "donate_interface-email-subject": "Wikimedia Foundation tänab sind südamest", + "donate_interface-email-subject": "Oleme sinu jaoks olemas. Aitäh, et oled meie jaoks olemas.", "donate_interface-email-unsub-title": "Loobu Wikimedia Foundationi teadetest", "donate_interface-email-unsub-button": "Lõpeta tellimus", "donate_interface-email-unsub-success": "Su katse meie postiloendist lahkuda läks igati korda", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/fr.json b/wikimedia/donation-interface/gateway_common/i18n/interface/fr.json index dd4152b..1e8cdfb 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/fr.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/fr.json @@ -395,7 +395,7 @@ "donate_interface-translate-redlink1": "Aidez à traduire cette page.", "donate_interface-translate-redlink2": "Ou envoyez votre traduction à translati...@wikimedia.org", "donate_interface-email-fallbackname": "ami de la Fondation Wikimédia", - "donate_interface-email-subject": "Merci à vous de la part de la Wikimedia Foundation", + "donate_interface-email-subject": "Nous sommes ici pour vous. Merci d’être là pour nous", "donate_interface-email-unsub-title": "Se désabonner de la Fondation Wikimédia", "donate_interface-email-unsub-button": "Se désabonner", "donate_interface-email-unsub-success": "Votre nom a bien été retiré de notre liste de diffusion", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/it.json b/wikimedia/donation-interface/gateway_common/i18n/interface/it.json index ddb07f9..f2f80dd 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/it.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/it.json @@ -377,7 +377,7 @@ "donate_interface-translate-redlink1": "Aiutaci a tradurre questa pagina.", "donate_interface-translate-redlink2": "O mandare per e-mail la tua traduzione a translati...@wikimedia.org", "donate_interface-email-fallbackname": "amico della Wikimedia Foundation", - "donate_interface-email-subject": "Grazie dalla Wikimedia Foundation", + "donate_interface-email-subject": "Siamo qui per te. Grazie per essere qui per noi", "donate_interface-email-unsub-title": "Cancellazione dalla Wikimedia Foundation", "donate_interface-email-unsub-button": "Annulla l'iscrizione", "donate_interface-email-unsub-success": "Sei stato rimosso con successo dalla nostra mailing list", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/jv.json b/wikimedia/donation-interface/gateway_common/i18n/interface/jv.json index 2637ca4..4381ad4 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/jv.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/jv.json @@ -159,7 +159,7 @@ "donate_interface-error-msg-amount": "Isènana kèhing pisumbangé panjenengan", "donate_interface-error-msg-email": "Lebokaké alamat layang èlèktronik Sampéyan", "donate_interface-error-msg-first_name": "Lebokaké jeneng ngarep Sampéyan", - "donate_interface-error-msg-last_name": "Mangga isinen jeneng buriné panjenengan", + "donate_interface-error-msg-last_name": "Mangga isi jeneng-buri panjenengan", "donate_interface-error-msg-street_address": "Mangga isinen alamat dalané panjenengan", "donate_interface-error-msg-city": "Lebokaké kutha Sampéyan", "donate_interface-error-msg-state_province": "Lebokaké nagara bagéyan Sampéyan", @@ -170,7 +170,7 @@ "donate_interface-error-msg-card_num": "nomer kertu krèdit", "donate_interface-error-msg-expiration": "Isènana tanggal kadaluwarsa kertuné", "donate_interface-error-msg-cvv": "CVV nèng mburiné kertu Sampéyan", - "donate_interface-error-msg-captcha": "Captcha sing Sampéyan lebokaké salah. Mangga jajal manèh.", + "donate_interface-error-msg-captcha": "Captcha sing penjenengan isi salah. Mangga jajal manèh.", "donate_interface-error-msg-captcha-please": "Kanggo kamanan kertu krèdit Sampéyan, mangga tulisaké karakter sing katon nèng ndhuwur.", "donate_interface-error-msg-cookies": "Urubaké cookie nèng pramban Sampéyan.", "donate_interface-donate-error-try-a-different-card": "Mangga [$1 jajal kertu liya] utawa sawijining [$2 carané awak dhéwé kanggo ngawèhi] utawa ngubungi awak dhéwé nèng $3", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/lb.json b/wikimedia/donation-interface/gateway_common/i18n/interface/lb.json index c3d7b42..dbc9404 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/lb.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/lb.json @@ -356,7 +356,7 @@ "donate_interface-translate-redlink1": "Hëlleft dës Säit z'iwwersetzen.", "donate_interface-translate-redlink2": "Oder schéckt Är Iwwersetzung un translati...@wikimedia.org", "donate_interface-email-fallbackname": "Frënd vun der Wikimedia Fondatioun", - "donate_interface-email-subject": "D'Wikimedia Foundation seet Iech merci", + "donate_interface-email-subject": "Mir si fir Iech do. Merci datt Dir fir eis do sidd", "donate_interface-email-unsub-title": "Sech ofmelle bei der Wikimedia Fondatioun", "donate_interface-email-unsub-button": "Ofbestellen", "donate_interface-email-unsub-success": "Dir gouft vun eiser Mailinglëscht erofgeholl", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/sl.json b/wikimedia/donation-interface/gateway_common/i18n/interface/sl.json index 9294ebe..b2d7499 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/sl.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/sl.json @@ -8,7 +8,8 @@ "Jsoby", "MZaplotnik", "Yerpo", - "Pcoombe" + "Pcoombe", + "Pinky sl" ] }, "donate_interface": "Podprite Wikimedijo", @@ -343,7 +344,7 @@ "donate_interface-translate-redlink1": "Pomagajte prevesti to stran.", "donate_interface-translate-redlink2": "Svoj prevod nam lahko pošljete tudi prek e-pošte na translati...@wikimedia.org", "donate_interface-email-fallbackname": "prijatelj fundacije Wikimedia", - "donate_interface-email-subject": "Fundacija Wikimedia se vam zahvaljuje", + "donate_interface-email-subject": "Tukaj smo zaradi vas. Hvala vam, ker ste tukaj za nas", "donate_interface-email-unsub-title": "Odjava s fundacije Wikimedia", "donate_interface-email-unsub-button": "Odjava", "donate_interface-email-unsub-success": "Uspešno ste bili odstranjeni z našega seznama za e-poštno obveščanje", diff --git a/wikimedia/donation-interface/gateway_common/i18n/interface/zh-hans.json b/wikimedia/donation-interface/gateway_common/i18n/interface/zh-hans.json index 22daca5..381eb9d 100644 --- a/wikimedia/donation-interface/gateway_common/i18n/interface/zh-hans.json +++ b/wikimedia/donation-interface/gateway_common/i18n/interface/zh-hans.json @@ -392,7 +392,7 @@ "donate_interface-translate-redlink1": "协助翻译此页。", "donate_interface-translate-redlink2": "或将您的翻译稿寄送至 translati...@wikimedia.org", "donate_interface-email-fallbackname": "维基媒体基金会的朋友", - "donate_interface-email-subject": "来自维基媒体基金会的感谢信", + "donate_interface-email-subject": "我们在这里等您。感谢您在此帮助我们", "donate_interface-email-unsub-title": "维基媒体基金会退订", "donate_interface-email-unsub-button": "取消订阅", "donate_interface-email-unsub-success": "您已经成功从我们的邮件列表中移除", diff --git a/wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonApiTest.php b/wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonApiTest.php index fafc6db..acff8af 100644 --- a/wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonApiTest.php +++ b/wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonApiTest.php @@ -11,14 +11,14 @@ * @group medium */ class AmazonApiTest extends DonationInterfaceApiTestCase { + /** + * @var \SmashPig\PaymentProviders\Amazon\Tests\AmazonTestConfiguration + */ + protected $providerConfig; + public function setUp() { parent::setUp(); - TestingAmazonAdapter::$mockClient = new MockAmazonClient(); - } - - public function tearDown() { - TestingAmazonAdapter::$mockClient = null; - parent::tearDown(); + $this->providerConfig = DonationInterface_Adapter_Amazon_Test::setUpAmazonTestingContext( $this ); } public function testDoPaymentSuccess() { @@ -43,7 +43,7 @@ $apiResult = $this->doApiRequest( $params, $session ); $redirect = $apiResult[0]['redirect']; $this->assertEquals( 'https://wikimediafoundation.org/wiki/Thank_You/en?country=US', $redirect ); - $mockClient = TestingAmazonAdapter::$mockClient; + $mockClient = $this->providerConfig->object( 'payments-client' ); $setOrderReferenceDetailsArgs = $mockClient->calls['setOrderReferenceDetails'][0]; $oid = $session['Donor']['contribution_tracking_id'] . '-1'; $this->assertEquals( $oid, $setOrderReferenceDetailsArgs['seller_order_id'], 'Did not set order id on order reference' ); diff --git a/wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonTest.php b/wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonTest.php index b688acc..a949780 100644 --- a/wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonTest.php +++ b/wikimedia/donation-interface/tests/phpunit/Adapter/Amazon/AmazonTest.php @@ -27,24 +27,33 @@ */ class DonationInterface_Adapter_Amazon_Test extends DonationInterfaceTestCase { + protected $testAdapterClass = 'AmazonAdapter'; /** - * @param $name string The name of the test case - * @param $data array Any parameters read from a dataProvider - * @param $dataName string|int The name or index of the data set + * @var \SmashPig\PaymentProviders\Amazon\Tests\AmazonTestConfiguration */ - public function __construct( $name = null, array $data = array(), $dataName = '' ) { - parent::__construct( $name, $data, $dataName ); - $this->testAdapterClass = 'TestingAmazonAdapter'; + protected $providerConfig; + + public static function setUpAmazonTestingContext( $testCase ) { + $config = AmazonTestConfiguration::instance( + $testCase->smashPigGlobalConfig + ); + $config->override( [ + 'payments-client' => [ + 'constructor-parameters' => [ + 0 => [ + 'response-directory' => + __DIR__ . '/../../includes/Responses/amazon' + ] + ] + ] + ] ); + TestingContext::get()->providerConfigurationOverride = $config; + return $config; } public function setUp() { parent::setUp(); - TestingContext::get()->providerConfigurationOverride = - AmazonTestConfiguration::instance( - $this->smashPigGlobalConfig - ); - - TestingAmazonAdapter::$mockClient = new MockAmazonClient(); + $this->providerConfig = self::setUpAmazonTestingContext( $this ); $this->setMwGlobals( array( 'wgAmazonGatewayEnabled' => true, @@ -64,11 +73,6 @@ ) ); } - public function tearDown() { - TestingAmazonAdapter::$fakeGlobals = array(); - parent::tearDown(); - } - /** * Integration test to verify that the Amazon gateway converts Canadian * dollars before redirecting @@ -76,6 +80,7 @@ * FIXME: Merge with currency fallback tests? * * @dataProvider canadaLanguageProvider + * @param string $language language code to test */ function testCanadianDollarConversion( $language ) { $init = $this->getDonorTestData( 'CA' ); @@ -87,11 +92,10 @@ $cadRate = $rates['CAD']; $expectedAmount = floor( $init['amount'] / $cadRate ); - - TestingAmazonAdapter::$fakeGlobals = array( - 'FallbackCurrency' => 'USD', - 'NotifyOnConvert' => true, - ); + $this->setMwGlobals( array( + 'wgAmazonGatewayFallbackCurrency' => 'USD', + 'wgAmazonGatewayNotifyOnConvert' => true, + ) ); $expectedNotification = wfMessage( 'donate_interface-fallback-currency-notice', @@ -151,7 +155,7 @@ $this->assertEquals( 'Testy', $gateway->getData_Unstaged_Escaped( 'first_name' ), 'Did not populate first name from Amazon data' ); $this->assertEquals( 'Test', $gateway->getData_Unstaged_Escaped( 'last_name' ), 'Did not populate last name from Amazon data' ); $this->assertEquals( 'nob...@wikimedia.org', $gateway->getData_Unstaged_Escaped( 'email' ), 'Did not populate email from Amazon data' ); - $mockClient = TestingAmazonAdapter::$mockClient; + $mockClient = $this->providerConfig->object( 'payments-client' ); $setOrderReferenceDetailsArgs = $mockClient->calls['setOrderReferenceDetails'][0]; $oid = $gateway->getData_Unstaged_Escaped( 'order_id' ); $this->assertEquals( $oid, $setOrderReferenceDetailsArgs['seller_order_id'], 'Did not set order id on order reference' ); @@ -175,7 +179,7 @@ unset( $init['first_name'] ); unset( $init['last_name'] ); - $mockClient = TestingAmazonAdapter::$mockClient; + $mockClient = $this->providerConfig->object( 'payments-client' ); $mockClient->returns['authorize'][] = 'InvalidPaymentMethod'; $gateway = $this->getFreshGatewayObject( $init ); @@ -202,7 +206,7 @@ unset( $init['first_name'] ); unset( $init['last_name'] ); - $mockClient = TestingAmazonAdapter::$mockClient; + $mockClient = $this->providerConfig->object( 'payments-client' ); $mockClient->returns['authorize'][] = 'AmazonRejected'; $gateway = $this->getFreshGatewayObject( $init ); @@ -227,7 +231,7 @@ unset( $init['first_name'] ); unset( $init['last_name'] ); - $mockClient = TestingAmazonAdapter::$mockClient; + $mockClient = $this->providerConfig->object( 'payments-client' ); $mockClient->returns['authorize'][] = 'TransactionTimedOut'; $gateway = $this->getFreshGatewayObject( $init ); @@ -248,7 +252,7 @@ unset( $init['first_name'] ); unset( $init['last_name'] ); - $mockClient = TestingAmazonAdapter::$mockClient; + $mockClient = $this->providerConfig->object( 'payments-client' ); $mockClient->exceptions['authorize'][] = new Exception( 'Test' ); $gateway = $this->getFreshGatewayObject( $init ); @@ -283,7 +287,7 @@ $this->assertEquals( 'Testy', $gateway->getData_Unstaged_Escaped( 'first_name' ), 'Did not populate first name from Amazon data' ); $this->assertEquals( 'Test', $gateway->getData_Unstaged_Escaped( 'last_name' ), 'Did not populate last name from Amazon data' ); $this->assertEquals( 'nob...@wikimedia.org', $gateway->getData_Unstaged_Escaped( 'email' ), 'Did not populate email from Amazon data' ); - $mockClient = TestingAmazonAdapter::$mockClient; + $mockClient = $this->providerConfig->object( 'payments-client' ); $setBillingAgreementDetailsArgs = $mockClient->calls['setBillingAgreementDetails'][0]; $oid = $gateway->getData_Unstaged_Escaped( 'order_id' ); $this->assertEquals( $oid, $setBillingAgreementDetailsArgs['seller_billing_agreement_id'], 'Did not set order id on billing agreement' ); diff --git a/wikimedia/donation-interface/tests/phpunit/DonationInterfaceApiTestCase.php b/wikimedia/donation-interface/tests/phpunit/DonationInterfaceApiTestCase.php index a5509bf..5f4d233 100644 --- a/wikimedia/donation-interface/tests/phpunit/DonationInterfaceApiTestCase.php +++ b/wikimedia/donation-interface/tests/phpunit/DonationInterfaceApiTestCase.php @@ -5,11 +5,12 @@ use SmashPig\Tests\TestingGlobalConfiguration; class DonationInterfaceApiTestCase extends ApiTestCase { + public $smashPigGlobalConfig; public function setUp() { parent::setUp(); - $config = TestingGlobalConfiguration::create(); - TestingContext::init( $config ); + $this->smashPigGlobalConfig = TestingGlobalConfiguration::create(); + TestingContext::init( $this->smashPigGlobalConfig ); $ctx = TestingContext::get(); $ctx->setSourceType( 'payments' ); $ctx->setSourceName( 'DonationInterface' ); diff --git a/wikimedia/donation-interface/tests/phpunit/DonationInterfaceTestCase.php b/wikimedia/donation-interface/tests/phpunit/DonationInterfaceTestCase.php index 5ab3999..2ec16f8 100644 --- a/wikimedia/donation-interface/tests/phpunit/DonationInterfaceTestCase.php +++ b/wikimedia/donation-interface/tests/phpunit/DonationInterfaceTestCase.php @@ -51,7 +51,7 @@ protected $gatewayAdapter; protected $testAdapterClass = TESTS_ADAPTER_DEFAULT; - protected $smashPigGlobalConfig; + public $smashPigGlobalConfig; /** * @param $name string The name of the test case @@ -69,7 +69,6 @@ public static function resetTestingAdapters() { $testing_adapters = array( 'TestingAdyenAdapter', - 'TestingAmazonAdapter', 'TestingAstroPayAdapter', 'TestingGenericAdapter', 'TestingGlobalCollectAdapter', diff --git a/wikimedia/donation-interface/tests/phpunit/TestConfiguration.php b/wikimedia/donation-interface/tests/phpunit/TestConfiguration.php index 0323198..5ffb477 100644 --- a/wikimedia/donation-interface/tests/phpunit/TestConfiguration.php +++ b/wikimedia/donation-interface/tests/phpunit/TestConfiguration.php @@ -66,6 +66,8 @@ $wgPaypalExpressGatewayAccountInfo, $wgAmazonGatewayReturnURL, $wgAmazonGatewayAccountInfo, + $wgAmazonGatewayFallbackCurrency, + $wgAmazonGatewayNotifyOnConvert, $wgAdyenGatewayURL, $wgAdyenGatewayAccountInfo, $wgAstroPayGatewayURL, @@ -97,7 +99,7 @@ $wgDonationInterfaceGatewayAdapters = array( 'globalcollect' => 'TestingGlobalCollectAdapter', 'ingenico' => 'IngenicoAdapter', - 'amazon' => 'TestingAmazonAdapter', + 'amazon' => 'AmazonAdapter', 'adyen' => 'TestingAdyenAdapter', 'astropay' => 'TestingAstroPayAdapter', 'paypal_ec' => 'TestingPaypalExpressAdapter', @@ -142,14 +144,12 @@ $wgAmazonGatewayAccountInfo['test'] = array( 'SellerID' => 'ABCDEFGHIJKL', 'ClientID' => 'amzn1.application-oa2-client.1a2b3c4d5e', - 'ClientSecret' => '12432g134e3421a41234b1341c324123d', - 'MWSAccessKey' => 'N0NSENSEXYZ', - 'MWSSecretKey' => 'iuasd/2jhaslk2j49lkaALksdJLsJLas+', - 'Region' => 'us', 'WidgetScriptURL' => 'https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js', 'ReturnURL' => "https://example.org/index.php/Special:AmazonGateway?debug=true", ); +$wgAmazonGatewayFallbackCurrency = false; +$wgAmazonGatewayNotifyOnConvert = false; /** Adyen **/ $wgAdyenGatewayURL = 'https://testorwhatever.adyen.com'; diff --git a/wikimedia/donation-interface/tests/phpunit/includes/MockAmazonClient.php b/wikimedia/donation-interface/tests/phpunit/includes/MockAmazonClient.php deleted file mode 100644 index a6bc078..0000000 --- a/wikimedia/donation-interface/tests/phpunit/includes/MockAmazonClient.php +++ /dev/null @@ -1,145 +0,0 @@ -<?php - -/** - * FIXME: Jenkins mwext-testextension-hhvm still not installing DonationInterface composer deps - * use PayWithAmazon\PaymentsClientInterface; - */ - -/** - * Stubs out the functionality of the Client class from the Login and Pay with - * Amazon SDK. TODO: replace with PHPUnit method return mocks when Jenkins - * is running new enough PHPUnit. Only mocking the stuff we use. - */ -class MockAmazonClient { // FIXME: implements PaymentsClientInterface { - - // Each key is a method name whose value is an array of times it's been - // called, recording all argument values. - public $calls = array(); - - // Keys are method names, values are arrays of error codes such as InvalidPaymentMethod - // When a code is not found, the operation will return a successful result - public $returns = array(); - - // Similar to $returns, but any entries here are thrown as exceptions - public $exceptions = array(); - - public function __construct( $config = null ) { - } - - public function __get( $name ) { - } - - protected function fakeCall( $functionName, $arguments ) { - $this->calls[$functionName][] = $arguments; - $status = null; - $returnIndex = count( $this->calls[$functionName] ) - 1; - if ( isset( $this->returns[$functionName] ) && isset( $this->returns[$functionName][$returnIndex] ) ) { - $status = $this->returns[$functionName][$returnIndex]; - } - if ( isset( $this->exceptions[$functionName] ) && isset( $this->exceptions[$functionName][$returnIndex] ) ) { - throw $this->exceptions[$functionName][$returnIndex]; - } - return new MockAmazonResponse( $functionName, $status ); - } - - public function authorize( $requestParameters = array() ) { - return $this->fakeCall( 'authorize', $requestParameters ); - } - - public function authorizeOnBillingAgreement( $requestParameters = array() ) { - return $this->fakeCall( 'authorizeOnBillingAgreement', $requestParameters ); - } - - public function cancelOrderReference( $requestParameters = array() ) { - } - - public function capture( $requestParameters = array() ) { - } - - public function charge( $requestParameters = array() ) { - } - - public function closeAuthorization( $requestParameters = array() ) { - } - - public function closeBillingAgreement( $requestParameters = array() ) { - } - - public function closeOrderReference( $requestParameters = array() ) { - return $this->fakeCall( 'closeOrderReference', $requestParameters ); - } - - public function confirmBillingAgreement( $requestParameters = array() ) { - return $this->fakeCall( 'confirmBillingAgreement', $requestParameters ); - } - - public function confirmOrderReference( $requestParameters = array() ) { - return $this->fakeCall( 'confirmOrderReference', $requestParameters ); - } - - public function createOrderReferenceForId( $requestParameters = array() ) { - } - - public function getAuthorizationDetails( $requestParameters = array() ) { - } - - public function getBillingAgreementDetails( $requestParameters = array() ) { - return $this->fakeCall( 'getBillingAgreementDetails', $requestParameters ); - } - - public function getCaptureDetails( $requestParameters = array() ) { - return $this->fakeCall( 'getCaptureDetails', $requestParameters ); - } - - public function getOrderReferenceDetails( $requestParameters = array() ) { - return $this->fakeCall( 'getOrderReferenceDetails', $requestParameters ); - } - - public function getParameters() { - } - - public function getProviderCreditDetails( $requestParameters = array() ) { - } - - public function getProviderCreditReversalDetails( $requestParameters = array() ) { - } - - public function getRefundDetails( $requestParameters = array() ) { - } - - public function getServiceStatus( $requestParameters = array() ) { - } - - public function getUserInfo( $access_token ) { - } - - public function refund( $requestParameters = array() ) { - } - - public function reverseProviderCredit( $requestParameters = array() ) { - } - - public function setBillingAgreementDetails( $requestParameters = array() ) { - return $this->fakeCall( 'setBillingAgreementDetails', $requestParameters ); - } - - public function setClientId( $value ) { - } - - public function setMwsServiceUrl( $url ) { - } - - public function setOrderReferenceDetails( $requestParameters = array() ) { - return $this->fakeCall( 'setOrderReferenceDetails', $requestParameters ); - } - - public function setProxy( $proxy ) { - } - - public function setSandbox( $value ) { - } - - public function validateBillingAgreement( $requestParameters = array() ) { - } - -} diff --git a/wikimedia/donation-interface/tests/phpunit/includes/MockAmazonResponse.php b/wikimedia/donation-interface/tests/phpunit/includes/MockAmazonResponse.php deleted file mode 100644 index bce94d4..0000000 --- a/wikimedia/donation-interface/tests/phpunit/includes/MockAmazonResponse.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -/** - * FIXME: Jenkins still not installing DonationInterface composer deps - * use PayWithAmazon\ResponseInterface as PwaResponseInterface; - */ - -/** - * Stubs out the functionality of the ResponseParser from the Login and Pay with - * Amazon SDK. TODO: replace with PHPUnit method return mocks when Jenkins - * is running new enough PHPUnit. We only use toArray. - */ -class MockAmazonResponse { // FIXME: implements PwaResponseInterface { - - protected $response; - - /** - * Creates the fake response from JSON in tests/includes/Responses/amazon - * @param string $operation The PwaClient function call we're faking - * @param string $status Set to fake responses with an error status - * Reads from $operation_$status.json - */ - public function __construct( $operation, $status = null ) { - $statusPart = $status ? '_' . $status : ''; - $filePath = __DIR__ . "/Responses/amazon/{$operation}{$statusPart}.json"; - $json = file_get_contents( $filePath ); - $this->response = json_decode( $json, true ); - } - - public function getBillingAgreementDetailsStatus( $response ) { - } - - public function toArray() { - return $this->response; - } - - public function toJson() { - } - - public function toXml() { - } -} diff --git a/wikimedia/donation-interface/tests/phpunit/includes/test_gateway/TestingAmazonAdapter.php b/wikimedia/donation-interface/tests/phpunit/includes/test_gateway/TestingAmazonAdapter.php deleted file mode 100644 index 2671872..0000000 --- a/wikimedia/donation-interface/tests/phpunit/includes/test_gateway/TestingAmazonAdapter.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -/** - * TestingAmazonAdapter - */ -class TestingAmazonAdapter extends AmazonAdapter { - use TTestingAdapter; - - public static $mockClient; - - protected function getPwaClient() { - return self::$mockClient; - } -} -- To view, visit https://gerrit.wikimedia.org/r/391983 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If5a30f0f841eb348bbe3acd37994973cf66c686c Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm/vendor Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> Gerrit-Reviewer: Ejegg <ej...@ejegg.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits