diff --git a/src/store/__mocks__/mockEmptyStore.js b/src/store/__mocks__/mockEmptyStore.js index 9969ab10..97450d2b 100644 --- a/src/store/__mocks__/mockEmptyStore.js +++ b/src/store/__mocks__/mockEmptyStore.js @@ -13,7 +13,6 @@ module.exports = { loading: false, loadingError: false, subscriptions: [], - stripeCustomerPortalURL: null, stripeError: false, stripeLoading: false, shouldShowSubscriptionsSection: true, diff --git a/src/store/__mocks__/subscriptions.mockStore.js b/src/store/__mocks__/subscriptions.mockStore.js index 6839134f..3c7bdcc6 100644 --- a/src/store/__mocks__/subscriptions.mockStore.js +++ b/src/store/__mocks__/subscriptions.mockStore.js @@ -4,7 +4,6 @@ module.exports = { loadingError: false, stripeLoading: false, stripeError: false, - stripeCustomerPortalURL: null, shouldShowSubscriptionsSection: true, subscriptions: [ { diff --git a/src/subscriptions/actions.js b/src/subscriptions/actions.js index 5b5c531b..94a0aa22 100644 --- a/src/subscriptions/actions.js +++ b/src/subscriptions/actions.js @@ -1,9 +1,6 @@ import { createRoutine } from 'redux-saga-routines'; export const fetchSubscriptions = createRoutine('FETCH_SUBSCRIPTIONS'); -export const fetchStripeCustomerPortalURL = createRoutine( - 'FETCH_STRIPE_CUSTOMER_PORTAL_URL', -); export const clearStripeError = () => ({ type: 'CLEAR_STRIPE_ERROR', diff --git a/src/subscriptions/reducer.js b/src/subscriptions/reducer.js index 72cb4e61..9a2aa42b 100644 --- a/src/subscriptions/reducer.js +++ b/src/subscriptions/reducer.js @@ -1,10 +1,9 @@ -import { fetchStripeCustomerPortalURL, fetchSubscriptions } from './actions'; +import { fetchSubscriptions } from './actions'; export const initialState = { loading: true, loadingError: false, subscriptions: [], - stripeCustomerPortalURL: null, stripeError: false, stripeLoading: false, shouldShowSubscriptionsSection: true, @@ -33,27 +32,6 @@ const subscriptionsReducer = (state = initialState, action = {}) => { ...state, loading: false, }; - case fetchStripeCustomerPortalURL.TRIGGER: - return { - ...state, - stripeLoading: true, - stripeCustomerPortalURL: null, - }; - case fetchStripeCustomerPortalURL.SUCCESS: - return { - ...state, - stripeCustomerPortalURL: action.payload, - }; - case fetchStripeCustomerPortalURL.FAILURE: - return { - ...state, - stripeError: true, - }; - case fetchStripeCustomerPortalURL.FULFILL: - return { - ...state, - stripeLoading: false, - }; case 'CLEAR_STRIPE_ERROR': return { ...state, diff --git a/src/subscriptions/saga.js b/src/subscriptions/saga.js index 4d0b3f58..a8f7ac74 100644 --- a/src/subscriptions/saga.js +++ b/src/subscriptions/saga.js @@ -1,9 +1,7 @@ import { put, takeLatest, call } from 'redux-saga/effects'; -import { createFetchHandler } from '../utils'; - -import { fetchSubscriptions, fetchStripeCustomerPortalURL, hideSubscriptionSection } from './actions'; -import { getSubscriptions, getStripeCustomerPortalURL } from './service'; +import { fetchSubscriptions, hideSubscriptionSection } from './actions'; +import { getSubscriptions } from './service'; function* handleFetchSubscriptions() { try { @@ -27,15 +25,6 @@ function* handleFetchSubscriptions() { } } -const handleFetchStripeCustomerPortalURL = createFetchHandler( - fetchStripeCustomerPortalURL, - getStripeCustomerPortalURL, -); - export default function* subscriptionSaga() { yield takeLatest(fetchSubscriptions.TRIGGER, handleFetchSubscriptions); - yield takeLatest( - fetchStripeCustomerPortalURL.TRIGGER, - handleFetchStripeCustomerPortalURL, - ); } diff --git a/src/subscriptions/service.js b/src/subscriptions/service.js index eb75d7c4..6b86f9ec 100644 --- a/src/subscriptions/service.js +++ b/src/subscriptions/service.js @@ -3,7 +3,7 @@ import { getConfig } from '@edx/frontend-platform'; const createURL = (url) => `${getConfig().SUBSCRIPTIONS_BASE_URL}/api/v1${url}`; -export async function getSubscriptions() { +export default async function getSubscriptions() { const httpClient = getAuthenticatedHttpClient(); const stripeUserSubscriptionsUrl = createURL('/stripe-user-subscriptions/'); @@ -19,13 +19,3 @@ export async function getSubscriptions() { : subscription.subscription_state?.toLowerCase(), })); } - -export async function getStripeCustomerPortalURL() { - const httpClient = getAuthenticatedHttpClient(); - - const stripePortalURL = createURL('/stripe-portal/'); - - const { data } = await httpClient.post(stripePortalURL); - - return data.portal_url; -}