Skip to content

Commit

Permalink
Add API for frontend-api and checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
mvantellingen committed Jun 29, 2023
1 parent 57a47bc commit ccac1d8
Show file tree
Hide file tree
Showing 26 changed files with 2,590 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/commercetools/checkout/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is automatically generated by the rmf-codegen project.
#
# The Python code generator is maintained by Lab Digital. If you want to
# contribute to this project then please do not edit this file directly
# but send a pull request to the Lab Digital fork of rmf-codegen at
# https://github.com/labd/rmf-codegen
from .client import Client
14 changes: 14 additions & 0 deletions src/commercetools/checkout/client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is automatically generated by the rmf-codegen project.
#
# The Python code generator is maintained by Lab Digital. If you want to
# contribute to this project then please do not edit this file directly
# but send a pull request to the Lab Digital fork of rmf-codegen at
# https://github.com/labd/rmf-codegen

from commercetools.client import BaseClient


class Client(BaseClient):
def __init__(self, *args, **kwargs):
kwargs.setdefault("url", "https://checkout.{region}.commercetools.com")
super().__init__(self, **kwargs)
8 changes: 8 additions & 0 deletions src/commercetools/checkout/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is automatically generated by the rmf-codegen project.
#
# The Python code generator is maintained by Lab Digital. If you want to
# contribute to this project then please do not edit this file directly
# but send a pull request to the Lab Digital fork of rmf-codegen at
# https://github.com/labd/rmf-codegen

from .responses import * # noqa
57 changes: 57 additions & 0 deletions src/commercetools/checkout/models/_abstract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This file is automatically generated by the rmf-codegen project.
#
# The Python code generator is maintained by Lab Digital. If you want to
# contribute to this project then please do not edit this file directly
# but send a pull request to the Lab Digital fork of rmf-codegen at
# https://github.com/labd/rmf-codegen


class _BaseType:
def __eq__(self, other):
if other.__class__ is self.__class__:
return self.__values__() == other.__values__()
else:
return NotImplemented

def __ne__(self, other):
result = self.__eq__(other)
if result is NotImplemented:
return NotImplemented
else:
return not result

def __lt__(self, other):
if other.__class__ is self.__class__:
return self.__values__() < other.__values__()
else:
return NotImplemented

def __le__(self, other):
if other.__class__ is self.__class__:
return self.__values__() <= other.__values__()
else:
return NotImplemented

def __gt__(self, other):
if other.__class__ is self.__class__:
return self.__values__() > other.__values__()
else:
return NotImplemented

def __ge__(self, other):
if other.__class__ is self.__class__:
return self.__values__() >= other.__values__()
else:
return NotImplemented

def __values__(self):
return tuple(self.__dict__.values())

def __hash__(self):
return hash((self.__class__,) + self.__values__())

def __repr__(self):
return "%s(%s)" % (
self.__class__.__name__,
", ".join("%s=%r" % (k, v) for k, v in self.__dict__.items()),
)
275 changes: 275 additions & 0 deletions src/commercetools/checkout/models/_schemas/responses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
# This file is automatically generated by the rmf-codegen project.
#
# The Python code generator is maintained by Lab Digital. If you want to
# contribute to this project then please do not edit this file directly
# but send a pull request to the Lab Digital fork of rmf-codegen at
# https://github.com/labd/rmf-codegen
import re
import typing

import marshmallow
import marshmallow_enum

from commercetools import helpers

from ... import models

# Fields


# Marshmallow Schemas
class ResponseMessageSchema(helpers.BaseSchema):
code = marshmallow.fields.String(allow_none=True, load_default=None)
type = marshmallow.fields.String(allow_none=True, load_default=None)
message = marshmallow.fields.String(allow_none=True, load_default=None)
payload = marshmallow.fields.Raw(
allow_none=True, metadata={"omit_empty": True}, load_default=None
)

class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.ResponseMessage(**data)


class AdyenBadConfigSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.AdyenBadConfig(**data)


class AdyenInitErrorSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.AdyenInitError(**data)


class AdyenTimeoutSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.AdyenTimeout(**data)


class ApplicationDeactivatedSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.ApplicationDeactivated(**data)


class ApplicationNotFoundSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.ApplicationNotFound(**data)


class CartEmptiedDuringCheckoutSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.CartEmptiedDuringCheckout(**data)


class CartEmptySchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.CartEmpty(**data)


class CartNotFoundSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.CartNotFound(**data)


class CheckoutCancelledSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.CheckoutCancelled(**data)


class CheckoutCompletedSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.CheckoutCompleted(**data)


class CheckoutLoadedSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.CheckoutLoaded(**data)


class CheckoutStartedSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.CheckoutStarted(**data)


class InitTimeoutSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.InitTimeout(**data)


class BadInputDataSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.BadInputData(**data)


class InvalidTokenSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.InvalidToken(**data)


class NoAllowedOriginsSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.NoAllowedOrigins(**data)


class NoPaymentMethodsSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.NoPaymentMethods(**data)


class NoShippingMethodsSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.NoShippingMethods(**data)


class OrderCreatedSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.OrderCreated(**data)


class SellerIsDeactivatedSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.SellerIsDeactivated(**data)


class SellerNotFoundSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.SellerNotFound(**data)


class ShippingAddressMissingSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.ShippingAddressMissing(**data)


class UnallowedOriginSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.UnallowedOrigin(**data)


class UnavailableLocaleSchema(ResponseMessageSchema):
class Meta:
unknown = marshmallow.EXCLUDE

@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["code"]
return models.UnavailableLocale(**data)
Loading

0 comments on commit ccac1d8

Please sign in to comment.