Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Event-specific URL setting not evaluated in SixPayResponseHandler._perform_request #6

Closed
cfgmr opened this issue Feb 27, 2018 · 6 comments
Assignees
Labels

Comments

@cfgmr
Copy link
Contributor

cfgmr commented Feb 27, 2018

The request-url in the SixPayResponseHandler._perform_request method is generated by combining base url from settings with endpoint:
request_url = urlparse.urljoin(current_plugin.settings.get('url'), endpoint)

current_plugin.settings.get('url')will return the url that was configured in the global plugin settings (reached via Indico->Administration->Plugins->SixPay Saferpay or via Indico->Administration->Payment-> SixPay Saferpay) not the url configured in the event-specific settings (reached via Indico->Event->Management Area->Payment->SixPay Saferpay)

If for example SixPay Saferpay URL is set to https://www.test.saferpay.com/hosting/ in the global plugin settings and to https://www.saferpay.com/hosting/ in the event-specific settings,
current_plugin.settings.get('url')will return https://www.test.saferpay.com/hosting/

@maxfischer2781 maxfischer2781 self-assigned this Feb 28, 2018
@maxfischer2781
Copy link
Owner

Does this appear for other settings as well? It seems that the plugin.Plugin.adjust_payment_form_data must also explicitly resolve event_settings versus settings.

@maxfischer2781
Copy link
Owner

@cfgmr
Can you give the hotfix branch a try?

@cfgmr
Copy link
Contributor Author

cfgmr commented Mar 1, 2018

I get the following error on our test system:

2018-03-01 09:51:51,443  a021a18ec9594ce0  indico.flask - ERROR errors.py:107 -- 'UserSuccessHandler' object has no attribute 'registration'

Traceback (most recent call last):
  File "/opt/indico/.venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/indico/.venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/indico/.venv/lib/python2.7/site-packages/flask_pluginengine/util.py", line 194, in wrapped
    return func(*args, **kwargs)
  File "/opt/indico/.venv/lib/python2.7/site-packages/indico/web/flask/util.py", line 114, in wrapper
    return obj().process()
  File "/opt/indico/indico_sixpay/indico_sixpay/request_handlers.py", line 81, in __init__
    self.sixpay_url = current_plugin.event_settings.get(self.registration.registration_form.event, 'url') \
AttributeError: 'UserSuccessHandler' object has no attribute 'registration'

{u'data': {u'get': {'DATA': u'<IDP MSGTYPE="PayConfirm" TOKEN="(unused)" VTVERIFY="(obsolete)" KEYID="1-0" ID="xtYWMrA4vGhdSAr2IYA0bSjY0rzA" ACCOUNTID="401860-17795278" PROVIDERID="1385" PROVIDERNAME="VISA Saferpay Test" PAYMENTMETHOD="2" ORDERID="e1u3_Claas Faber" AMOUNT="100" CURRENCY="EUR" IP="134.245.216.72" IPCOUNTRY="DE" CCCOUNTRY="JP" MPI_LIABILITYSHIFT="yes" MPI_TX_CAVV="jAABBIIFmAAAAAAAAAAAAAAAAAA=" MPI_XID="bAwKbwJiBxpLBCY9EAEFaW8ZfQs=" ECI="1" CAVV="jAABBIIFmAAAAAAAAAAAAAAAAAA=" XID="bAwKbwJiBxpLBCY9EAEFaW8ZfQs=" />',
                    'SIGNATURE': u'9ab70d3f93f45b8b4b79f10131fbbd67ee32f8ed2b7b1acad94540570e12b9b9b5a6442035352b403ec442e6f17065c9f29f9af6312ca3ff19d1b45e27169984',
                    'token': u'dcf1c35d-4277-4fff-88a0-fa64cecc6ce3'},
           u'headers': {'Accept': u'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                        'Accept-Encoding': u'gzip, deflate, br',
                        'Accept-Language': u'en-US,en;q=0.5',
                        'Connection': u'keep-alive',
                        'Cookie': u'SCREEN_NAME=6968586b48374362562f4348445663546f564b4151773d3d; indico_session=2bed1f04-f047-4cf2-9e41-5ce9802c43a9',
                        'Host': u'dm-carsten.geomar.de',
                        'Referer': u'https://test.saferpay.com/VT2/mpp/Confirmation/Close/fs0idzdegaf5rqdmxsl4mmyq',
                        'Upgrade-Insecure-Requests': u'1',
                        'User-Agent': u'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:58.0) Gecko/20100101 Firefox/58.0'},
           u'json': None,
           u'post': {},
           u'url': {'confId': u'1', 'reg_form_id': 5}},
 u'endpoint': u'plugin_payment_sixpay.success',
 u'id': 'a021a18ec9594ce0',
 u'ip': '134.245.216.72',
 u'method': 'GET',
 u'referrer': 'https://test.saferpay.com/VT2/mpp/Confirmation/Close/fs0idzdegaf5rqdmxsl4mmyq',
 u'rh': None,
 u'time': '2018-03-01T09:51:51.507122',
 u'url': u'https://dm-carsten.geomar.de/event/1/registrations/5/payment/response/sixpay/success?token=dcf1c35d-4277-4fff-88a0-fa64cecc6ce3&DATA=<IDP+MSGTYPE%3d"PayConfirm"+TOKEN%3d"(unused)"+VTVERIFY%3d"(obsolete)"+KEYID%3d"1-0"+ID%3d"xtYWMrA4vGhdSAr2IYA0bSjY0rzA"+ACCOUNTID%3d"401860-17795278"+PROVIDERID%3d"1385"+PROVIDERNAME%3d"VISA+Saferpay+Test"+PAYMENTMETHOD%3d"2"+ORDERID%3d"e1u3_Claas+Faber"+AMOUNT%3d"100"+CURRENCY%3d"EUR"+IP%3d"134.245.216.72"+IPCOUNTRY%3d"DE"+CCCOUNTRY%3d"JP"+MPI_LIABILITYSHIFT%3d"yes"+MPI_TX_CAVV%3d"jAABBIIFmAAAAAAAAAAAAAAAAAA%3d"+MPI_XID%3d"bAwKbwJiBxpLBCY9EAEFaW8ZfQs%3d"+ECI%3d"1"+CAVV%3d"jAABBIIFmAAAAAAAAAAAAAAAAAA%3d"+XID%3d"bAwKbwJiBxpLBCY9EAEFaW8ZfQs%3d"+%2f>&SIGNATURE=9ab70d3f93f45b8b4b79f10131fbbd67ee32f8ed2b7b1acad94540570e12b9b9b5a6442035352b403ec442e6f17065c9f29f9af6312ca3ff19d1b45e27169984',
 u'user': {u'email': u'cfaber@geomar.de', u'id': 3, u'name': u'Claas Faber'},
 u'user_agent': u'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:58.0) Gecko/20100101 Firefox/58.0'}

@maxfischer2781
Copy link
Owner

@cfgmr
Thanks for trying! The setting is now looked up after its dependencies are initialised.

@cfgmr
Copy link
Contributor Author

cfgmr commented Mar 1, 2018

Great, now it works!

@maxfischer2781
Copy link
Owner

Should be fixed in v2.0.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants