Skip to content

Commit

Permalink
PP-11681 Apply suggested changes following review comments
Browse files Browse the repository at this point in the history
- Pick up baseUrl from options parameter if present otherwise use default.
- Uncomment baseUrl test to test for the above.
  • Loading branch information
JFSGDS committed Mar 12, 2024
1 parent 1b7c6aa commit adc0015
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/services/clients/ledger.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const transaction = async function transaction (id, gatewayAccountId, options =
}

const transactionWithAccountOverride = async function transactionWithAccountOverride (id, options = {}) {
const url = urlJoin(defaultOptions.baseUrl,'/v1/transaction', id)
const baseUrl = options.baseUrl ? options.baseUrl : defaultOptions.baseUrl
const url = urlJoin(baseUrl,'/v1/transaction', id)
this.client = new Client(defaultOptions.service)
const fullUrl = `${url}?override_account_id_restriction=true`
configureClient(this.client, fullUrl)
Expand Down
3 changes: 1 addition & 2 deletions app/services/clients/ledger.client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ describe('Ledger client', () => {

await ledgerClient.transactionWithAccountOverride('id', { baseUrl: 'https://example.com' })

expect(configureSpy.getCall(0).args[0]).to.equal('http://127.0.0.1:8006/v1/transaction/id?override_account_id_restriction=true')
// expect(configureSpy.getCall(0).args[0]).to.equal('https://example.com/v1/transaction/id?override_account_id_restriction=true')
expect(configureSpy.getCall(0).args[0]).to.equal('https://example.com/v1/transaction/id?override_account_id_restriction=true')
})
})

Expand Down

0 comments on commit adc0015

Please sign in to comment.