fix: Modify nextPaymentDate in program details subscriptions (#32310)

PON-247
This commit is contained in:
Juliana Kang
2023-05-26 10:50:39 -04:00
committed by GitHub
parent 38a69d10ff
commit c67408b9c5
9 changed files with 14 additions and 14 deletions

View File

@@ -46,8 +46,8 @@ class ProgramSubscriptionModel extends Backbone.Model {
const remainingDays = trialMoment.diff(moment.utc(), 'days');
const [nextPaymentDate] = ProgramSubscriptionModel.formatDate(
data.next_payment_date,
const [currentPeriodEnd] = ProgramSubscriptionModel.formatDate(
data.current_period_end,
userPreferences
);
const [trialEndDate, trialEndTime] = ProgramSubscriptionModel.formatDate(
@@ -60,7 +60,7 @@ class ProgramSubscriptionModel extends Backbone.Model {
super(
{
hasActiveTrial,
nextPaymentDate,
currentPeriodEnd,
remainingDays,
subscriptionPrice,
subscriptionState,

View File

@@ -9,7 +9,7 @@ describe('Program Alert List View', () => {
trialEndingAlerts: [{
title: 'Test Program',
hasActiveTrial: true,
nextPaymentDate: 'May 8, 2023',
currentPeriodEnd: 'May 8, 2023',
remainingDays: 2,
subscriptionPrice: '$100/month USD',
subscriptionState: 'active',

View File

@@ -48,7 +48,7 @@ describe('Program Details Header View', () => {
subscriptionData: [
{
trial_end: '1970-01-01T03:25:45Z',
next_payment_date: '1970-06-03T07:12:04Z',
current_period_end: '1970-06-03T07:12:04Z',
price: '100.00',
currency: 'USD',
subscription_state: 'active',

View File

@@ -110,7 +110,7 @@ describe('Program Progress View', () => {
isSubscriptionEligible = false;
subscriptionData = {
trial_end: '1970-01-01T03:25:45Z',
next_payment_date: '1970-06-03T07:12:04Z',
current_period_end: '1970-06-03T07:12:04Z',
price: '100.00',
currency: 'USD',
subscription_state: 'pre',

View File

@@ -471,7 +471,7 @@ describe('Program Details View', () => {
subscriptionData: [
{
trial_end: '1970-01-01T03:25:45Z',
next_payment_date: '1970-06-03T07:12:04Z',
current_period_end: '1970-06-03T07:12:04Z',
price: '100.00',
currency: 'USD',
subscription_state: 'pre',

View File

@@ -29,7 +29,7 @@ describe('Program List Header View', () => {
id: 'eeb25640-9741-4c11-963c-8a27337f217c',
resource_id: 'b90d70d5-f981-4508-bdeb-5b792d930c03',
trial_end: '2022-04-20T05:59:42Z',
next_payment_date: '2023-05-08T05:59:42Z',
current_period_end: '2023-05-08T05:59:42Z',
subscription_state: 'active',
},
],

View File

@@ -87,14 +87,14 @@
hasActiveTrial
? gettext('Active trial ends {trialEndDate} at {trialEndTime}')
: subscriptionState === 'active'
? gettext('Your next billing date is {nextPaymentDate}')
? gettext('Your next billing date is {currentPeriodEnd}')
: subscriptionState === 'inactive'
? gettext('Unlock verified access to all courses for {subscriptionPrice}. Cancel anytime.')
: gettext('{subscriptionPrice} subscription after trial ends. Cancel anytime.')
),
{
subscriptionPrice,
nextPaymentDate,
currentPeriodEnd,
trialEndDate,
trialEndTime,
}

View File

@@ -62,14 +62,14 @@
hasActiveTrial
? gettext('Active trial ends {trialEndDate} at {trialEndTime}')
: subscriptionState === 'active'
? gettext('Your next billing date is {nextPaymentDate}')
? gettext('Your next billing date is {currentPeriodEnd}')
: subscriptionState === 'inactive'
? gettext('Unlock verified access to all courses for {subscriptionPrice}. Cancel anytime.')
: gettext('{subscriptionPrice} subscription after trial ends. Cancel anytime.')
),
{
subscriptionPrice,
nextPaymentDate,
currentPeriodEnd,
trialEndDate,
trialEndTime,
}

View File

@@ -1747,12 +1747,12 @@ class TestGetProgramsSubscriptionData(TestCase):
{'id': uuid.uuid4(), 'resource_id': uuid.uuid4(),
'resource_type': 'program', 'resource_data': None, 'trial_end': '1970-01-01T00:02:03Z',
'price': '100.00', 'currency': 'USD', 'sub_type': 'stripe', 'identifier': 'dummy_1',
'next_payment_date': '1970-01-01T00:02:03Z', 'status': 'active',
'current_period_end': '1970-01-01T00:02:03Z', 'status': 'active',
'customer': 1, 'subscription_state': 'active'},
{'id': uuid.uuid4(), 'resource_id': uuid.uuid4(),
'resource_type': 'program', 'resource_data': None, 'trial_end': '1970-01-01T03:25:12Z',
'price': '1000.00', 'currency': 'USD', 'sub_type': 'stripe', 'identifier': 'dummy_2',
'next_payment_date': '1970-05-23T12:05:21Z', 'status': 'subscription_initiated',
'current_period_end': '1970-05-23T12:05:21Z', 'status': 'subscription_initiated',
'customer': 1, 'subscription_state': 'notStarted'}
]