make coinify callback hostname configurable, so we can workaround old openssl in their callback engine

This commit is contained in:
Thomas Steen Rasmussen 2017-07-11 11:06:46 +02:00
parent 2e13525ad7
commit 974b90676e
2 changed files with 7 additions and 1 deletions

View file

@ -57,6 +57,7 @@ EPAY_MD5_SECRET='{{ epay_md5_secret }}'
COINIFY_API_KEY='{{ coinify_api_key }}' COINIFY_API_KEY='{{ coinify_api_key }}'
COINIFY_API_SECRET='{{ coinify_api_secret }}' COINIFY_API_SECRET='{{ coinify_api_secret }}'
COINIFY_IPN_SECRET='{{ coinify_ipn_secret }}' COINIFY_IPN_SECRET='{{ coinify_ipn_secret }}'
COINIFY_CALLBACK_HOSTNAME='{{ coinify_callback_hostname }}' # leave empty or comment out to use hostname from request
# shop settings # shop settings
PDF_LETTERHEAD_FILENAME='{{ pdf_letterhead_filename }}' PDF_LETTERHEAD_FILENAME='{{ pdf_letterhead_filename }}'

View file

@ -144,7 +144,12 @@ class Order(CreatedUpdatedModel):
return False return False
def get_coinify_callback_url(self, request): def get_coinify_callback_url(self, request):
return 'https://' + request.get_host() + str(reverse_lazy('shop:coinify_callback', kwargs={'pk': self.pk})) """ Check settings for an alternative COINIFY_CALLBACK_HOSTNAME otherwise use the one from the request """
if 'COINIFY_CALLBACK_HOSTNAME' in settings and settings['COINIFY_CALLBACK_HOSTNAME']:
host = settings['COINIFY_CALLBACK_HOSTNAME']
else:
host = request.get_host()
return 'https://' + host + str(reverse_lazy('shop:coinify_callback', kwargs={'pk': self.pk}))
def get_coinify_thanks_url(self, request): def get_coinify_thanks_url(self, request):
return 'https://' + request.get_host() + str(reverse_lazy('shop:coinify_thanks', kwargs={'pk': self.pk})) return 'https://' + request.get_host() + str(reverse_lazy('shop:coinify_thanks', kwargs={'pk': self.pk}))