diff --git a/ghost/admin/app/models/member-subscription.js b/ghost/admin/app/models/member-subscription.js index 4b83d59b72..9dc53574ae 100644 --- a/ghost/admin/app/models/member-subscription.js +++ b/ghost/admin/app/models/member-subscription.js @@ -1,9 +1,14 @@ import EmberObject from '@ember/object'; export default EmberObject.extend({ - adapter: '', - amount: 0, - plan: '', - status: '', - validUntil: 0 + customer: 'customer_id', + subscription: 'subscription_id', + plan: 'plan_id', + status: 'subscription status', + name: 'plan nickname e.g. "Monthly"', + interval: 'how often plan charges e.g "month", "year"', + amount: 'amount in smallest denomination e.g. cents, so value for 5 dollars would be 500', + currency: 'e.g. usd', + last4: 'last four digits of card OR null', + validUntil: 'epoch timestamp of when current interval ends IN SECONDS' }); diff --git a/ghost/admin/app/models/member.js b/ghost/admin/app/models/member.js index e92f537fa1..094d8564c7 100644 --- a/ghost/admin/app/models/member.js +++ b/ghost/admin/app/models/member.js @@ -5,5 +5,5 @@ export default DS.Model.extend({ name: attr('string'), email: attr('string'), createdAt: attr('moment-utc'), - subscriptions: attr('member-subscription') + stripe: attr('member-subscription') }); diff --git a/ghost/admin/app/transforms/member-subscription.js b/ghost/admin/app/transforms/member-subscription.js index 83b373bee6..ea68575b6f 100644 --- a/ghost/admin/app/transforms/member-subscription.js +++ b/ghost/admin/app/transforms/member-subscription.js @@ -6,7 +6,7 @@ export default Transform.extend({ deserialize(serialized) { let subscriptions, subscriptionArray; - subscriptionArray = serialized || []; + subscriptionArray = serialized.subscriptions || []; subscriptions = subscriptionArray.map(itemDetails => MemberSubscription.create(itemDetails)); @@ -30,6 +30,8 @@ export default Transform.extend({ subscriptionArray = []; } - return subscriptionArray; + return { + subscriptions: subscriptionArray + }; } });