Send in affiliate info as option

This commit is contained in:
Steve Klebanoff 2018-11-15 15:12:43 -08:00
parent 447b0f91f9
commit 33a156d9b5
3 changed files with 7 additions and 12 deletions

View File

@ -81,14 +81,11 @@ const mapDispatchToProps = (
// even if it's debounced, give them the illusion it's loading
dispatch(actions.setQuoteRequestStatePending());
// tslint:disable-next-line:no-floating-promises
debouncedUpdateBuyQuoteAsync(
assetBuyer,
dispatch,
asset,
value,
{ setPending: true, dispatchErrors: true },
debouncedUpdateBuyQuoteAsync(assetBuyer, dispatch, asset, value, {
setPending: true,
dispatchErrors: true,
affiliateInfo,
);
});
}
},
});

View File

@ -97,8 +97,7 @@ export const asyncData = {
dispatch,
selectedAsset as ERC20Asset,
selectedAssetUnitAmount,
{ setPending: !options.updateSilently, dispatchErrors: !options.updateSilently },
affiliateInfo,
{ setPending: !options.updateSilently, dispatchErrors: !options.updateSilently, affiliateInfo },
);
}
},

View File

@ -16,8 +16,7 @@ export const buyQuoteUpdater = {
dispatch: Dispatch<Action>,
asset: ERC20Asset,
assetUnitAmount: BigNumber,
options: { setPending: boolean; dispatchErrors: boolean },
affiliateInfo?: AffiliateInfo,
options: { setPending: boolean; dispatchErrors: boolean; affiliateInfo?: AffiliateInfo },
): Promise<void> => {
// get a new buy quote.
const baseUnitValue = Web3Wrapper.toBaseUnitAmount(assetUnitAmount, asset.metaData.decimals);
@ -25,7 +24,7 @@ export const buyQuoteUpdater = {
// mark quote as pending
dispatch(actions.setQuoteRequestStatePending());
}
const feePercentage = oc(affiliateInfo).feePercentage();
const feePercentage = oc(options.affiliateInfo).feePercentage();
let newBuyQuote: BuyQuote | undefined;
try {
newBuyQuote = await assetBuyer.getBuyQuoteAsync(asset.assetData, baseUnitValue, { feePercentage });