@@ -117,7 +117,7 @@ def hpp_payment(self, request="", skip_details=None, **kwargs):
117117 if all (k in request for k in ("shopperEmail" , "shopperReference" ,
118118 "recurringContract" )):
119119 recc = request ['recurringContract' ]
120- if recc != 'ONECLICK' and recc != 'RECURRING' \
120+ if recc != 'ONECLICK' and recc != 'RECURRING' \
121121 and recc != 'ONECLICK,RECURRING' :
122122 raise ValueError (
123123 "HPP: recurringContract must be on of the following"
@@ -190,8 +190,8 @@ def capture(self, request="", **kwargs):
190190 action = "capture"
191191
192192 if validation .check_in (request , action ):
193- if request ['modificationAmount' ]["value" ] == "" or \
194- request ['modificationAmount' ]['value' ] == "0" :
193+ if request ['modificationAmount' ]["value" ] == "" or \
194+ request ['modificationAmount' ]['value' ] == "0" :
195195 raise ValueError (
196196 "Set the 'modificationAmount' to the original transaction"
197197 " amount, or less for a partial capture. "
@@ -210,8 +210,8 @@ def refund(self, request="", **kwargs):
210210 action = "refund"
211211
212212 if validation .check_in (request , action ):
213- if request ['modificationAmount' ]['value' ] == "" or \
214- request ['modificationAmount' ]['value' ] == "0" :
213+ if request ['modificationAmount' ]['value' ] == "" or \
214+ request ['modificationAmount' ]['value' ] == "0" :
215215 raise ValueError (
216216 "To refund this payment, provide the original value. "
217217 "Set the value to less than the original amount, "
@@ -279,3 +279,62 @@ def store_detail_and_submit(self, request=None, **kwargs):
279279 return self .client .call_api (
280280 request , self .service , action , ** kwargs
281281 )
282+
283+
284+ class AdyenCheckoutApi (AdyenServiceBase ):
285+ """This represents the Adyen Checkout API .
286+
287+ API calls currently implemented:
288+ paymentMethods
289+ payments
290+ payments/details
291+ originKeys
292+ Please refer to the checkout documentation for specifics around the API.
293+ https://docs.adyen.com/developers/checkout
294+
295+ The AdyenPayment class, is accessible as adyen.payment.method(args)
296+
297+ Args:
298+ client (AdyenAPIClient, optional): An API client for the service to
299+ use. If not provided, a new API client will be created.
300+ """
301+
302+ def __init__ (self , client = "" ):
303+ super (AdyenCheckoutApi , self ).__init__ (client = client )
304+ self .service = "Checkout"
305+
306+ def payment_methods (self , request = "" , ** kwargs ):
307+ action = "paymentMethods"
308+ if validation .check_in (request , action ):
309+ if 'merchantAccount' in request :
310+ if request ['merchantAccount' ] == '' :
311+ raise ValueError (
312+ 'merchantAccount must contain the merchant account'
313+ ' when retrieving payment methods.' )
314+
315+ return self .client .call_checkout_api (request , action , ** kwargs )
316+
317+ def payments (self , request = "" , ** kwargs ):
318+ action = "payments"
319+ if validation .check_in (request , action ):
320+ return self .client .call_checkout_api (request , action , ** kwargs )
321+
322+ def payments_details (self , request = "" , ** kwargs ):
323+ action = "paymentsDetails"
324+ if validation .check_in (request , action ):
325+ return self .client .call_checkout_api (request , action , ** kwargs )
326+
327+ def payment_session (self , request = "" , ** kwargs ):
328+ action = "paymentSession"
329+ if validation .check_in (request , action ):
330+ return self .client .call_checkout_api (request , action , ** kwargs )
331+
332+ def payment_result (self , request = "" , ** kwargs ):
333+ action = "paymentsResult"
334+ if validation .check_in (request , action ):
335+ return self .client .call_checkout_api (request , action , ** kwargs )
336+
337+ def origin_keys (self , request = "" , ** kwargs ):
338+ action = "originKeys"
339+ if validation .check_in (request , action ):
340+ return self .client .call_checkout_api (request , action , ** kwargs )
0 commit comments