Example #1
0
    def __init__(self, customer: Optional[FakeBasicCustomer] = None, **kwargs):
        FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
        self.config = kwargs.get("config")

        self._customer = self._init_customer(customer)
        """
        Internal Address variables
        """
        self._address_type = kwargs.get("address_type",
                                        self._init_address_type())
        """
        Necessary fields for address
        """
        self._first_name = self._init_first_name(
            first_name=kwargs.get("first_name"))
        self._last_name = self._init_last_name(
            last_name=kwargs.get("last_name"))
        self._company = self._init_company()
        address_1, address_2 = self._init_addresses()
        self._address1 = kwargs.get("address1", address_1)
        self._address2 = kwargs.get("address2", address_2)
        self._city = self._init_city(city=kwargs.get("city"))
        self._province = self._init_province(kwargs.get("province"))
        self._zip = self._init_postal_code(zip_code=kwargs.get("zip"))
        fake_country_code = FAKE.format('country_code',
                                        representation="alpha-2")
        self._country_code = kwargs.get(
            "country_code",
            fake_country_code)  # make country code - weight based
        self._country = pycountry.countries.get(
            alpha_2=self._country_code).name
    def __init__(self, **kwargs):
        FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
        self._config = kwargs.get("config", {})
        self._sku = self._init_sku(sku=kwargs.get("sku"))

        self._price_incl_taxes = self._init_price_incl_taxes(
            price_incl_taxes=kwargs.get("price_incl_taxes"))
Example #3
0
 def __init__(self, **kwargs):
     FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
     self.config = kwargs.get("config", {})
     self.payment_cfg = self.config.get("payment", {}) if self.config else {}
     self._financial_status = self._init_financial_status(
         financial_status=kwargs.get("financial_status")
     )
     self._payment_method = self._init_payment_method(
         payment_method=kwargs.get("payment_method")
     )
 def __init__(self, **kwargs):
     FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
     self.config = kwargs.get("config", {})
     self.order_item_cfg = self.config.get("order_item",
                                           {}) if self.config else {}
     # define the order item quantity
     self._quantity = self._init_order_item_qty(
         quantity=kwargs.get("quantity"))
     # define the variant to use
     self._variants = self._init_variants(variants=kwargs.get("variants"))
     self._product_variant = self._init_product_variant(
         product_variant=kwargs.get("product_variant"))
 def __init__(self, **kwargs):
     FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
     self.config = kwargs.get("config", {})
     self.promo_config = self.config.get("promotion", {}) if self.config else {}
     self._type = self._init_promotion_type(type_=kwargs.get("type"))
     self._value_type = self._init_promotion_value_type(
         value_type=kwargs.get("value_type")
     )
     self._value = self._init_promotion_value(value=kwargs.get("value"))
     self._discount_code = self._init_discount_code(
         discount_code=kwargs.get("discount_code")
     )
Example #6
0
 def __init__(self,
              first_name: str = None,
              last_name: str = None,
              **kwargs):
     FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
     self.config = kwargs.get("config", {})
     self.email_config = self.config.get("email", {}) if self.config else {}
     self.kwargs = kwargs
     self._first_name = self._init_first_name(first_name=first_name)
     self._last_name = self._init_last_name(last_name=last_name)
     self._email_type = self._init_email_provider_type()
     self._format = self._init_format()
     self._match_dict = self._init_match_dict()
     self._email_address = self._init_email(
         email_address=kwargs.get("email_address"))
Example #7
0
    def __init__(self, customer: Optional[FakeCustomer] = None, **kwargs):
        """
        TODO PLACEHOLDER DOCSTRING FOR INIT
        """
        FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
        self.config = kwargs.get("config", {})
        self._variants = kwargs.get("variants")

        self._customer = self._init_customer(customer)

        # generates a shipping and billing address
        self.shipping_addresses_cfg = self._init_addresses_configuration()
        self.billing_addresses_cfg = self._init_addresses_configuration()

        # initiating order Items
        self._order_items_cnt = self._init_order_item_cnt()
        self._order_items = self._init_order_items()

        # setting up a random time within an interval
        self._timestamp = self._init_ts()

        # setting up the shipping and billing address
        self._shipping_address = self._init_address(
            self.shipping_addresses_cfg)
        self._billing_address = self._init_address(self.billing_addresses_cfg)

        # initiating the Promotion Object
        self._promotion = self._init_promotion()

        # calculate order items aggregates
        self._total_product_price_incl_taxes = self._calc_total_product_price_incl(
        )
        self._total_product_quantity = self._calc_total_product_quantity()

        # calculate the discount amount
        self._discount_amount = self.promotion.calc(self)
        # TODO Shipping fee
        self._shipping_fee_incl_taxes = np.float64(0)

        # total order price
        self._total_price = self._calc_total_price()

        # setting up the payment object
        self._payment = FakePayment()
Example #8
0
    def __init__(self,
                 companies: Optional[Dict[FakeCompany, float]] = None,
                 **kwargs):
        FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
        self.config = kwargs.get("config")
        self._gender = self._init_gender(gender=kwargs.get("gender"))
        self._first_name = self._init_first_name(
            first_name=kwargs.get("first_name"))
        self._last_name = self._init_last_name(
            last_name=kwargs.get("last_name"))
        self._date_of_birth = self._init_date_of_birth(
            date_of_birth=kwargs.get("date_of_birth"))
        self._company = self._init_company(company=kwargs.get("company"),
                                           companies=companies)

        self._email_address = self._init_email(
            email_address=kwargs.get("email_address"))
        self._home_phone = kwargs.get("home_phone",
                                      FAKE.format('phone_number'))
        self._mobile_phone = kwargs.get("mobile_phone",
                                        FAKE.format('phone_number'))
Example #9
0
 def __init__(self, **kwargs):
     FakeBaseObject.__init__(self, uid=kwargs.get("uid"))
     self._company_name = self._init_company_name(
         company_name=kwargs.get("company_name"))
     self._top_level_domain = self._init_top_level_domain(
         top_level_domain=kwargs.get("top_level_domain"))