jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/348837 )

Change subject: Fix EC recurring profile creation
......................................................................


Fix EC recurring profile creation

Also tests

Change-Id: Ia4d4bac44c11f8ff74b837ded8d94f8eeb6d5f55
---
M PaymentProviders/PayPal/Job.php
A PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created.json
A 
PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
M PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
4 files changed, 54 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Ejegg: Looks good to me, approved



diff --git a/PaymentProviders/PayPal/Job.php b/PaymentProviders/PayPal/Job.php
index 6e8816f..ab64a33 100644
--- a/PaymentProviders/PayPal/Job.php
+++ b/PaymentProviders/PayPal/Job.php
@@ -78,6 +78,8 @@
                // FIXME random document formats
                if ( substr( $txn_type, 0, 7 ) === 'subscr_' ) {
                        $log_id = "subscr_id:{$request['subscr_id']}";
+               } elseif ( substr( $txn_type, 0, 10 ) === 'recurring_'  ) {
+                       $log_id = 
"recurring_payment_id:{$request['recurring_payment_id']}";
                } else {
                        $log_id = "txn_id:{$request['txn_id']}";
                }
diff --git 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created.json 
b/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created.json
new file mode 100644
index 0000000..1cd1c71
--- /dev/null
+++ b/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created.json
@@ -0,0 +1,30 @@
+{
+  "payment_cycle": "Monthly",
+  "txn_type": "recurring_payment_profile_created",
+  "last_name": "Fowl",
+  "next_payment_date": "03:00:00 May 18, 2017 PDT",
+  "residence_country": "US",
+  "initial_payment_amount": "0",
+  "rp_invoice_id": "47017286",
+  "currency_code": "JPY",
+  "time_created": "09:45:28 Apr 18, 2017 PDT",
+  "verify_sign": "ATZo1sTL1YpCR8SD-CzFolXviWIiAYV78oZbytx6QLNuI3z-KS8wKLqC",
+  "period_type": " Regular",
+  "payer_status": "unverified",
+  "tax": "0",
+  "payer_email": "do...@generous.net",
+  "first_name": "Fezziwig",
+  "receiver_email": "recei...@organization.org",
+  "payer_id": "8R297FE87CD8S",
+  "product_type": "1",
+  "shipping": "0",
+  "amount_per_cycle": "140",
+  "profile_status": "Active",
+  "charset": "UTF-8",
+  "notify_version": "3.8",
+  "amount": "140",
+  "outstanding_balance": "0",
+  "recurring_payment_id": "I-88J1M3DLSF0",
+  "product_name": "Monthly donation to the Wikimedia Foundation",
+  "ipn_track_id": "8999c084zz0f2"
+}
diff --git 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
 
b/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
new file mode 100644
index 0000000..890f7dd
--- /dev/null
+++ 
b/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
@@ -0,0 +1,21 @@
+{
+  "subscr_id": "I-88J1M3DLSF0",
+  "txn_type": "subscr_signup",
+  "contribution_tracking_id": "47017286",
+  "order_id": "47017286",
+  "email": "do...@generous.net",
+  "first_name": "Fezziwig",
+  "middle_name": "",
+  "last_name": "Fowl",
+  "frequency_interval": "1",
+  "frequency_unit": "month",
+  "installments": 0,
+  "create_date": 1492533928,
+  "start_date": 1492533928,
+  "date": 1492533928,
+  "gateway": "paypal_ec",
+  "recurring": "1",
+  "source_name": "SmashPig",
+  "source_type": "listener",
+  "source_version": "unknown"
+}
diff --git 
a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php 
b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
index 7af7c01..f57aa9e 100644
--- a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
+++ b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
@@ -27,6 +27,7 @@
        static $message_data = array(
                'web_accept.json' => 'donations',
                'express_checkout.json' => 'donations',
+               'recurring_payment_profile_created.json' => 'recurring',
                'subscr_signup.json' => 'recurring',
                'subscr_payment.json' => 'recurring',
                'recurring_payment.json' => 'recurring',

-- 
To view, visit https://gerrit.wikimedia.org/r/348837
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4d4bac44c11f8ff74b837ded8d94f8eeb6d5f55
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org>
Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to