jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/342893 )
Change subject: Cast a wider net when searching for ct_id
......................................................................
Cast a wider net when searching for ct_id
Change-Id: Ib569785cb38717c744716e1b364db7785e068538
FIXME: should we set transaction_subject to ct_id for express checkout?
---
M audit/paypal/TrrFile.py
M audit/paypal/tests/test_trr_file.py
2 files changed, 11 insertions(+), 3 deletions(-)
Approvals:
XenoRyet: Looks good to me, approved
jenkins-bot: Verified
diff --git a/audit/paypal/TrrFile.py b/audit/paypal/TrrFile.py
index a73a5f3..a884681 100644
--- a/audit/paypal/TrrFile.py
+++ b/audit/paypal/TrrFile.py
@@ -143,9 +143,17 @@
if row['PayPal Reference ID Type'] == 'SUB':
out['subscr_id'] = row['PayPal Reference ID']
+ # Look in all the places we might have stuck a ct_id
if re.search('^[0-9]+$', row['Transaction Subject']):
out['contribution_tracking_id'] = row['Transaction Subject']
- out['order_id'] = row['Transaction Subject']
+ elif row['Custom Field']:
+ out['contribution_tracking_id'] = row['Custom Field']
+ elif row['Invoice ID']:
+ # Here it can be the ct_id.attempt format
+ out['contribution_tracking_id'] = row['Invoice ID'].split('.')[0]
+
+ if out['contribution_tracking_id']:
+ out['order_id'] = out['contribution_tracking_id']
event_type = row['Transaction Event Code'][0:3]
diff --git a/audit/paypal/tests/test_trr_file.py
b/audit/paypal/tests/test_trr_file.py
index db4533b..2cf3c3e 100644
--- a/audit/paypal/tests/test_trr_file.py
+++ b/audit/paypal/tests/test_trr_file.py
@@ -135,7 +135,7 @@
# Did we send it?
args = MockRedis().send.call_args
assert args[0][0] == 'refund'
- expected = sorted({'last_name': 'Man', 'thankyou_date': 0, 'city': '',
'payment_method': '', 'gateway_status': 'S', 'currency': 'USD', 'postal_code':
'', 'date': '1474736101', 'gateway_refund_id': 'AS7D98AS7D9A8S7D9AS',
'gateway': 'paypal', 'state_province': '', 'gross': 10.0, 'first_name':
'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS',
'gross_currency': 'USD', 'country': '', 'payment_submethod': '', 'note': 'r',
'supplemental_address_1': '', 'settled_date': '1474736101',
'gateway_parent_id': '3GJH3GJ3334214812', 'type': 'refund', 'email':
'[email protected]', 'street_address': ''})
+ expected = sorted({'last_name': 'Man', 'thankyou_date': 0, 'city': '',
'payment_method': '', 'gateway_status': 'S', 'currency': 'USD', 'postal_code':
'', 'date': '1474736101', 'gateway_refund_id': 'AS7D98AS7D9A8S7D9AS',
'gateway': 'paypal', 'state_province': '', 'gross': 10.0, 'first_name':
'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS',
'gross_currency': 'USD', 'country': '', 'payment_submethod': '', 'note': 'r',
'supplemental_address_1': '', 'settled_date': '1474736101',
'gateway_parent_id': '3GJH3GJ3334214812', 'type': 'refund', 'email':
'[email protected]', 'street_address': '', 'contribution_tracking_id':
'1234567', 'order_id': '1234567'})
actual = sorted(args[0][1])
assert actual == expected
@@ -175,6 +175,6 @@
# Did we send it?
args = MockRedis().send.call_args
assert args[0][0] == 'recurring'
- expected = sorted({'last_name': 'Man', 'txn_type': 'subscr_payment',
'thankyou_date': 0, 'city': '', 'payment_method': '', 'gateway_status': 'S',
'currency': 'USD', 'postal_code': '', 'date': '1474736101', 'subscr_id':
'3GJH3GJ3334214812', 'gateway': 'paypal', 'state_province': '', 'gross': 0.1,
'first_name': 'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS',
'country': '', 'payment_submethod': '', 'note': '', 'supplemental_address_1':
'', 'settled_date': '1474736101', 'email': '[email protected]',
'street_address': ''})
+ expected = sorted({'last_name': 'Man', 'txn_type': 'subscr_payment',
'thankyou_date': 0, 'city': '', 'payment_method': '', 'gateway_status': 'S',
'currency': 'USD', 'postal_code': '', 'date': '1474736101', 'subscr_id':
'3GJH3GJ3334214812', 'gateway': 'paypal', 'state_province': '', 'gross': 0.1,
'first_name': 'Banana', 'fee': 0.55, 'gateway_txn_id': 'AS7D98AS7D9A8S7D9AS',
'country': '', 'payment_submethod': '', 'note': '', 'supplemental_address_1':
'', 'settled_date': '1474736101', 'email': '[email protected]',
'street_address': '', 'contribution_tracking_id': '1234567', 'order_id':
'1234567'})
actual = sorted(args[0][1])
assert actual == expected
--
To view, visit https://gerrit.wikimedia.org/r/342893
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib569785cb38717c744716e1b364db7785e068538
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits