@@ -114,14 +114,14 @@ def _get_links(self, payment):
114
114
return extra_data .get ("links" , {})
115
115
116
116
@authorize
117
- def post (self , payment , * args , ** kwargs ):
117
+ def http_request (self , payment , * args , http_method = None , ** kwargs ):
118
118
kwargs ["headers" ] = {
119
119
"Content-Type" : "application/json" ,
120
120
"Authorization" : self .access_token ,
121
121
}
122
122
if "data" in kwargs :
123
123
kwargs ["data" ] = json .dumps (kwargs ["data" ])
124
- response = requests . post (* args , ** kwargs )
124
+ response = http_method (* args , ** kwargs )
125
125
try :
126
126
data = response .json ()
127
127
except ValueError :
@@ -144,6 +144,12 @@ def post(self, payment, *args, **kwargs):
144
144
self .set_response_data (payment , data )
145
145
return data
146
146
147
+ def post (self , payment , * args , ** kwargs ):
148
+ return self .http_request (payment , * args , http_method = requests .post , ** kwargs )
149
+
150
+ def get (self , payment , * args , ** kwargs ):
151
+ return self .http_request (payment , * args , http_method = requests .get , ** kwargs )
152
+
147
153
def get_last_response (self , payment , is_auth = False ):
148
154
extra_data = json .loads (payment .extra_data or "{}" )
149
155
if is_auth :
0 commit comments