mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Remove Stripe account creation from listing creation
This commit is contained in:
parent
05bd75d26b
commit
05962e70e5
2 changed files with 4 additions and 15 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { omitBy, isUndefined } from 'lodash';
|
||||
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { createStripeAccount, fetchCurrentUserHasListingsSuccess } from '../../ducks/user.duck';
|
||||
import { fetchCurrentUserHasListingsSuccess } from '../../ducks/user.duck';
|
||||
|
||||
const requestAction = actionType => params => ({ type: actionType, payload: { params } });
|
||||
|
||||
|
|
@ -176,17 +176,10 @@ export function requestShowListing(actionPayload) {
|
|||
|
||||
export function requestCreateListing(data) {
|
||||
return (dispatch, getState, sdk) => {
|
||||
const { bankAccountToken, country, ...actionPayload } = data;
|
||||
dispatch(createListing(actionPayload));
|
||||
dispatch(createListing(data));
|
||||
|
||||
const shouldCreateStripeAccount = bankAccountToken && country;
|
||||
const stripeAccountAddress = { country };
|
||||
const accountCreated = shouldCreateStripeAccount
|
||||
? dispatch(createStripeAccount(bankAccountToken, stripeAccountAddress))
|
||||
: Promise.resolve('already created');
|
||||
|
||||
return accountCreated
|
||||
.then(() => sdk.listings.create(actionPayload))
|
||||
return sdk.listings
|
||||
.create(data)
|
||||
.then(response => {
|
||||
const id = response.data.data.id.uuid;
|
||||
// Modify store to understand that we have created listing and can redirect away
|
||||
|
|
|
|||
|
|
@ -21,13 +21,11 @@ import {
|
|||
const formatRequestData = values => {
|
||||
const {
|
||||
address,
|
||||
country,
|
||||
description,
|
||||
images,
|
||||
geolocation,
|
||||
price,
|
||||
title,
|
||||
bankAccountToken,
|
||||
} = values;
|
||||
|
||||
return {
|
||||
|
|
@ -37,8 +35,6 @@ const formatRequestData = values => {
|
|||
images: images.map(i => i.imageId),
|
||||
price,
|
||||
title,
|
||||
country,
|
||||
bankAccountToken,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue