REFACTOR: Use the Prices API in place of Plans (#17)

Stripe has a newer API called Prices where you can create a price for any product and it can either be recurring or one-time. The easy part is existing Plans work with the Prices API by passing a Plan ID, but objects are returned in the slightly-different Prices API object format.

This commit is a refactor to the new API to handle the data in its new form, and lays the foundation for a one time payment plan to be added to any subscriptions product.
This commit is contained in:
Justin DiRose
2020-07-15 08:44:40 -05:00
committed by GitHub
parent 8bcb7aa93c
commit c9ff55b46a
22 changed files with 128 additions and 136 deletions
@@ -12,7 +12,7 @@
<td>{{plan.id}}</td>
<td>{{plan.nickname}}</td>
<td>{{plan.interval}}</td>
<td>{{plan.amount}}</td>
<td>{{plan.unit_amount}}</td>
<td class="td-right">
{{d-button
action=(action "editPlan" plan.id)
@@ -80,7 +80,6 @@
</p>
<div class="pull-right">
{{d-button label="cancel" action=(action "cancelPlan" model.plan.product) icon="times"}}
{{#if model.plan.isNew}}
{{d-button label="discourse_subscriptions.admin.plans.operations.create" action="createPlan" icon="plus" class="btn btn-primary"}}
@@ -62,11 +62,6 @@
{{#link-to "adminPlugins.discourse-subscriptions.products.show.plans.show" model.product.id plan.id class="btn no-text btn-icon"}}
{{d-icon "far-edit"}}
{{/link-to}}
{{d-button
action=(route-action "destroyPlan")
actionParam=plan
icon="trash-alt"
class="btn-danger btn no-text btn-icon"}}
</td>
</tr>
{{/each}}