feat: Totals calculation (#6980)

This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2024-04-07 16:50:40 +02:00
1 parent 7302d078a9
commit b6879f017a
48 files changed
+1674 -571

No files matched your search

+68 -47
View File
@@ -1,5 +1,6 @@
import { BaseFilterable } from "../dal"
import { OperatorMap } from "../dal/utils"
import { BigNumberValue } from "../totals"
/**
* The adjustment line details.
@@ -19,7 +20,7 @@ export interface AdjustmentLineDTO {
/**
* The amount to adjust the original amount with.
*/
amount: number
amount: BigNumberValue
/**
* The ID of the associated cart.
@@ -142,6 +143,16 @@ export interface ShippingMethodTaxLineDTO extends TaxLineDTO {
* The ID of the associated shipping method.
*/
shipping_method_id: string
/**
* The total tax relative to the shipping method.
*/
total: BigNumberValue
/**
* The subtotal tax relative to the shipping method.
*/
subtotal: BigNumberValue
}
/**
@@ -157,6 +168,16 @@ export interface LineItemTaxLineDTO extends TaxLineDTO {
* The ID of the associated line item.
*/
item_id: string
/**
* The total tax relative to the item.
*/
total: BigNumberValue
/**
* The subtotal tax relative to the item.
*/
subtotal: BigNumberValue
}
/**
@@ -266,7 +287,7 @@ export interface CartShippingMethodDTO {
/**
* The price of the shipping method.
*/
amount: number
amount: BigNumberValue
/**
* Whether the shipping method price is tax inclusive.
@@ -315,42 +336,42 @@ export interface CartShippingMethodDTO {
/**
* The original total of the cart shipping method.
*/
original_total: number
original_total: BigNumberValue
/**
* The original subtotal of the cart shipping method.
*/
original_subtotal: number
original_subtotal: BigNumberValue
/**
* The original tax total of the cart shipping method.
*/
original_tax_total: number
original_tax_total: BigNumberValue
/**
* The total of the cart shipping method.
*/
total: number
total: BigNumberValue
/**
* The subtotal of the cart shipping method.
*/
subtotal: number
subtotal: BigNumberValue
/**
* The tax total of the cart shipping method.
*/
tax_total: number
tax_total: BigNumberValue
/**
* The discount total of the cart shipping method.
*/
discount_total: number
discount_total: BigNumberValue
/**
* The discount tax total of the cart shipping method.
*/
discount_tax_total: number
discount_tax_total: BigNumberValue
}
/**
@@ -360,57 +381,57 @@ export interface CartLineItemTotalsDTO {
/**
* The original total of the cart line item.
*/
original_total: number
original_total: BigNumberValue
/**
* The original subtotal of the cart line item.
*/
original_subtotal: number
original_subtotal: BigNumberValue
/**
* The original tax total of the cart line item.
*/
original_tax_total: number
original_tax_total: BigNumberValue
/**
* The item total of the cart line item.
*/
item_total: number
item_total: BigNumberValue
/**
* The item subtotal of the cart line item.
*/
item_subtotal: number
item_subtotal: BigNumberValue
/**
* The item tax total of the cart line item.
*/
item_tax_total: number
item_tax_total: BigNumberValue
/**
* The total of the cart line item.
*/
total: number
total: BigNumberValue
/**
* The subtotal of the cart line item.
*/
subtotal: number
subtotal: BigNumberValue
/**
* The tax total of the cart line item.
*/
tax_total: number
tax_total: BigNumberValue
/**
* The discount total of the cart line item.
*/
discount_total: number
discount_total: BigNumberValue
/**
* The discount tax total of the cart line item.
*/
discount_tax_total: number
discount_tax_total: BigNumberValue
}
/**
@@ -440,7 +461,7 @@ export interface CartLineItemDTO extends CartLineItemTotalsDTO {
/**
* The line item's quantity in the cart.
*/
quantity: number
quantity: BigNumberValue
/**
* The ID of the associated product.
@@ -520,12 +541,12 @@ export interface CartLineItemDTO extends CartLineItemTotalsDTO {
/**
* The calculated price of the line item.
*/
compare_at_unit_price?: number
compare_at_unit_price?: BigNumberValue
/**
* The unit price of the item.
*/
unit_price: number
unit_price: BigNumberValue
/**
* The associated tax lines.
@@ -654,67 +675,67 @@ export interface CartDTO {
/**
* The original item total of the cart.
*/
original_item_total: number
original_item_total: BigNumberValue
/**
* The original item subtotal of the cart.
*/
original_item_subtotal: number
original_item_subtotal: BigNumberValue
/**
* The original item tax total of the cart.
*/
original_item_tax_total: number
original_item_tax_total: BigNumberValue
/**
* The item total of the cart.
*/
item_total: number
item_total: BigNumberValue
/**
* The item subtotal of the cart.
*/
item_subtotal: number
item_subtotal: BigNumberValue
/**
* The item tax total of the cart.
*/
item_tax_total: number
item_tax_total: BigNumberValue
/**
* The original total of the cart.
*/
original_total: number
original_total: BigNumberValue
/**
* The original subtotal of the cart.
*/
original_subtotal: number
original_subtotal: BigNumberValue
/**
* The original tax total of the cart.
*/
original_tax_total: number
original_tax_total: BigNumberValue
/**
* The total of the cart.
*/
total: number
total: BigNumberValue
/**
* The subtotal of the cart.
* The subtotal of the cart. (Excluding taxes)
*/
subtotal: number
subtotal: BigNumberValue
/**
* The tax total of the cart.
*/
tax_total: number
tax_total: BigNumberValue
/**
* The discount total of the cart.
*/
discount_total: number
discount_total: BigNumberValue
/**
* The raw discount total of the cart.
@@ -724,47 +745,47 @@ export interface CartDTO {
/**
* The discount tax total of the cart.
*/
discount_tax_total: number
discount_tax_total: BigNumberValue
/**
* The gift card total of the cart.
*/
gift_card_total: number
gift_card_total: BigNumberValue
/**
* The gift card tax total of the cart.
*/
gift_card_tax_total: number
gift_card_tax_total: BigNumberValue
/**
* The shipping total of the cart.
*/
shipping_total: number
shipping_total: BigNumberValue
/**
* The shipping subtotal of the cart.
*/
shipping_subtotal: number
shipping_subtotal: BigNumberValue
/**
* The shipping tax total of the cart.
*/
shipping_tax_total: number
shipping_tax_total: BigNumberValue
/**
* The original shipping total of the cart.
*/
original_shipping_total: number
original_shipping_total: BigNumberValue
/**
* The original shipping subtotal of the cart.
*/
original_shipping_subtotal: number
original_shipping_subtotal: BigNumberValue
/**
* The original shipping tax total of the cart.
*/
original_shipping_tax_total: number
original_shipping_tax_total: BigNumberValue
}
/**
+14 -13
View File
@@ -1,3 +1,4 @@
import { BigNumberInput } from "../totals"
import { CartDTO, CartLineItemDTO } from "./common"
/** ADDRESS START */
@@ -228,7 +229,7 @@ export interface CreateAdjustmentDTO {
/**
* The amount to adjust the original amount with.
*/
amount: number
amount: BigNumberInput
/**
* The description of the adjustment.
@@ -264,7 +265,7 @@ export interface UpdateAdjustmentDTO {
/**
* The amount to adjust the original amount with.
*/
amount: number
amount: BigNumberInput
/**
* The description of the adjustment.
@@ -325,7 +326,7 @@ export interface UpsertLineItemAdjustmentDTO {
/**
* The amount to adjust the original amount with.
*/
amount?: number
amount?: BigNumberInput
/**
* The description of the line item adjustment.
@@ -463,7 +464,7 @@ export interface CreateLineItemDTO {
/**
* The quantity of the line item in the cart.
*/
quantity: number
quantity: BigNumberInput
/**
* The associated product's ID.
@@ -543,12 +544,12 @@ export interface CreateLineItemDTO {
/**
* The calculated price of the line item after applying promotions.
*/
compare_at_unit_price?: number
compare_at_unit_price?: BigNumberInput
/**
* The unit price of the line item.
*/
unit_price: number | string
unit_price: BigNumberInput
/**
* The tax lines of the line item.
@@ -626,12 +627,12 @@ export interface UpdateLineItemDTO
/**
* The quantity of the line item in the cart.
*/
quantity?: number
quantity?: BigNumberInput
/**
* The unit price of the line item.
*/
unit_price?: number
unit_price?: BigNumberInput
/**
* Holds custom data in key-value pairs.
@@ -670,7 +671,7 @@ export interface CreateShippingMethodDTO {
/**
* The amount of the shipping method.
*/
amount: number
amount: BigNumberInput
/**
* The data of the shipping method.
@@ -700,7 +701,7 @@ export interface CreateShippingMethodForSingleCartDTO {
/**
* The amount of the shipping method.
*/
amount: number
amount: BigNumberInput
/**
* The data of the shipping method.
@@ -735,7 +736,7 @@ export interface UpdateShippingMethodDTO {
/**
* The amount of the shipping method.
*/
amount?: number
amount?: BigNumberInput
/**
* The data of the shipping method.
@@ -771,7 +772,7 @@ export interface CreateShippingMethodAdjustmentDTO {
/**
* The amount to adjust the original amount with.
*/
amount: number
amount: BigNumberInput
/**
* The description of the shipping method adjustment.
@@ -807,7 +808,7 @@ export interface UpdateShippingMethodAdjustmentDTO {
/**
* The amount to adjust the original amount with.
*/
amount?: number
amount?: BigNumberInput
/**
* The description of the shipping method adjustment.
+6 -5
View File
@@ -2,11 +2,12 @@ import { CustomerDTO } from "../customer"
import { ShippingOptionDTO } from "../fulfillment"
import { ProductDTO } from "../product"
import { RegionDTO } from "../region"
import { BigNumberInput } from "../totals"
import { CartDTO, CartLineItemDTO } from "./common"
import { UpdateLineItemDTO } from "./mutations"
export interface CreateCartCreateLineItemDTO {
quantity: number
quantity: BigNumberInput
variant_id: string
title?: string
@@ -31,8 +32,8 @@ export interface CreateCartCreateLineItemDTO {
is_tax_inclusive?: boolean
is_giftcard?: boolean
compare_at_unit_price?: number
unit_price?: number | string
compare_at_unit_price?: BigNumberInput
unit_price?: BigNumberInput
metadata?: Record<string, unknown>
}
@@ -93,7 +94,7 @@ export interface CreatePaymentCollectionForCartWorkflowInputDTO {
cart_id: string
region_id: string
currency_code: string
amount: number
amount: BigNumberInput
metadata?: Record<string, unknown>
}
@@ -115,5 +116,5 @@ export interface ListShippingOptionsForCartWorkflowInputDTO {
}
export interface PricedShippingOptionDTO extends ShippingOptionDTO {
amount: number
amount: BigNumberInput
}
+79 -25
View File
@@ -1,30 +1,30 @@
import { BaseFilterable } from "../dal"
import { OperatorMap } from "../dal/utils"
import { BigNumberRawValue } from "../totals"
import { BigNumberRawValue, BigNumberValue } from "../totals"
export type OrderSummaryDTO = {
total: number
subtotal: number
total_tax: number
total: BigNumberValue
subtotal: BigNumberValue
total_tax: BigNumberValue
ordered_total: number
fulfilled_total: number
returned_total: number
return_request_total: number
write_off_total: number
projected_total: number
ordered_total: BigNumberValue
fulfilled_total: BigNumberValue
returned_total: BigNumberValue
return_request_total: BigNumberValue
write_off_total: BigNumberValue
projected_total: BigNumberValue
net_total: number
net_subtotal: number
net_total_tax: number
net_total: BigNumberValue
net_subtotal: BigNumberValue
net_total_tax: BigNumberValue
future_total: number
future_subtotal: number
future_total_tax: number
future_projected_total: number
future_total: BigNumberValue
future_subtotal: BigNumberValue
future_total_tax: BigNumberValue
future_projected_total: BigNumberValue
balance: number
future_balance: number
balance: BigNumberValue
future_balance: BigNumberValue
}
export interface OrderAdjustmentLineDTO {
@@ -39,7 +39,7 @@ export interface OrderAdjustmentLineDTO {
/**
* The amount of the adjustment line
*/
amount: number
amount: BigNumberValue
/**
* The ID of the associated order
*/
@@ -134,6 +134,16 @@ export interface OrderShippingMethodTaxLineDTO extends OrderTaxLineDTO {
* The ID of the associated shipping method
*/
shipping_method_id: string
/**
* The total tax relative to the shipping method.
*/
total: BigNumberValue
/**
* The subtotal tax relative to the shipping method.
*/
subtotal: BigNumberValue
}
export interface OrderLineItemTaxLineDTO extends OrderTaxLineDTO {
@@ -145,6 +155,16 @@ export interface OrderLineItemTaxLineDTO extends OrderTaxLineDTO {
* The ID of the associated line item
*/
item_id: string
/**
* The total tax relative to the item.
*/
total: BigNumberValue
/**
* The subtotal tax relative to the item.
*/
subtotal: BigNumberValue
}
export interface OrderAddressDTO {
@@ -276,11 +296,45 @@ export interface OrderShippingMethodDTO {
*/
updated_at: Date | string
total: number
subtotal: number
tax_total: number
discount_total: number
discount_tax_total: number
/**
* The original total of the order shipping method.
*/
original_total: BigNumberValue
/**
* The original subtotal of the order shipping method.
*/
original_subtotal: BigNumberValue
/**
* The original tax total of the order shipping method.
*/
original_tax_total: BigNumberValue
/**
* The total of the order shipping method.
*/
total: BigNumberValue
/**
* The subtotal of the order shipping method.
*/
subtotal: BigNumberValue
/**
* The tax total of the order shipping method.
*/
tax_total: BigNumberValue
/**
* The discount total of the order shipping method.
*/
discount_total: BigNumberValue
/**
* The discount tax total of the order shipping method.
*/
discount_tax_total: BigNumberValue
}
export interface OrderLineItemTotalsDTO {
+6 -4
View File
@@ -40,7 +40,7 @@ export interface CreateOrderDTO {
no_notification?: boolean
items?: CreateOrderLineItemDTO[]
shipping_methods?: Omit<CreateOrderShippingMethodDTO, "order_id">[]
transactions?: CreateOrderTransactionDTO[]
transactions?: Omit<CreateOrderTransactionDTO, "order_id">[]
metadata?: Record<string, unknown>
promo_codes?: string[]
@@ -244,7 +244,9 @@ export interface CreateOrderChangeDTO {
internal_note?: string
requested_by?: string
requested_at?: Date
created_by?: string
metadata?: Record<string, unknown>
actions?: CreateOrderChangeActionDTO[]
}
export interface UpdateOrderChangeDTO {
@@ -286,9 +288,9 @@ export interface ConfirmOrderChangeDTO {
/** ORDER CHANGE ACTION START */
export interface CreateOrderChangeActionDTO {
order_change_id: string
reference: string
reference_id: string
order_change_id?: string
reference?: string
reference_id?: string
action: string
internal_note?: string
details?: Record<string, unknown>
+14 -13
View File
@@ -1,5 +1,6 @@
import { BaseFilterable } from "../dal"
import { OperatorMap } from "../dal/utils"
import { BigNumberValue } from "../totals"
/* ********** PAYMENT COLLECTION ********** */
/**
* @enum
@@ -87,17 +88,17 @@ export interface PaymentCollectionDTO {
/**
* The total amount to be authorized and captured.
*/
amount: number
amount: BigNumberValue
/**
* The amount authorized within the associated payment sessions.
*/
authorized_amount?: number
authorized_amount?: BigNumberValue
/**
* The amount refunded within the associated payments.
*/
refunded_amount?: number
refunded_amount?: BigNumberValue
/**
* When the payment collection was completed.
@@ -190,7 +191,7 @@ export interface FilterablePaymentSessionProps
/**
* Filter the payment sessions by their amount.
*/
amount?: number | OperatorMap<number>
amount?: BigNumberValue | OperatorMap<BigNumberValue>
/**
* Filter the payment sessions by the ID of their associated payment provider.
@@ -240,7 +241,7 @@ export interface FilterableCaptureProps extends BaseFilterable<CaptureDTO> {
/**
* Filter the captures by their amounts.
*/
amount?: number | OperatorMap<number>
amount?: BigNumberValue | OperatorMap<BigNumberValue>
/**
* Filter the captures by the ID of their associated payment.
@@ -280,7 +281,7 @@ export interface FilterableRefundProps extends BaseFilterable<RefundDTO> {
/**
* Filter the refunds by their amount.
*/
amount?: number | OperatorMap<number>
amount?: BigNumberValue | OperatorMap<BigNumberValue>
/**
* Filter the refunds by the ID of their associated payment.
@@ -312,12 +313,12 @@ export interface PaymentDTO {
/**
* The payment's total amount.
*/
amount: number
amount: BigNumberValue
/**
* The authorized amount of the payment.
*/
authorized_amount?: number
authorized_amount?: BigNumberValue
/**
* The ISO 3 character currency code of the payment.
@@ -377,12 +378,12 @@ export interface PaymentDTO {
/**
* The sum of the associated captures' amounts.
*/
captured_amount?: number
captured_amount?: BigNumberValue
/**
* The sum of the associated refunds' amounts.
*/
refunded_amount?: number
refunded_amount?: BigNumberValue
/**
* The associated captures.
@@ -481,7 +482,7 @@ export interface CaptureDTO {
/**
* The captured amount.
*/
amount: number
amount: BigNumberValue
/**
* The creation date of the capture.
@@ -512,7 +513,7 @@ export interface RefundDTO {
/**
* The refunded amount.
*/
amount: number
amount: BigNumberValue
/**
* The creation date of the refund.
@@ -543,7 +544,7 @@ export interface PaymentSessionDTO {
/**
* The amount to authorize.
*/
amount: number
amount: BigNumberValue
/**
* The 3 character currency code of the payment session.
+9 -8
View File
@@ -1,3 +1,4 @@
import { BigNumberInput } from "../totals"
import { PaymentProviderContext } from "./provider"
/**
@@ -17,7 +18,7 @@ export interface CreatePaymentCollectionDTO {
/**
* The amount of the payment collection.
*/
amount: number
amount: BigNumberInput
/**
* Holds custom data in key-value pairs.
@@ -58,7 +59,7 @@ export interface UpsertPaymentCollectionDTO {
/**
* The amount of the payment collection.
*/
amount?: number
amount?: BigNumberInput
/**
* Holds custom data in key-value pairs.
@@ -83,7 +84,7 @@ export interface PaymentCollectionUpdatableFields {
/**
* The amount of the payment collection.
*/
amount?: number
amount?: BigNumberInput
/**
* Holds custom data in key-value pairs.
@@ -98,7 +99,7 @@ export interface CreatePaymentDTO {
/**
* The amount of the payment.
*/
amount: number
amount: BigNumberInput
/**
* The ISO 3 character currency code of the payment.
@@ -183,7 +184,7 @@ export interface CreateCaptureDTO {
/**
* The amount of the capture.
*/
amount?: number
amount?: BigNumberInput
/**
* The associated payment's ID.
@@ -204,7 +205,7 @@ export interface CreateRefundDTO {
/**
* The amount of the refund.
*/
amount?: number
amount?: BigNumberInput
/**
* The associated payment's ID.
@@ -235,7 +236,7 @@ export interface CreatePaymentSessionDTO {
/**
* The amount to be authorized.
*/
amount: number
amount: BigNumberInput
/**
* Necessary data for the associated payment provider to process the payment.
@@ -270,7 +271,7 @@ export interface UpdatePaymentSessionDTO {
/**
* The amount to be authorized.
*/
amount: number
amount: BigNumberInput
/**
* Necessary context data for the associated payment provider.
+6 -5
View File
@@ -1,5 +1,6 @@
import { AddressDTO } from "../address"
import { CustomerDTO } from "../customer"
import { BigNumberInput, BigNumberValue } from "../totals"
import { PaymentSessionStatus } from "./common"
import { ProviderWebhookPayload } from "./mutations"
@@ -85,7 +86,7 @@ export type CreatePaymentProviderSession = {
/**
* The amount to be authorized.
*/
amount: number
amount: BigNumberInput
/**
* The ISO 3 character currency code.
@@ -112,7 +113,7 @@ export type UpdatePaymentProviderSession = {
/**
* The payment session's amount.
*/
amount: number
amount: BigNumberInput
/**
* The ISO 3 character code of the payment session.
@@ -203,7 +204,7 @@ export type WebhookActionData = {
/**
* The amount to be captured or authorized (based on the action's type.)
*/
amount: number
amount: BigNumberValue
}
/**
@@ -310,12 +311,12 @@ export interface IPaymentProvider {
* In this method, you can interact with the third-party provider and perform any actions necessary to refund the payment.
*
* @param {Record<string, unknown>} paymentSessionData - The `data` field of a Payment.
* @param {number} refundAmount - The amount to refund.
* @param {BigNumberInput} refundAmount - The amount to refund.
* @returns {Promise<PaymentProviderError | PaymentProviderSessionResponse["data"]>} Either an error object or an object that's stored in the `data` field of the payment.
*/
refundPayment(
paymentSessionData: Record<string, unknown>,
refundAmount: number
refundAmount: BigNumberInput
): Promise<PaymentProviderError | PaymentProviderSessionResponse["data"]>
/**
@@ -1,4 +1,5 @@
import { BaseFilterable } from "../../dal"
import { BigNumberInput, BigNumberValue } from "../../totals"
/**
* @interface
@@ -17,15 +18,15 @@ export interface MoneyAmountDTO {
/**
* The price of this money amount.
*/
amount?: number
amount?: BigNumberValue
/**
* The minimum quantity required to be purchased for this price to be applied.
*/
min_quantity?: number
min_quantity?: BigNumberValue
/**
* The maximum quantity required to be purchased for this price to be applied.
*/
max_quantity?: number
max_quantity?: BigNumberValue
/**
* When the money_amount was created.
*/
@@ -57,15 +58,15 @@ export interface CreateMoneyAmountDTO {
/**
* The amount of this money amount.
*/
amount: number
amount: BigNumberInput
/**
* The minimum quantity required to be purchased for this money amount to be applied.
*/
min_quantity?: number | null
min_quantity?: BigNumberInput | null
/**
* The maximum quantity required to be purchased for this money amount to be applied.
*/
max_quantity?: number | null
max_quantity?: BigNumberInput | null
}
/**
@@ -85,15 +86,15 @@ export interface UpdateMoneyAmountDTO {
/**
* The price of this money amount.
*/
amount?: number
amount?: BigNumberInput
/**
* The minimum quantity required to be purchased for this money amount to be applied.
*/
min_quantity?: number
min_quantity?: BigNumberInput
/**
* The maximum quantity required to be purchased for this money amount to be applied.
*/
max_quantity?: number
max_quantity?: BigNumberInput
}
/**
@@ -1,5 +1,6 @@
import { BaseFilterable } from "../../dal"
import { Context } from "../../shared-context"
import { BigNumberInput, BigNumberValue } from "../../totals"
import {
CreateMoneyAmountDTO,
FilterableMoneyAmountProps,
@@ -24,10 +25,10 @@ export interface PricingRepositoryService {
*/
export interface PricingContext {
/**
* an object whose keys are the name of the context attribute. Its value can be a string or a number. For example, you can pass the `currency_code` property with its value being the currency code to calculate the price in.
* an object whose keys are the name of the context attribute. Its value can be a string or a BigNumberInput. For example, you can pass the `currency_code` property with its value being the currency code to calculate the price in.
* Another example is passing the `quantity` property to calculate the price for that specified quantity, which finds a price set whose `min_quantity` and `max_quantity` conditions match the specified quantity.
*/
context?: Record<string, string | number>
context?: Record<string, string | BigNumberInput>
}
/**
@@ -124,7 +125,7 @@ export interface CalculatedPriceSet {
/**
* The amount of the calculated price, or `null` if there isn't a calculated price.
*/
calculated_amount: number | null
calculated_amount: BigNumberValue | null
/**
* Whether the original price is associated with a price list. During the calculation process, if the price list of the calculated price is of type override,
@@ -134,7 +135,7 @@ export interface CalculatedPriceSet {
/**
* The amount of the original price, or `null` if there isn't a calculated price.
*/
original_amount: number | null
original_amount: BigNumberValue | null
/**
* The currency code of the calculated price, or null if there isn't a calculated price.
@@ -160,11 +161,11 @@ export interface CalculatedPriceSet {
/**
* The `min_quantity` field defined on a price.
*/
min_quantity: number | null
min_quantity: BigNumberValue | null
/**
* The `max_quantity` field defined on a price.
*/
max_quantity: number | null
max_quantity: BigNumberValue | null
}
/**
@@ -186,11 +187,11 @@ export interface CalculatedPriceSet {
/**
* The `min_quantity` field defined on a price.
*/
min_quantity: number | null
min_quantity: BigNumberValue | null
/**
* The `max_quantity` field defined on a price.
*/
max_quantity: number | null
max_quantity: BigNumberValue | null
}
}
+10 -9
View File
@@ -1,4 +1,5 @@
import { BaseFilterable } from "../../dal"
import { BigNumberInput, BigNumberValue } from "../../totals"
import { PriceListDTO } from "./price-list"
import { PriceRuleDTO } from "./price-rule"
import { PriceSetDTO } from "./price-set"
@@ -24,15 +25,15 @@ export interface PriceDTO {
/**
* The price of this price.
*/
amount?: number
amount?: BigNumberValue
/**
* The minimum quantity required to be purchased for this price to be applied.
*/
min_quantity?: number
min_quantity?: BigNumberValue
/**
* The maximum quantity required to be purchased for this price to be applied.
*/
max_quantity?: number
max_quantity?: BigNumberValue
/**
* The price set associated with the price.
*
@@ -80,15 +81,15 @@ export interface UpdatePriceDTO {
/**
* The amount of this price.
*/
amount?: number
amount?: BigNumberInput
/**
* The minimum quantity required to be purchased for this price to be applied.
*/
min_quantity?: number
min_quantity?: BigNumberInput
/**
* The maximum quantity required to be purchased for this price to be applied.
*/
max_quantity?: number
max_quantity?: BigNumberInput
}
export interface CreatePriceDTO {
@@ -104,15 +105,15 @@ export interface CreatePriceDTO {
/**
* The amount of this price.
*/
amount: number
amount: BigNumberInput
/**
* The minimum quantity required to be purchased for this price to be applied.
*/
min_quantity?: number | null
min_quantity?: BigNumberInput | null
/**
* The maximum quantity required to be purchased for this price to be applied.
*/
max_quantity?: number | null
max_quantity?: BigNumberInput | null
}
/**
+2
View File
@@ -6,3 +6,5 @@ export type BigNumberRawValue = {
}
export type BigNumberInput = BigNumberRawValue | number | string | BigNumberJS
export type BigNumberValue = BigNumberJS | number | string
+26 -1
View File
@@ -1,2 +1,27 @@
export * from "./big-number";
import { BigNumberValue } from "./big-number"
export * from "./big-number"
export type CartLikeWithTotals = {
original_item_subtotal: BigNumberValue
original_item_tax_total: BigNumberValue
item_total: BigNumberValue
item_subtotal: BigNumberValue
item_tax_total: BigNumberValue
original_total: BigNumberValue
original_subtotal: BigNumberValue
original_tax_total: BigNumberValue
total: BigNumberValue
subtotal: BigNumberValue
tax_total: BigNumberValue
discount_total: BigNumberValue
discount_tax_total: BigNumberValue
gift_card_total: BigNumberValue
gift_card_tax_total: BigNumberValue
shipping_total: BigNumberValue
shipping_subtotal: BigNumberValue
shipping_tax_total: BigNumberValue
original_shipping_total: BigNumberValue
original_shipping_subtotal: BigNumberValue
original_shipping_tax_total: BigNumberValue
}