Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Promise from 'promise';
- import { fieldValidation } from './registrasi';
- import { setToastMessage } from './statusRequest';
- import { getPaymentLogo, sprintf } from '../utils/Functions';
- import lang from '../lang';
- /**
- * Load metode pembayaran
- */
- export const loadMetodePembayaran = () => () => new Promise((resolve) => {
- resolve({
- status: '',
- message: '',
- data: [
- {
- id: '1',
- name: 'G-Cash BNI',
- icon: getPaymentLogo('gCashBNI'),
- selected: true
- },
- {
- id: '2',
- name: 'G-Cash BRI',
- icon: getPaymentLogo('gCashBRI'),
- selected: false
- },
- {
- id: '3',
- name: 'ShopeePay',
- icon: getPaymentLogo('shopeepay'),
- selected: false
- }
- ]
- });
- });
- /**
- * Load rekening
- */
- export const loadRekening = () => () => new Promise((resolve) => {
- resolve({
- status: '',
- message: '',
- data: [
- {
- id: '1',
- title: 'ShopeePay',
- subtitle: 'Rp 10.000.000 (500.000 koin)'
- },
- {
- id: '2',
- title: 'G-Cash BRI',
- subtitle: 'Rp 50.000'
- }
- ]
- });
- });
- /**
- * Delete metode pembayaran
- */
- export const deleteMetodePembayaran = (params) => (dispatch) => new Promise((resolve) => {
- dispatch(
- setToastMessage(
- sprintf(
- lang.metodePembayaranXBerhasilDihapus,
- params.title
- ),
- 'success'
- )
- );
- resolve({
- status: '',
- message: '',
- data: null
- });
- });
- export const postValidasiMetodePembayaran = (param) => () => new Promise((resolve, reject) => {
- if (__DEV__) console.log('METODE PEMBAYARAN PAYLOAD', param);
- const fields = [{
- key: 'handphone', label: lang.nomorHandphone, regexType: 'phone', value: param.handphone
- }];
- fieldValidation(fields).then(() => {
- resolve({
- status: '',
- message: '',
- data: null
- });
- }).catch((errorJSON) => {
- reject(errorJSON);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement