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

Commit

Permalink
fix: product api FeeDetail property, temporary fix
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed May 21, 2020
1 parent 1db6a84 commit ee978e0
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/sections/products.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { boolean, Codec, exactly, GetInterface, number, oneOf, optional, string } from 'purify-ts'
import {
array,
boolean,
Codec,
exactly,
GetInterface,
number,
oneOf,
optional,
string,
unknown,
} from 'purify-ts'

import { ParsingError } from '../error'
import { HttpClient, RequestMeta, Resource } from '../http'
Expand Down Expand Up @@ -103,12 +114,32 @@ enum FeeType {
FBADeliveryServicesFee = 'FBADeliveryServicesFee',
}

type AvailableFeeTypes =
| 'ReferralFee'
| 'VariableClosingFee'
| 'PerItemFee'
| 'FBAFees'
| 'FBAPickAndPack'
| 'FBAWeightHandling'
| 'FBAOrderHandling'
| 'FBADeliveryServicesFee'

interface FeeDetail {
FeeType: AvailableFeeTypes
FeeAmount: MoneyType
FeePromotion?: MoneyType
TaxAmount?: MoneyType
FinalFee: MoneyType
IncludedFeeDetailList?: FeeDetail
}

const FeeDetail = Codec.interface({
FeeType: oneOf(Object.values(FeeType).map((x) => exactly(x))),
FeeAmount: MoneyType,
FeePromotion: optional(MoneyType),
TaxAmount: optional(MoneyType),
FinalFee: MoneyType,
IncludedFeeDetailList: optional(array(unknown)), // Unsure how to handle this
// IncludedFeeDetailList: optional(ensureArray('IncludedFeeDetail', FeeDetail)) // Need to think about how to get around this
})

Expand Down

0 comments on commit ee978e0

Please sign in to comment.