Skip to content

Commit 0ad82f1

Browse files
authored
Merge pull request #42 from huntario/PSE-704
fix: PSE-704 / GH Issue #28 Customer attribute name undefined
2 parents 09a122b + 4db4c50 commit 0ad82f1

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

  • backend/services/bigcommerce/customers
  • src/pages/api/store/display-settings

backend/services/bigcommerce/customers/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import BigBaseApi from "../big-base-api";
2+
import {SUBSCRIPTION_CUSTOMER_ATTRIBUTE_NAME, SUBSCRIPTION_IDS_ATTRIBUTE_NAME } from "@/shared/constants/bigcommerce";
23

34
/**
45
* Customer API
@@ -97,16 +98,16 @@ export default class CustomersApi extends BigBaseApi {
9798
*/
9899
public async getExistingCustomerAttributeNameIds() {
99100
const attributeNameSearchResults = await this.client.get(
100-
`${this.baseUri}/attributes?name=${process.env.SUBSCRIPTION_CUSTOMER_ATTRIBUTE_NAME}`
101+
`${this.baseUri}/attributes?name=${SUBSCRIPTION_CUSTOMER_ATTRIBUTE_NAME}`
101102
);
102103
const attributeNameSearchResults2 = await this.client.get(
103-
`${this.baseUri}/attributes?name=${process.env.SUBSCRIPTION_IDS_ATTRIBUTE_NAME}`
104+
`${this.baseUri}/attributes?name=${SUBSCRIPTION_IDS_ATTRIBUTE_NAME}`
104105
);
105106

106107
return {
107-
[process.env.SUBSCRIPTION_CUSTOMER_ATTRIBUTE_NAME]:
108+
[SUBSCRIPTION_CUSTOMER_ATTRIBUTE_NAME]:
108109
attributeNameSearchResults.data[0]?.id,
109-
[process.env.SUBSCRIPTION_IDS_ATTRIBUTE_NAME]:
110+
[SUBSCRIPTION_IDS_ATTRIBUTE_NAME]:
110111
attributeNameSearchResults2.data[0]?.id
111112
};
112113
}

src/pages/api/store/display-settings/put.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import { DisplaySettingPayload } from "@/shared/payloads/DisplaySettingPayload";
77
import HttpStatus from "http-status-codes";
88
import { appContainer } from "@/shared/di-container/app";
99
import { injectable } from "tsyringe";
10-
import { STOREFRONT_CONTENT_MODE } from "@/constants/bigcommerce";
11-
10+
import { STOREFRONT_CONTENT_MODE, SUBSCRIPTION_CUSTOMER_ATTRIBUTE_NAME, SUBSCRIPTION_IDS_ATTRIBUTE_NAME } from "@/constants/bigcommerce";
1211
@injectable()
1312
export class DisplaySettingController extends BaseBigCommerceController {
1413
public requiresAuth = true;
@@ -121,9 +120,9 @@ export class DisplaySettingController extends BaseBigCommerceController {
121120
await this.bigApi.customers.upsertInitialCustomerAttributes();
122121
const customerAttributesUpdate = {
123122
customerAttributeFieldId:
124-
customerAttributeIds[process.env.SUBSCRIPTION_CUSTOMER_ATTRIBUTE_NAME],
123+
customerAttributeIds[SUBSCRIPTION_CUSTOMER_ATTRIBUTE_NAME],
125124
subscriptionsAttributeFieldId:
126-
customerAttributeIds[process.env.SUBSCRIPTION_IDS_ATTRIBUTE_NAME]
125+
customerAttributeIds[SUBSCRIPTION_IDS_ATTRIBUTE_NAME]
127126
};
128127

129128
// Update store record with secure store URL and the script or widget ids from the upsert process above

0 commit comments

Comments
 (0)