@@ -11,7 +11,7 @@ def __init__(self,parent):
11
11
self .parent = parent
12
12
13
13
def status (self , transaction_id ):
14
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/status'
14
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/status'
15
15
response_dict , response_object = self .parent .http_client .request (
16
16
'get' ,
17
17
self .parent .api_config .server_key ,
@@ -22,7 +22,7 @@ def status(self, transaction_id):
22
22
return response_dict
23
23
24
24
def statusb2b (self , transaction_id ):
25
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/status/b2b'
25
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/status/b2b'
26
26
response_dict , response_object = self .parent .http_client .request (
27
27
'get' ,
28
28
self .parent .api_config .server_key ,
@@ -33,7 +33,7 @@ def statusb2b(self, transaction_id):
33
33
return response_dict
34
34
35
35
def approve (self , transaction_id ):
36
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/approve'
36
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/approve'
37
37
response_dict , response_object = self .parent .http_client .request (
38
38
'post' ,
39
39
self .parent .api_config .server_key ,
@@ -44,7 +44,7 @@ def approve(self, transaction_id):
44
44
return response_dict
45
45
46
46
def deny (self , transaction_id ):
47
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/deny'
47
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/deny'
48
48
response_dict , response_object = self .parent .http_client .request (
49
49
'post' ,
50
50
self .parent .api_config .server_key ,
@@ -55,7 +55,7 @@ def deny(self, transaction_id):
55
55
return response_dict
56
56
57
57
def cancel (self , transaction_id ):
58
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/cancel'
58
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/cancel'
59
59
response_dict , response_object = self .parent .http_client .request (
60
60
'post' ,
61
61
self .parent .api_config .server_key ,
@@ -66,7 +66,7 @@ def cancel(self, transaction_id):
66
66
return response_dict
67
67
68
68
def expire (self , transaction_id ):
69
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/expire'
69
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/expire'
70
70
response_dict , response_object = self .parent .http_client .request (
71
71
'post' ,
72
72
self .parent .api_config .server_key ,
@@ -77,7 +77,7 @@ def expire(self, transaction_id):
77
77
return response_dict
78
78
79
79
def refund (self , transaction_id ,parameters = dict ()):
80
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/refund'
80
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/refund'
81
81
response_dict , response_object = self .parent .http_client .request (
82
82
'post' ,
83
83
self .parent .api_config .server_key ,
@@ -88,7 +88,7 @@ def refund(self, transaction_id,parameters=dict()):
88
88
return response_dict
89
89
90
90
def refundDirect (self , transaction_id ,parameters = dict ()):
91
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/refund/online/direct'
91
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/refund/online/direct'
92
92
response_dict , response_object = self .parent .http_client .request (
93
93
'post' ,
94
94
self .parent .api_config .server_key ,
@@ -99,15 +99,15 @@ def refundDirect(self, transaction_id,parameters=dict()):
99
99
return response_dict
100
100
101
101
def notification (self , notification = dict ()):
102
- is_notification_string = isinstance (notification , str )
102
+ is_notification_string = isinstance (notification , str if sys . version_info [ 0 ] >= 3 else basestring )
103
103
if is_notification_string :
104
104
try :
105
105
notification = json .loads (notification )
106
106
except Exception as e :
107
107
raise JSONDecodeError ('fail to parse `notification` string as JSON. Use JSON string or Dict as `notification`. with message: `{0}`' .format (repr (e )))
108
108
109
109
transaction_id = notification ['transaction_id' ]
110
- api_url = self .parent .api_config .get_core_api_base_url ()+ '/' + transaction_id + '/status'
110
+ api_url = self .parent .api_config .get_base_url ()+ '/v2 /' + transaction_id + '/status'
111
111
response_dict , response_object = self .parent .http_client .request (
112
112
'get' ,
113
113
self .parent .api_config .server_key ,
0 commit comments