Skip to content

Commit

Permalink
fix: Place an order with total amount equal to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Dec 10, 2021
1 parent 89e378d commit ec72aa6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/reducers/PlaceOrderReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ export const setPlaceOrder: SetPlaceOrder = async ({
placed: false,
}
try {
if (state && order && config && paymentSource) {
if (state && order && config) {
const sdk = getSdk(config)
const { options, paymentType } = state
if (paymentType === 'paypal_payments') {
if (paymentType === 'paypal_payments' && paymentSource) {
if (!options?.paypalPayerId && paymentSource?.approval_url) {
window.location.href = paymentSource?.approval_url as string
return response
Expand Down Expand Up @@ -170,7 +170,6 @@ export const setPlaceOrder: SetPlaceOrder = async ({
placed: true,
}
default:
// await sdk.orders.
if (saveToWallet()) {
await sdk.orders.update({
id: order.id,
Expand All @@ -186,7 +185,6 @@ export const setPlaceOrder: SetPlaceOrder = async ({
}
return response
} catch (error) {
// const errors = getErrorsByCollection(error, 'order')
const errors = getErrors(error, 'orders')
setOrderErrors && setOrderErrors(errors)
return {
Expand Down

0 comments on commit ec72aa6

Please sign in to comment.