|
|
@@ -1,66 +0,0 @@
|
|
|
-import { useMemo } from 'react';
|
|
|
-
|
|
|
-import { useTranslation } from 'react-i18next';
|
|
|
-import type { IconifyIcon } from '@iconify/react';
|
|
|
-import logosApple from '@/assets/iconify/multi-color/applepay.svg';
|
|
|
-import logosGooglePay from '@/assets/iconify/multi-color/googlepay.svg';
|
|
|
-import logosPaypal from '@/assets/iconify/multi-color/paypal.svg';
|
|
|
-import siAlipay from '@/assets/iconify/multi-color/alipay.svg';
|
|
|
-import siWechat from '@/assets/iconify/multi-color/wechatpay.svg';
|
|
|
-
|
|
|
-import { PayMethodType } from '@/defines';
|
|
|
-
|
|
|
-export interface PayMethodInfo {
|
|
|
- payMethodType: PayMethodType;
|
|
|
- name: string;
|
|
|
- icon: IconifyIcon;
|
|
|
-}
|
|
|
-
|
|
|
-export function useService(payMethodType: PayMethodType) {
|
|
|
- const { t } = useTranslation();
|
|
|
-
|
|
|
- const payMethodInfo = useMemo<PayMethodInfo>((): PayMethodInfo => {
|
|
|
- switch (payMethodType) {
|
|
|
- case PayMethodType.WECHAT:
|
|
|
- return {
|
|
|
- payMethodType: PayMethodType.WECHAT,
|
|
|
- name: t('pages.pricing.payMethod.wechat'),
|
|
|
- icon: siWechat,
|
|
|
- };
|
|
|
- case PayMethodType.ALIPAY:
|
|
|
- return {
|
|
|
- payMethodType: PayMethodType.ALIPAY,
|
|
|
- name: t('pages.pricing.payMethod.alipay'),
|
|
|
- icon: siAlipay,
|
|
|
- };
|
|
|
- case PayMethodType.PAYPAL:
|
|
|
- return {
|
|
|
- payMethodType: PayMethodType.PAYPAL,
|
|
|
- name: t('pages.pricing.payMethod.paypal'),
|
|
|
- icon: logosPaypal,
|
|
|
- };
|
|
|
- case PayMethodType.APPLE_PAY:
|
|
|
- return {
|
|
|
- payMethodType: PayMethodType.APPLE_PAY,
|
|
|
- name: t('pages.pricing.payMethod.applePay'),
|
|
|
- icon: logosApple,
|
|
|
- };
|
|
|
- case PayMethodType.GOOGLE_PAY:
|
|
|
- return {
|
|
|
- payMethodType: PayMethodType.GOOGLE_PAY,
|
|
|
- name: t('pages.pricing.payMethod.googlePay'),
|
|
|
- icon: logosGooglePay,
|
|
|
- };
|
|
|
- default:
|
|
|
- return {
|
|
|
- payMethodType: PayMethodType.WECHAT,
|
|
|
- name: t('pages.pricing.payMethod.wechat'),
|
|
|
- icon: siWechat,
|
|
|
- };
|
|
|
- }
|
|
|
- }, [payMethodType, t]);
|
|
|
-
|
|
|
- return {
|
|
|
- payMethodInfo,
|
|
|
- };
|
|
|
-}
|