diff --git a/.env.development b/.env.development
index ca83045f0..221345e5b 100644
--- a/.env.development
+++ b/.env.development
@@ -17,7 +17,7 @@ LANGUAGE_PREFERENCE_COOKIE_NAME=openedx-language-preference
SITE_NAME=localhost
MARKETING_SITE_BASE_URL=http://localhost:18000
SUPPORT_URL=http://localhost:18000/support
-ORDER_HISTORY_URL=http://localhost:1996/orders
+ORDER_HISTORY_URL=http://localhost:8140/orders/unified/order_history/
LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
diff --git a/.env.test b/.env.test
index 23e5a9fe5..cf38dcd2b 100644
--- a/.env.test
+++ b/.env.test
@@ -17,7 +17,7 @@ LANGUAGE_PREFERENCE_COOKIE_NAME=openedx-language-preference
SITE_NAME=localhost
MARKETING_SITE_BASE_URL=http://localhost:18000
SUPPORT_URL=http://localhost:18000/support
-ORDER_HISTORY_URL=https://localhost:1996/orders
+ORDER_HISTORY_URL=http://localhost:8140/orders/unified/order_history/
LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
diff --git a/src/order-history/OrderHistoryPage.jsx b/src/order-history/OrderHistoryPage.jsx
index 2462c9fd7..eff6d4f04 100644
--- a/src/order-history/OrderHistoryPage.jsx
+++ b/src/order-history/OrderHistoryPage.jsx
@@ -6,7 +6,6 @@ import {
injectIntl,
intlShape,
FormattedDate,
- FormattedNumber,
} from '@edx/frontend-platform/i18n';
import { DataTable, Hyperlink, Pagination } from '@edx/paragon';
import MediaQuery from 'react-responsive';
@@ -36,14 +35,13 @@ class OrderHistoryPage extends React.Component {
lineItems,
datePlaced,
total,
- currency,
orderId,
receiptUrl,
}) => ({
description: this.renderLineItems(lineItems),
datePlaced: ,
// eslint-disable-next-line react/style-prop-object
- total: ,
+ total,
receiptUrl: (
{this.props.intl.formatMessage(messages['ecommerce.order.history.view.order.detail'])}
diff --git a/src/order-history/service.js b/src/order-history/service.js
index fc71f88c1..92774857a 100644
--- a/src/order-history/service.js
+++ b/src/order-history/service.js
@@ -6,19 +6,25 @@ import { getConfig } from '@edx/frontend-platform';
const { ECOMMERCE_BASE_URL } = getConfig();
-const ECOMMERCE_API_BASE_URL = `${ECOMMERCE_BASE_URL}/api/v2`;
const ECOMMERCE_RECEIPT_BASE_URL = `${ECOMMERCE_BASE_URL}/checkout/receipt/`;
+const decimalishMatcher = /^([0-9]*[.,]*)+[0-9]*$/;
+
+function isNotDecimalish(num) {
+ if (Number.isNaN(num)) {
+ return true;
+ }
+
+ return !decimalishMatcher.test(num);
+}
+
// eslint-disable-next-line import/prefer-default-export
export async function getOrders(page = 1, pageSize = 20) {
const httpClient = getAuthenticatedHttpClient();
const { username } = getAuthenticatedUser();
- const { COMMERCE_COORDINATOR_BASE_URL } = getConfig();
- const orderFetchingUrl = `${COMMERCE_COORDINATOR_BASE_URL}/orders/order_history/`;
+ const { ORDER_HISTORY_URL } = getConfig();
- // [START] TEMPORARY CODE for rollout testing/confirmation===========
- // Call ecommerce for order info including waffle flag
- let { data } = await httpClient.get(`${ECOMMERCE_API_BASE_URL}/orders/`, {
+ const { data } = await httpClient.get(`${ORDER_HISTORY_URL}`, {
params: {
username,
page,
@@ -26,35 +32,7 @@ export async function getOrders(page = 1, pageSize = 20) {
},
});
- let callCC = false;
- if (data.count > 0) {
- callCC = data.results[0].enable_hoist_order_history;
- }
-
- if (callCC) {
- // REV-2577: enable_hoist_order_history flag is on, about to call commerce-coordinator
- const newData = await httpClient.get(orderFetchingUrl, {
- params: {
- username,
- page,
- page_size: pageSize,
- },
- });
- data = newData.data;
- }
- // [END] TEMPORARY CODE for rollout testing/confirmation===========
-
- // @TODO: after we've confirmed the above works in prod, we can replace with this:
- // let { data } = await httpClient.get(orderFetchingUrl, {
- // params: {
- // username,
- // page,
- // page_size: pageSize,
- // },
- // });
- // data = newData.data;
-
- const transformedResults = data.results.map(({
+ const transformedResults = data.map(({
total_excl_tax, // eslint-disable-line camelcase
lines,
number,
@@ -73,7 +51,7 @@ export async function getOrders(page = 1, pageSize = 20) {
return {
datePlaced: date_placed, // eslint-disable-line camelcase
- total: total_excl_tax, // eslint-disable-line camelcase
+ total: isNotDecimalish(total_excl_tax) ? total_excl_tax : `$${total_excl_tax}`, // eslint-disable-line camelcase
orderId: number,
currency,
lineItems,
@@ -83,10 +61,10 @@ export async function getOrders(page = 1, pageSize = 20) {
return {
count: data.count,
- pageCount: Math.ceil(data.count / pageSize),
- currentPage: page,
- next: data.next,
- previous: data.previous,
+ pageCount: 0, // Math.ceil(data.count / pageSize),
+ currentPage: 1,
+ next: false,
+ previous: false,
orders: transformedResults,
};
}