Skip to content

Commit

Permalink
Update Wyre minimum fee and minimum amount (#1917)
Browse files Browse the repository at this point in the history
* Add min  fee to wyre

* Remove fees from wyre payment method selector

* Update minimum amount to

Co-authored-by: Esteban Miño <efmino@uc.cl>
  • Loading branch information
wachunei and estebanmino authored Nov 2, 2020
1 parent 6d92e5f commit 0e4e178
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 33 deletions.
8 changes: 3 additions & 5 deletions app/components/UI/FiatOrders/PaymentMethodApplePay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ QuickAmount.propTypes = {
//* Constants */

const quickAmounts = ['50', '100', '250'];
const minAmount = 5;
const minAmount = 50;
const maxAmount = 250;

const hasTwoDecimals = /^\d+\.\d{2}$/;
Expand Down Expand Up @@ -265,7 +265,7 @@ function PaymentMethodApplePay({

const handleWyreTerms = useWyreTerms(navigation);
const rates = useWyreRates(network, 'USDETH');
const [pay, ABORTED, percentFee, flatFee, , fee] = useWyreApplePay(roundAmount, selectedAddress, network);
const [pay, ABORTED, , , , fee] = useWyreApplePay(roundAmount, selectedAddress, network);

const handlePressApplePay = useCallback(async () => {
const prevLockTime = lockTime;
Expand Down Expand Up @@ -431,9 +431,7 @@ function PaymentMethodApplePay({
<>
{disabledButton ? (
<Text>
<Text bold>
{strings('fiat_on_ramp.Fee')} ~{percentFee}% + ${flatFee}
</Text>
<Text bold> </Text>
</Text>
) : (
<Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ import PropTypes from 'prop-types';
import { StyleSheet, Image, TouchableOpacity } from 'react-native';
import { NavigationContext } from 'react-navigation';
import { strings } from '../../../../../locales/i18n';
import {
useWyreTerms,
WYRE_IS_PROMOTION,
WYRE_FEE_PERCENT,
WYRE_FEE_FLAT,
WYRE_REGULAR_FEE_PERCENT,
WYRE_REGULAR_FEE_FLAT
} from '../orderProcessor/wyreApplePay';
import { useWyreTerms } from '../orderProcessor/wyreApplePay';

import PaymentMethod from '../components/PaymentMethod';

Expand Down Expand Up @@ -45,25 +38,6 @@ const WyreApplePayPaymentMethod = ({ onPress }) => {
<Title>{strings('fiat_on_ramp.apple_pay')}</Title> <Text>{strings('fiat_on_ramp.via')}</Text>{' '}
<WyreLogo />
</Text>
<Text>
{WYRE_IS_PROMOTION ? (
<>
<Text bold strikethrough>
${WYRE_REGULAR_FEE_PERCENT.toFixed(2)} + ${WYRE_REGULAR_FEE_FLAT.toFixed(2)}
</Text>{' '}
<Text bold green>
{WYRE_FEE_PERCENT}% {strings('fiat_on_ramp.fee')}
</Text>
{'\n'}
<Text disclaimer>{strings('fiat_on_ramp.limited_time')}</Text>
</>
) : (
<Text bold>
{strings('fiat_on_ramp.Fee')} ~{WYRE_FEE_PERCENT.toFixed(2)}% + $
{WYRE_FEE_FLAT.toFixed(2)}
</Text>
)}
</Text>
<Text>{strings('fiat_on_ramp.wyre_minutes')}</Text>
<Text>{strings('fiat_on_ramp.wyre_max')}</Text>
<Text>{strings('fiat_on_ramp.wyre_requires_debit_card')}</Text>
Expand Down
7 changes: 6 additions & 1 deletion app/components/UI/FiatOrders/orderProcessor/wyreApplePay.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const { WYRE_MERCHANT_ID, WYRE_MERCHANT_ID_TEST, WYRE_API_ENDPOINT, WYRE_API_END
export const WYRE_IS_PROMOTION = false;
export const WYRE_REGULAR_FEE_PERCENT = 2.9;
export const WYRE_REGULAR_FEE_FLAT = 0.3;
export const WYRE_MIN_FEE = 5;
export const WYRE_FEE_PERCENT = WYRE_IS_PROMOTION ? 0 : WYRE_REGULAR_FEE_PERCENT;
export const WYRE_FEE_FLAT = WYRE_IS_PROMOTION ? 0 : WYRE_REGULAR_FEE_FLAT;

Expand Down Expand Up @@ -392,7 +393,11 @@ export function useWyreApplePay(amount, address, network) {
amount,
percentFee
]);
const fee = useMemo(() => (Number(percentFeeAmount) + Number(flatFee)).toFixed(2), [flatFee, percentFeeAmount]);
const fee = useMemo(() => {
const totalFee = Number(percentFeeAmount) + Number(flatFee);

return totalFee < WYRE_MIN_FEE ? WYRE_MIN_FEE : totalFee.toFixed(2);
}, [flatFee, percentFeeAmount]);
const total = useMemo(() => Number(amount) + Number(fee), [amount, fee]);
const methodData = useMemo(() => getMethodData(network), [network]);
const paymentDetails = useMemo(() => getPaymentDetails(ETH_CURRENCY_CODE, amount, fee, total), [
Expand Down

0 comments on commit 0e4e178

Please sign in to comment.