Skip to content

Commit

Permalink
feat: remove hard coding
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Han committed Dec 15, 2021
1 parent e41b7ea commit 62e8a40
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -825,15 +825,20 @@ export default ({ api, coreSagas, networks }: { api: APIType; coreSagas: any; ne
const fetchBuyQuote = function* ({ payload }: ReturnType<typeof A.fetchBuyQuote>) {
try {
yield put(A.fetchQuoteLoading())
const { amount, pair } = payload
const { amount, pair, paymentMethod } = payload
let paymentMethodId

if (paymentMethod === BSPaymentTypes.BANK_TRANSFER) {
paymentMethodId = 'd74992e0-a462-4aeb-903e-fc8e9a11bb40'
}

const quote: ReturnType<typeof api.getBuyQuote> = yield call(
api.getBuyQuote,
pair,
'SIMPLEBUY',
amount,
'BANK_TRANSFER',
'd74992e0-a462-4aeb-903e-fc8e9a11bb40'
paymentMethod,
paymentMethodId
)

yield put(A.fetchBuyQuoteSuccess({ quote }))
Expand Down Expand Up @@ -1121,7 +1126,13 @@ export default ({ api, coreSagas, networks }: { api: APIType; coreSagas: any; ne
const pairReversed = `${pairArr[1]}-${pairArr[0]}`

// TODO: the below code is breaking, need to add price which is equivalent to rate
yield put(A.fetchBuyQuote({ amount: '0', pair: pairReversed }))
yield put(
A.fetchBuyQuote({
amount: '0',
pair: pairReversed,
paymentMethod: BSPaymentTypes.FUNDS
})
)
} else {
yield put(A.fetchQuote({ amount: '0', orderType, pair: pair.pair }))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ const buySellSlice = createSlice({
action: PayloadAction<{
amount: string
pair: BSPairsType
paymentMethod: BSPaymentTypes
}>
) => {},
fetchBuyQuoteFailure: (state, action: PayloadAction<string>) => {
Expand Down Expand Up @@ -523,6 +524,7 @@ const buySellSlice = createSlice({
action: PayloadAction<{
amount: string
pair: BSPairsType
paymentMethod: BSPaymentTypes
}>
) => {},
startPollSellQuote: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ class CheckoutConfirm extends PureComponent<Props> {
if (this.props.flexiblePricingModel) {
this.props.buySellActions.fetchBuyQuote({
amount: this.props.order.inputQuantity,
pair: this.props.order.pair
pair: this.props.order.pair,
paymentMethod:
this.props.order.paymentType === undefined
? BSPaymentTypes.FUNDS
: this.props.order.paymentType
})
} else {
this.props.buySellActions.fetchQuote({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export default ({
pair: string,
profile: 'SIMPLEBUY' | 'SIMPLETRADE' | 'SWAP_FROM_USERKEY' | 'SWAP_INTERNAL' | 'SWAP_ON_CHAIN',
inputValue: string,
paymentMethod: 'FUNDS' | 'PAYMENT_CARD' | 'BANK_TRANSFER' | 'BANK_ACCOUNT',
paymentMethod: BSPaymentTypes,
paymentMethodId?: string
): BuyQuoteType =>
authorizedPost({
Expand Down

0 comments on commit 62e8a40

Please sign in to comment.