diff --git a/src/bornhack/environment_settings.py.dist b/src/bornhack/environment_settings.py.dist index 865c719a..e5f15046 100644 --- a/src/bornhack/environment_settings.py.dist +++ b/src/bornhack/environment_settings.py.dist @@ -57,6 +57,7 @@ EPAY_MD5_SECRET='{{ epay_md5_secret }}' COINIFY_API_KEY='{{ coinify_api_key }}' COINIFY_API_SECRET='{{ coinify_api_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 PDF_LETTERHEAD_FILENAME='{{ pdf_letterhead_filename }}' diff --git a/src/shop/models.py b/src/shop/models.py index 1163e361..0053970d 100644 --- a/src/shop/models.py +++ b/src/shop/models.py @@ -144,7 +144,12 @@ class Order(CreatedUpdatedModel): return False 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): return 'https://' + request.get_host() + str(reverse_lazy('shop:coinify_thanks', kwargs={'pk': self.pk}))