Skip to content

Commit

Permalink
fix: Modify nextPaymentDate in program details subscriptions (openedx…
Browse files Browse the repository at this point in the history
…#32310)

PON-247
  • Loading branch information
julianajlk authored and Yagnesh committed Jun 8, 2023
1 parent 6709061 commit 22e0b9b
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -60,7 +60,7 @@ class ProgramSubscriptionModel extends Backbone.Model {
super(
{
hasActiveTrial,
nextPaymentDate,
currentPeriodEnd,
remainingDays,
subscriptionPrice,
subscriptionState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/programs/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
]

Expand Down

0 comments on commit 22e0b9b

Please sign in to comment.