import React from 'react';
import { Image } from 'react-native';
import Svg, { Path } from 'react-native-svg';
import { PageList } from '../Router';
export const PAYTYPE = {
CREDIT_WALLET: "CreditWallet", // 余额支付
PAY_PER_USE: "PayPerUse", // 按次支付
PAY_PER_USE_CONTAIN: "pay_per_use"
}
/**
* @is2c2p 控制是否启用2C2P
* @DEFAULT 控制默认的支付方式
*/
export const PaymentDefault = {
is2c2p: true, //是否启用2C2P
enablePayPerUse: true, //是否启用按次支付
enableInnerWebView: true, //是否启用内部浏览器执行支付
DEFAULT: {
payType: PAYTYPE.CREDIT_WALLET,
payName: "Credit Wallet",
isWallet: true,
isPayPerUse: false
},
DEFAULT2: {
payType: PAYTYPE.PAY_PER_USE,
payName: "Pay Per Use (SGQR)",
isWallet: false,
isPayPerUse: true
}
}
export const getPaymenOptions = (back) => {
if (PaymentDefault.enablePayPerUse) {
if (PaymentDefault.DEFAULT.payType == PAYTYPE.PAY_PER_USE) {
back([{
title: $t('payment.payPerUse'),
desc: '(CARD)',
value: PAYTYPE.PAY_PER_USE,
iconFont: "PAYNOW",
icon: require('../../images/wallet/ic_payperuse.png')
}, {
title: $t('wallet.creditWallet'),
desc: '',
value: PAYTYPE.CREDIT_WALLET,
iconFont: "WALLET",
icon: require('../../images/icon/draw-wallet.png')
}])
} else {
back([{
title: $t('wallet.creditWallet'),
desc: '',
value: PAYTYPE.CREDIT_WALLET,
iconFont: "WALLET",
icon: require('../../images/icon/draw-wallet.png')
}, {
title: $t('payment.payPerUse'),
desc: '(CARD)',
value: PAYTYPE.PAY_PER_USE,
iconFont: "PAYNOW",
icon: require('../../images/wallet/ic_payperuse.png')
}])
}
} else {
back([{
title: $t('wallet.creditWallet'),
desc: '',
value: PAYTYPE.CREDIT_WALLET,
iconFont: "WALLET",
icon: require('../../images/icon/draw-wallet.png')
}])
}
}
export const PaymentIcon = ({method="CARD", size=40, checked=false}) => {
switch (method) {
case "CARD":
return (
/**/
);
case "PAYNOW":
return (
)
case "GRABPAY":
return (
);
case "WALLET":
return (
)
}
}
/*export const toTopupPage = () => {
if (PaymentDefault.is2c2p) {
startPage(PageList.topupV2);
} else {
startPage(PageList.topup);
}
}*/
export const toTopupPage = () => {
startPage(PageList.topupNew);
}