2022-03-29 23:16:59 +00:00
|
|
|
import React, { Component } from 'react'
|
2022-04-05 14:25:53 +00:00
|
|
|
import PaymentIcon from './PaymentIcons'
|
2022-03-30 14:26:13 +00:00
|
|
|
import {Tooltip} from "@mui/material"
|
2022-03-29 23:16:59 +00:00
|
|
|
|
2022-03-30 14:26:13 +00:00
|
|
|
const someMethods = [
|
2022-03-29 23:16:59 +00:00
|
|
|
{name: "Revolut",icon:'revolut'},
|
|
|
|
{name: "CashApp",icon:'cashapp'},
|
|
|
|
{name: "Zelle",icon:'zelle'},
|
|
|
|
{name: "Strike",icon:'strike'},
|
|
|
|
{name: "Rebellion",icon:'rebellion'},
|
2022-04-10 12:28:10 +00:00
|
|
|
{name: "Instant SEPA", icon:'sepa'},
|
2022-03-29 23:16:59 +00:00
|
|
|
{name: "Interac e-Transfer",icon:'interac'},
|
|
|
|
{name: "Wise",icon:'wise'},
|
|
|
|
{name: "Venmo",icon:'venmo'},
|
|
|
|
{name: "Faster Payments",icon:'faster'},
|
|
|
|
{name: "Paypal",icon:'paypal'},
|
|
|
|
{name: "LINE Pay",icon:'linepay'},
|
|
|
|
{name: "PromptPay",icon:'promptpay'},
|
|
|
|
{name: "Bizum",icon:'bizum'},
|
|
|
|
{name: "N26",icon:'n26'},
|
|
|
|
{name: "Amazon GiftCard",icon:'amazon'},
|
|
|
|
{name: "Bancolombia",icon:'bancolombia'},
|
|
|
|
{name: "SPEI",icon:'spei'},
|
|
|
|
{name: "PIX",icon:'pix'},
|
|
|
|
{name: "HalCash",icon:'halcash'},
|
|
|
|
{name: "Vivid",icon:'vivid'},
|
|
|
|
{name: "Google Play Gift Code",icon:'googleplay'},
|
|
|
|
{name: "Nequi",icon:'nequi'},
|
|
|
|
{name: "MercadoPago",icon:'mercadopago'},
|
|
|
|
{name: "Monero",icon:'monero'},
|
|
|
|
{name: "USDT",icon:'usdt'},
|
2022-03-30 14:26:13 +00:00
|
|
|
{name: "Airtel Money",icon:'airtel'},
|
|
|
|
{name: "MTN Money",icon:'mtn'},
|
|
|
|
{name: "M-Pesa",icon:'mpesa'},
|
|
|
|
{name: "MoMo",icon:'momo'},
|
|
|
|
{name: "Tigo Pesa",icon:'tigopesa'},
|
|
|
|
{name: "Cash F2F",icon:'cash'},
|
|
|
|
{name: "On-Chain BTC",icon:'onchain'},
|
|
|
|
{name: "RBTC",icon:'rbtc'},
|
|
|
|
{name: "LBTC",icon:'lbtc'},
|
|
|
|
{name: "WBTC",icon:'wbtc'},
|
2022-03-29 23:16:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
export default class PaymentText extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
2022-03-30 14:26:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
parseText(){
|
|
|
|
var rows = [];
|
|
|
|
var custom_methods = this.props.text;
|
|
|
|
// Adds icons for each PaymentMethod that matches
|
|
|
|
someMethods.forEach((method, i) =>{
|
|
|
|
if(this.props.text.includes(method.name)){
|
|
|
|
custom_methods = custom_methods.replace(method.name,'')
|
|
|
|
rows.push(
|
|
|
|
<Tooltip placement="top" enterTouchDelay="0" title={method.name} >
|
2022-03-30 20:01:26 +00:00
|
|
|
<div style={{display: 'inline-block', width: this.props.size+2, height: this.props.size}}>
|
2022-03-30 14:26:13 +00:00
|
|
|
<PaymentIcon width={this.props.size} height={this.props.size} icon={method.icon}/>
|
|
|
|
</div>
|
|
|
|
</Tooltip>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// Adds a Custom icon if there are words that do not match
|
2022-04-10 12:28:10 +00:00
|
|
|
var chars_left = custom_methods.replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ','')
|
|
|
|
|
2022-03-31 09:45:45 +00:00
|
|
|
if(chars_left.length > 0){rows.push(
|
2022-04-05 14:25:53 +00:00
|
|
|
<Tooltip placement="top" enterTouchDelay="0" title={this.props.verbose ? this.props.othersText: this.props.othersText+": "+ custom_methods} >
|
2022-03-31 11:22:25 +00:00
|
|
|
<div style={{position:'relative', display: 'inline-block',width: this.props.size+2, maxHeight: this.props.size, top:'-1px'}}>
|
2022-03-30 14:26:13 +00:00
|
|
|
<PaymentIcon width={this.props.size*1.1} height={this.props.size*1.1} icon={"custom"}/>
|
|
|
|
</div>
|
|
|
|
</Tooltip>
|
|
|
|
)}
|
|
|
|
|
|
|
|
if(this.props.verbose){
|
2022-03-31 11:22:25 +00:00
|
|
|
return (<>{rows} <div style={{display: 'inline-block'}}> <span>{custom_methods}</span></div></>)
|
2022-03-30 14:26:13 +00:00
|
|
|
}else{
|
|
|
|
return rows
|
|
|
|
}
|
|
|
|
}
|
2022-03-29 23:16:59 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2022-03-31 11:22:25 +00:00
|
|
|
<div style={{display:'flex',alignItems:'center', flexWrap:'wrap'}}>
|
2022-03-30 20:01:26 +00:00
|
|
|
{this.parseText()}
|
|
|
|
</div>
|
2022-03-29 23:16:59 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
};
|