Skip to content

Commit

Permalink
fix(payments): PAYMENTS-4228 remove currency code for when ID already…
Browse files Browse the repository at this point in the history
… provided
  • Loading branch information
Eira Tse committed May 21, 2019
1 parent 3100a8a commit c9da8a8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/store/store-request-sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ export default class StoreRequestSender {
const url = this.urlHelper.getInstrumentByIdUrl(
data.storeId,
data.customerId,
data.instrumentId,
data.currencyCode
data.instrumentId
);
const options = {
method: DELETE,
Expand Down
5 changes: 2 additions & 3 deletions src/store/url-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ export default class UrlHelper {
* @param {number} storeId
* @param {number} customerId
* @param {number} instrumentId
* @param {string} currencyCode
* @returns {string}
*/
getInstrumentByIdUrl(storeId, customerId, instrumentId, currencyCode) {
return `${this.host}/api/v2/stores/${storeId}/shoppers/${customerId}/instruments/${instrumentId}?currency_code=${currencyCode}`;
getInstrumentByIdUrl(storeId, customerId, instrumentId) {
return `${this.host}/api/v2/stores/${storeId}/shoppers/${customerId}/instruments/${instrumentId}`;
}
}
3 changes: 1 addition & 2 deletions test/store/store-request-sender.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ describe('StoreRequestSender', () => {
expect(urlHelperMock.getInstrumentByIdUrl).toHaveBeenCalledWith(
data.storeId,
data.customerId,
data.instrumentId,
data.currencyCode
data.instrumentId
);
expect(requestSenderMock.sendRequest).toHaveBeenCalled();
expect(mappers.mapToHeaders).toHaveBeenCalled();
Expand Down
4 changes: 2 additions & 2 deletions test/store/url-helper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe('UrlHelper', () => {
});

it('returns a URL for generating a client token', () => {
const result = urlHelper.getInstrumentByIdUrl(storeId, shopperId, instrumentId, currencyCode);
const expected = `${host}/api/v2/stores/${storeId}/shoppers/${shopperId}/instruments/${instrumentId}?currency_code=${currencyCode}`;
const result = urlHelper.getInstrumentByIdUrl(storeId, shopperId, instrumentId);
const expected = `${host}/api/v2/stores/${storeId}/shoppers/${shopperId}/instruments/${instrumentId}`;

expect(result).toEqual(expected);
});
Expand Down

0 comments on commit c9da8a8

Please sign in to comment.