Skip to content

Commit

Permalink
Remove customer Id param from customer resource fetch calls
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoss18 committed Jul 3, 2023
1 parent 0b43f5b commit 1a5a138
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions lib/services/accounts-and-customers-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ export default class AccountsAndCustomersService {
}

//Customers: Operations about customers
async getCustomerResource(customerId: string){
async getCustomerResource(){
//Get a full customer resource.
const customerResource = (await this.httpClient.getData(`/customers/${customerId}`, {}, {}))
const customerResource = (await this.httpClient.getData(`/customers/me`, {}, {}))
return extractResponseData(customerResource)
}
async getCustomerAccountResources(customerId: string){
async getCustomerAccountResources(){
//Get a list of all the customer account resources attached to the current customer.
const customerAccountResources = (await this.httpClient.getData(`/customers/${customerId}/accounts`, {}, {}))
const customerAccountResources = (await this.httpClient.getData(`/customers/me/accounts`, {}, {}))
return extractResponseData(customerAccountResources)
}
async getFullCustomerAccountResource(customerId: string, accountNumber: string){
async getFullCustomerAccountResource(accountNumber: string){
//Get a full customer account resource.
const fullCustomerAccountResource = (await this.httpClient.getData(`/customers/${customerId}/accounts/${accountNumber}`, {}, {}))
const fullCustomerAccountResource = (await this.httpClient.getData(`/customers/me/accounts/${accountNumber}`, {}, {}))
return extractResponseData(fullCustomerAccountResource)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ describe('getCustomerAccounts', () => {

describe('getCustomerResource', () => {
it('responds with the correct data', async function() {
const response = await accountsAndCustomersService.getCustomerResource('me')
const response = await accountsAndCustomersService.getCustomerResource()
expect(response.id).toBe('me')
})
})

describe('getCustomerAccountResources', () => {
it('responds with the correct data', async function() {
const response = await accountsAndCustomersService.getCustomerAccountResources('me')
const response = await accountsAndCustomersService.getCustomerAccountResources()
expect(response.length).toBeGreaterThan(0)
expect(response[0].account["account-number"]).toBeDefined();
expect(response[0].account["margin-or-cash"]).toBeDefined();
Expand All @@ -39,7 +39,7 @@ describe('getCustomerAccountResources', () => {

describe('getFullCustomerAccountResource', () => {
it('responds with the correct data', async function() {
const response = await accountsAndCustomersService.getFullCustomerAccountResource('me', process.env.API_ACCOUNT_NUMBER!)
const response = await accountsAndCustomersService.getFullCustomerAccountResource(process.env.API_ACCOUNT_NUMBER!)
expect(response["account-number"]).toBeDefined();
expect(response["margin-or-cash"]).toBeDefined();
expect(response["investment-objective"]).toBeDefined();
Expand Down

0 comments on commit 1a5a138

Please sign in to comment.