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

[Recurring Donations] PayPal Pro Gateway (NVP API) - Request Body Bug #2293

Closed
2 tasks
wesdunn opened this issue Nov 5, 2017 · 4 comments
Closed
2 tasks

Comments

@wesdunn
Copy link

wesdunn commented Nov 5, 2017

Note: I have opened a ticket on this issue as well, but thought I would also open an issue.
I would issue a PR, but it looks like the Give-Recurring-Donations add-on is a private repo

Issue Overview

  • Using the Recurring Donations Add-On
  • Gateway: PayPal Website Payments Pro (NVP API)
  • Submitting the form to create a new recurring donation always returns "Error: Internal Error"
  • Failed Payment logs show that Error 10001 is being returned from PayPal

Expected Behavior

  • Given the recurring donation form is submitted with valid information, a new "Recurring Profile" should be created in PayPal and the user should be redirected to the "Donation Confirmation" page

Current Behavior

  • In a dev environment, I modifiedgive-recurring/includes/gateways/give-recurring-paypalpro.php and set the api_endpoint to a proxy that would forward the request onto my local box so I could inspect the request body.
  • The following was found in the request body: STATE=US&COUNTRYCODE=TX
  • Since the request also includes an INITAMT, paypal will try to charge the credit card immediately, but because the request body had the state and country mixed up, the payment failed.
  • As the request also includes FAILEDINITAMTACTION=CancelOnFailure, the recurring payment profiles is NOT created.

Possible Solution

FILE: give-recurring/includes/gateways/give-recurring-paypalpro.php
FUNCTION: public function create_payment_profiles()
LINES: 133 - 134

Current Code:

'STATE'                         => $this->purchase_data['card_info']['card_country'],
'COUNTRYCODE'         => $this->purchase_data['card_info']['card_state'],

Should be changed to:

'COUNTRYCODE'         => $this->purchase_data['card_info']['card_country'],
'STATE'                         => $this->purchase_data['card_info']['card_state'],

Steps to Reproduce (for bugs)

  1. Setup the Recurring Donations Add-on
  2. Setup the PayPal Pro Gateway Add-on
  3. Configure the add-ons, build a form, etc
  4. Try the form for a recurring credit card donation

Related Issues and/or PRs

N/A

Todos

  • Tests
  • Documentation
@DevinWalker
Copy link
Member

Thanks for the issue @wesdunn - It looks like switching the array ordering fixes it? I'm going to move the issue to the recurring repo and look into it.

@DevinWalker
Copy link
Member

Issue moved to WordImpress/Give-Recurring-Donations #414 via ZenHub

@wesdunn
Copy link
Author

wesdunn commented Nov 6, 2017

@DevinWalker I should have added, yes, the fix I proposed is being used in a production environment now and is successfully creating recurring profiles in PayPal.

The issue is not the order of the array, but that COUNTRYCODE is using purchase_data['card_info']['card_state'] and STATE is using purchase_data['card_info']['card_country']. So, just switching the array keys, but leaving the values in place fixes it.

@DevinWalker
Copy link
Member

Thanks for the clarification!

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