Skip to content

Commit

Permalink
fix: Place order by paypal
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Dec 13, 2021
1 parent cd0d7bc commit 4ed3dd2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/components/PlaceOrderButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,24 @@ const PlaceOrderButton: FunctionComponent<PlaceOrderButtonProps> = (props) => {
setNotPermitted(true)
}
}
if (paymentType === 'paypal_payments' && options?.paypalPayerId) {
handleClick()
}
return () => {
setNotPermitted(true)
}
}, [
isPermitted,
options?.paypalPayerId,
paymentType,
currentPaymentMethodRef?.current?.onsubmit,
paymentSource,
loading,
currentPaymentMethodType,
order,
])
useEffect(() => {
if (paymentType === 'paypal_payments' && options?.paypalPayerId) {
debugger
handleClick()
}
}, [options?.paypalPayerId])
const handleClick = async () => {
let isValid = true
setForceDisable(true)
Expand Down
1 change: 0 additions & 1 deletion src/components/Price.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const Price: FunctionComponent<PriceProps> = (props) => {
const [skuPrices, setSkuPrices] = useState<PriceType[]>([])
const sCode = pricesSkuCode || skuCode
useEffect(() => {
// if (props.skuCode === 'LSLEEVMM000000FFFFFFLXXX') debugger
if (!isEmpty(prices) && has(prices, `${sCode}`)) {
setSkuPrices(prices[sCode] as PriceType[])
} else {
Expand Down
5 changes: 5 additions & 0 deletions src/reducers/PlaceOrderReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ export const setPlaceOrder: SetPlaceOrder = async ({
window.location.href = paymentSource?.approval_url as string
return response
}
console.log(`order`, order)
console.log(`paymentSource`, paymentSource)
debugger
await sdk.paypal_payments.update({
id: paymentSource.id,
paypal_payer_id: options?.paypalPayerId,
Expand Down Expand Up @@ -185,6 +188,8 @@ export const setPlaceOrder: SetPlaceOrder = async ({
}
return response
} catch (error) {
console.log(`error`, error)
debugger
const errors = getErrors(error, 'orders')
setOrderErrors && setOrderErrors(errors)
return {
Expand Down
1 change: 0 additions & 1 deletion src/reducers/VariantReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export const setSkuCode: SetSkuCodeVariant = (params) => {
})
})
.catch((errors) => {
debugger
dispatch({
type: 'setErrors',
payload: {
Expand Down

0 comments on commit 4ed3dd2

Please sign in to comment.