Skip to content

Commit

Permalink
Merge pull request #139 from epilot-dev/STABLE360-4076-journey-price-…
Browse files Browse the repository at this point in the history
…display-decimal-cent-values-rounded-to-full-cents

feat: adds types for total and sub-total amounts with full precision
  • Loading branch information
JoFont authored Nov 28, 2023
2 parents a2001a5 + 5359185 commit ab13df5
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 55 deletions.
117 changes: 82 additions & 35 deletions clients/pricing-client/src/openapi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ declare namespace Components {
*/
title?: string | null;
}
export interface Amounts {
/**
* Total of all items before (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total of all items before (discounts or) taxes are applied, as a string with all the decimal places.
*/
amount_subtotal_decimal?: string;
/**
* Total of all items after (discounts and) taxes are applied.
*/
amount_total?: number;
/**
* Total of all items after (discounts and) taxes are applied, as a string with all the decimal places.
*/
amount_total_decimal?: string;
}
/**
* Availability check request payload
*/
Expand Down Expand Up @@ -165,6 +183,22 @@ declare namespace Components {
* }
*/
export interface BasePriceItem {
/**
* Total of all items before (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total of all items before (discounts or) taxes are applied, as a string with all the decimal places.
*/
amount_subtotal_decimal?: string;
/**
* Total of all items after (discounts and) taxes are applied.
*/
amount_total?: number;
/**
* Total of all items after (discounts and) taxes are applied, as a string with all the decimal places.
*/
amount_total_decimal?: string;
/**
* price item id
*/
Expand All @@ -178,10 +212,6 @@ declare namespace Components {
* The unit gross amount value.
*/
unit_amount_gross?: number;
/**
* Total before any (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total tax amount for this line item.
*/
Expand All @@ -194,10 +224,6 @@ declare namespace Components {
* The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
*/
unit_amount_decimal?: string;
/**
* Total after (discounts and) taxes.
*/
amount_total?: number;
currency?: /**
* Three-letter ISO currency code, in lowercase. Must be a supported currency.
* ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
Expand Down Expand Up @@ -260,9 +286,6 @@ declare namespace Components {
* The sum of amounts of the price items by recurrence.
*/
recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmount)[];
/**
* Price mapping information required to compute totals
*/
price_mappings?: /**
* example:
* [
Expand Down Expand Up @@ -433,6 +456,22 @@ declare namespace Components {
* Supports shopping for products and services until ready for checkout.
*/
export interface Cart {
/**
* Total of all items before (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total of all items before (discounts or) taxes are applied, as a string with all the decimal places.
*/
amount_subtotal_decimal?: string;
/**
* Total of all items after (discounts and) taxes are applied.
*/
amount_total?: number;
/**
* Total of all items after (discounts and) taxes are applied, as a string with all the decimal places.
*/
amount_total_decimal?: string;
/**
* The cart identifier
*/
Expand All @@ -454,14 +493,6 @@ declare namespace Components {
delivery_address?: Address;
metadata?: /* A set of key-value pairs used to store meta data information about an entity. */ MetaData;
line_items?: /* Tracks a set of product prices, quantities, (discounts) and taxes. */ PriceItems;
/**
* Total of all items before (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total of all items after (discounts and) taxes are applied.
*/
amount_total?: number;
total_details?: /* The total details with tax (and discount) aggregated totals. */ TotalDetails;
created_at?: string; // date-time
updated_at?: string; // date-time
Expand Down Expand Up @@ -702,6 +733,22 @@ declare namespace Components {
* }
*/
export interface CompositePriceItem {
/**
* Total of all items before (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total of all items before (discounts or) taxes are applied, as a string with all the decimal places.
*/
amount_subtotal_decimal?: string;
/**
* Total of all items after (discounts and) taxes are applied.
*/
amount_total?: number;
/**
* Total of all items after (discounts and) taxes are applied, as a string with all the decimal places.
*/
amount_total_decimal?: string;
/**
* price item id
*/
Expand All @@ -715,10 +762,6 @@ declare namespace Components {
* The unit gross amount value.
*/
unit_amount_gross?: number;
/**
* Total before any (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total tax amount for this line item.
*/
Expand All @@ -731,10 +774,6 @@ declare namespace Components {
* The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
*/
unit_amount_decimal?: string;
/**
* Total after (discounts and) taxes.
*/
amount_total?: number;
currency?: /**
* Three-letter ISO currency code, in lowercase. Must be a supported currency.
* ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
Expand Down Expand Up @@ -1762,6 +1801,22 @@ declare namespace Components {
* }
*/
export interface PriceItem {
/**
* Total of all items before (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total of all items before (discounts or) taxes are applied, as a string with all the decimal places.
*/
amount_subtotal_decimal?: string;
/**
* Total of all items after (discounts and) taxes are applied.
*/
amount_total?: number;
/**
* Total of all items after (discounts and) taxes are applied, as a string with all the decimal places.
*/
amount_total_decimal?: string;
/**
* price item id
*/
Expand All @@ -1775,10 +1830,6 @@ declare namespace Components {
* The unit gross amount value.
*/
unit_amount_gross?: number;
/**
* Total before any (discounts or) taxes are applied.
*/
amount_subtotal?: number;
/**
* Total tax amount for this line item.
*/
Expand All @@ -1791,10 +1842,6 @@ declare namespace Components {
* The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
*/
unit_amount_decimal?: string;
/**
* Total after (discounts and) taxes.
*/
amount_total?: number;
currency?: /**
* Three-letter ISO currency code, in lowercase. Must be a supported currency.
* ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
Expand Down
51 changes: 31 additions & 20 deletions clients/pricing-client/src/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,11 @@
},
"Cart": {
"description": "Supports shopping for products and services until ready for checkout.",
"allOf": [
{
"$ref": "#/components/schemas/Amounts"
}
],
"properties": {
"id": {
"type": "string",
Expand Down Expand Up @@ -2496,16 +2501,6 @@
"line_items": {
"$ref": "#/components/schemas/PriceItems"
},
"amount_subtotal": {
"readOnly": true,
"type": "integer",
"description": "Total of all items before (discounts or) taxes are applied."
},
"amount_total": {
"readOnly": true,
"type": "integer",
"description": "Total of all items after (discounts and) taxes are applied."
},
"total_details": {
"$ref": "#/components/schemas/TotalDetails"
},
Expand Down Expand Up @@ -2652,6 +2647,11 @@
"example": {
"$ref": "#/components/examples/price-item"
},
"allOf": [
{
"$ref": "#/components/schemas/Amounts"
}
],
"properties": {
"_id": {
"type": "string",
Expand All @@ -2671,11 +2671,6 @@
"description": "The unit gross amount value.",
"readOnly": true
},
"amount_subtotal": {
"type": "integer",
"description": "Total before any (discounts or) taxes are applied.",
"readOnly": true
},
"amount_tax": {
"type": "integer",
"description": "Total tax amount for this line item."
Expand All @@ -2689,11 +2684,6 @@
"description": "The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.",
"type": "string"
},
"amount_total": {
"type": "integer",
"description": "Total after (discounts and) taxes.",
"readOnly": true
},
"currency": {
"$ref": "#/components/schemas/Currency"
},
Expand Down Expand Up @@ -2765,6 +2755,27 @@
}
}
},
"Amounts": {
"type": "object",
"properties": {
"amount_subtotal": {
"type": "integer",
"description": "Total of all items before (discounts or) taxes are applied."
},
"amount_subtotal_decimal": {
"type": "string",
"description": "Total of all items before (discounts or) taxes are applied, as a string with all the decimal places."
},
"amount_total": {
"type": "integer",
"description": "Total of all items after (discounts and) taxes are applied."
},
"amount_total_decimal": {
"type": "string",
"description": "Total of all items after (discounts and) taxes are applied, as a string with all the decimal places."
}
}
},
"PriceItem": {
"allOf": [
{
Expand Down

0 comments on commit ab13df5

Please sign in to comment.