Skip to content

Commit 905c5b4

Browse files
committed
added more options
1 parent 56ffa20 commit 905c5b4

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

cryptapi/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from django.conf import settings
22

33
CRYPTAPI_URL = getattr(settings, 'CRYPTAPI_URL', "https://cryptapi.io/api/")
4+
CALLBACK_BASE_URL = getattr(settings, 'CALLBACK_BASE_URL', None)

cryptapi/dispatchers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ def request(self, cb_params={}, params={}):
148148

149149
if self.coin in TOKEN_DICT:
150150
divider = TOKEN_DICT[self.coin][4]
151-
self.value = self.value / 10**divider
151+
self.value = self.value / (10 ** divider)
152152

153153
request_model.nonce = _cb_params['nonce']
154154
request_model.address_in = response['address_in']
155-
request_model.address_out = provider.cold_wallet
155+
request_model.address_out = _params['address']
156156
request_model.value_requested = self.value
157157
request_model.status = 'created'
158158
request_model.raw_request_url = raw_response.url

cryptapi/meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from distutils.version import StrictVersion
22

33

4-
VERSION = StrictVersion('0.2.5')
4+
VERSION = StrictVersion('0.2.6')

cryptapi/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import requests
22
from django.shortcuts import reverse
3-
from cryptapi.config import CRYPTAPI_URL
3+
from cryptapi.config import CRYPTAPI_URL, CALLBACK_BASE_URL
44
from urllib.parse import urlencode
55

66

@@ -9,7 +9,10 @@ def build_query_string(data):
99

1010

1111
def build_callback_url(_r, params):
12-
base_url = '{scheme}://{host}'.format(scheme=_r.scheme, host=_r.get_host())
12+
13+
base_url = CALLBACK_BASE_URL
14+
if not base_url:
15+
base_url = '{scheme}://{host}'.format(scheme=_r.scheme, host=_r.get_host())
1316

1417
base_request = requests.Request(
1518
url="{}{}".format(base_url, reverse('cryptapi:callback')),

0 commit comments

Comments
 (0)