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

Include tier attributes in request body #500

Merged
merged 3 commits into from
Jun 12, 2020
Merged

Include tier attributes in request body #500

merged 3 commits into from
Jun 12, 2020

Conversation

joannasese
Copy link
Contributor

@joannasese joannasese commented May 29, 2020

Reported issue: When using the subscription_update call, a plan with tiered pricing will fail, with an error requesting additional parameters not specified in API Request.

Expected result: Subscription should update, regardless of tiered add-on state.

Actual result: Subscription will fail to update, with errors around tiers, unit_amount_in_cents and tier_quantity.

Sample xml:

<subscription>
  <timeframe>now</timeframe>
  <subscription_add_ons>
    <subscription_add_on>
      <add_on_code>muppy</add_on_code>
      <quantity>3</quantity>
      <revenue_schedule_type>evenly</revenue_schedule_type>
      <tier_type>tiered</tier_type>
      <tiers>
        <tier></tier>
        <tier></tier>
      </tiers>
    </subscription_add_on>
  </subscription_add_ons>
  <collection_method>automatic</collection_method>
  <custom_fields></custom_fields>
</subscription>

Solution:
Include tier attributes in request body. This also activates PUT /v2/subscriptions/:subscription_id

Sample xml:

<subscription>
  <timeframe>now</timeframe>
  <subscription_add_ons>
    <subscription_add_on>
      <add_on_code>muppy</add_on_code>
      <quantity>3</quantity>
      <revenue_schedule_type>evenly</revenue_schedule_type>
      <tier_type>tiered</tier_type>
      <tiers>
        <tier>
          <unit_amount_in_cents>400</unit_amount_in_cents> 
          <ending_quantity>800</ending_quantity>
        </tier>
        <tier>
          <unit_amount_in_cents>200</unit_amount_in_cents>
          <ending_quantity>999999999</ending_quantity>
        </tier>
      </tiers>
    </subscription_add_on>
  </subscription_add_ons>
  <collection_method>automatic</collection_method>
  <custom_fields></custom_fields>
</subscription>

@joannasese joannasese added the V2 V2 Client label May 29, 2020
@joannasese joannasese changed the title [WIP] Include tier attributes in request body Include tier attributes in request body Jun 1, 2020
@joannasese joannasese requested a review from bhelx June 1, 2020 20:18
@@ -32,4 +32,8 @@ protected function getWriteableAttributes()
'unit_amount_in_cents', 'ending_quantity'
);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment here for context.

@bhelx bhelx merged commit b292d24 into v2 Jun 12, 2020
@bhelx bhelx deleted the dx-1541-update-sub branch June 12, 2020 23:59
@joannasese joannasese mentioned this pull request Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants