2020-05-30 21:58:22 +00:00
|
|
|
import I18n from 'react-native-i18n';
|
2020-06-02 09:05:50 +00:00
|
|
|
import isEqual from 'lodash/isEqual';
|
2020-06-17 14:09:27 +00:00
|
|
|
import Toast from 'react-native-root-toast';
|
|
|
|
import { Color } from '../config/Color';
|
2020-06-02 09:05:50 +00:00
|
|
|
let slugify = require('slugify');
|
|
|
|
let route = require('./../route.json');
|
2020-05-30 21:58:22 +00:00
|
|
|
|
2020-05-03 09:16:24 +00:00
|
|
|
export const thousandsSeparators = (num) => {
|
|
|
|
var num_parts = num.toString().split(".");
|
|
|
|
num_parts[0] = num_parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
|
|
|
return num_parts.join(".");
|
2020-05-30 21:58:22 +00:00
|
|
|
}
|
|
|
|
|
2020-06-05 10:32:37 +00:00
|
|
|
export const cutString = (word, max) => {
|
|
|
|
return `${word.slice(0, max)}...`;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const isNormalInteger = (str) => {
|
|
|
|
if (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(str))
|
|
|
|
return false;
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-06-17 14:09:27 +00:00
|
|
|
export const displayToast = (message) => {
|
|
|
|
Toast.show(message, {
|
|
|
|
duration: Toast.durations.SHORT,
|
|
|
|
position: Toast.positions.BOTTOM,
|
|
|
|
backgroundColor: Color.primaryColor,
|
|
|
|
shadow: true,
|
|
|
|
animation: true,
|
|
|
|
hideOnPress: true,
|
|
|
|
delay: 0,
|
|
|
|
onShow: () => {
|
|
|
|
// calls on toast\`s appear animation start
|
|
|
|
},
|
|
|
|
onShown: () => {
|
|
|
|
// calls on toast\`s appear animation end.
|
|
|
|
},
|
|
|
|
onHide: () => {
|
|
|
|
// calls on toast\`s hide animation start.
|
|
|
|
},
|
|
|
|
onHidden: () => {
|
|
|
|
// calls on toast\`s hide animation end.
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export const isIlinkWorldWallet = (walletName) => {
|
|
|
|
return isEqual(slugify(walletName).toLowerCase(), 'ilink-world');
|
|
|
|
}
|
|
|
|
|
|
|
|
export const isEmptyObject = (obj) => {
|
|
|
|
for (let prop in obj) {
|
|
|
|
if (obj.hasOwnProperty(prop)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return JSON.stringify(obj) === JSON.stringify({});
|
|
|
|
}
|
|
|
|
|
2020-05-30 21:58:22 +00:00
|
|
|
export const identityPieces = () => {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
name: I18n.t('IDENTITY_CARD')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: I18n.t('PASSEPORT')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: I18n.t('OTHER_IDENTITY_PIECE')
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2020-06-05 10:32:37 +00:00
|
|
|
export const inputCardSource = () => [
|
|
|
|
{
|
|
|
|
name: I18n.t('NUMERO_DE_SERIE'),
|
|
|
|
value: 'serial-number'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: I18n.t('CREDIT_CARD'),
|
|
|
|
value: 'credit-card'
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2020-06-02 17:12:39 +00:00
|
|
|
export const transactionHistoryLabel = () => {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
icon: 'arrow-expand',
|
|
|
|
label: 'Type'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'inbox-arrow-up',
|
|
|
|
label: 'Source'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'cash',
|
2020-06-05 10:32:37 +00:00
|
|
|
label: I18n.t('AMOUNT_LABEL')
|
2020-06-02 17:12:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'account-arrow-right',
|
2020-06-05 10:32:37 +00:00
|
|
|
label: I18n.t('DESTINATAIRE')
|
2020-06-02 17:12:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'calendar-clock',
|
|
|
|
label: 'Date'
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2020-05-30 21:58:22 +00:00
|
|
|
export const transactionHistoryUser = () => {
|
|
|
|
return [
|
|
|
|
{
|
2020-06-02 17:12:39 +00:00
|
|
|
type: 'depot',
|
|
|
|
source: 'wallet',
|
|
|
|
montant: 10000,
|
|
|
|
destinataire: 'John Doe',
|
|
|
|
date: '2020-05-15',
|
2020-05-30 21:58:22 +00:00
|
|
|
},
|
|
|
|
{
|
2020-06-02 17:12:39 +00:00
|
|
|
type: 'retrait',
|
|
|
|
source: 'wallet',
|
|
|
|
montant: 10000,
|
|
|
|
destinataire: 'John Doe',
|
|
|
|
date: '2020-05-15',
|
2020-05-30 21:58:22 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2020-06-02 09:05:50 +00:00
|
|
|
export const optionDepotScreen = {
|
|
|
|
title: I18n.t('DEPOSIT'),
|
|
|
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'wallet',
|
|
|
|
title: I18n.t('DEPOSIT_CASH_TO_WALLET'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'cash-refund',
|
|
|
|
title: I18n.t('DEPOSIT_CASH_TO_OTHER_WALLET'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'credit-card',
|
|
|
|
title: I18n.t('DEPOSIT_CASH_TO_VISA'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'bank-transfer-in',
|
|
|
|
title: I18n.t('DEPOSIT_CASH_TO_BANK'),
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
export const optionRetraitScreen = {
|
|
|
|
title: I18n.t('WITHDRAWAL'),
|
|
|
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
screen: route.walletRetrait,
|
|
|
|
icon: 'cash',
|
|
|
|
title: I18n.t('WITHDRAWAL_IN_CASH'),
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
export const optionRetraitUserScreen = {
|
|
|
|
title: I18n.t('WITHDRAWAL'),
|
|
|
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'wallet',
|
|
|
|
title: I18n.t('WITHDRAWAL_WALLET_TO_CASH'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.walletRetrait,
|
|
|
|
icon: 'credit-card-refund',
|
|
|
|
title: I18n.t('WITHDRAWAL_CARD_TO_CASH'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.walletRetrait,
|
|
|
|
icon: 'card',
|
|
|
|
title: I18n.t('WITHDRAWAL_CARD_TO_WALLET'),
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
export const optionDepotUserScreen = {
|
|
|
|
title: I18n.t('DEPOSIT'),
|
|
|
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'wallet',
|
|
|
|
title: I18n.t('DEPOSIT_WALLET_TO_WALLET'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'cash-refund',
|
|
|
|
title: I18n.t('DEPOSIT_TO_CASH'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'credit-card',
|
|
|
|
title: I18n.t('DEPOSIT_TO_CARD'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.walletDepot,
|
|
|
|
icon: 'bank-transfer-in',
|
|
|
|
title: I18n.t('DEPOSIT_TO_BANK'),
|
|
|
|
},
|
|
|
|
]
|
2020-06-10 03:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const optionIdentificationScreen = {
|
|
|
|
title: I18n.t('IDENTIFICATION'),
|
|
|
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
screen: route.createIdentification,
|
|
|
|
icon: 'pencil-plus',
|
2020-06-12 11:13:59 +00:00
|
|
|
title: I18n.t('CREATION_IDENTIFICATION_DESCRIPTION_SUBSCREEN'),
|
2020-06-10 03:10:45 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: route.validateIdentification,
|
|
|
|
icon: 'check-circle',
|
2020-06-12 11:13:59 +00:00
|
|
|
title: I18n.t('VALIDATE_IDENTIFICATION_DESCRIPTION'),
|
2020-06-10 03:10:45 +00:00
|
|
|
},
|
|
|
|
]
|
2020-06-16 09:25:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const optionPaiementFacture = {
|
|
|
|
title: I18n.t('PAIEMENT_FACTURE'),
|
|
|
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
icon: 'water',
|
2020-06-17 14:09:27 +00:00
|
|
|
title: 'Paiement eau/électricité',
|
|
|
|
screen: route.paiementOptionSelect,
|
|
|
|
subScreenOption: optionPaiementFactureSubScreen
|
2020-06-16 09:25:46 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'school',
|
2020-06-17 14:09:27 +00:00
|
|
|
title: 'Paiement école',
|
|
|
|
screen: route.paiementOptionSelect,
|
|
|
|
subScreenOption: optionPaiementFactureSubScreen
|
2020-06-16 09:25:46 +00:00
|
|
|
},
|
|
|
|
{
|
2020-06-17 14:09:27 +00:00
|
|
|
icon: 'phone-classic',
|
|
|
|
title: 'Paiement crédit téléphonique',
|
|
|
|
screen: route.paiementOptionSelect,
|
|
|
|
subScreenOption: optionPaiementFactureSubScreen
|
2020-06-16 09:25:46 +00:00
|
|
|
},
|
|
|
|
{
|
2020-06-17 14:09:27 +00:00
|
|
|
icon: 'television-classic',
|
|
|
|
title: 'Paiement abonnement TV',
|
|
|
|
screen: route.paiementOptionSelect,
|
|
|
|
subScreenOption: optionPaiementFactureSubScreen
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
export const optionPaiementFactureSubScreen = {
|
|
|
|
title: I18n.t('PAIEMENT_FACTURE'),
|
|
|
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
screen: '',
|
|
|
|
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
|
|
|
title: 'Opérateur 1',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: '',
|
|
|
|
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
|
|
|
title: 'Opérateur 2',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: '',
|
|
|
|
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
|
|
|
title: 'Opérateur 3',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: '',
|
|
|
|
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
|
|
|
title: 'Opérateur 4',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: '',
|
|
|
|
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
|
|
|
title: 'Opérateur 5',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
screen: '',
|
|
|
|
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
|
|
|
title: 'Opérateur 6',
|
2020-06-16 09:25:46 +00:00
|
|
|
},
|
|
|
|
]
|
2020-05-03 09:16:24 +00:00
|
|
|
}
|