Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onShippingChange.reject does not interrupt the flow - order completed #163

Open
maxima120 opened this issue Feb 20, 2021 · 5 comments
Open

Comments

@maxima120
Copy link

I am using largely your "create order on server" scenario with added onShippingChange callback.
everything is working except when I need to reject order if shipping country does not match user country data on server - the order still goes to onApprove and onClientAuthorization and the order appears in the paypal Activity as a good order.

I expect the order flow to be interrupted at that point and user notified in the UI about the fact

      onShippingChange: (data, actions) => {
        console.log('onShippingChange - data: ', data);

        this.http.post<boolean>(`${this.baseUrl}ppc/order/${this.order.id}/shipping`, data.shipping_address)
          .toPromise()
          .then((res) => {
            if (res) {
              console.log('onShippingChange - OK');
              return actions.resolve();
            }
            else {
              console.log('onShippingChange - FAIL');
              this.showError = true;
              return actions.reject();
            }
          })
          .catch(error => {
            console.error('Shipping change ERROR', error);
            this.showError = true;
          });
      },

what am I doing wrong here?

@nokoh
Copy link

nokoh commented Apr 2, 2021

Currently experiencing a similar issue. Customer is still able to make payment even after the action.reject() function is called.

@maxima120
Copy link
Author

I had to abandon using onShippingChange altogether.

@nokoh
Copy link

nokoh commented Apr 2, 2021

Interesting, do you mind shedding some light on how you're currently handling shipping address changes? My current plan is to have an alert modal popup to inform the user whenever the country is not valid.

@maxima120
Copy link
Author

yeah thats what I wanted too.. but had to go without.. just write into your T&C that you can only use shipping addresses in certain countries and refund manually if they circumvent it.. i dont know of a better way.. but with reject not working it seems to me a bigger problem .. so i chose between two evils :)

@nokoh
Copy link

nokoh commented Apr 2, 2021

Fair enough, possibly a bug on Paypal's end because I remember it working last year. In the meantime, I think I'll include the popup and also refund manually if they go ahead and circumvent it. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants