mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-13 07:29:39 +00:00
Payment/Paypal: Don't fail on business mismatch
Merchant ID and email seem to be interchangable. THANKS PAYPAL.
This commit is contained in:
parent
ab6daa662e
commit
a1a878de86
@ -54,8 +54,7 @@ class RHPaypalIPN(RH):
|
||||
raise BadRequest
|
||||
|
||||
def _process(self):
|
||||
if not self._verify_business():
|
||||
return
|
||||
self._verify_business()
|
||||
verify_params = list(chain(IPN_VERIFY_EXTRA_PARAMS, request.form.iteritems()))
|
||||
result = requests.post(current_plugin.settings.get('url'), data=verify_params).text
|
||||
if result != 'VERIFIED':
|
||||
|
||||
@ -75,7 +75,6 @@ def test_ipn_is_transaction_duplicated(mocker, txn_id, payment_status, expected)
|
||||
|
||||
@pytest.mark.usefixtures('db', 'request_context')
|
||||
@pytest.mark.parametrize('fail', (
|
||||
'business',
|
||||
'verify',
|
||||
'dup_txn',
|
||||
'fail',
|
||||
@ -89,7 +88,6 @@ def test_ipn_process(mocker, fail):
|
||||
post = mocker.patch('indico_payment_paypal.controllers.requests.post')
|
||||
post.return_value.text = 'INVALID' if fail == 'verify' else 'VERIFIED'
|
||||
rh = RHPaypalIPN()
|
||||
rh._verify_business = lambda: fail != 'business'
|
||||
rh._is_transaction_duplicated = lambda: fail == 'dup_txn'
|
||||
rh.event = MagicMock(id=1)
|
||||
rh.registrant = MagicMock()
|
||||
@ -99,8 +97,8 @@ def test_ipn_process(mocker, fail):
|
||||
request.view_args = {'confId': rh.event.id}
|
||||
request.args = {'registrantId': '1'}
|
||||
request.form = {'payment_status': payment_status, 'txn_id': '12345', 'mc_gross': amount,
|
||||
'mc_currency': 'EUR'}
|
||||
'mc_currency': 'EUR', 'business': 'foo@bar.com'}
|
||||
with PaypalPaymentPlugin.instance.plugin_context():
|
||||
rh._process()
|
||||
assert post.called == (fail != 'business')
|
||||
assert post.called
|
||||
assert rt.called == (fail is None)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user