paymentTools.ts 804 B

12345678910111213141516171819202122232425
  1. import Big from 'big.js';
  2. import {paymentMethodImageMap} from "@/utils/constants";
  3. export function getPaymentMethodLogo(payment: string) {
  4. return paymentMethodImageMap[payment] || paymentMethodImageMap.default;
  5. }
  6. export function getPaymentDescription(param: {payment: string; grandTotal: number; symble: string;}) {
  7. switch (param.payment) {
  8. case 'klarna':
  9. case 'awxklarna':
  10. case 'awxafterpay':
  11. case 'afterpay':
  12. const n = Big(param.grandTotal).div(4).toFixed(2);
  13. return `4 interest-free payments of ${param.symble}${n}`;
  14. case 'applepay':
  15. return 'Apple Pay';
  16. case 'paypal_smart_button':
  17. return 'Paypal';
  18. case 'airwallex':
  19. return '';
  20. default:
  21. return '';
  22. }
  23. }