4032 lines
107 KiB
Rust
4032 lines
107 KiB
Rust
|
use std::collections::HashMap;
|
||
|
use std::ops::Deref;
|
||
|
|
||
|
use chrono::NaiveDateTime;
|
||
|
use serde::{Deserialize, Serialize};
|
||
|
use uuid::Uuid;
|
||
|
|
||
|
use crate::FullAccount;
|
||
|
|
||
|
pub type Record<K, V> = HashMap<K, V>;
|
||
|
|
||
|
pub type Number = i64;
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct LineItemId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct LineItemTaxLineId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct DiscountId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct CustomerId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct DiscountRuleId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ClaimOrderId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct FulfillmentId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct TrackingLinkId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ShippingMethodId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ShippingMethodTaxLineId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ShippingOptionId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductOptionValueId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ShippingOptionRequirementId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductVariantId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct PriceListId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct CustomerGroupId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct MoneyAmountId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductVariantInventoryItemId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct InventoryItemId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ClaimItemId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ClaimTagId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ClaimImageId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct OrderEditId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct OrderItemChangeId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct CartId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct OrderId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct LocationId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ShippingProfileId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct GiftCardId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct RegionId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct PaymentCollectionId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct TaxRateId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct DraftOrderId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct DisplayId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct PaymentProviderId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct TaxProviderId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductTagId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductCollectionId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct DiscountConditionId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductTypeId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct PaymentSessionId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct SwapId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct FulfillmentProviderId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ShippingAddressId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct AddressId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct PaymentId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct RefundId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct LineItemAdjustmentId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ReturnId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ReturnReasonId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct CountryId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ImageId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductCategoryId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct SalesChannelLocationId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct SalesChannelId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct ProductOptionId(pub Uuid);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct CountryIso2(pub [char; 2]);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct CountryIso3(pub [char; 3]);
|
||
|
|
||
|
#[derive(Default, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
|
||
|
pub struct CurrencyCode([char; 3]);
|
||
|
|
||
|
impl Into<String> for CurrencyCode {
|
||
|
fn into(self) -> String {
|
||
|
let mut s = String::with_capacity(3);
|
||
|
for c in self.0 {
|
||
|
s.push(c);
|
||
|
}
|
||
|
s
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Price(pub i64);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Amount(pub i64);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Total(pub i64);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Quantity(pub i64);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Count(pub i64);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct TaxRateValue(pub i64);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct TaxRateCode(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct TaxRateName(pub String);
|
||
|
|
||
|
/**
|
||
|
* A unique code for the discount - this will be used by the
|
||
|
* customer to apply the discount
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountCode(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Sku(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct RegionName(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ExtOrderId(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct IdempotencyKey(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct CountryName(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Email(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ImageUrl(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct TrackingNumber(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct TrackingUrl(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ReturnNote(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ReturnReasonValue(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ReturnReasonLabel(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ReturnReasonDescription(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct RefundNote(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ClaimItemNote(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ClaimTagValue(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ExternalOrderId(pub String);
|
||
|
|
||
|
/**
|
||
|
* The unique code that identifies the Gift Card. This is used by the
|
||
|
* Customer to redeem the value of the Gift Card.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct GiftCardCode(pub String);
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Metadata(pub Option<HashMap<String, Vec<u8>>>);
|
||
|
|
||
|
impl Deref for Metadata {
|
||
|
type Target = Option<HashMap<String, Vec<u8>>>;
|
||
|
|
||
|
fn deref(&self) -> &Self::Target {
|
||
|
&self.0
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum CartType {
|
||
|
#[default]
|
||
|
Default, // = "default",
|
||
|
Swap, // = "swap",
|
||
|
DraftOrder, // = "draft_order",
|
||
|
PaymentLink, // = "payment_link",
|
||
|
Claim, // = "claim",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum OrderStatus {
|
||
|
#[default]
|
||
|
Pending, // = "pending",
|
||
|
Completed, // = "completed",
|
||
|
Archived, // = "archived",
|
||
|
Canceled, // = "canceled",
|
||
|
RequiresAction, // = "requires_action",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum OrderEditStatus {
|
||
|
Confirmed,
|
||
|
Declined,
|
||
|
#[default]
|
||
|
Requested,
|
||
|
Created,
|
||
|
Canceled,
|
||
|
// "confirmed" | "declined" | "requested" | "created" | "canceled"
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum FulfillmentStatus {
|
||
|
#[default]
|
||
|
NotFulfilled, // = "not_fulfilled",
|
||
|
PartiallyFulfilled, // = "partially_fulfilled",
|
||
|
Fulfilled, // = "fulfilled",
|
||
|
PartiallyShipped, // = "partially_shipped",
|
||
|
Shipped, // = "shipped",
|
||
|
PartiallyReturned, // = "partially_returned",
|
||
|
Returned, // = "returned",
|
||
|
Canceled, // = "canceled",
|
||
|
RequiresAction, // = "requires_action",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum PaymentStatus {
|
||
|
#[default]
|
||
|
NotPaid, // = "not_paid",
|
||
|
Awaiting, // = "awaiting",
|
||
|
Captured, // = "captured",
|
||
|
PartiallyRefunded, // = "partially_refunded",
|
||
|
Refunded, // = "refunded",
|
||
|
Canceled, // = "canceled",
|
||
|
RequiresAction, // = "requires_action",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum DraftOrderStatus {
|
||
|
#[default]
|
||
|
Open, // = "open",
|
||
|
Completed, // = "completed",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum PaymentSessionStatus {
|
||
|
#[default]
|
||
|
Pending,
|
||
|
RequiresMore,
|
||
|
Canceled,
|
||
|
Authorized,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum ShippingOptionPriceType {
|
||
|
#[default]
|
||
|
FlatRate, // = "flat_rate",
|
||
|
Calculated, // = "calculated",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum ReturnStatus {
|
||
|
#[default]
|
||
|
Requested,
|
||
|
// = "requested",
|
||
|
Received,
|
||
|
// = "received",
|
||
|
RequiresAction,
|
||
|
// = "requires_action",
|
||
|
Canceled, // = "canceled",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum ClaimType {
|
||
|
#[default]
|
||
|
Refund,
|
||
|
// = "refund",
|
||
|
Replace, // = "replace",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum ClaimPaymentStatus {
|
||
|
#[default]
|
||
|
NotAvailable,
|
||
|
// = "na",
|
||
|
NotRefunded,
|
||
|
// = "not_refunded",
|
||
|
Refunded, // = "refunded",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum ClaimFulfillmentStatus {
|
||
|
#[default]
|
||
|
NotFulfilled,
|
||
|
// = "not_fulfilled",
|
||
|
PartiallyFulfilled,
|
||
|
// = "partially_fulfilled",
|
||
|
Fulfilled,
|
||
|
// = "fulfilled",
|
||
|
PartiallyShipped,
|
||
|
// = "partially_shipped",
|
||
|
Shipped,
|
||
|
// = "shipped",
|
||
|
PartiallyReturned,
|
||
|
// = "partially_returned",
|
||
|
Returned,
|
||
|
// = "returned",
|
||
|
Canceled,
|
||
|
// = "canceled",
|
||
|
RequiresAction, // = "requires_action",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum ClaimReason {
|
||
|
#[default]
|
||
|
MissingItem,
|
||
|
// = "missing_item",
|
||
|
WrongItem,
|
||
|
// = "wrong_item",
|
||
|
ProductionFailure,
|
||
|
// = "production_failure",
|
||
|
Other, // = "other",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum PriceListType {
|
||
|
// "sale"
|
||
|
#[default]
|
||
|
Sale,
|
||
|
// "override"
|
||
|
Override,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum ShippingProfileType {
|
||
|
#[default]
|
||
|
Default,
|
||
|
// = "default",
|
||
|
GiftCard,
|
||
|
// = "gift_card",
|
||
|
Custom, // = "custom",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum RequirementType {
|
||
|
#[default]
|
||
|
MinSubtotal,
|
||
|
// = "min_subtotal",
|
||
|
MaxSubtotal, // = "max_subtotal",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum PriceListStatus {
|
||
|
// "active"
|
||
|
#[default]
|
||
|
Active,
|
||
|
// "draft"
|
||
|
Draft,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum DiscountRuleType {
|
||
|
// "fixed"
|
||
|
#[default]
|
||
|
Fixed,
|
||
|
// "percentage"
|
||
|
Percentage,
|
||
|
// "free_shipping"
|
||
|
FreeShipping,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum DiscountRuleAllocation {
|
||
|
// "total"
|
||
|
#[default]
|
||
|
Total,
|
||
|
// "item"
|
||
|
Item,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum DiscountConditionType {
|
||
|
#[default]
|
||
|
Products,
|
||
|
//| "products"
|
||
|
ProductTypes,
|
||
|
//| "product_types"
|
||
|
ProductCollections,
|
||
|
//| "product_collections"
|
||
|
ProductTags,
|
||
|
//| "product_tags"
|
||
|
CustomerGroups, //| "customer_groups"
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum DiscountConditionOperator {
|
||
|
// "in"
|
||
|
#[default]
|
||
|
In,
|
||
|
// "not_in"
|
||
|
NotIn,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum SwapFulfillmentStatus {
|
||
|
#[default]
|
||
|
NotFulfilled,
|
||
|
// = "not_fulfilled",
|
||
|
Fulfilled,
|
||
|
// = "fulfilled",
|
||
|
Shipped,
|
||
|
// = "shipped",
|
||
|
PartiallyShipped,
|
||
|
// = "partially_shipped",
|
||
|
Canceled,
|
||
|
// = "canceled",
|
||
|
RequiresAction, // = "requires_action",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum SwapPaymentStatus {
|
||
|
NotPaid,
|
||
|
// = "not_paid",
|
||
|
#[default]
|
||
|
Awaiting,
|
||
|
// = "awaiting",
|
||
|
Captured,
|
||
|
// = "captured",
|
||
|
Confirmed,
|
||
|
// = "confirmed",
|
||
|
Canceled,
|
||
|
// = "canceled",
|
||
|
DifferenceRefunded,
|
||
|
// = "difference_refunded",
|
||
|
PartiallyRefunded,
|
||
|
// = "partially_refunded",
|
||
|
Refunded,
|
||
|
// = "refunded",
|
||
|
RequiresAction, // = "requires_action",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum ProductStatus {
|
||
|
#[default]
|
||
|
Draft, // = "draft",
|
||
|
Proposed, // = "proposed",
|
||
|
Published, // = "published",
|
||
|
Rejected, // = "rejected",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum RefundReason {
|
||
|
#[default]
|
||
|
Discount,
|
||
|
Return,
|
||
|
Swap,
|
||
|
Claim,
|
||
|
Other,
|
||
|
// "discount" | "return" | "swap" | "claim" | "other"
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Images holds a reference to a URL at which the image file can be found.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Image {
|
||
|
/**
|
||
|
* The image's ID
|
||
|
*/
|
||
|
pub id: ImageId,
|
||
|
/**
|
||
|
* The URL at which the image file can be found.
|
||
|
*/
|
||
|
pub url: ImageUrl,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents a product category
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductCategory {
|
||
|
pub id: ProductCategoryId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The product category's name
|
||
|
*/
|
||
|
pub name: String,
|
||
|
pub description: String,
|
||
|
/**
|
||
|
* A string for Materialized Paths - used for finding ancestors and
|
||
|
* descendents
|
||
|
*/
|
||
|
pub mpath: Option<String>,
|
||
|
/**
|
||
|
* A unique string that identifies the Product Category - can for
|
||
|
* example be used in slug structures.
|
||
|
*/
|
||
|
pub handle: String,
|
||
|
/**
|
||
|
* A flag to make product category visible/hidden in the store front
|
||
|
*/
|
||
|
pub is_active: bool,
|
||
|
/**
|
||
|
* A flag to make product category an internal category for admins
|
||
|
*/
|
||
|
pub is_internal: bool,
|
||
|
/**
|
||
|
* The ID of the parent category.
|
||
|
*/
|
||
|
pub parent_category_id: Uuid,
|
||
|
/**
|
||
|
* An integer that depicts the rank of category in a tree node
|
||
|
*/
|
||
|
pub rank: Number,
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Sales Channel Stock Location link sales channels with stock locations.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct SalesChannelLocation {
|
||
|
/**
|
||
|
* The Sales Channel Stock Location's ID
|
||
|
*/
|
||
|
pub id: SalesChannelLocationId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The id of the Sales Channel
|
||
|
*/
|
||
|
pub sales_channel_id: SalesChannelId,
|
||
|
/**
|
||
|
* The id of the Location Stock.
|
||
|
*/
|
||
|
pub location_id: LocationId,
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A Sales Channel
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct SalesChannel {
|
||
|
/**
|
||
|
* The sales channel's ID
|
||
|
*/
|
||
|
pub id: SalesChannelId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The name of the sales channel.
|
||
|
*/
|
||
|
pub name: String,
|
||
|
/**
|
||
|
* The description of the sales channel.
|
||
|
*/
|
||
|
pub description: Option<String>,
|
||
|
/**
|
||
|
* Specify if the sales channel is enabled or disabled.
|
||
|
*/
|
||
|
pub is_disabled: bool,
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductImage {
|
||
|
pub product_id: ProductId,
|
||
|
pub image_id: ImageId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductCategoryProduct {
|
||
|
pub product_id: ProductId,
|
||
|
pub product_category_id: ProductCategoryId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductTags {
|
||
|
pub product_id: ProductId,
|
||
|
pub product_tag_id: ProductTagId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductSalesChannel {
|
||
|
pub product_id: ProductId,
|
||
|
pub sales_channel_id: SalesChannelId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Products are a grouping of Product Variants that have common properties
|
||
|
* such as images and descriptions. Products can have multiple options which
|
||
|
* define the properties that Product Variants differ by.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Product {
|
||
|
/**
|
||
|
* The product's ID
|
||
|
*/
|
||
|
pub id: ProductId,
|
||
|
/**
|
||
|
* A title that can be displayed for easy identification of the Product.
|
||
|
*/
|
||
|
pub title: String,
|
||
|
/**
|
||
|
* An optional subtitle that can be used to further specify the Product.
|
||
|
*/
|
||
|
pub subtitle: Option<String>,
|
||
|
/**
|
||
|
* A short description of the Product.
|
||
|
*/
|
||
|
pub description: Option<String>,
|
||
|
/**
|
||
|
* A unique identifier for the Product (e.g. for slug structure).
|
||
|
*/
|
||
|
pub handle: Option<String>,
|
||
|
/**
|
||
|
* Whether the Product represents a Gift Card. Products that represent
|
||
|
* Gift Cards will automatically generate a redeemable Gift Card code
|
||
|
* once they are purchased.
|
||
|
*/
|
||
|
pub is_giftcard: bool,
|
||
|
/**
|
||
|
* The status of the product
|
||
|
*/
|
||
|
pub status: ProductStatus,
|
||
|
/**
|
||
|
* A URL to an image file that can be used to identify the Product.
|
||
|
*/
|
||
|
pub thumbnail: Option<String>,
|
||
|
/**
|
||
|
* The ID of the [ShippingProfile] that the Product belongs to. Shipping
|
||
|
* Profiles have a set of defined Shipping Options that can be used to
|
||
|
* Fulfill a given set of Products.
|
||
|
*/
|
||
|
pub profile_id: ShippingProfileId,
|
||
|
/**
|
||
|
* The weight of the Product Variant. May be used in shipping rate
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub weight: Option<Number>,
|
||
|
/**
|
||
|
* The length of the Product Variant. May be used in shipping rate
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub length: Option<Number>,
|
||
|
/**
|
||
|
* The height of the Product Variant. May be used in shipping rate
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub height: Option<Number>,
|
||
|
/**
|
||
|
* The width of the Product Variant. May be used in shipping rate
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub width: Option<Number>,
|
||
|
/**
|
||
|
* The Harmonized System code of the Product Variant. May be used by
|
||
|
* Fulfillment Providers to pass customs information to shipping
|
||
|
* carriers.
|
||
|
*/
|
||
|
pub hs_code: Option<String>,
|
||
|
/**
|
||
|
* The country in which the Product Variant was produced. May be used by
|
||
|
* Fulfillment Providers to pass customs information to shipping
|
||
|
* carriers.
|
||
|
*/
|
||
|
pub origin_country: Option<CountryId>,
|
||
|
/**
|
||
|
* The Manufacturers Identification code that identifies the
|
||
|
* manufacturer of the Product Variant. May be used by Fulfillment
|
||
|
* Providers to pass customs information to shipping carriers.
|
||
|
*/
|
||
|
pub mid_code: Option<String>,
|
||
|
/**
|
||
|
* The material and composition that the Product Variant is made of, May
|
||
|
* be used by Fulfillment Providers to pass customs information to
|
||
|
* shipping carriers.
|
||
|
*/
|
||
|
pub material: Option<String>,
|
||
|
/**
|
||
|
* The [ProductCollection] that the Product belongs to
|
||
|
*/
|
||
|
pub collection_id: ProductCollectionId,
|
||
|
/**
|
||
|
* The [ProductType] that the Product belongs to
|
||
|
*/
|
||
|
pub type_id: Option<ProductTypeId>,
|
||
|
/**
|
||
|
* The Product Tags assigned to the Product. Available if the relation
|
||
|
* `tags` is expanded.
|
||
|
*/
|
||
|
pub tags: Option<Vec<ProductTagId>>,
|
||
|
/**
|
||
|
* Whether the Product can be discounted. Discounts will not apply to
|
||
|
* Line Items of this Product when this flag is set to `false`.
|
||
|
*/
|
||
|
pub discountable: bool,
|
||
|
/**
|
||
|
* The external ID of the product
|
||
|
*/
|
||
|
pub external_id: Option<String>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Product Type can be added to Products for filtering and reporting
|
||
|
* purposes.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductType {
|
||
|
/**
|
||
|
* The product type's ID
|
||
|
*/
|
||
|
pub id: ProductTypeId,
|
||
|
/**
|
||
|
* The value that the Product Type represents.
|
||
|
*/
|
||
|
pub value: String,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Currency
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Currency {
|
||
|
/**
|
||
|
* The 3 character ISO code for the currency.
|
||
|
*/
|
||
|
pub code: CurrencyCode,
|
||
|
/**
|
||
|
* The symbol used to indicate the currency.
|
||
|
*/
|
||
|
pub symbol: String,
|
||
|
/**
|
||
|
* The native symbol used to indicate the currency.
|
||
|
*/
|
||
|
pub symbol_native: String,
|
||
|
/**
|
||
|
* The written name of the currency
|
||
|
*/
|
||
|
pub name: String,
|
||
|
/**
|
||
|
* [EXPERIMENTAL] Does the currency prices include tax
|
||
|
*/
|
||
|
pub includes_tax: Option<bool>,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Shipping Profiles have a set of defined Shipping Options that can be used
|
||
|
* to fulfill a given set of Products.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ShippingProfile {
|
||
|
/**
|
||
|
* The shipping profile's ID
|
||
|
*/
|
||
|
pub id: ShippingProfileId,
|
||
|
/**
|
||
|
* The name given to the Shipping profile - this may be displayed to the
|
||
|
* Customer.
|
||
|
*/
|
||
|
pub name: String,
|
||
|
/**
|
||
|
* The type of the Shipping Profile, may be `default`, `gift_card` or
|
||
|
* `custom`.
|
||
|
*/
|
||
|
pub profile_type: ShippingProfileType,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents a fulfillment provider plugin and holds its installation
|
||
|
* status.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct FulfillmentProvider {
|
||
|
/**
|
||
|
* The id of the fulfillment provider as given by the plugin.
|
||
|
*/
|
||
|
pub id: FulfillmentProviderId,
|
||
|
/**
|
||
|
* Whether the plugin is installed in the current version. Plugins that
|
||
|
* are no longer installed are not deleted by will have this field set
|
||
|
* to `false`.
|
||
|
*/
|
||
|
pub is_installed: bool,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The tax service used to calculate taxes
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct TaxProvider {
|
||
|
/**
|
||
|
* The id of the tax provider as given by the plugin.
|
||
|
*/
|
||
|
pub id: TaxProviderId,
|
||
|
/**
|
||
|
* Whether the plugin is installed in the current version. Plugins that
|
||
|
* are no longer installed are not deleted by will have this field set
|
||
|
* to `false`.
|
||
|
*/
|
||
|
pub is_installed: bool,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents a Payment Provider plugin and holds its installation status.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct PaymentProvider {
|
||
|
/**
|
||
|
* The id of the payment provider as given by the plugin.
|
||
|
*/
|
||
|
pub id: PaymentProviderId,
|
||
|
/**
|
||
|
* Whether the plugin is installed in the current version. Plugins that
|
||
|
* are no longer installed are not deleted by will have this field set
|
||
|
* to `false`.
|
||
|
*/
|
||
|
pub is_installed: bool,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A requirement that a Cart must satisfy for the Shipping Option to be
|
||
|
* available to the Cart.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ShippingOptionRequirement {
|
||
|
/**
|
||
|
* The shipping option requirement's ID
|
||
|
*/
|
||
|
pub id: ShippingOptionRequirementId,
|
||
|
/**
|
||
|
* The id of the Shipping Option that the hipping option requirement
|
||
|
* belongs to
|
||
|
*/
|
||
|
pub shipping_option_id: ShippingOptionId,
|
||
|
/**
|
||
|
* The type of the requirement, this defines how the value will be
|
||
|
* compared to the Cart's total. `min_subtotal` requirements define the
|
||
|
* minimum subtotal that is needed for the Shipping Option to be
|
||
|
* available, while the `max_subtotal` defines the maximum subtotal that
|
||
|
* the Cart can have for the Shipping Option to be available.
|
||
|
*/
|
||
|
pub shipping_requirement_type: RequirementType,
|
||
|
/**
|
||
|
* The amount to compare the Cart subtotal to.
|
||
|
*/
|
||
|
pub amount: Number,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: NaiveDateTime,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Shipping Options represent a way in which an Order or Return can be
|
||
|
* shipped. Shipping Options have an associated Fulfillment Provider that
|
||
|
* will be used when the fulfillment of an Order is initiated. Shipping
|
||
|
* Options themselves cannot be added to Carts, but serve as a template for
|
||
|
* Shipping Methods. This distinction makes it possible to customize
|
||
|
* individual Shipping Methods with additional information.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductOption {
|
||
|
/**
|
||
|
* The product option's ID
|
||
|
*/
|
||
|
pub id: ProductOptionId,
|
||
|
/**
|
||
|
* The title that the Product Option is defined by (e.g. `Size`).
|
||
|
*/
|
||
|
pub title: String,
|
||
|
/**
|
||
|
* The ID of the Product that the Product Option is defined for.
|
||
|
*/
|
||
|
pub product_id: ProductId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductOptionValue {
|
||
|
/**
|
||
|
* The product option value's ID
|
||
|
*/
|
||
|
pub id: ProductOptionValueId,
|
||
|
/**
|
||
|
* The value that the Product Variant has defined for the specific
|
||
|
* Product Option (e.g. if the Product Option is \"Size\" this value
|
||
|
* could be `Small`, `Medium` or `Large`).
|
||
|
*/
|
||
|
pub value: String,
|
||
|
/**
|
||
|
* The ID of the [ProductOption] that the Product Option Value is
|
||
|
* defined for.
|
||
|
*/
|
||
|
pub option_id: ShippingOptionId,
|
||
|
/**
|
||
|
* The ID of the [ProductVariant] that the Product Option Value is
|
||
|
* defined for.
|
||
|
*/
|
||
|
pub variant_id: ProductVariantId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Product Variant Inventory Items link variants with inventory items and
|
||
|
* denote the number of inventory items constituting a variant.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductVariantInventoryItem {
|
||
|
/**
|
||
|
* The product variant inventory item's ID
|
||
|
*/
|
||
|
pub id: ProductVariantInventoryItemId,
|
||
|
/**
|
||
|
* The id of the inventory item
|
||
|
*/
|
||
|
pub inventory_item_id: InventoryItemId,
|
||
|
/**
|
||
|
* The id of the [ProductVariant].
|
||
|
*/
|
||
|
pub variant_id: ProductVariantId,
|
||
|
/**
|
||
|
* The quantity of an inventory item required for one quantity of
|
||
|
* the variant.
|
||
|
*/
|
||
|
pub required_quantity: Number,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: NaiveDateTime,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductVariant {
|
||
|
/**
|
||
|
* The product variant's ID
|
||
|
*/
|
||
|
pub id: ProductVariantId,
|
||
|
/**
|
||
|
* A title that can be displayed for easy identification of the
|
||
|
* Product Variant.
|
||
|
*/
|
||
|
pub title: String,
|
||
|
/**
|
||
|
* The ID of the [Product] that the Product Variant belongs to.
|
||
|
*/
|
||
|
pub product_id: ProductId,
|
||
|
/**
|
||
|
* The unique stock keeping unit used to identify the Product
|
||
|
* Variant. This will usually be a unqiue identifer for the item
|
||
|
* that is to be shipped, and can be referenced across multiple
|
||
|
* systems.
|
||
|
*/
|
||
|
pub sku: Option<Sku>,
|
||
|
/**
|
||
|
* A generic field for a GTIN number that can be used to identify
|
||
|
* the Product Variant.
|
||
|
*/
|
||
|
pub barcode: Option<String>,
|
||
|
/**
|
||
|
* An EAN barcode number that can be used to identify the Product
|
||
|
* Variant.
|
||
|
*/
|
||
|
pub ean: Option<String>,
|
||
|
/**
|
||
|
* A UPC barcode number that can be used to identify the Product
|
||
|
* Variant.
|
||
|
*/
|
||
|
pub upc: Option<String>,
|
||
|
/**
|
||
|
* The ranking of this variant
|
||
|
*/
|
||
|
pub variant_rank: Option<Number>,
|
||
|
/**
|
||
|
* The current quantity of the item that is stocked.
|
||
|
*/
|
||
|
pub inventory_quantity: Number,
|
||
|
/**
|
||
|
* Whether the Product Variant should be purchasable when
|
||
|
* `inventory_quantity` is 0.
|
||
|
*/
|
||
|
pub allow_backorder: bool,
|
||
|
/**
|
||
|
* Whether Medusa should manage inventory for the Product Variant.
|
||
|
*/
|
||
|
pub manage_inventory: bool,
|
||
|
/**
|
||
|
* The Harmonized System code of the Product Variant. May be used by
|
||
|
* Fulfillment Providers to pass customs information to shipping
|
||
|
* carriers.
|
||
|
*/
|
||
|
pub hs_code: Option<String>,
|
||
|
/**
|
||
|
* The country in which the Product Variant was produced. May be
|
||
|
* used by Fulfillment Providers to pass customs information to
|
||
|
* shipping carriers.
|
||
|
*/
|
||
|
pub origin_country: Option<String>,
|
||
|
/**
|
||
|
* The Manufacturers Identification code that identifies the
|
||
|
* manufacturer of the Product Variant. May be used by Fulfillment
|
||
|
* Providers to pass customs information to shipping carriers.
|
||
|
*/
|
||
|
pub mid_code: Option<String>,
|
||
|
/**
|
||
|
* The material and composition that the Product Variant is made of,
|
||
|
* May be used by Fulfillment Providers to pass customs information
|
||
|
* to shipping carriers.
|
||
|
*/
|
||
|
pub material: Option<String>,
|
||
|
/**
|
||
|
* The weight of the Product Variant. May be used in shipping rate
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub weight: Option<Number>,
|
||
|
/**
|
||
|
* The length of the Product Variant. May be used in shipping rate
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub length: Option<Number>,
|
||
|
/**
|
||
|
* The height of the Product Variant. May be used in shipping rate
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub height: Option<Number>,
|
||
|
/**
|
||
|
* The width of the Product Variant. May be used in shipping rate
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub width: Option<Number>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
/**
|
||
|
* Only used with the inventory modules.
|
||
|
* A boolean value indicating whether the Product Variant is
|
||
|
* purchasable. A variant is purchasable if:
|
||
|
* - inventory is not managed
|
||
|
* - it has no inventory items
|
||
|
* - it is in stock
|
||
|
* - it is back-order-able.
|
||
|
*
|
||
|
*/
|
||
|
pub purchasable: Option<bool>,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Product Variants represent a Product with a specific set of Product
|
||
|
* Option configurations. The maximum number of Product Variants that a
|
||
|
* Product can have is given by the number of available Product Option
|
||
|
* combinations.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct MoneyAmount {
|
||
|
/**
|
||
|
* The money amount's ID
|
||
|
*/
|
||
|
pub id: MoneyAmountId,
|
||
|
/**
|
||
|
* The 3 character currency code that the Money Amount is given in.
|
||
|
*/
|
||
|
pub currency_code: String,
|
||
|
/**
|
||
|
* Available if the relation `currency` is expanded.
|
||
|
*/
|
||
|
pub currency: Option<Currency>,
|
||
|
/**
|
||
|
* The amount in the smallest currency unit (e.g. cents 100 cents to
|
||
|
* charge $1) that the Product Variant will cost.
|
||
|
*/
|
||
|
pub amount: Number,
|
||
|
/**
|
||
|
* The minimum quantity that the Money Amount applies to. If this
|
||
|
* value is not set, the Money Amount applies to all quantities.
|
||
|
*/
|
||
|
pub min_quantity: Option<Number>,
|
||
|
/**
|
||
|
* The maximum quantity that the Money Amount applies to. If this
|
||
|
* value is not set, the Money Amount applies to all quantities.
|
||
|
*/
|
||
|
pub max_quantity: Option<Number>,
|
||
|
/**
|
||
|
* The ID of the price list associated with the money amount
|
||
|
*/
|
||
|
pub price_list_id: Option<PriceListId>,
|
||
|
/**
|
||
|
* The id of the [ProductVariant] contained in the Line Item.
|
||
|
*/
|
||
|
pub variant_id: Option<ProductVariantId>,
|
||
|
/**
|
||
|
* The region's ID
|
||
|
*/
|
||
|
pub region_id: Option<RegionId>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct PriceListCustomerGroups {
|
||
|
pub price_list_id: PriceListId,
|
||
|
pub customer_group_id: CustomerGroupId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Price Lists represents a set of prices that overrides the default price
|
||
|
* for one or more product variants.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct PriceList {
|
||
|
/**
|
||
|
* The price list's ID
|
||
|
*/
|
||
|
pub id: PriceListId,
|
||
|
/**
|
||
|
* The price list's name
|
||
|
*/
|
||
|
pub name: String,
|
||
|
/**
|
||
|
* The price list's description
|
||
|
*/
|
||
|
pub description: String,
|
||
|
/**
|
||
|
* The type of Price List. This can be one of either `sale` or
|
||
|
* `override`.
|
||
|
*/
|
||
|
pub price_list_type: PriceListType,
|
||
|
/**
|
||
|
* The status of the Price List
|
||
|
*/
|
||
|
pub status: PriceListStatus,
|
||
|
/**
|
||
|
* The date with timezone that the Price List starts being valid.
|
||
|
*/
|
||
|
pub starts_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The date with timezone that the Price List stops being valid.
|
||
|
*/
|
||
|
pub ends_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* [EXPERIMENTAL] Does the price list prices include tax
|
||
|
*/
|
||
|
pub includes_tax: Option<bool>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct CustomerToCustomerGroup {
|
||
|
/**
|
||
|
* The customer to group ID
|
||
|
*/
|
||
|
pub id: Uuid,
|
||
|
/**
|
||
|
* The customer group's ID
|
||
|
*/
|
||
|
pub customer_grup_id: Uuid,
|
||
|
/**
|
||
|
* The customer's ID
|
||
|
*/
|
||
|
pub customer_id: Uuid,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct PriceListCustomerGroup {
|
||
|
/**
|
||
|
* The customer group's ID
|
||
|
*/
|
||
|
pub customer_group_id: CustomerGroupId,
|
||
|
/**
|
||
|
* The price list's ID
|
||
|
*/
|
||
|
pub price_list_id: PriceListId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct CustomerGroup {
|
||
|
/**
|
||
|
* The customer group's ID
|
||
|
*/
|
||
|
pub id: CustomerGroupId,
|
||
|
/**
|
||
|
* The name of the customer group
|
||
|
*/
|
||
|
pub name: String,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Shipping Method Tax Line
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ShippingMethodTaxLine {
|
||
|
/**
|
||
|
* The line item tax line's ID
|
||
|
*/
|
||
|
pub id: ShippingMethodTaxLineId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The numeric rate to charge tax by
|
||
|
*/
|
||
|
pub rate: Number,
|
||
|
/**
|
||
|
* A human friendly name for the tax
|
||
|
*/
|
||
|
pub name: String,
|
||
|
/**
|
||
|
* A code to identify the tax type by
|
||
|
*/
|
||
|
pub code: Option<String>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
/**
|
||
|
* The ID of the line item [ShippingMethod]
|
||
|
*/
|
||
|
pub shipping_method_id: ShippingMethodId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Shipping Methods represent a way in which an Order or Return can be
|
||
|
* shipped. Shipping Methods are built from a Shipping Option, but may
|
||
|
* contain additional details, that can be necessary for the Fulfillment
|
||
|
* Provider to handle the shipment.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ShippingMethod {
|
||
|
/**
|
||
|
* The shipping method's ID
|
||
|
*/
|
||
|
pub id: ShippingMethodId,
|
||
|
/**
|
||
|
* The id of the [ShippingOption] that the Shipping Method is built
|
||
|
* from.
|
||
|
*/
|
||
|
pub shipping_option_id: ShippingOptionId,
|
||
|
/**
|
||
|
* The id of the [Order] that the Shipping Method is used on.
|
||
|
*/
|
||
|
pub order_id: OrderId,
|
||
|
/**
|
||
|
* The id of the [ClaimOrder] that the Shipping Method is used on.
|
||
|
*/
|
||
|
pub claim_order_id: Option<ClaimOrderId>,
|
||
|
/**
|
||
|
* The id of the [Cart] that the Shipping Method is used on.
|
||
|
*/
|
||
|
pub cart_id: CartId,
|
||
|
/**
|
||
|
* The id of the [Swap] that the Shipping Method is used on.
|
||
|
*/
|
||
|
pub swap_id: SwapId,
|
||
|
/**
|
||
|
* The id of the [Return] that the Shipping Method is used on.
|
||
|
*/
|
||
|
pub return_id: ReturnId,
|
||
|
/**
|
||
|
* The amount to charge for the Shipping Method. The currency of the
|
||
|
* price is defined by the Region that the Order that the Shipping
|
||
|
* Method belongs to is a part of.
|
||
|
*/
|
||
|
pub price: Price,
|
||
|
/**
|
||
|
* Additional data that the Fulfillment Provider needs to fulfill the
|
||
|
* shipment. This is used in combination with the Shipping Options data,
|
||
|
* and may contain information such as a drop point id.
|
||
|
*/
|
||
|
pub data: Metadata,
|
||
|
/**
|
||
|
* [EXPERIMENTAL] Indicates if the shipping method price include tax
|
||
|
*/
|
||
|
pub includes_tax: bool,
|
||
|
/**
|
||
|
* The subtotal of the shipping
|
||
|
*/
|
||
|
pub subtotal: Option<Price>,
|
||
|
/**
|
||
|
* The total amount of the shipping
|
||
|
*/
|
||
|
pub total: Option<Price>,
|
||
|
/**
|
||
|
* The total of tax
|
||
|
*/
|
||
|
pub tax_total: Option<Price>,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Refund represent an amount of money transferred back to the Customer for
|
||
|
* a given reason. Refunds may occur in relation to Returns, Swaps and
|
||
|
* Claims, but can also be initiated by a store operator.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Refund {
|
||
|
/**
|
||
|
* The refund's ID
|
||
|
*/
|
||
|
pub id: RefundId,
|
||
|
/**
|
||
|
* The id of the [Order] that the Refund is related to.
|
||
|
*/
|
||
|
pub order_id: OrderId,
|
||
|
/**
|
||
|
* The [Payment]'s ID if available
|
||
|
*/
|
||
|
pub payment_id: PaymentId,
|
||
|
/**
|
||
|
* The amount that has be refunded to the Customer.
|
||
|
*/
|
||
|
pub amount: Amount,
|
||
|
/**
|
||
|
* An optional note explaining why the amount was refunded.
|
||
|
*/
|
||
|
pub note: RefundNote,
|
||
|
/**
|
||
|
* The reason given for the Refund, will automatically be set when
|
||
|
* processed as part of a Swap, Claim or Return.
|
||
|
*/
|
||
|
pub reason: RefundReason,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of the refund
|
||
|
* in case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents a draft order
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DraftOrder {
|
||
|
/**
|
||
|
* The draft order's ID
|
||
|
*/
|
||
|
pub id: DraftOrderId,
|
||
|
/**
|
||
|
* The status of the draft order
|
||
|
*/
|
||
|
pub status: DraftOrderStatus,
|
||
|
/**
|
||
|
* The draft order's display ID
|
||
|
*/
|
||
|
pub display_id: DisplayId,
|
||
|
/**
|
||
|
* The ID of the cart associated with the draft order.
|
||
|
*/
|
||
|
pub cart_id: CartId,
|
||
|
/**
|
||
|
* The ID of the order associated with the draft order.
|
||
|
*/
|
||
|
pub order_id: OrderId,
|
||
|
/**
|
||
|
* The date the draft order was canceled at.
|
||
|
*/
|
||
|
pub canceled_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The date the draft order was completed at.
|
||
|
*/
|
||
|
pub completed_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* Whether to send the customer notifications regarding order updates.
|
||
|
*/
|
||
|
pub no_notification_order: Option<bool>,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of the cart
|
||
|
* associated with the draft order in case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The discounts used in the order. Available if the relation
|
||
|
* `discounts` is expanded.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct OrderDiscount {
|
||
|
/**
|
||
|
* The order's ID
|
||
|
*/
|
||
|
pub order_id: OrderId,
|
||
|
/**
|
||
|
* The discount's ID
|
||
|
*/
|
||
|
pub discount_id: DiscountId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents an order
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Order {
|
||
|
/**
|
||
|
* The order's ID
|
||
|
*/
|
||
|
pub id: OrderId,
|
||
|
/**
|
||
|
* The order's status
|
||
|
*/
|
||
|
pub status: OrderStatus,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The order's fulfillment status
|
||
|
*/
|
||
|
pub fulfillment_status: FulfillmentStatus,
|
||
|
/**
|
||
|
* The order's payment status
|
||
|
*/
|
||
|
pub payment_status: PaymentStatus,
|
||
|
/**
|
||
|
* The order's display ID
|
||
|
*/
|
||
|
pub display_id: DisplayId,
|
||
|
/**
|
||
|
* The ID of the cart associated with the order
|
||
|
*/
|
||
|
pub cart_id: CartId,
|
||
|
/**
|
||
|
* The ID of the [Customer] associated with the order
|
||
|
*/
|
||
|
pub customer_id: CustomerId,
|
||
|
/**
|
||
|
* The email associated with the order
|
||
|
*/
|
||
|
pub email: Email,
|
||
|
/**
|
||
|
* The ID of the billing address associated with the order
|
||
|
*/
|
||
|
pub billing_address_id: Option<AddressId>,
|
||
|
/**
|
||
|
* The ID of the shipping address associated with the order
|
||
|
*/
|
||
|
pub shipping_address_id: Option<AddressId>,
|
||
|
/**
|
||
|
* The region's ID
|
||
|
*/
|
||
|
pub region_id: Option<RegionId>,
|
||
|
/**
|
||
|
* The 3 character currency code that is used in the order
|
||
|
*/
|
||
|
pub currency_code: CurrencyCode,
|
||
|
/**
|
||
|
* The order's tax rate
|
||
|
*/
|
||
|
pub tax_rate: Option<TaxRateValue>,
|
||
|
/**
|
||
|
* The ID of the draft order this order is associated with.
|
||
|
*/
|
||
|
pub draft_order_id: Option<DraftOrderId>,
|
||
|
/**
|
||
|
* The date the order was canceled on.
|
||
|
*/
|
||
|
pub canceled_at: NaiveDateTime,
|
||
|
/**
|
||
|
* Flag for describing whether notifications related to this should be
|
||
|
* sent.
|
||
|
*/
|
||
|
pub no_notification: Option<bool>,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the processing of the order
|
||
|
* in case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The ID of an external order.
|
||
|
*/
|
||
|
pub external_id: Option<ExternalOrderId>,
|
||
|
/**
|
||
|
* The ID of the sales channel this order is associated with.
|
||
|
*/
|
||
|
pub sales_channel_id: Option<SalesChannelId>,
|
||
|
/**
|
||
|
* The total of shipping
|
||
|
*/
|
||
|
pub shipping_total: Option<Number>,
|
||
|
/**
|
||
|
* The total of discount
|
||
|
*/
|
||
|
pub discount_total: Option<Number>,
|
||
|
/**
|
||
|
* The total of discount rounded
|
||
|
*/
|
||
|
pub raw_discount_total: Option<Number>,
|
||
|
/**
|
||
|
* The total of tax
|
||
|
*/
|
||
|
pub tax_total: Option<TaxRateValue>,
|
||
|
/**
|
||
|
* The total amount refunded if the order is returned.
|
||
|
*/
|
||
|
pub refunded_total: Option<Total>,
|
||
|
/**
|
||
|
* The total amount of the order
|
||
|
*/
|
||
|
pub total: Option<Total>,
|
||
|
/**
|
||
|
* The subtotal of the order
|
||
|
*/
|
||
|
pub subtotal: Option<Total>,
|
||
|
/**
|
||
|
* The total amount paid
|
||
|
*/
|
||
|
pub paid_total: Option<Total>,
|
||
|
/**
|
||
|
* The amount that can be refunded
|
||
|
*/
|
||
|
pub refundable_amount: Option<Amount>,
|
||
|
/**
|
||
|
* The total of gift cards
|
||
|
*/
|
||
|
pub gift_card_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of gift cards with taxes
|
||
|
*/
|
||
|
pub gift_card_tax_total: Option<Total>,
|
||
|
/**
|
||
|
* The items that are returnable as part of the order, order swaps or
|
||
|
* order claims
|
||
|
*/
|
||
|
pub returnable_items: Option<Vec<LineItemId>>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct CustomerGroupCustomers {
|
||
|
pub customer_group_id: CustomerGroupId,
|
||
|
pub customer_id: CustomerId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Customer {
|
||
|
/**
|
||
|
* The customer's ID
|
||
|
*/
|
||
|
pub id: CustomerId,
|
||
|
/**
|
||
|
* The customer's email
|
||
|
*/
|
||
|
pub email: String,
|
||
|
/**
|
||
|
* The customer's first name
|
||
|
*/
|
||
|
pub first_name: Option<String>,
|
||
|
/**
|
||
|
* The customer's last name
|
||
|
*/
|
||
|
pub last_name: Option<String>,
|
||
|
/**
|
||
|
* The customer's billing address ID
|
||
|
*/
|
||
|
pub billing_address_id: Option<AddressId>,
|
||
|
/**
|
||
|
* The customer's phone number
|
||
|
*/
|
||
|
pub phone: Option<String>,
|
||
|
/**
|
||
|
* Whether the customer has an account or not
|
||
|
*/
|
||
|
pub has_account: bool,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Shipping Options represent a way in which an Order or Return can be
|
||
|
* shipped. Shipping Options have an associated Fulfillment Provider that
|
||
|
* will be used when the fulfillment of an Order is initiated. Shipping
|
||
|
* Options themselves cannot be added to Carts, but serve as a template for
|
||
|
* Shipping Methods. This distinction makes it possible to customize
|
||
|
* individual Shipping Methods with additional information.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ShippingOption {
|
||
|
/**
|
||
|
* The shipping option's ID
|
||
|
*/
|
||
|
pub id: ShippingOptionId,
|
||
|
/**
|
||
|
* The name given to the Shipping Option - this may be displayed to the
|
||
|
* Customer.
|
||
|
*/
|
||
|
pub name: String,
|
||
|
/**
|
||
|
* The [Region]'s ID
|
||
|
*/
|
||
|
pub region_id: RegionId,
|
||
|
/**
|
||
|
* The ID of the [ShippingProfile] that the shipping option belongs to.
|
||
|
* Shipping Profiles have a set of defined Shipping Options that can be
|
||
|
* used to Fulfill a given set of Products.
|
||
|
*/
|
||
|
pub profile_id: ShippingProfileId,
|
||
|
/**
|
||
|
* The id of the [FulfillmentProvider], that will be used to process
|
||
|
* [Fulfillment]s from the Shipping Option.
|
||
|
*/
|
||
|
pub provider_id: FulfillmentProviderId,
|
||
|
/**
|
||
|
* The type of pricing calculation that is used when creation Shipping
|
||
|
* Methods from the Shipping Option. Can be `flat_rate` for fixed prices
|
||
|
* or `calculated` if the Fulfillment Provider can provide price
|
||
|
* calculations.
|
||
|
*/
|
||
|
pub price_type: ShippingOptionPriceType,
|
||
|
/**
|
||
|
* The amount to charge for shipping when the Shipping Option price type
|
||
|
* is `flat_rate`.
|
||
|
*/
|
||
|
pub amount: Option<Amount>,
|
||
|
/**
|
||
|
* Flag to indicate if the Shipping Option can be used for Return
|
||
|
* shipments.
|
||
|
*/
|
||
|
pub is_return: bool,
|
||
|
/**
|
||
|
* Flag to indicate if the Shipping Option usage is restricted to admin
|
||
|
* users.
|
||
|
*/
|
||
|
pub admin_only: bool,
|
||
|
/**
|
||
|
* The data needed for the Fulfillment Provider to identify the Shipping
|
||
|
* Option.
|
||
|
*/
|
||
|
pub data: Metadata,
|
||
|
/**
|
||
|
* [EXPERIMENTAL] Does the shipping option price include tax
|
||
|
*/
|
||
|
pub includes_tax: Option<bool>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The products that belong to this tax rate. Available if the relation
|
||
|
* `products` is expanded.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductTaxRate {
|
||
|
/**
|
||
|
* The tax rate's ID
|
||
|
*/
|
||
|
pub tax_rate_id: TaxRateId,
|
||
|
/**
|
||
|
* The product's ID
|
||
|
*/
|
||
|
pub product_id: ProductId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The product types that belong to this tax rate. Available if the relation
|
||
|
* `product_types` is expanded.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductTypeTaxRate {
|
||
|
/**
|
||
|
* The tax rate's ID
|
||
|
*/
|
||
|
pub tax_rate_id: TaxRateId,
|
||
|
/**
|
||
|
* The product's ID
|
||
|
*/
|
||
|
pub product_type_id: ProductTypeId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The shipping options that belong to this tax rate. Available if the
|
||
|
* relation `shipping_options` is expanded.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ShippingTaxRate {
|
||
|
/**
|
||
|
* The tax rate's ID
|
||
|
*/
|
||
|
pub tax_rate_id: TaxRateId,
|
||
|
/**
|
||
|
* The product's ID
|
||
|
*/
|
||
|
pub shipping_option_id: ShippingOptionId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A Tax Rate can be used to associate a certain rate to charge on products
|
||
|
* within a given Region
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct TaxRate {
|
||
|
/**
|
||
|
* The tax rate's ID
|
||
|
*/
|
||
|
pub id: TaxRateId,
|
||
|
/**
|
||
|
* The numeric rate to charge
|
||
|
*/
|
||
|
pub rate: Option<Number>,
|
||
|
/**
|
||
|
* A code to identify the tax type by
|
||
|
*/
|
||
|
pub code: TaxRateCode,
|
||
|
/**
|
||
|
* A human friendly name for the tax
|
||
|
*/
|
||
|
pub name: TaxRateName,
|
||
|
/**
|
||
|
* The id of the Region that the rate belongs to
|
||
|
*/
|
||
|
pub region_id: RegionId,
|
||
|
/**
|
||
|
* The count of products
|
||
|
*/
|
||
|
pub product_count: Option<Count>,
|
||
|
/**
|
||
|
* The count of product types
|
||
|
*/
|
||
|
pub product_type_count: Option<Count>,
|
||
|
/**
|
||
|
* The count of shipping options
|
||
|
*/
|
||
|
pub shipping_option_count: Option<Count>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Country details
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Country {
|
||
|
/**
|
||
|
* The country's ID
|
||
|
*/
|
||
|
pub id: CountryId,
|
||
|
/**
|
||
|
* The 2 character ISO code of the country in lower case
|
||
|
*/
|
||
|
pub iso_2: CountryIso2,
|
||
|
/**
|
||
|
* The 2 character ISO code of the country in lower case
|
||
|
*/
|
||
|
pub iso_3: CountryIso3,
|
||
|
/**
|
||
|
* The numerical ISO code for the country.
|
||
|
*/
|
||
|
pub num_code: i64,
|
||
|
/**
|
||
|
* The normalized country name in upper case.
|
||
|
*/
|
||
|
pub name: CountryName,
|
||
|
/**
|
||
|
* The country name appropriate for display.
|
||
|
*/
|
||
|
pub display_name: String,
|
||
|
/**
|
||
|
* The region ID this country is associated with.
|
||
|
*/
|
||
|
pub region_id: Option<RegionId>,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The Payment Providers that can be used to process Payments in the
|
||
|
* Region. Available if the relation `payment_providers` is expanded.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct RegionPaymentProviders {
|
||
|
pub region_id: RegionId,
|
||
|
pub provider_id: PaymentProviderId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The Fulfillment Providers that can be used to fulfill orders in the
|
||
|
* Region. Available if the relation `fulfillment_providers` is
|
||
|
* expanded.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct RegionFulfillmentProviders {
|
||
|
pub region_id: RegionId,
|
||
|
pub provider_id: FulfillmentProviderId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Regions hold settings for how Customers in a given geographical location
|
||
|
* shop. The is, for example, where currencies and tax rates are defined. A
|
||
|
* Region can consist of multiple countries to accommodate common shopping
|
||
|
* settings across countries.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Region {
|
||
|
/**
|
||
|
* The region's ID
|
||
|
*/
|
||
|
pub id: RegionId,
|
||
|
/**
|
||
|
* The name of the region as displayed to the customer. If the Region
|
||
|
* only has one country it is recommended to write the country name.
|
||
|
*/
|
||
|
pub name: RegionName,
|
||
|
/**
|
||
|
* The 3 character currency code that the Region uses.
|
||
|
*/
|
||
|
pub currency_code: CurrencyCode,
|
||
|
/**
|
||
|
* Available if the relation `currency` is expanded.
|
||
|
*/
|
||
|
pub currency: Option<Currency>,
|
||
|
/**
|
||
|
* The tax rate that should be charged on purchases in the Region.
|
||
|
*/
|
||
|
pub tax_rate: TaxRateValue,
|
||
|
/**
|
||
|
* The tax code used on purchases in the Region. This may be used by
|
||
|
* other systems for accounting purposes.
|
||
|
*/
|
||
|
pub tax_code: Option<TaxRateCode>,
|
||
|
/**
|
||
|
* Whether the gift cards are taxable or not in this region.
|
||
|
*/
|
||
|
pub gift_cards_taxable: bool,
|
||
|
/**
|
||
|
* Whether taxes should be automated in this region.
|
||
|
*/
|
||
|
pub automatic_taxes: bool,
|
||
|
/**
|
||
|
* The ID of the tax provider used in this region
|
||
|
*/
|
||
|
pub tax_provider_id: Option<TaxProviderId>,
|
||
|
/**
|
||
|
* [EXPERIMENTAL] Does the prices for the region include tax
|
||
|
*/
|
||
|
pub includes_tax: Option<bool>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* An address.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Address {
|
||
|
/**
|
||
|
* ID of the address
|
||
|
*/
|
||
|
pub id: AddressId,
|
||
|
/**
|
||
|
* ID of the customer this address belongs to
|
||
|
*/
|
||
|
pub customer_id: Option<CustomerId>,
|
||
|
/**
|
||
|
* Company name
|
||
|
*/
|
||
|
pub company: Option<String>,
|
||
|
/**
|
||
|
* First name
|
||
|
*/
|
||
|
pub first_name: Option<String>,
|
||
|
/**
|
||
|
* Last name
|
||
|
*/
|
||
|
pub last_name: Option<String>,
|
||
|
/**
|
||
|
* Address line 1
|
||
|
*/
|
||
|
pub address_1: Option<String>,
|
||
|
/**
|
||
|
* Address line 2
|
||
|
*/
|
||
|
pub address_2: Option<String>,
|
||
|
/**
|
||
|
* City
|
||
|
*/
|
||
|
pub city: Option<String>,
|
||
|
/**
|
||
|
* The 2 character ISO code of the country in lower case
|
||
|
*/
|
||
|
pub country_code: Option<String>,
|
||
|
/**
|
||
|
* Province
|
||
|
*/
|
||
|
pub province: Option<String>,
|
||
|
/**
|
||
|
* Postal Code
|
||
|
*/
|
||
|
pub postal_code: Option<String>,
|
||
|
/**
|
||
|
* Phone Number
|
||
|
*/
|
||
|
pub phone: Option<String>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Gift Cards are redeemable and represent a value that can be used towards
|
||
|
* the payment of an Order.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct GiftCard {
|
||
|
/**
|
||
|
* The gift card's ID
|
||
|
*/
|
||
|
pub id: GiftCardId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The unique code that identifies the Gift Card. This is used by the
|
||
|
* Customer to redeem the value of the Gift Card.
|
||
|
*/
|
||
|
pub code: GiftCardCode,
|
||
|
/**
|
||
|
* The value that the Gift Card represents.
|
||
|
*/
|
||
|
pub value: i64,
|
||
|
/**
|
||
|
* The remaining value on the Gift Card.
|
||
|
*/
|
||
|
pub balance: i64,
|
||
|
/**
|
||
|
* The id of the Region in which the Gift Card is available.
|
||
|
*/
|
||
|
pub region_id: RegionId,
|
||
|
/**
|
||
|
* The id of the Order that the Gift Card was purchased in.
|
||
|
*/
|
||
|
pub order_id: OrderId,
|
||
|
/**
|
||
|
* Whether the Gift Card has been disabled. Disabled Gift Cards cannot
|
||
|
* be applied to carts.
|
||
|
*/
|
||
|
pub is_disabled: bool,
|
||
|
/**
|
||
|
* The time at which the Gift Card can no longer be used.
|
||
|
*/
|
||
|
pub ends_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The gift card's tax rate that will be applied on calculating totals
|
||
|
*/
|
||
|
pub tax_rate: Option<TaxRateValue>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Payment Sessions are created when a Customer initializes the checkout
|
||
|
* flow, and can be used to hold the state of a payment flow. Each Payment
|
||
|
* Session is controlled by a Payment Provider, who is responsible for the
|
||
|
* communication with external payment services. Authorized Payment Sessions
|
||
|
* will eventually get promoted to Payments to indicate that they are
|
||
|
* authorized for capture/refunds/etc.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct PaymentSession {
|
||
|
/**
|
||
|
* The payment session's ID
|
||
|
*/
|
||
|
pub id: PaymentSessionId,
|
||
|
/**
|
||
|
* The id of the Cart that the Payment Session is created for.
|
||
|
*/
|
||
|
pub cart_id: Option<CartId>,
|
||
|
/**
|
||
|
* The id of the [PaymentProvider] that is responsible for the Payment
|
||
|
* Session
|
||
|
*/
|
||
|
pub provider_id: PaymentProviderId,
|
||
|
/**
|
||
|
* A flag to indicate if the Payment Session has been selected as the
|
||
|
* method that will be used to complete the purchase.
|
||
|
*/
|
||
|
pub is_selected: Option<bool>,
|
||
|
/**
|
||
|
* A flag to indicate if a communication with the third party provider
|
||
|
* has been initiated.
|
||
|
*/
|
||
|
pub is_initiated: bool,
|
||
|
/**
|
||
|
* Indicates the status of the Payment Session. Will default to
|
||
|
* `pending`, and will eventually become `authorized`. Payment Sessions
|
||
|
* may have the status of `requires_more` to indicate that further
|
||
|
* actions are to be completed by the Customer.
|
||
|
*/
|
||
|
pub status: PaymentSessionStatus,
|
||
|
/**
|
||
|
* The data required for the Payment Provider to identify, modify and
|
||
|
* process the Payment Session. Typically this will be an object that
|
||
|
* holds an id to the external payment session, but can be an empty
|
||
|
* object if the Payment Provider doesn't hold any state.
|
||
|
*/
|
||
|
pub data: Metadata,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of a cart in
|
||
|
* case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The amount that the Payment Session has been authorized for.
|
||
|
*/
|
||
|
pub amount: Option<Price>,
|
||
|
/**
|
||
|
* The date with timezone at which the Payment Session was authorized.
|
||
|
*/
|
||
|
pub payment_authorized_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Product Tags can be added to Products for easy filtering and grouping.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductTag {
|
||
|
/**
|
||
|
* The product tag's ID
|
||
|
*/
|
||
|
pub id: ProductTagId,
|
||
|
/**
|
||
|
* The value that the Product Tag represents
|
||
|
*/
|
||
|
pub value: String,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Product Collections represents a group of Products that are related.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ProductCollection {
|
||
|
/**
|
||
|
* The product collection's ID
|
||
|
*/
|
||
|
pub id: ProductCollectionId,
|
||
|
/**
|
||
|
* The title that the Product Collection is identified by.
|
||
|
*/
|
||
|
pub title: String,
|
||
|
/**
|
||
|
* A unique string that identifies the Product Collection - can for
|
||
|
* example be used in slug structures.
|
||
|
*/
|
||
|
pub handle: Option<String>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Associates a discount condition with a product
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountConditionProduct {
|
||
|
/**
|
||
|
* The ID of the [Product]
|
||
|
*/
|
||
|
pub product_id: ProductId,
|
||
|
/**
|
||
|
* The ID of the [DiscountCondition]
|
||
|
*/
|
||
|
pub condition_id: DiscountConditionId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Associates a discount condition with a product type
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountConditionProductType {
|
||
|
/**
|
||
|
* The ID of the [ProductType]
|
||
|
*/
|
||
|
pub product_type_id: ProductTypeId,
|
||
|
/**
|
||
|
* The ID of the [DiscountCondition]
|
||
|
*/
|
||
|
pub condition_id: DiscountConditionId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Associates a discount condition with a product tag
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountConditionProductTag {
|
||
|
/**
|
||
|
* The ID of the [ProductTag]
|
||
|
*/
|
||
|
pub product_tag_id: ProductTagId,
|
||
|
/**
|
||
|
* The ID of the [DiscountCondition]
|
||
|
*/
|
||
|
pub condition_id: DiscountConditionId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Associates a discount condition with a product collection
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountConditionProductCollection {
|
||
|
/**
|
||
|
* The ID of the [ProductCollectionId]
|
||
|
*/
|
||
|
pub product_collection_id: ProductCollectionId,
|
||
|
/**
|
||
|
* The ID of the [DiscountCondition]
|
||
|
*/
|
||
|
pub condition_id: DiscountConditionId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountConditionCustomerGroup {
|
||
|
pub condition_id: DiscountConditionId,
|
||
|
pub customer_group_id: CustomerGroupId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountCondition {
|
||
|
/**
|
||
|
* The discount condition's ID
|
||
|
*/
|
||
|
pub id: DiscountConditionId,
|
||
|
/**
|
||
|
* The type of the Condition
|
||
|
*/
|
||
|
pub discount_condition_type: DiscountConditionType,
|
||
|
/**
|
||
|
* The operator of the Condition
|
||
|
*/
|
||
|
pub operator: DiscountConditionOperator,
|
||
|
/**
|
||
|
* The ID of the discount rule associated with the condition
|
||
|
*/
|
||
|
pub discount_rule_id: DiscountRuleId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Holds the rules that governs how a Discount is calculated when applied to
|
||
|
* a Cart.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountRule {
|
||
|
/**
|
||
|
* The discount rule's ID
|
||
|
*/
|
||
|
pub id: DiscountRuleId,
|
||
|
/**
|
||
|
* The type of the Discount, can be `fixed` for discounts that
|
||
|
* reduce the price by a fixed amount, `percentage` for percentage
|
||
|
* reductions or `free_shipping` for shipping vouchers.
|
||
|
*/
|
||
|
pub discount_rule_type: DiscountRuleType,
|
||
|
/**
|
||
|
* A short description of the discount
|
||
|
*/
|
||
|
pub description: Option<String>,
|
||
|
/**
|
||
|
* The value that the discount represents; this will depend on the
|
||
|
* type of the discount
|
||
|
*/
|
||
|
pub value: i64,
|
||
|
/**
|
||
|
* The scope that the discount should apply to.
|
||
|
*/
|
||
|
pub allocation: Option<DiscountRuleAllocation>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct DiscountRegion {
|
||
|
pub discount_id: DiscountId,
|
||
|
pub region_id: RegionId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents a discount that can be applied to a cart for promotional
|
||
|
* purposes.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Serialize, Deserialize)]
|
||
|
pub struct Discount {
|
||
|
/**
|
||
|
* The discount's ID
|
||
|
*/
|
||
|
pub id: DiscountId,
|
||
|
/**
|
||
|
* A unique code for the discount - this will be used by the
|
||
|
* customer to apply the discount
|
||
|
*/
|
||
|
pub code: DiscountCode,
|
||
|
/**
|
||
|
* A flag to indicate if multiple instances of the discount can be
|
||
|
* generated. I.e. for newsletter discounts
|
||
|
*/
|
||
|
pub is_dynamic: bool,
|
||
|
/**
|
||
|
* The Discount Rule that governs the behaviour of the Discount
|
||
|
*/
|
||
|
pub rule_id: Option<DiscountRuleId>,
|
||
|
/**
|
||
|
* Whether the Discount has been disabled. Disabled discounts cannot
|
||
|
* be applied to carts
|
||
|
*/
|
||
|
pub is_disabled: bool,
|
||
|
/**
|
||
|
* The Discount that the discount was created from. This will always
|
||
|
* be a dynamic discount
|
||
|
*/
|
||
|
pub parent_discount_id: Option<DiscountId>,
|
||
|
/**
|
||
|
* Available if the relation `parent_discount` is expanded.
|
||
|
*/
|
||
|
// pub parent_discount: Option<Rc<Discount>>,
|
||
|
/**
|
||
|
* The time at which the discount can be used.
|
||
|
*/
|
||
|
pub starts_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The time at which the discount can no longer be used.
|
||
|
*/
|
||
|
pub ends_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* Duration the discount runs between
|
||
|
*/
|
||
|
pub valid_duration: Option<std::time::Duration>,
|
||
|
/**
|
||
|
* The maximum number of times that a discount can be used.
|
||
|
*/
|
||
|
pub usage_limit: Option<Number>,
|
||
|
/**
|
||
|
* The number of times a discount has been used.
|
||
|
*/
|
||
|
pub usage_count: Number,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents photo documentation of a claim.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ClaimImage {
|
||
|
/**
|
||
|
* The claim image's ID
|
||
|
*/
|
||
|
pub id: ClaimImageId,
|
||
|
/**
|
||
|
* The ID of the claim item associated with the image
|
||
|
*/
|
||
|
pub claim_item_id: ClaimItemId,
|
||
|
/**
|
||
|
* The URL of the image
|
||
|
*/
|
||
|
pub url: ImageUrl,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Claim Tags are user defined tags that can be assigned to claim items for
|
||
|
* easy filtering and grouping.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ClaimTag {
|
||
|
/**
|
||
|
* The claim tag's ID
|
||
|
*/
|
||
|
pub id: ClaimTagId,
|
||
|
/**
|
||
|
* The value that the claim tag holds
|
||
|
*/
|
||
|
pub value: ClaimTagValue,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ClaimItemTag {
|
||
|
pub item_id: ClaimItemId,
|
||
|
pub tag_id: ClaimTagId,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents a claimed item along with information about the reasons for
|
||
|
* the claim.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ClaimItem {
|
||
|
/**
|
||
|
* The claim item's ID
|
||
|
*/
|
||
|
pub id: ClaimItemId,
|
||
|
/**
|
||
|
* The ID of the claim this item is associated with.
|
||
|
*/
|
||
|
pub claim_order_id: ClaimOrderId,
|
||
|
/**
|
||
|
* The ID of the [LineItem] that the claim item refers to.
|
||
|
*/
|
||
|
pub item_id: LineItemId,
|
||
|
/**
|
||
|
* The ID of the [ProductVariant] that is claimed.
|
||
|
*/
|
||
|
pub variant_id: ProductVariantId,
|
||
|
/**
|
||
|
* The reason for the claim
|
||
|
*/
|
||
|
pub reason: ClaimReason,
|
||
|
/**
|
||
|
* An optional note about the claim, for additional information
|
||
|
*/
|
||
|
pub note: ClaimItemNote,
|
||
|
/**
|
||
|
* The quantity of the item that is being claimed; must be less than or
|
||
|
* equal to the amount purchased in the original order.
|
||
|
*/
|
||
|
pub quantity: Quantity,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A Reason for why a given product is returned. A Return Reason can be used
|
||
|
* on Return Items in order to indicate why a Line Item was returned.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ReturnReason {
|
||
|
/**
|
||
|
* The return reason's ID
|
||
|
*/
|
||
|
pub id: ReturnReasonId,
|
||
|
/**
|
||
|
* The value to identify the reason by.
|
||
|
*/
|
||
|
pub value: ReturnReasonValue,
|
||
|
/**
|
||
|
* A text that can be displayed to the Customer as a reason.
|
||
|
*/
|
||
|
pub label: ReturnReasonLabel,
|
||
|
/**
|
||
|
* A description of the Reason.
|
||
|
*/
|
||
|
pub description: Option<ReturnReasonDescription>,
|
||
|
/**
|
||
|
* The ID of the parent reason.
|
||
|
*/
|
||
|
pub parent_return_reason_id: Option<ReturnReasonId>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Correlates a Line Item with a Return, keeping track of the quantity of
|
||
|
* the Line Item that will be returned.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ReturnItem {
|
||
|
/**
|
||
|
* The id of the Return that the Return Item belongs to.
|
||
|
*/
|
||
|
pub return_id: ReturnId,
|
||
|
/**
|
||
|
* The id of the [LineItem] that the Return Item references.
|
||
|
*/
|
||
|
pub item_id: LineItemId,
|
||
|
/**
|
||
|
* The quantity of the Line Item that is included in the Return.
|
||
|
*/
|
||
|
pub quantity: Number,
|
||
|
/**
|
||
|
* Whether the Return Item was requested initially or received
|
||
|
* unexpectedly in the warehouse.
|
||
|
*/
|
||
|
pub is_requested: bool,
|
||
|
/**
|
||
|
* The quantity that was originally requested to be returned.
|
||
|
*/
|
||
|
pub requested_quantity: Option<Quantity>,
|
||
|
/**
|
||
|
* The quantity that was received in the warehouse.
|
||
|
*/
|
||
|
pub received_quantity: Option<Quantity>,
|
||
|
/**
|
||
|
* The ID of the reason for returning the item.
|
||
|
*/
|
||
|
pub reason_id: ReturnReasonId,
|
||
|
/**
|
||
|
* An optional note with additional details about the Return.
|
||
|
*/
|
||
|
pub note: Option<ReturnNote>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Return orders hold information about Line Items that a Customer wishes to
|
||
|
* send back, along with how the items will be returned. Returns can be used
|
||
|
* as part of a Swap.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Return {
|
||
|
/**
|
||
|
* The return's ID
|
||
|
*/
|
||
|
pub id: ReturnId,
|
||
|
/**
|
||
|
* Status of the Return.
|
||
|
*/
|
||
|
pub status: ReturnStatus,
|
||
|
/**
|
||
|
* The ID of the Swap that the Return is a part of.
|
||
|
*/
|
||
|
pub swap_id: Option<SwapId>,
|
||
|
/**
|
||
|
* The ID of the [ClaimOrder] that the Return is a part of.
|
||
|
*/
|
||
|
pub claim_order_id: Option<ClaimOrderId>,
|
||
|
/**
|
||
|
* The ID of the Order that the Return is made from.
|
||
|
*/
|
||
|
pub order_id: Option<OrderId>,
|
||
|
/**
|
||
|
* Data about the return shipment as provided by the Fulfilment Provider
|
||
|
* that handles the return shipment.
|
||
|
*/
|
||
|
pub shipping_data: Metadata,
|
||
|
/**
|
||
|
* The id of the stock location the return will be added back.
|
||
|
*/
|
||
|
pub location_id: Option<LocationId>,
|
||
|
/**
|
||
|
* The amount that should be refunded as a result of the return.
|
||
|
*/
|
||
|
pub refund_amount: Number,
|
||
|
/**
|
||
|
* When set to true, no notification will be sent related to this
|
||
|
* return.
|
||
|
*/
|
||
|
pub no_notification: Option<bool>,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of the return
|
||
|
* in case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The date with timezone at which the return was received.
|
||
|
*/
|
||
|
pub received_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Tracking Link holds information about tracking numbers for a Fulfillment.
|
||
|
* Tracking Links can optionally contain a URL that can be visited to see
|
||
|
* the status of the shipment.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct TrackingLink {
|
||
|
/**
|
||
|
* The tracking link's ID
|
||
|
*/
|
||
|
pub id: TrackingLinkId,
|
||
|
/**
|
||
|
* The URL at which the status of the shipment can be tracked.
|
||
|
*/
|
||
|
pub url: Option<TrackingUrl>,
|
||
|
/**
|
||
|
* The tracking number given by the shipping carrier.
|
||
|
*/
|
||
|
pub tracking_number: TrackingNumber,
|
||
|
/**
|
||
|
* The id of the Fulfillment that the Tracking Link references.
|
||
|
*/
|
||
|
pub fulfillment_id: FulfillmentId,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of a process
|
||
|
* in case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Correlates a Line Item with a Fulfillment, keeping track of the quantity
|
||
|
* of the Line Item.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct FulfillmentItem {
|
||
|
/**
|
||
|
* The id of the Fulfillment that the Fulfillment Item belongs to.
|
||
|
*/
|
||
|
pub fulfillment_id: FulfillmentId,
|
||
|
/**
|
||
|
* The id of the [LineItem] that the Fulfillment Item references.
|
||
|
*/
|
||
|
pub item_id: LineItemId,
|
||
|
/**
|
||
|
* The quantity of the Line Item that is included in the Fulfillment.
|
||
|
*/
|
||
|
pub quantity: Number,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* [Fulfillment]s are created once store operators can prepare the purchased
|
||
|
* goods. Fulfillments will eventually be shipped and hold information about
|
||
|
* how to track shipments. Fulfillments are created through a provider,
|
||
|
* which is typically an external shipping aggregator, shipping partner og
|
||
|
* 3PL, most plugins will have asynchronous communications with these
|
||
|
* providers through webhooks in order to automatically update and
|
||
|
* synchronize the state of Fulfillments.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Fulfillment {
|
||
|
/**
|
||
|
* The fulfillment's ID
|
||
|
*/
|
||
|
pub id: FulfillmentId,
|
||
|
/**
|
||
|
* The id of the [ClaimOrder] that the Fulfillment belongs to.
|
||
|
*/
|
||
|
pub claim_order_id: Option<ClaimOrderId>,
|
||
|
/**
|
||
|
* The id of the [Swap] that the Fulfillment belongs to.
|
||
|
*/
|
||
|
pub swap_id: Option<SwapId>,
|
||
|
/**
|
||
|
* The id of the [Order] that the Fulfillment belongs to.
|
||
|
*/
|
||
|
pub order_id: Option<OrderId>,
|
||
|
/**
|
||
|
* The id of the [FulfillmentProvider] responsible for handling the
|
||
|
* fulfillment
|
||
|
*/
|
||
|
pub provider_id: FulfillmentProviderId,
|
||
|
/**
|
||
|
* The id of the stock location the fulfillment will be shipped from
|
||
|
*/
|
||
|
pub location_id: LocationId,
|
||
|
/**
|
||
|
* The tracking numbers that can be used to track the status of the
|
||
|
* fulfillment. @deprecated
|
||
|
*/
|
||
|
pub tracking_numbers: Option<Vec<String>>,
|
||
|
/**
|
||
|
* This contains all the data necessary for the Fulfillment provider to
|
||
|
* handle the fulfillment.
|
||
|
*/
|
||
|
pub data: Metadata,
|
||
|
/**
|
||
|
* The date with timezone at which the Fulfillment was shipped.
|
||
|
*/
|
||
|
pub shipped_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* Flag for describing whether or not notifications related to this
|
||
|
* should be sent.
|
||
|
*/
|
||
|
pub no_notification: Option<bool>,
|
||
|
/**
|
||
|
* The date with timezone at which the Fulfillment was canceled.
|
||
|
*/
|
||
|
pub canceled_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of the
|
||
|
* fulfillment in case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
impl FullAccount {
|
||
|
pub fn claim_order(&self) -> Option<ClaimOrder> {
|
||
|
todo!()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Claim Orders represent a group of faulty or missing items. Each claim
|
||
|
* order consists of a subset of items associated with an original order,
|
||
|
* and can contain additional information about fulfillments and returns.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct ClaimOrder {
|
||
|
/**
|
||
|
* The claim's ID
|
||
|
*/
|
||
|
pub id: ClaimOrderId,
|
||
|
/**
|
||
|
* The claim's type
|
||
|
*/
|
||
|
pub claim_order_type: ClaimType,
|
||
|
/**
|
||
|
* The status of the claim's payment
|
||
|
*/
|
||
|
pub payment_status: ClaimPaymentStatus,
|
||
|
/**
|
||
|
* The claim's fulfillment status
|
||
|
*/
|
||
|
pub fulfillment_status: ClaimFulfillmentStatus,
|
||
|
/**
|
||
|
* The ID of the order that the claim comes from.
|
||
|
*/
|
||
|
pub order_id: OrderId,
|
||
|
/**
|
||
|
* The ID of the address that the new items should be shipped to
|
||
|
*/
|
||
|
pub shipping_address_id: ShippingAddressId,
|
||
|
/**
|
||
|
* The amount that will be refunded in conjunction with the claim
|
||
|
*/
|
||
|
pub refund_amount: Option<Amount>,
|
||
|
/**
|
||
|
* The date with timezone at which the claim was canceled.
|
||
|
*/
|
||
|
pub canceled_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
/**
|
||
|
* Flag for describing whether or not notifications related to this
|
||
|
* should be send.
|
||
|
*/
|
||
|
pub no_notification: Option<bool>,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of the cart
|
||
|
* associated with the claim in case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents a Line Item Tax Line
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct LineItemTaxLine {
|
||
|
/**
|
||
|
* The line item tax line's ID
|
||
|
*/
|
||
|
pub id: LineItemTaxLineId,
|
||
|
/**
|
||
|
* The numeric rate to charge tax by
|
||
|
*/
|
||
|
pub rate: i64,
|
||
|
/**
|
||
|
* A human friendly name for the tax
|
||
|
*/
|
||
|
pub name: String,
|
||
|
/**
|
||
|
* A code to identify the tax type by
|
||
|
*/
|
||
|
pub code: Option<String>,
|
||
|
/**
|
||
|
* The ID of the [LineItem]
|
||
|
*/
|
||
|
pub item_id: LineItemId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Represents a Line Item Adjustment
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct LineItemAdjustment {
|
||
|
/**
|
||
|
* The Line Item Adjustment's ID
|
||
|
*/
|
||
|
pub id: LineItemAdjustmentId,
|
||
|
/**
|
||
|
* The ID of the [LineItem]
|
||
|
*/
|
||
|
pub item_id: LineItemId,
|
||
|
/**
|
||
|
* The line item's adjustment description
|
||
|
*/
|
||
|
pub description: String,
|
||
|
/**
|
||
|
* The ID of the [Discount] associated with the adjustment
|
||
|
*/
|
||
|
pub discount_id: Option<DiscountId>,
|
||
|
/**
|
||
|
* The adjustment amount
|
||
|
*/
|
||
|
pub amount: Amount,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum OrderItemChangeType {
|
||
|
#[default]
|
||
|
ItemAdd,
|
||
|
ItemRemove,
|
||
|
ItemUpdate,
|
||
|
// "item_add" | "item_remove" | "item_update"
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct OrderItemChange {
|
||
|
/**
|
||
|
* The order item change's ID
|
||
|
*/
|
||
|
pub id: OrderItemChangeId,
|
||
|
/**
|
||
|
* The order item change's status
|
||
|
*/
|
||
|
pub change_type: OrderItemChangeType,
|
||
|
/**
|
||
|
* The ID of the order edit
|
||
|
*/
|
||
|
pub order_edit_id: OrderEditId,
|
||
|
/**
|
||
|
* The ID of the original line item in the order
|
||
|
*/
|
||
|
pub original_line_item_id: Option<LineItemId>,
|
||
|
/**
|
||
|
* The ID of the cloned [LineItem].
|
||
|
*/
|
||
|
pub line_item_id: Option<LineItemId>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum PaymentCollectionType {
|
||
|
#[default]
|
||
|
OrderEdit,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub enum PaymentCollectionStatus {
|
||
|
#[default]
|
||
|
NotPaid,
|
||
|
Awaiting,
|
||
|
Authorized,
|
||
|
PartiallyAuthorized,
|
||
|
Canceled,
|
||
|
// "not_paid" | "awaiting" | "authorized" | "partially_authorized" | "canceled",
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct PaymentCollectionSessions {
|
||
|
pub payment_collection_id: PaymentCollectionId,
|
||
|
pub payment_session_id: PaymentSessionId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct PaymentCollectionPayments {
|
||
|
pub payment_collection_id: PaymentCollectionId,
|
||
|
pub payment_id: PaymentId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct PaymentCollection {
|
||
|
/**
|
||
|
* The payment collection's ID
|
||
|
*/
|
||
|
pub id: PaymentCollectionId,
|
||
|
/**
|
||
|
* The type of the payment collection
|
||
|
*/
|
||
|
pub collection_type: PaymentCollectionType,
|
||
|
/**
|
||
|
* The type of the payment collection
|
||
|
*/
|
||
|
pub status: PaymentCollectionStatus,
|
||
|
/**
|
||
|
* Description of the payment collection
|
||
|
*/
|
||
|
pub description: Option<String>,
|
||
|
/**
|
||
|
* Amount of the payment collection.
|
||
|
*/
|
||
|
pub amount: Amount,
|
||
|
/**
|
||
|
* Authorized amount of the payment collection.
|
||
|
*/
|
||
|
pub authorized_amount: Option<Amount>,
|
||
|
/**
|
||
|
* The region's ID
|
||
|
*/
|
||
|
pub region_id: RegionId,
|
||
|
/**
|
||
|
* The 3 character ISO code for the currency.
|
||
|
*/
|
||
|
pub currency_code: CurrencyCode,
|
||
|
/**
|
||
|
* The ID of the user that created the payment collection.
|
||
|
*/
|
||
|
pub created_by: CustomerId,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Order edit keeps track of order items changes.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct OrderEdit {
|
||
|
/**
|
||
|
* The order edit's ID
|
||
|
*/
|
||
|
pub id: OrderEditId,
|
||
|
/**
|
||
|
* The ID of the order that is edited
|
||
|
*/
|
||
|
pub order_id: OrderId,
|
||
|
/**
|
||
|
* An optional note with additional details about the order edit.
|
||
|
*/
|
||
|
pub internal_note: Option<String>,
|
||
|
/**
|
||
|
* The unique identifier of the user or customer who created the
|
||
|
* order edit.
|
||
|
*/
|
||
|
pub created_by: CustomerId,
|
||
|
/**
|
||
|
* The unique identifier of the user or customer who requested the
|
||
|
* order edit.
|
||
|
*/
|
||
|
pub requested_by: Option<CustomerId>,
|
||
|
/**
|
||
|
* The date with timezone at which the edit was requested.
|
||
|
*/
|
||
|
pub requested_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The unique identifier of the user or customer who confirmed the
|
||
|
* order edit.
|
||
|
*/
|
||
|
pub confirmed_by: Option<CustomerId>,
|
||
|
/**
|
||
|
* The date with timezone at which the edit was confirmed.
|
||
|
*/
|
||
|
pub confirmed_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The unique identifier of the user or customer who declined the
|
||
|
* order edit.
|
||
|
*/
|
||
|
pub declined_by: Option<CustomerId>,
|
||
|
/**
|
||
|
* The date with timezone at which the edit was declined.
|
||
|
*/
|
||
|
pub declined_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional note why the order edit is declined.
|
||
|
*/
|
||
|
pub declined_reason: Option<String>,
|
||
|
/**
|
||
|
* The unique identifier of the user or customer who cancelled the
|
||
|
* order edit.
|
||
|
*/
|
||
|
pub canceled_by: Option<CustomerId>,
|
||
|
/**
|
||
|
* The date with timezone at which the edit was cancelled.
|
||
|
*/
|
||
|
pub canceled_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The total of subtotal
|
||
|
*/
|
||
|
pub subtotal: Option<Total>,
|
||
|
/**
|
||
|
* The total of discount
|
||
|
*/
|
||
|
pub discount_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of the shipping amount
|
||
|
*/
|
||
|
pub shipping_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of the gift card amount
|
||
|
*/
|
||
|
pub gift_card_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of the gift card tax amount
|
||
|
*/
|
||
|
pub gift_card_tax_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of tax
|
||
|
*/
|
||
|
pub tax_total: Option<Total>,
|
||
|
/**
|
||
|
* The total amount of the edited order.
|
||
|
*/
|
||
|
pub total: Option<Total>,
|
||
|
/**
|
||
|
* The difference between the total amount of the order and total
|
||
|
* amount of edited order.
|
||
|
*/
|
||
|
pub difference_due: Option<i64>,
|
||
|
/**
|
||
|
* The status of the order edit.
|
||
|
*/
|
||
|
pub status: OrderEditStatus,
|
||
|
/**
|
||
|
* The ID of the payment collection
|
||
|
*/
|
||
|
pub payment_collection_id: Option<PaymentCollectionId>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Line Items represent purchasable units that can be added to a Cart for checkout. When Line Items are purchased they will get copied to the resulting order and can eventually be referenced in Fulfillments and Returns. Line Items may also be created when processing Swaps and Claims.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct LineItem {
|
||
|
/**
|
||
|
* The line item's ID
|
||
|
*/
|
||
|
pub id: LineItemId,
|
||
|
/**
|
||
|
* The ID of the Cart that the Line Item belongs to.
|
||
|
*/
|
||
|
pub cart_id: Option<CartId>,
|
||
|
/**
|
||
|
* The ID of the Order that the Line Item belongs to.
|
||
|
*/
|
||
|
pub order_id: Option<OrderId>,
|
||
|
/**
|
||
|
* The id of the Swap that the Line Item belongs to.
|
||
|
*/
|
||
|
pub swap_id: Option<SwapId>,
|
||
|
/**
|
||
|
* The id of the [ClaimOrder] that the Line Item belongs to.
|
||
|
*/
|
||
|
pub claim_order_id: Option<ClaimOrderId>,
|
||
|
/**
|
||
|
* The id of the original [LineItem]
|
||
|
*/
|
||
|
pub original_item_id: Option<LineItemId>,
|
||
|
/**
|
||
|
* The ID of the [OrderEdit] to which a cloned item belongs
|
||
|
*/
|
||
|
pub order_edit_id: Option<OrderEditId>,
|
||
|
/**
|
||
|
* The title of the Line Item, this should be easily identifiable by the
|
||
|
* Customer.
|
||
|
*/
|
||
|
pub title: String,
|
||
|
/**
|
||
|
* A more detailed description of the contents of the Line Item.
|
||
|
*/
|
||
|
pub description: Option<String>,
|
||
|
/**
|
||
|
* A URL string to a small image of the contents of the Line Item.
|
||
|
*/
|
||
|
pub thumbnail: Option<String>,
|
||
|
/**
|
||
|
* Is the item being returned
|
||
|
*/
|
||
|
pub is_return: bool,
|
||
|
/**
|
||
|
* Flag to indicate if the Line Item is a Gift Card.
|
||
|
*/
|
||
|
pub is_giftcard: bool,
|
||
|
/**
|
||
|
* Flag to indicate if new Line Items with the same variant should be
|
||
|
* merged or added as an additional Line Item.
|
||
|
*/
|
||
|
pub should_merge: bool,
|
||
|
/**
|
||
|
* Flag to indicate if the Line Item should be included when doing
|
||
|
* discount calculations.
|
||
|
*/
|
||
|
pub allow_discounts: bool,
|
||
|
/**
|
||
|
* Flag to indicate if the Line Item has fulfillment associated with it.
|
||
|
*/
|
||
|
pub has_shipping: Option<bool>,
|
||
|
/**
|
||
|
* The price of one unit of the content in the Line Item. This should be
|
||
|
* in the currency defined by the Cart/Order/Swap/Claim that the Line
|
||
|
* Item belongs to.
|
||
|
*/
|
||
|
pub unit_price: Number,
|
||
|
/**
|
||
|
* The id of the [ProductVariant] contained in the Line Item.
|
||
|
*/
|
||
|
pub variant_id: Option<ProductVariantId>,
|
||
|
/**
|
||
|
* The quantity of the content in the Line Item.
|
||
|
*/
|
||
|
pub quantity: Quantity,
|
||
|
/**
|
||
|
* The quantity of the Line Item that has been fulfilled.
|
||
|
*/
|
||
|
pub fulfilled_quantity: Option<Quantity>,
|
||
|
/**
|
||
|
* The quantity of the Line Item that has been returned.
|
||
|
*/
|
||
|
pub returned_quantity: Option<Quantity>,
|
||
|
/**
|
||
|
* The quantity of the Line Item that has been shipped.
|
||
|
*/
|
||
|
pub shipped_quantity: Option<Quantity>,
|
||
|
/**
|
||
|
* The amount that can be refunded from the given Line Item. Takes taxes
|
||
|
* and discounts into consideration.
|
||
|
*/
|
||
|
pub refundable: Option<Number>,
|
||
|
/**
|
||
|
* The subtotal of the line item
|
||
|
*/
|
||
|
pub subtotal: Option<Total>,
|
||
|
/**
|
||
|
* The total of tax of the line item
|
||
|
*/
|
||
|
pub tax_total: Option<Total>,
|
||
|
/**
|
||
|
* The total amount of the line item
|
||
|
*/
|
||
|
pub total: Option<Total>,
|
||
|
/**
|
||
|
* The original total amount of the line item
|
||
|
*/
|
||
|
pub original_total: Option<Total>,
|
||
|
/**
|
||
|
* The original tax total amount of the line item
|
||
|
*/
|
||
|
pub original_tax_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of discount of the line item rounded
|
||
|
*/
|
||
|
pub discount_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of discount of the line item
|
||
|
*/
|
||
|
pub raw_discount_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of the gift card of the line item
|
||
|
*/
|
||
|
pub gift_card_total: Option<Total>,
|
||
|
/**
|
||
|
* [EXPERIMENTAL] Indicates if the line item unit_price include tax
|
||
|
*/
|
||
|
pub includes_tax: Option<bool>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Swaps can be created when a Customer wishes to exchange Products that
|
||
|
* they have purchased to different Products. Swaps consist of a Return of
|
||
|
* previously purchased Products and a Fulfillment of new Products, the
|
||
|
* amount paid for the Products being returned will be used towards payment
|
||
|
* for the new Products. In the case where the amount paid for the the
|
||
|
* Products being returned exceed the amount to be paid for the new
|
||
|
* Products, a Refund will be issued for the difference.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Swap {
|
||
|
/**
|
||
|
* The swap's ID
|
||
|
*/
|
||
|
pub id: SwapId,
|
||
|
/**
|
||
|
* The status of the Fulfillment of the Swap.
|
||
|
*/
|
||
|
pub fulfillment_status: SwapFulfillmentStatus,
|
||
|
/**
|
||
|
* The status of the Payment of the Swap. The payment may either refer
|
||
|
* to the refund of an amount or the authorization of a new amount.
|
||
|
*/
|
||
|
pub payment_status: SwapPaymentStatus,
|
||
|
/**
|
||
|
* The ID of the Order where the Line Items to be returned where
|
||
|
* purchased.
|
||
|
*/
|
||
|
pub order_id: OrderId,
|
||
|
/**
|
||
|
* The difference that is paid or refunded as a result of the Swap. May
|
||
|
* be negative when the amount paid for the returned items exceed the
|
||
|
* total of the new Products.
|
||
|
*/
|
||
|
pub difference_due: Option<Number>,
|
||
|
/**
|
||
|
* The [Address] to send the new Line Items to - in most cases this will
|
||
|
* be the same as the shipping address on the Order.
|
||
|
*/
|
||
|
pub shipping_address_id: Option<ShippingAddressId>,
|
||
|
/**
|
||
|
* The id of the [Cart] that the Customer will use to confirm the Swap.
|
||
|
*/
|
||
|
pub cart_id: Option<CartId>,
|
||
|
/**
|
||
|
* The date with timezone at which the Swap was confirmed by the
|
||
|
* Customer.
|
||
|
*/
|
||
|
pub confirmed_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The date with timezone at which the Swap was canceled.
|
||
|
*/
|
||
|
pub canceled_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* If set to true, no notification will be sent related to this swap
|
||
|
*/
|
||
|
pub no_notification: Option<bool>,
|
||
|
/**
|
||
|
* If true, swaps can be completed with items out of stock
|
||
|
*/
|
||
|
pub allow_backorder: bool,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of the swap in
|
||
|
* case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
impl Swap {
|
||
|
pub fn line_items(&self) -> Vec<LineItem> {
|
||
|
todo!()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Payments represent an amount authorized with a given payment method,
|
||
|
* Payments can be captured, canceled or refunded.
|
||
|
*/
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Payment {
|
||
|
/**
|
||
|
* The payment's ID
|
||
|
*/
|
||
|
pub id: PaymentId,
|
||
|
/**
|
||
|
* The ID of the Swap that the Payment is used for.
|
||
|
*/
|
||
|
pub swap_id: Option<SwapId>,
|
||
|
/**
|
||
|
* The id of the Cart that the Payment Session is created for.
|
||
|
*/
|
||
|
pub cart_id: Option<CartId>,
|
||
|
/**
|
||
|
* The ID of the Order that the Payment is used for.
|
||
|
*/
|
||
|
pub order_id: Option<OrderId>,
|
||
|
/**
|
||
|
* The amount that the Payment has been authorized for.
|
||
|
*/
|
||
|
pub amount: Number,
|
||
|
/**
|
||
|
* The 3 character ISO currency code that the Payment is completed in.
|
||
|
*/
|
||
|
pub currency_code: CurrencyCode,
|
||
|
/**
|
||
|
* The amount of the original Payment amount that has been refunded back
|
||
|
* to the Customer.
|
||
|
*/
|
||
|
pub amount_refunded: Number,
|
||
|
/**
|
||
|
* The id of the [PaymentProvider] that is responsible for the Payment
|
||
|
*/
|
||
|
pub provider_id: PaymentProviderId,
|
||
|
/**
|
||
|
* The data required for the Payment Provider to identify, modify and
|
||
|
* process the Payment. Typically this will be an object that holds an
|
||
|
* id to the external payment session, but can be an empty object if the
|
||
|
* Payment Provider doesn't hold any state.
|
||
|
*/
|
||
|
pub data: Metadata,
|
||
|
/**
|
||
|
* The date with timezone at which the Payment was captured.
|
||
|
*/
|
||
|
pub captured_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The date with timezone at which the Payment was canceled.
|
||
|
*/
|
||
|
pub canceled_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of a payment
|
||
|
* in case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct CartDiscounts {
|
||
|
pub cart_id: CartId,
|
||
|
pub discount_id: DiscountId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct CartGiftCards {
|
||
|
pub cart_id: CartId,
|
||
|
pub gift_card_id: GiftCardId,
|
||
|
}
|
||
|
|
||
|
#[derive(Default, Debug, Deserialize, Serialize)]
|
||
|
pub struct Cart {
|
||
|
/**
|
||
|
* The cart's ID
|
||
|
*/
|
||
|
pub id: CartId,
|
||
|
/**
|
||
|
* The email associated with the cart
|
||
|
*/
|
||
|
pub email: Option<Email>,
|
||
|
/**
|
||
|
* The billing address's ID
|
||
|
*/
|
||
|
pub billing_address_id: Option<AddressId>,
|
||
|
/**
|
||
|
* The shipping address's ID
|
||
|
*/
|
||
|
pub shipping_address_id: Option<ShippingAddressId>,
|
||
|
/**
|
||
|
* The region's ID
|
||
|
*/
|
||
|
pub region_id: RegionId,
|
||
|
/**
|
||
|
* The customer's ID
|
||
|
*/
|
||
|
pub customer_id: Option<CustomerId>,
|
||
|
/**
|
||
|
* The selected payment session in the cart.
|
||
|
*/
|
||
|
pub payment_session_id: Option<PaymentSessionId>,
|
||
|
/**
|
||
|
* The payment's ID if available
|
||
|
*/
|
||
|
pub payment_id: Option<PaymentId>,
|
||
|
/**
|
||
|
* The cart's type.
|
||
|
*/
|
||
|
pub cart_type: CartType,
|
||
|
/**
|
||
|
* The date with timezone at which the cart was completed.
|
||
|
*/
|
||
|
pub completed_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* The date with timezone at which the payment was authorized.
|
||
|
*/
|
||
|
pub payment_authorized_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* Randomly generated key used to continue the completion of a cart in
|
||
|
* case of failure.
|
||
|
*/
|
||
|
pub idempotency_key: Option<IdempotencyKey>,
|
||
|
/**
|
||
|
* The context of the cart which can include info like IP or user agent.
|
||
|
*/
|
||
|
pub context: Metadata,
|
||
|
/**
|
||
|
* The sales channel ID the cart is associated with.
|
||
|
*/
|
||
|
pub sales_channel_id: Option<SalesChannelId>,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was created.
|
||
|
*/
|
||
|
pub created_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was updated.
|
||
|
*/
|
||
|
pub updated_at: NaiveDateTime,
|
||
|
/**
|
||
|
* The date with timezone at which the resource was deleted.
|
||
|
*/
|
||
|
pub deleted_at: Option<NaiveDateTime>,
|
||
|
/**
|
||
|
* An optional key-value map with additional details
|
||
|
*/
|
||
|
pub metadata: Metadata,
|
||
|
/**
|
||
|
* The total of shipping
|
||
|
*/
|
||
|
pub shipping_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of discount rounded
|
||
|
*/
|
||
|
pub discount_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of discount
|
||
|
*/
|
||
|
pub raw_discount_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of items with taxes
|
||
|
*/
|
||
|
pub item_tax_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of shipping with taxes
|
||
|
*/
|
||
|
pub shipping_tax_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of tax
|
||
|
*/
|
||
|
pub tax_total: Option<Total>,
|
||
|
/**
|
||
|
* The total amount refunded if the order associated with this cart is
|
||
|
* returned.
|
||
|
*/
|
||
|
pub refunded_total: Option<Total>,
|
||
|
/**
|
||
|
* The total amount of the cart
|
||
|
*/
|
||
|
pub total: Option<Total>,
|
||
|
/**
|
||
|
* The subtotal of the cart
|
||
|
*/
|
||
|
pub subtotal: Option<Total>,
|
||
|
/**
|
||
|
* The amount that can be refunded
|
||
|
*/
|
||
|
pub refundable_amount: Option<Amount>,
|
||
|
/**
|
||
|
* The total of gift cards
|
||
|
*/
|
||
|
pub gift_card_total: Option<Total>,
|
||
|
/**
|
||
|
* The total of gift cards with taxes
|
||
|
*/
|
||
|
pub gift_card_tax_total: Option<Total>,
|
||
|
}
|