Skip to content

Commit e5c2a9b

Browse files
committed
update base url endpoint
1 parent 473b47f commit e5c2a9b

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

midtransclient/core_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def charge(self,parameters=dict()):
3434
3535
:return: Dictionary from JSON decoded response
3636
"""
37-
api_url = self.api_config.get_core_api_base_url()+'/charge'
37+
api_url = self.api_config.get_base_url()+'/v2/charge'
3838

3939
response_dict, response_object = self.http_client.request(
4040
'post',
@@ -53,7 +53,7 @@ def capture(self,parameters=dict()):
5353
5454
:return: Dictionary from JSON decoded response
5555
"""
56-
api_url = self.api_config.get_core_api_base_url()+'/capture'
56+
api_url = self.api_config.get_base_url()+'/v2/capture'
5757

5858
response_dict, response_object = self.http_client.request(
5959
'post',
@@ -73,7 +73,7 @@ def card_register(self,parameters=dict()):
7373
7474
:return: Dictionary from JSON decoded response
7575
"""
76-
api_url = self.api_config.get_core_api_base_url()+'/card/register'
76+
api_url = self.api_config.get_base_url()+'/v2/card/register'
7777

7878
response_dict, response_object = self.http_client.request(
7979
'get',
@@ -93,7 +93,7 @@ def card_token(self,parameters=dict()):
9393
9494
:return: Dictionary from JSON decoded response
9595
"""
96-
api_url = self.api_config.get_core_api_base_url()+'/token'
96+
api_url = self.api_config.get_base_url()+'/v2/token'
9797

9898
response_dict, response_object = self.http_client.request(
9999
'get',
@@ -113,7 +113,7 @@ def card_point_inquiry(self,token_id):
113113
114114
:return: Dictionary from JSON decoded response
115115
"""
116-
api_url = self.api_config.get_core_api_base_url()+'/point_inquiry/'+token_id
116+
api_url = self.api_config.get_base_url()+'/v2/point_inquiry/'+token_id
117117

118118
response_dict, response_object = self.http_client.request(
119119
'get',

midtransclient/transactions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self,parent):
1111
self.parent = parent
1212

1313
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'
1515
response_dict, response_object = self.parent.http_client.request(
1616
'get',
1717
self.parent.api_config.server_key,
@@ -22,7 +22,7 @@ def status(self, transaction_id):
2222
return response_dict
2323

2424
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'
2626
response_dict, response_object = self.parent.http_client.request(
2727
'get',
2828
self.parent.api_config.server_key,
@@ -33,7 +33,7 @@ def statusb2b(self, transaction_id):
3333
return response_dict
3434

3535
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'
3737
response_dict, response_object = self.parent.http_client.request(
3838
'post',
3939
self.parent.api_config.server_key,
@@ -44,7 +44,7 @@ def approve(self, transaction_id):
4444
return response_dict
4545

4646
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'
4848
response_dict, response_object = self.parent.http_client.request(
4949
'post',
5050
self.parent.api_config.server_key,
@@ -55,7 +55,7 @@ def deny(self, transaction_id):
5555
return response_dict
5656

5757
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'
5959
response_dict, response_object = self.parent.http_client.request(
6060
'post',
6161
self.parent.api_config.server_key,
@@ -66,7 +66,7 @@ def cancel(self, transaction_id):
6666
return response_dict
6767

6868
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'
7070
response_dict, response_object = self.parent.http_client.request(
7171
'post',
7272
self.parent.api_config.server_key,
@@ -77,7 +77,7 @@ def expire(self, transaction_id):
7777
return response_dict
7878

7979
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'
8181
response_dict, response_object = self.parent.http_client.request(
8282
'post',
8383
self.parent.api_config.server_key,
@@ -88,7 +88,7 @@ def refund(self, transaction_id,parameters=dict()):
8888
return response_dict
8989

9090
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'
9292
response_dict, response_object = self.parent.http_client.request(
9393
'post',
9494
self.parent.api_config.server_key,
@@ -99,15 +99,15 @@ def refundDirect(self, transaction_id,parameters=dict()):
9999
return response_dict
100100

101101
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)
103103
if is_notification_string:
104104
try:
105105
notification = json.loads(notification)
106106
except Exception as e:
107107
raise JSONDecodeError('fail to parse `notification` string as JSON. Use JSON string or Dict as `notification`. with message: `{0}`'.format(repr(e)))
108108

109109
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'
111111
response_dict, response_object = self.parent.http_client.request(
112112
'get',
113113
self.parent.api_config.server_key,

0 commit comments

Comments
 (0)