From 57e9a50285d6fdd734b767fc16b090090af97927 Mon Sep 17 00:00:00 2001 From: julianajlk Date: Thu, 25 May 2023 10:38:39 -0400 Subject: [PATCH 1/2] fix: Modify nextPaymentDate name to match change in subscriptions --- .../learner_dashboard/models/program_subscription_model.js | 6 +++--- .../learner_dashboard/spec/program_alert_list_view_spec.js | 2 +- .../learner_dashboard/spec/program_details_header_spec.js | 2 +- .../spec/program_details_sidebar_view_spec.js | 2 +- .../js/learner_dashboard/spec/program_details_view_spec.js | 2 +- .../learner_dashboard/spec/program_list_header_view_spec.js | 2 +- openedx/core/djangoapps/programs/tests/test_utils.py | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lms/static/js/learner_dashboard/models/program_subscription_model.js b/lms/static/js/learner_dashboard/models/program_subscription_model.js index 8f15092a6769..edff27479077 100644 --- a/lms/static/js/learner_dashboard/models/program_subscription_model.js +++ b/lms/static/js/learner_dashboard/models/program_subscription_model.js @@ -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, diff --git a/lms/static/js/learner_dashboard/spec/program_alert_list_view_spec.js b/lms/static/js/learner_dashboard/spec/program_alert_list_view_spec.js index 2e8d8beb3e35..c5c5f0ec7a85 100644 --- a/lms/static/js/learner_dashboard/spec/program_alert_list_view_spec.js +++ b/lms/static/js/learner_dashboard/spec/program_alert_list_view_spec.js @@ -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', diff --git a/lms/static/js/learner_dashboard/spec/program_details_header_spec.js b/lms/static/js/learner_dashboard/spec/program_details_header_spec.js index 4a3fe43fb00c..398632ebb46a 100644 --- a/lms/static/js/learner_dashboard/spec/program_details_header_spec.js +++ b/lms/static/js/learner_dashboard/spec/program_details_header_spec.js @@ -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', diff --git a/lms/static/js/learner_dashboard/spec/program_details_sidebar_view_spec.js b/lms/static/js/learner_dashboard/spec/program_details_sidebar_view_spec.js index 554cc3119060..8f3f4a759a4c 100644 --- a/lms/static/js/learner_dashboard/spec/program_details_sidebar_view_spec.js +++ b/lms/static/js/learner_dashboard/spec/program_details_sidebar_view_spec.js @@ -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', diff --git a/lms/static/js/learner_dashboard/spec/program_details_view_spec.js b/lms/static/js/learner_dashboard/spec/program_details_view_spec.js index 29f7e5bdef61..b574e644d976 100644 --- a/lms/static/js/learner_dashboard/spec/program_details_view_spec.js +++ b/lms/static/js/learner_dashboard/spec/program_details_view_spec.js @@ -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', diff --git a/lms/static/js/learner_dashboard/spec/program_list_header_view_spec.js b/lms/static/js/learner_dashboard/spec/program_list_header_view_spec.js index b021a1d22042..558b984487f2 100644 --- a/lms/static/js/learner_dashboard/spec/program_list_header_view_spec.js +++ b/lms/static/js/learner_dashboard/spec/program_list_header_view_spec.js @@ -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', }, ], diff --git a/openedx/core/djangoapps/programs/tests/test_utils.py b/openedx/core/djangoapps/programs/tests/test_utils.py index 416424497471..572efb348e75 100644 --- a/openedx/core/djangoapps/programs/tests/test_utils.py +++ b/openedx/core/djangoapps/programs/tests/test_utils.py @@ -1747,12 +1747,12 @@ def setUpClass(cls): {'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'} ] From ab494afcd3f2ba7adfae514542dbb71ce5a5ebed Mon Sep 17 00:00:00 2001 From: julianajlk Date: Thu, 25 May 2023 13:44:38 -0400 Subject: [PATCH 2/2] fix: Modify underscore JS files for program details --- .../learner_dashboard/program_details_tab_view.underscore | 4 ++-- .../learner_dashboard/program_details_view.underscore | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lms/templates/learner_dashboard/program_details_tab_view.underscore b/lms/templates/learner_dashboard/program_details_tab_view.underscore index 4532cc218030..35fe29151a88 100644 --- a/lms/templates/learner_dashboard/program_details_tab_view.underscore +++ b/lms/templates/learner_dashboard/program_details_tab_view.underscore @@ -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, } diff --git a/lms/templates/learner_dashboard/program_details_view.underscore b/lms/templates/learner_dashboard/program_details_view.underscore index 2a03bf75b9ac..6d48ce7ff7f1 100644 --- a/lms/templates/learner_dashboard/program_details_view.underscore +++ b/lms/templates/learner_dashboard/program_details_view.underscore @@ -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, }