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

Address fields are not being passed to the API #1112

Closed
Benunc opened this issue Oct 11, 2016 · 12 comments
Closed

Address fields are not being passed to the API #1112

Benunc opened this issue Oct 11, 2016 · 12 comments
Assignees
Milestone

Comments

@Benunc
Copy link
Member

Benunc commented Oct 11, 2016

Issue Overview

The Give API is not picking up Donor Address data in either the Donor endpoint or the Donation endpoint.

Expected Behavior

When a donation is processed, the Donation and Donor endpoints should include donor address data.

Current Behavior

Currently on the Donation Endpoint, there are the following fields:

"ID"
"transaction_id"
"key"
"total"
"gateway"
"name"
"fname"
"lname"
"email"
"date"
"form" {
   "id"
   "name"
   "price"
            },
"payment_meta": {
   "fees": [],
   "currency": "USD"
            }

Currently on the Donor endpoint there are the following fields:

"info": {
   "user_id"
   "username"
   "display_name"
   "customer_id"
   "first_name"
   "last_name"
   "email"
            },
"stats": {
   "total_donations"
   "total_spent"
            }

Steps to Reproduce

  1. Create a form with address required
  2. Submit a donation
  3. Check the API URL donation endpoint here: http://yoursite.com/give-api/donations/?key=YOURPUBLICKEYHERE&token=YOURTOKENHERE and the Donor endpoint here: http://yoursite.com/give-api/donor/?key=YOURPUBLICKEYHERE&token=YOURTOKENHERE following the instructions in the API reference: https://givewp.com/documentation/developers/give-api-reference/
  4. No Address field is there.
@mathetos
Copy link
Member

@Benunc Did you also check the /donation endpoint instead of just the /donor endpoint?

@Benunc
Copy link
Member Author

Benunc commented Oct 11, 2016

Yes, as noted in the issue. Neither endpoint is functional for addresses.

@DevinWalker
Copy link
Member

DevinWalker commented Oct 11, 2016

The donor address and billing address are separate from each other. See #370 for details. Despite this, the billing address should be included within the payment_meta array on the both endpoints

@kevinwhoffman
Copy link
Contributor

@DevinWalker I just left feedback on #370 (comment). Do you think that issue needs resolved before fixing the API here? If the location of where donor addresses are saved within the database changes, that will affect where the API retrieves them from.

@DevinWalker
Copy link
Member

@kevinwhoffman please review my comment on #370 and LMK what you think. If you agree the location of the billing address in _give_payment_meta stays in place then we can proceed here.

@kevinwhoffman
Copy link
Contributor

kevinwhoffman commented Oct 18, 2016

@DevinWalker I agree that billing address stays within _give_payment_meta, so I can fix the Donations endpoint, but addresses in the Donor endpoint should wait until the changes mentioned in #370 are complete. Agree?

@DevinWalker
Copy link
Member

DevinWalker commented Oct 18, 2016

Agree, yes. Ideally we'll loop through the _give_payment_meta array and output the contents within the API response which should show other payment meta besides address if using FFM or custom code.

@DevinWalker DevinWalker modified the milestones: 1.8, 1.7 Oct 25, 2016
@DevinWalker DevinWalker modified the milestones: 1.9, 1.8 Dec 21, 2016
@DevinWalker DevinWalker modified the milestones: 1.9, 2.0 Feb 13, 2017
@DevinWalker DevinWalker assigned emgk and unassigned DevinWalker Jan 2, 2018
@DevinWalker
Copy link
Member

@emgk can you take care of this for me?

@emgk
Copy link
Contributor

emgk commented Jan 2, 2018

Sure, @DevinWalker I will check

@emgk
Copy link
Contributor

emgk commented Jan 2, 2018

I have reproduced this issue and found that \donations endpoint containing payment billing_address but not donor_address and \donor has no address in it.

Despite this, the billing address should be included within the payment_meta array on the both endpoints

@DevinWalker as mentioned in above line, do we need to include payment_meta array in /donor endpoint as well? Because billing_address may vary for each donation created by any particular donor, so how would we determine which billing_address it should contain for the specific donor?

@DevinWalker
Copy link
Member

Hey @emgk - the /donations/ endpoint should only have the billing address for that payment. The /donor/ endpoint should loop through all the addresses attached to the donor and output them. You don't need to include all the payment meta info.

@emgk emgk mentioned this issue Jan 3, 2018
3 tasks
@mathetos
Copy link
Member

mathetos commented Jan 6, 2018

Just tested and this works perfectly. Just wanted to confirm. See here:

image

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

5 participants