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

Commit

Permalink
feat: complete products remaining sub attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jul 30, 2020
1 parent da2fdd6 commit b2b5361
Show file tree
Hide file tree
Showing 2 changed files with 280 additions and 251 deletions.
49 changes: 45 additions & 4 deletions src/sections/products/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,51 @@ const CompetitivePricingType = Codec.interface({
NumberOfOfferListings: optional(NumberOfOfferListingsList),
TradeInValue: optional(MoneyType),
})
const SalesRankList = unknown
const LowestOfferListingList = unknown
const Offers = unknown
// @todo all unknowns

const SalesRankType = Codec.interface({
ProductCategoryId: optional(ensureString),
Rank: optional(number),
})

const SalesRankList = ensureArray('SalesRank', SalesRankType)

const ShippingTimeType = Codec.interface({
Max: string,
})

const QualifiersType = Codec.interface({
ItemCondition: optional(ensureString),
ItemSubcondition: optional(ensureString),
FulfillmentChannel: optional(ensureString),
ShipsDomestically: optional(ensureString),
ShippingTime: optional(ShippingTimeType),
SellerPositiveFeedbackRating: optional(ensureString),
})

const LowestOfferListingType = Codec.interface({
Qualifiers: optional(QualifiersType),
NumberOfOfferListingsConsidered: optional(number),
SellerFeedbackCount: optional(number),
Price: optional(PriceType),
MultipleOffersAtLowestPrice: optional(string),
})

const LowestOfferListingList = ensureArray('LowestOfferListing', LowestOfferListingType)

const OfferType = Codec.interface({
BuyingPrice: optional(PriceType),
RegularPrice: optional(MoneyType),
FulfillmentChannel: optional(string),
ItemCondition: optional(string),
ItemSubCondition: optional(string),
SellerId: optional(string),
SellerSKU: optional(string),
})

const OffersList = ensureArray('Offer', OfferType)

const Offers = OffersList

const Product = Codec.interface({
Identifiers: optional(IdentifierType),
AttributeSets: optional(AttributeSetList),
Expand Down
Loading

0 comments on commit b2b5361

Please sign in to comment.