@@ -48,15 +48,15 @@ def create(
4848
4949 invoice .token = self .__token_container .get_access_token (facade )
5050 invoice_json = invoice .to_json ()
51- response = self .__bitpay_client .post (
52- "invoices" , invoice_json , sign_request
53- )
51+ response = self .__bitpay_client .post ("invoices" , invoice_json , sign_request )
5452 response_json = ResponseParser .response_to_json_string (response )
5553
5654 try :
5755 invoice = Invoice (** response_json )
5856 except Exception as exe :
59- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
57+ BitPayExceptionProvider .throw_deserialize_resource_exception (
58+ "Invoice" , str (exe )
59+ )
6060
6161 return invoice
6262
@@ -88,7 +88,9 @@ def get(
8888 try :
8989 invoice = Invoice (** response_json )
9090 except Exception as exe :
91- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
91+ BitPayExceptionProvider .throw_deserialize_resource_exception (
92+ "Invoice" , str (exe )
93+ )
9294 raise
9395
9496 return invoice
@@ -118,7 +120,9 @@ def get_by_guid(
118120 try :
119121 invoice = Invoice (** response_json )
120122 except Exception as exe :
121- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
123+ BitPayExceptionProvider .throw_deserialize_resource_exception (
124+ "Invoice" , str (exe )
125+ )
122126 raise
123127
124128 return invoice
@@ -169,7 +173,9 @@ def get_invoices(
169173 for invoice_data in response_json :
170174 invoices .append (Invoice (** invoice_data ))
171175 except Exception as exe :
172- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
176+ BitPayExceptionProvider .throw_deserialize_resource_exception (
177+ "Invoice" , str (exe )
178+ )
173179 raise
174180
175181 return invoices
@@ -204,15 +210,15 @@ def update(
204210 if sms_code is not None :
205211 params ["smsCode" ] = sms_code
206212
207- response = self .__bitpay_client .update (
208- "invoices/%s" % invoice_id , params
209- )
213+ response = self .__bitpay_client .update ("invoices/%s" % invoice_id , params )
210214 response_json = ResponseParser .response_to_json_string (response )
211215
212216 try :
213217 invoice = Invoice (** response_json )
214218 except Exception as exe :
215- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
219+ BitPayExceptionProvider .throw_deserialize_resource_exception (
220+ "Invoice" , str (exe )
221+ )
216222 raise
217223
218224 return invoice
@@ -233,15 +239,15 @@ def cancel(self, invoice_id: str, force_cancel: bool = False) -> Invoice:
233239 "token" : self .__token_container .get_access_token (Facade .MERCHANT ),
234240 "forceCancel" : force_cancel ,
235241 }
236- response = self .__bitpay_client .delete (
237- "invoices/%s" % invoice_id , params
238- )
242+ response = self .__bitpay_client .delete ("invoices/%s" % invoice_id , params )
239243 response_json = ResponseParser .response_to_json_string (response )
240244
241245 try :
242246 invoice = Invoice (** response_json )
243247 except Exception as exe :
244- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
248+ BitPayExceptionProvider .throw_deserialize_resource_exception (
249+ "Invoice" , str (exe )
250+ )
245251 raise
246252
247253 return invoice
@@ -262,15 +268,15 @@ def cancel_by_guid(self, guid: str, force_cancel: bool = False) -> Invoice:
262268 "token" : self .__token_container .get_access_token (Facade .MERCHANT ),
263269 "forceCancel" : force_cancel ,
264270 }
265- response = self .__bitpay_client .delete (
266- "invoices/guid/%s" % guid , params
267- )
271+ response = self .__bitpay_client .delete ("invoices/guid/%s" % guid , params )
268272 response_json = ResponseParser .response_to_json_string (response )
269273
270274 try :
271275 invoice = Invoice (** response_json )
272276 except Exception as exe :
273- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
277+ BitPayExceptionProvider .throw_deserialize_resource_exception (
278+ "Invoice" , str (exe )
279+ )
274280 raise
275281
276282 return invoice
@@ -296,7 +302,9 @@ def get_event_token(self, invoice_id: str) -> InvoiceEventToken:
296302 try :
297303 return InvoiceEventToken (** response_json )
298304 except Exception as exe :
299- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
305+ BitPayExceptionProvider .throw_deserialize_resource_exception (
306+ "Invoice" , str (exe )
307+ )
300308 raise
301309
302310 def pay (self , invoice_id : str , status : str ) -> Invoice :
@@ -314,15 +322,15 @@ def pay(self, invoice_id: str, status: str) -> Invoice:
314322 "token" : self .__token_container .get_access_token (Facade .MERCHANT ),
315323 "status" : status ,
316324 }
317- response = self .__bitpay_client .update (
318- "invoices/pay/%s" % invoice_id , params
319- )
325+ response = self .__bitpay_client .update ("invoices/pay/%s" % invoice_id , params )
320326 response_json = ResponseParser .response_to_json_string (response )
321327
322328 try :
323329 invoice = Invoice (** response_json )
324330 except Exception as exe :
325- BitPayExceptionProvider .throw_deserialize_resource_exception ("Invoice" , str (exe ))
331+ BitPayExceptionProvider .throw_deserialize_resource_exception (
332+ "Invoice" , str (exe )
333+ )
326334 raise
327335
328336 return invoice
0 commit comments