Updated member model to use new subscriptions structure
no issue Members API was updated to have new subscription structure, this updates model and its transformation to match it.
This commit is contained in:
parent
06e6e15cc5
commit
40fddac43c
@ -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'
|
||||
});
|
||||
|
@ -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')
|
||||
});
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user