Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
fix: get lowest priced offer for sku and asin fi
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jun 4, 2020
1 parent f1597aa commit 3b1e398
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sections/products/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const BuyBoxPrice = Codec.interface({

const Summary = Codec.interface({
TotalOfferCount: number,
NumberOfOffers: OfferCountType,
NumberOfOffers: optional(OfferCountType),
LowestPrices: optional(ensureArray('LowestPrice', LowestPrice)),
BuyBoxPrices: optional(ensureArray('BuyBoxPrice', BuyBoxPrice)),
ListPrice: optional(MoneyType),
Expand Down
62 changes: 62 additions & 0 deletions test/unit/__snapshots__/products.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,68 @@ Array [
]
`;

exports[`products getLowestPricedOffersForSku returns lowest priced offer for sku when response is valid 2`] = `
Array [
Object {
"Identifier": Object {
"ItemCondition": "New",
"MarketplaceId": "A2EUQ1WTGCTBG2",
"SellerSKU": "ACA-8039-6PK-DL57",
"TimeOfOfferChange": undefined,
},
"Offers": Array [],
"Summary": Object {
"BuyBoxEligibleOffers": undefined,
"BuyBoxPrices": undefined,
"ListPrice": undefined,
"LowestPrices": undefined,
"NumberOfOffers": undefined,
"OffersAvailableTime": 2017-03-08T07:13:21.763Z,
"SuggestedLowerPricePlusShipping": undefined,
"TotalOfferCount": 0,
},
},
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
},
]
`;

exports[`products getLowestPricedOffersForSku returns lowest priced offer for sku when response is valid 3`] = `
Array [
Object {
"Identifier": Object {
"ItemCondition": "New",
"MarketplaceId": "ATVPDKIKX0DER",
"SellerSKU": "0I-RIAS-6UA0",
"TimeOfOfferChange": undefined,
},
"Offers": Array [],
"Summary": Object {
"BuyBoxEligibleOffers": undefined,
"BuyBoxPrices": undefined,
"ListPrice": undefined,
"LowestPrices": undefined,
"NumberOfOffers": undefined,
"OffersAvailableTime": undefined,
"SuggestedLowerPricePlusShipping": undefined,
"TotalOfferCount": 0,
},
},
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
},
]
`;

exports[`products getMatchingProduct returns a matching product when the response is valid 1`] = `
Array [
Array [
Expand Down

0 comments on commit 3b1e398

Please sign in to comment.