def test_get_by_key(old_client): product = old_client.products.create( models.ProductDraft( master_variant=models.ProductVariantDraft(sku="123"), publish=True, name=models.LocalizedString(nl="Test product"), slug=models.LocalizedString(en="my-product"), product_type=models.ProductTypeResourceIdentifier(key="dummy"), )) variant = product.master_data.current.master_variant shopping_list = old_client.shopping_lists.create( draft=models.ShoppingListDraft( key="test-shopping-list", name=models.LocalizedString({"nl": "Verlanglijstje"}), description=models.LocalizedString( {"nl": "Verlanglijstje van LabD"}), line_items=[ models.ShoppingListLineItemDraft(sku=variant.sku, quantity=1) ], )) assert shopping_list.key shopping_list = old_client.shopping_lists.get_by_key("test-shopping-list") assert shopping_list.name["nl"] == "Verlanglijstje" assert shopping_list.description["nl"] == "Verlanglijstje van LabD" assert shopping_list.line_items[0].variant.sku == "123" assert shopping_list.line_items[0].quantity == 1
def test_cart_discount_query(old_client): old_client.cart_discounts.create( models.CartDiscountDraft( name=models.LocalizedString({"en:": "test discount"}), value=models.CartDiscountValueRelative(permyriad=10), cart_predicate="", sort_order="", requires_discount_code=False, )) old_client.cart_discounts.create( models.CartDiscountDraft( name=models.LocalizedString({"en:": "test discount"}), value=models.CartDiscountValueRelative(permyriad=10), cart_predicate="", sort_order="", requires_discount_code=False, )) # single sort query result = old_client.cart_discounts.query(sort="id asc") assert len(result.results) == 2 assert result.total == 2 # multiple sort queries result = old_client.cart_discounts.query(sort=["id asc", "name asc"]) assert len(result.results) == 2 assert result.total == 2
def test_category_query(old_client): category = old_client.categories.create( models.CategoryDraft( key="test-category1", name=models.LocalizedString(en="category"), slug=models.LocalizedString(en="something"), ) ) category = old_client.categories.create( models.CategoryDraft( key="test-category2", name=models.LocalizedString(en="category"), slug=models.LocalizedString(en="something"), ) ) # single sort query result = old_client.categories.query(sort="id asc", limit=10) assert len(result.results) == 2 assert result.total == 2 # multiple sort queries result = old_client.categories.query(sort=["id asc", "name asc"]) assert len(result.results) == 2 assert result.total == 2
def test_category_update(old_client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ category = old_client.categories.create( models.CategoryDraft( key="test-category", slug=models.LocalizedString(nl="nl-slug"), name=models.LocalizedString(nl="category"), ) ) assert category.key == "test-category" category = old_client.categories.update_by_id( id=category.id, version=category.version, actions=[ models.CategoryChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")) ], ) assert category.key == "test-category" category = old_client.categories.update_by_key( key="test-category", version=category.version, actions=[ models.CategoryChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")) ], ) assert category.key == "test-category"
def test_correlation_id_is_set_in_exception(old_client): product = old_client.products.create( models.ProductDraft( key="test-product", name=models.LocalizedString(en=f"my-product"), slug=models.LocalizedString(en=f"my-product"), product_type=models.ProductTypeResourceIdentifier(key="dummy"), )) product = old_client.products.update_by_id( id=product.id, version=product.version, actions=[ models.ProductChangeSlugAction(slug=models.LocalizedString( nl="nl-slug2")) ], ) # This should raise a version conflict error with pytest.raises(CommercetoolsError) as exc: old_client.products.update_by_id( id=product.id, version=1, actions=[ models.ProductChangeSlugAction(slug=models.LocalizedString( nl="nl-slug3")) ], ) assert exc.value.correlation_id is not None
def create_products(client: ByProjectKeyRequestBuilder): for i in range(100): client.products().post( models.ProductDraft( key=f"test-product-{i}", product_type=models.ProductTypeResourceIdentifier(key="dummy"), name=models.LocalizedString(en=f"my-product-{i}"), slug=models.LocalizedString(en=f"my-product-{i}"), ))
def test_delete_by_key(old_client): shopping_list = old_client.shopping_lists.create( draft=models.ShoppingListDraft( key="test-shopping-list", name=models.LocalizedString({"nl": "Verlanglijstje"}), description=models.LocalizedString( {"nl": "Verlanglijstje van LabD"}), )) assert shopping_list.id shopping_list = old_client.shopping_lists.delete_by_key( shopping_list.key, version=shopping_list.version)
def test_non_equality(): obj_1 = models.ProductDraft( slug=models.LocalizedString(en="test-2"), name=models.LocalizedString(en="test-1"), product_type=models.ProductTypeResourceIdentifier(key="dummy"), ) obj_2 = models.ProductDraft( slug=models.LocalizedString(en="test-1"), name=models.LocalizedString(en="test-1"), product_type=models.ProductTypeResourceIdentifier(key="dummy"), ) assert obj_1 != obj_2
def test_resource_update_conflict(old_client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ product = old_client.products.create( models.ProductDraft( key="test-product", product_type=models.ProductTypeResourceIdentifier(key="dummy"), name={"en": "my-product"}, slug={"en": "foo-bar"}, )) assert product.version == 1 assert uuid.UUID(product.id) assert product.key == "test-product" product = old_client.products.update_by_id( id=product.id, version=product.version, actions=[ models.ProductChangeSlugAction(slug=models.LocalizedString( nl="nl-slug2")) ], ) assert product.key == "test-product" assert product.version == 2 # This should raise a version conflict error with pytest.raises(CommercetoolsError) as exc: product = old_client.products.update_by_id( id=product.id, version=1, actions=[ models.ProductChangeSlugAction(slug=models.LocalizedString( nl="nl-slug3")) ], ) assert exc.value.response.status_code == 409 assert exc.value.response.errors[0].current_version == 2 # Force it product = old_client.products.update_by_id( id=product.id, version=1, actions=[ models.ProductChangeSlugAction(slug=models.LocalizedString( nl="nl-slug2")) ], force_update=True, )
def test_http_server_expanding(commercetools_client, commercetools_http_server): os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" client = Client( project_key="unittest", client_id="client-id", client_secret="client-secret", scope=[], url=commercetools_http_server.api_url, token_url=f"{commercetools_http_server.api_url}/oauth/token", ) client.channels.create( ChannelDraft(key="FOO", roles=[ChannelRoleEnum.PRODUCT_DISTRIBUTION])) store = client.stores.create( StoreDraft( name=models.LocalizedString(nl="foo"), key="FOO", distribution_channels=[ChannelResourceIdentifier(key="FOO")], )) url = commercetools_http_server.api_url + f"/unittest/stores/{store.id}" response = requests.get( url, params={"expand": "distributionChannels[*]"}, headers={"Authorization": "Bearer token"}, ) assert response.status_code == 200, response.text data = response.json() assert data["distributionChannels"][0]["obj"]["key"] == "FOO"
def test_product_projections_get_by_key(old_client): variant = models.ProductVariantDraft() product_create = old_client.products.create( models.ProductDraft( key="test-product", product_type=models.ProductTypeResourceIdentifier(key="dummy"), name=models.LocalizedString(en=f"my-product"), slug=models.LocalizedString(en=f"my-product"), master_variant=variant, variants=[variant], publish=False, )) product = old_client.product_projections.get_by_key(product_create.key, staged=True) assert product.id == product_create.id assert product.key == product_create.key
def test_category_get_by_id(old_client): category = old_client.categories.create( models.CategoryDraft( key="test-category", name=models.LocalizedString(en="category"), slug=models.LocalizedString(en="something"), ) ) assert category.id assert category.key == "test-category" category = old_client.categories.get_by_id(category.id) assert category.id assert category.key == "test-category" with pytest.raises(HTTPError): old_client.categories.get_by_id("invalid")
def test_product_projections_query(ct_platform_client: Client, old_client): client = ct_platform_client.with_project_key("test") for key in ["product-1", "product-2"]: variant = models.ProductVariantDraft() client.products().post( models.ProductDraft( key=key, product_type=models.ProductTypeResourceIdentifier(key="dummy"), name=models.LocalizedString(en=key), slug=models.LocalizedString(en=key), master_variant=variant, variants=[variant], publish=True, )) key = "product-3" client.products().post( models.ProductDraft( key=key, product_type=models.ProductTypeResourceIdentifier(key="dummy"), name=models.LocalizedString(en=key), slug=models.LocalizedString(en=key), master_variant=variant, variants=[variant], publish=False, )) # single sort query result = client.product_projections().get( sort="id asc", where=[f'slug(nl-NL="product-3")'], expand=["parent.category"]) assert len(result.results) == 2 assert result.total == 2 assert result.results[0].key == "product-1" assert result.results[1].key == "product-2" # multiple sort queries result = client.product_projections().get(sort=["id asc", "name asc"]) assert len(result.results) == 2 assert result.total == 2
def test_product_discount_get_by_id(old_client): product_discount = old_client.product_discounts.create( models.ProductDiscountDraft( name=models.LocalizedString(nl="test-discount"), predicate="", value=models.ProductDiscountValueRelativeDraft(permyriad=10), is_active=True, sort_order="", )) assert product_discount.id
def test_query(old_client): shopping_list_draft = models.ShoppingListDraft( key="test-shopping-list", name=models.LocalizedString({"nl": "Verlanglijstje"}), description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), ) old_client.shopping_lists.create(draft=shopping_list_draft) # Update the key and create another one. shopping_list_draft.key = "test-shopping-list2" old_client.shopping_lists.create(draft=shopping_list_draft) result = old_client.shopping_lists.query(sort="id asc", limit=10) assert len(result.results) == 2 assert result.total == 2 result = old_client.shopping_lists.query(sort=["id asc", "name asc"], limit=1) assert len(result.results) == 1 assert result.total == 2
def _create_line_item_from_draft( self, draft: models.CartDraft, line_item_draft: models.LineItemDraft) -> models.LineItem: line_id = str(uuid.uuid4()) price = 1000 product_data = self._storage.get_by_resource_identifier( models.ProductResourceIdentifier(id=line_item_draft.product_id)) product: models.Product = ProductSchema().load(product_data) variant = None for v in product.master_data.current.variants: if v.id == line_item_draft.variant_id: variant = v return models.LineItem( id=line_id, name=models.LocalizedString({"en": line_id}), product_id=line_item_draft.product_id, product_type=product.product_type, variant=variant, price=models.Price( id=str(uuid.uuid4()), value=models.CentPrecisionMoney(currency_code=draft.currency, cent_amount=price, fraction_digits=2), ), taxed_price=models.TaxedItemPrice( total_net=models.CentPrecisionMoney( currency_code=draft.currency, cent_amount=price * (line_item_draft.quantity or 0), fraction_digits=2, ), total_gross=models.CentPrecisionMoney( currency_code=draft.currency, cent_amount=price * (line_item_draft.quantity or 0), fraction_digits=2, ), ), total_price=models.CentPrecisionMoney( currency_code=draft.currency, cent_amount=price * (line_item_draft.quantity or 0), fraction_digits=2, ), quantity=line_item_draft.quantity, discounted_price_per_quantity=[], state=[], price_mode=models.LineItemPriceMode.PLATFORM, line_item_mode=models.LineItemMode.STANDARD, custom=utils.create_from_draft(line_item_draft.custom), )
def test_discount_code_query(old_client): old_client.discount_codes.create( models.DiscountCodeDraft( name=models.LocalizedString({"en:": "test discount"}), code="1337", cart_discounts=[], )) old_client.discount_codes.create( models.DiscountCodeDraft( name=models.LocalizedString({"en:": "test discount"}), code="1338", cart_discounts=[], )) # single sort query result = old_client.discount_codes.query(sort="id asc") assert len(result.results) == 2 assert result.total == 2 # multiple sort queries result = old_client.discount_codes.query(sort=["id asc", "name asc"]) assert len(result.results) == 2 assert result.total == 2
def _create_from_draft(self, draft: models.ProductDraft, id: Optional[str] = None) -> models.Product: object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4()) master_variant = None if draft.master_variant: master_variant = self._create_variant_from_draft( draft.master_variant) product_data = models.ProductData( name=draft.name, categories=draft.categories, category_order_hints=draft.category_order_hints, description=draft.description, master_variant=master_variant, variants=[ self._create_variant_from_draft(vd) for vd in draft.variants ] if draft.variants else [], slug=draft.slug or models.LocalizedString(), search_keywords=models.SearchKeywords(), ) if draft.publish: master_data = models.ProductCatalogData( staged=None, current=product_data, published=True, has_staged_changes=False, ) else: master_data = models.ProductCatalogData( staged=product_data, current=None, published=False, has_staged_changes=True, ) product = models.Product( id=str(object_id), key=draft.key, product_type=draft.product_type, master_data=master_data, version=1, created_at=datetime.datetime.now(datetime.timezone.utc), last_modified_at=datetime.datetime.now(datetime.timezone.utc), ) return product
def cart_draft(ct_platform_client: Client): client = ct_platform_client.with_project_key("test") product_1 = client.products().post( models.ProductDraft( key="product-1", product_type=models.ProductTypeResourceIdentifier(key="dummy"), name=models.LocalizedString(en=f"my-product-1"), slug=models.LocalizedString(en=f"my-product-1"), publish=True, )) product_2 = client.products().post( models.ProductDraft( key="product-2", product_type=models.ProductTypeResourceIdentifier(key="dummy"), name=models.LocalizedString(en=f"my-product-2"), slug=models.LocalizedString(en=f"my-product-2"), publish=True, )) return models.CartDraft( customer_id=str(uuid.uuid4()), customer_email="*****@*****.**", currency="GBP", anonymous_id=str(uuid.uuid4()), country="GB", inventory_mode=models.InventoryMode.NONE, tax_mode=models.TaxMode.PLATFORM, tax_rounding_mode=models.RoundingMode.HALF_EVEN, tax_calculation_mode=models.TaxCalculationMode.LINE_ITEM_LEVEL, line_items=[ models.LineItemDraft(product_id=product_1.id, quantity=1), models.LineItemDraft(product_id=product_2.id, quantity=2), ], locale="en", origin=models.CartOrigin.CUSTOMER, )
def test_channel_update(old_client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ channel = old_client.channels.create( models.ChannelDraft( key="test-channel", name=models.LocalizedString(nl="nl-channel"), roles=[models.ChannelRoleEnum.INVENTORY_SUPPLY], ) ) assert channel.key == "test-channel" channel = old_client.channels.update_by_id( id=channel.id, version=channel.version, actions=[ models.ChannelChangeNameAction( name=models.LocalizedString(nl="nl-channel2") ) ], )
def test_discount_code_get_by_id(old_client): discount_code = old_client.discount_codes.create( models.DiscountCodeDraft( name=models.LocalizedString({"en": "test discount"}), code="1337", cart_discounts=[], )) assert discount_code.id assert discount_code.code == "1337" discount_code = old_client.discount_codes.get_by_id(discount_code.id) assert discount_code.id assert discount_code.code == "1337" with pytest.raises(HTTPError): old_client.discount_codes.get_by_id("invalid")
def test_discount_code_update(old_client): discount_code = old_client.discount_codes.create( models.DiscountCodeDraft( name=models.LocalizedString(en="en-discount_code"), code="1337", is_active=True, cart_discounts=[], )) assert discount_code.code == "1337" discount_code = old_client.discount_codes.update_by_id( id=discount_code.id, version=discount_code.version, actions=[models.DiscountCodeChangeIsActiveAction(is_active=False)], ) assert discount_code.is_active is False
def test_cart_discount_update(old_client): cart_discount = old_client.cart_discounts.create( models.CartDiscountDraft( name=models.LocalizedString(en="en-cart_discount"), value=models.CartDiscountValueRelative(permyriad=10), is_active=True, cart_predicate="", sort_order="", requires_discount_code=False, )) assert cart_discount.is_active is True cart_discount = old_client.cart_discounts.update_by_id( id=cart_discount.id, version=cart_discount.version, actions=[models.CartDiscountChangeIsActiveAction(is_active=False)], ) assert cart_discount.is_active is False
def test_cart_discount_get_by_id(ct_platform_client: PlatformClient): cart_discount = ( ct_platform_client.with_project_key("foo").cart_discounts().post( models.CartDiscountDraft( name=models.LocalizedString({"en": "test discount"}), value=models.CartDiscountValueRelative(permyriad=10), cart_predicate="", sort_order="", requires_discount_code=False, ))) assert cart_discount.id cart_discount = ( ct_platform_client.with_project_key("foo").cart_discounts().with_id( cart_discount.id).get()) assert cart_discount.id item = (ct_platform_client.with_project_key( "foo").cart_discounts().with_id("invalid").get()) assert item is None
def store_draft(): return models.StoreDraft(key="test store", name=models.LocalizedString({"en": "test store"}))
def test_update_actions(old_client): custom_type = old_client.types.create( models.TypeDraft( name=models.LocalizedString(en="myType"), key="payment-info", resource_type_ids=[ models.ResourceTypeId.PAYMENT_INTERFACE_INTERACTION ], field_definitions=[ models.FieldDefinition( type=models.CustomFieldStringType(), name="operations", label=models.LocalizedString(en="Operation"), required=False, ) ], )) payment = old_client.payments.create( models.PaymentDraft( key="test-payment", amount_planned=models.Money(cent_amount=2000, currency_code="GBP"), payment_method_info=models.PaymentMethodInfo( payment_interface="ADYEN", method="mc"), transactions=[ models.TransactionDraft( type=models.TransactionType.CHARGE, amount=models.Money(cent_amount=2000, currency_code="GBP"), state=models.TransactionState.PENDING, ) ], )) existing_transaction = payment.transactions[0] payment = old_client.payments.update_by_id( payment.id, payment.version, actions=[ models.PaymentAddInterfaceInteractionAction( type=models.TypeResourceIdentifier(id=custom_type.id), fields=models.FieldContainer({"pspRef": "1337"}), ), models.PaymentChangeTransactionInteractionIdAction( transaction_id=existing_transaction.id, interaction_id="1337"), models.PaymentAddTransactionAction( transaction=models.TransactionDraft( type=models.TransactionType.CHARGE, amount=models.Money(currency_code="GBP", cent_amount=1000), interaction_id="123", state=models.TransactionState.INITIAL, )), models.PaymentChangeTransactionStateAction( transaction_id=existing_transaction.id, state=models.TransactionState.SUCCESS, ), ], ) assert payment.interface_interactions[0].fields == {"pspRef": "1337"} assert payment.transactions[0].interaction_id == "1337" assert len(payment.transactions) == 2 assert payment.transactions[0].state == models.TransactionState.SUCCESS
def test_payments_get_by_id(old_client): custom_type = old_client.types.create( models.TypeDraft( name=models.LocalizedString(en="myType"), key="payment-info", resource_type_ids=[ models.ResourceTypeId.PAYMENT_INTERFACE_INTERACTION ], field_definitions=[ models.FieldDefinition( type=models.CustomFieldStringType(), name="operations", label=models.LocalizedString(en="Operation"), required=False, ) ], )) payment = old_client.payments.create( models.PaymentDraft( key="test-payment", amount_planned=models.Money(cent_amount=2000, currency_code="GBP"), payment_method_info=models.PaymentMethodInfo( payment_interface="ADYEN", method="mc"), transactions=[ models.TransactionDraft( type=models.TransactionType.CHARGE, amount=models.Money(cent_amount=2000, currency_code="GBP"), interaction_id="8525483242578266", state=models.TransactionState.SUCCESS, ) ], interface_interactions=[ models.CustomFieldsDraft( type=models.TypeResourceIdentifier(id=custom_type.id), fields=models.FieldContainer({ "operations": "CANCEL,CAPTURE,REFUND", "success": True, "psp_reference": "8525483242578266", "merchant_reference": "some reference", "reason": "82132:0005:10/2020", "amount": 2000, "payment_method": "mc", "event_date": "2019-01-24T11:04:17.000000Z", "currency_code": "GBP", "event_code": "AUTHORISATION", "merchant_account_code": "TestMerchant", }), ) ], )) assert payment.id assert payment.key == "test-payment"
def get_test_order(): order = models.Order( id="20ad6c92-fe04-4983-877e-5f5f80b5e37b", version=10, created_at=datetime.datetime.now(datetime.timezone.utc), last_modified_at=datetime.datetime.now(datetime.timezone.utc), last_message_sequence_number=8, order_number="test-number", customer_email="*****@*****.**", anonymous_id="a706a9bf-4cd5-4bd0-b35d-b2373fb0c15e", locale="en", total_price=models.CentPrecisionMoney(cent_amount=2000, currency_code="GBP", fraction_digits=2), taxed_price=models.TaxedPrice( total_net=models.CentPrecisionMoney(cent_amount=1666, currency_code="GBP", fraction_digits=2), total_gross=models.CentPrecisionMoney(cent_amount=2000, currency_code="GBP", fraction_digits=2), tax_portions=[ models.TaxPortion( rate=0.2, amount=models.CentPrecisionMoney(cent_amount=334, currency_code="GBP", fraction_digits=2), name="GB", ) ], ), country="GB", order_state=models.OrderState.OPEN, shipment_state=None, payment_state=models.PaymentState.PAID, shipping_info=models.ShippingInfo( shipping_method_name="Shipwire", price=models.CentPrecisionMoney(currency_code="GBP", cent_amount=1000, fraction_digits=2), shipping_rate=models.ShippingRate( price=models.CentPrecisionMoney(currency_code="GBP", cent_amount=1000, fraction_digits=2), free_above=models.CentPrecisionMoney(currency_code="GBP", cent_amount=5000, fraction_digits=2), tiers=[], ), tax_rate=models.TaxRate( name="GB", amount=0.2, included_in_price=False, country="GB", id="8olFiIwX", ), tax_category=models.TaxCategoryReference( id="5e564356-d367-4718-a0bb-6a17c3b1fdeb"), shipping_method=models.ShippingMethodReference( id="b0e88c41-8553-4904-a2d5-a096c5f6f09f"), taxed_price=models.TaxedItemPrice( total_net=models.CentPrecisionMoney(cent_amount=833, currency_code="GBP", fraction_digits=2), total_gross=models.CentPrecisionMoney(cent_amount=1000, currency_code="GBP", fraction_digits=2), ), shipping_method_state=models.ShippingMethodState.MATCHES_CART, ), tax_mode=models.TaxMode.PLATFORM, tax_rounding_mode=models.RoundingMode.HALF_EVEN, tax_calculation_mode=models.TaxCalculationMode.LINE_ITEM_LEVEL, origin=models.CartOrigin.CUSTOMER, line_items=[ models.LineItem( id="4e7e38f2-45c1-4672-9c41-9c74dbd911bd", product_id="b32d3cfd-6920-4788-a5ee-c0bcfd460c0d", name=models.LocalizedString({"en": "FRUIT MIX STAGE 1"}), product_type=models.ProductTypeReference( id="9faf6335-7618-4f8b-a11d-c0f832b733c1"), product_slug=models.LocalizedString( {"en": "fruit-mix-stage-1"}), variant=models.ProductVariant( id=1, sku="982218931672529", prices=[ models.Price( id="fb424988-79b3-4418-8730-9f324025a13c", value=models.CentPrecisionMoney( cent_amount=1000, currency_code="GBP", fraction_digits=2), ) ], ), price=models.Price( id="fb424988-79b3-4418-8730-9f324025a13c", value=models.CentPrecisionMoney(cent_amount=1000, currency_code="GBP", fraction_digits=2), ), quantity=1, tax_rate=models.TaxRate( name="GB", amount=0.19, included_in_price=False, country="GB", id="7JkeuGwo", ), state=[ models.ItemState( quantity=1, state=models.StateReference( id="0e59473e-1203-4135-8bcb-f1c5141ed5ad"), ) ], discounted_price_per_quantity=[], price_mode=models.LineItemPriceMode.PLATFORM, total_price=models.CentPrecisionMoney(cent_amount=1000, currency_code="GBP", fraction_digits=2), taxed_price=models.TaxedItemPrice( total_net=models.CentPrecisionMoney(cent_amount=1190, currency_code="GBP", fraction_digits=2), total_gross=models.CentPrecisionMoney(cent_amount=1190, currency_code="GBP", fraction_digits=2), ), line_item_mode=models.LineItemMode.STANDARD, ) ], custom_line_items=[], cart=models.CartReference(id="some cart id"), payment_info=models.PaymentInfo(payments=[ models.PaymentReference(id="a433f3f8-5e27-406e-b2b0-d4a1f64592c4") ]), custom=models.CustomFields( type=models.TypeReference(id="dummy"), fields=models.FieldContainer({ "sentEmails": ["order_email_confirmed"], "shipwireServiceLevelCode": "GD", }), ), shipping_address=models.Address( first_name="David", last_name="Weterings", street_name="Kanaalweg", street_number="14", postal_code="3526KL", city="Utrecht", country="GB", ), billing_address=models.Address( first_name="David", last_name="Weterings", street_name="Kanaalweg", street_number="14", postal_code="3526KL", city="Utrecht", country="GB", ), sync_info=[], refused_gifts=[], ) return order