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

Merge feature/contact-info branch into trunk #943

Merged
merged 106 commits into from
Aug 9, 2021
Merged

Conversation

ecgan
Copy link
Member

@ecgan ecgan commented Aug 9, 2021

Changes proposed in this Pull Request:

This PR merges the feature/contact-info branch into trunk. The changes in the branch have been reviewed in other smaller PRs, so we don't really need to review them in detail here.

(Merges changes for #863)

Changelog entry

Add - New contact information feature.

eason9487 and others added 30 commits July 29, 2021 16:21
The previously added API endpoints for updating and fetching the phone number are now modified to also handle updating the business address.

The endpoint name is changed from `phone-number` to `contact-information` but it still only accepts one `phone_number` input. However, now it also updates the address in Merchant Center to the store's address set in WooCommerce settings.

The `GET` endpoint now also returns three extra parameters in its response:
- `mc_address`: The address stored in Merchant Center
- `wc_address`: The address stored in WooCommerce Settings
- `is_mc_address_different`: A boolean indicating whether the two addresses above are different

This also sets the country for the Merchant Center account but given that the MC accounts created by GLA are all sub-accounts and [Google does not allow changing a sub-account's country](https://developers.google.com/shopping-content/reference/rest/v2.1/accounts#AccountAddress) we might need to modify this once the Google API behaviour is changed. Google API currently doesn't enforce this and allows modifying the country (even though it's not possible to do so via MC interface).

Merchant Center API only accepts one address line and to adapt the WooCommerce address to it, the two addresses entered in WooCommerce settings are merged into one string separated with a new line character (`\n`). MC interface detects the addresses correctly and displays each in their own fields.

Note that address components are returned in the API response as they appear on Google API. This means that their naming might be different from WooCommerce. For example, city is called `locality`, state is called `region`, etc. This is just for the sake of simplicity and can be modified if we want to keep things similar to WC core.
Only update the phone number if a value is set in the request params. If a null or empty value is set then remove the phone number from contact information.

Rename the `MerchantVerification` service to `ContactInformation`.
…ionControllerTest.php

Co-authored-by: Mik <mikkamp@users.noreply.github.com>
Add API endpoints to update and fetch contact information
Change MC setup flow to have four steps
@ecgan ecgan requested a review from a team August 9, 2021 13:47
@ecgan ecgan self-assigned this Aug 9, 2021
@tomalec
Copy link
Member

tomalec commented Aug 9, 2021

The changes in the branch have been reviewed in other smaller PRs, so we don't really need to review them in detail here.

But none of CI checks were done (see #922), so it would be nice to check it here.

@tomalec
Copy link
Member

tomalec commented Aug 9, 2021

I'm still stuck with an account with an incomplete MC address. It does not allow me to save address, as it "Add contact information" uses WC address, but Settings check MC address:
wrong address checked

edit:

I can no longer reproduce that, maybe I had some merge artifacts :\

@ecgan ecgan merged commit 4d1e895 into trunk Aug 9, 2021
@ecgan ecgan deleted the feature/contact-info branch August 9, 2021 18:21
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

Successfully merging this pull request may close these issues.

6 participants