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

Fix subscription updates when subcription has add_ons #242

Merged
merged 1 commit into from
Jun 24, 2016

Conversation

bhelx
Copy link
Contributor

@bhelx bhelx commented Jun 23, 2016

Addresses #240
Reported By: @ScottSpittle

We are seeing an issue with updating subscriptions containing add ons. Using the updateImmediately method was generating some xml which was trying to update immutable fields for the subscription add ons on the backend. The update payload was looking something like this:

<?xml version="1.0" encoding="UTF-8"?>
<subscription>
   <quantity>2</quantity>
   <timeframe>now</timeframe>
   <subscription_add_ons>
      <subscription_add_on>
         <add_on_code>marketing_emails</add_on_code>
         <add_on_type>fixed</add_on_type>
         <quantity>1</quantity>
         <unit_amount_in_cents>5</unit_amount_in_cents>
      </subscription_add_on>
   </subscription_add_ons>
</subscription>

And the resulting error:

<?xml version="1.0" encoding="UTF-8"?>
<error>
  <symbol>invalid_xml</symbol>
  <description>The provided XML was invalid.</description>
  <details>Unacceptable tag &lt;add_on_type&gt;</details>
</error>

I added some code to ignore the immutable fields on update but I think this is a larger problem around changes to arrays not being tracked. We shouldn't be rendering the subscription add ons unless they have changed.

So while this should be a fine solution to this problem, I think a follow up should be made to investigate how we handle tracking of changes on arrays of objects.

@bhelx bhelx force-pushed the fix_subscription_update_with_add_ons branch from 6aa33d0 to d874519 Compare June 24, 2016 19:18
@bhelx bhelx removed the WIP label Jun 24, 2016
@drewish
Copy link

drewish commented Jun 24, 2016

+1

@drewish drewish merged commit 512f7b8 into master Jun 24, 2016
@drewish drewish deleted the fix_subscription_update_with_add_ons branch June 24, 2016 19:39
@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V2 V2 Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants