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

Unsubscribe from a rate plan does not work with developerId, only email #36

Closed
minnur opened this issue Nov 28, 2018 · 5 comments
Closed

Comments

@minnur
Copy link

minnur commented Nov 28, 2018

Q A
Bug? yes
New Feature? no
Version 2.0.0

Actual Behavior

When trying to unsubscribe from an existing rate plan I get this:
URL id qualifier [email@email.com] does not match with the entity id [someID-0839-4057-84fc-...] or some of these entities may not exist

Expected Behavior

Successfully unsubscribe form a rate plan.

Steps to Reproduce the behavior

The code for the subscribe/unsubscribe is in my fork. I am trying to create a patch that would temporarily solve this issue or give some ideas on how this issue could be better handled in the library.

Proposed Solution

Looks like Apigee\Edge\Api\Monetization\Normalizer\EntityNormalizer::normalize needs a special treatment for the developer ID when calling unsubscribe method. While developer entity ID is used for the subscribe to rate plan is used the unsubscribe requires actual email address as a Developer ID.

@cnovak
Copy link
Collaborator

cnovak commented Nov 28, 2018

We should not be using anything but email addresses as an ID for developers. The older client library only used developerId in one location and it broke after internal changes (CPS migration). We needed to change that code to use email instead of developerId. The developerId is not guaranteed to be unique.

@minnur
Copy link
Author

minnur commented Nov 29, 2018

Here is payload example when trying to unsubscribe:

{"created":"2018-11-29 00:06:36","developer":{"id":"someID-000-0000-84fc-..."},"endDate":"2018-11-28 09:07:33","id":"...-0000-subscriptionID-0000-...","ratePlan":{"id":"10_cents_rate_planID"},"startDate":"2018-11-28 15:15:00","updated":"2018-11-29 00:06:36"}

That developer[id] ='someID-000-0000-84fc-...' should be email address.

@minnur
Copy link
Author

minnur commented Nov 29, 2018

Here is my ugly patch so you get the idea what I am trying to achieve.
unsubscribe-rate-plan-developer-id.patch.txt

@cnovak cnovak changed the title Unable to unsubscribe from a rate plan due to incorrect developer ID Unsubscribe from a rate plan does not work with developerId, only email Dec 3, 2018
@mxr576
Copy link
Contributor

mxr576 commented Dec 5, 2018

@minnur You can apply this patch on the PHP API client with Composer Patches until we do not figure out a general solution for this and any related issues to this problem.

@mxr576
Copy link
Contributor

mxr576 commented Jan 23, 2019

Hi @minnur, the fix is available in #42 and the latest dev build for this issue. Please install the latest dev or apply the mentioned PR as a patch with composer patches.
Please let me know if it worked.

@mxr576 mxr576 closed this as completed in 0e84933 Jan 23, 2019
mxr576 added a commit to mxr576/apigee-client-php that referenced this issue Feb 6, 2019
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

3 participants