diff --git a/src/client/client.js b/src/client/client.js index 05b8f738..935db3e4 100644 --- a/src/client/client.js +++ b/src/client/client.js @@ -113,8 +113,8 @@ export default class Client { * @param {Function} [callback] * @return {void} */ - getShopperInstruments(data, callback) { - this.storeRequestSender.getShopperInstruments(data, callback); + loadInstruments(data, callback) { + this.storeRequestSender.loadInstruments(data, callback); } /** @@ -125,8 +125,8 @@ export default class Client { * @param {Function} [callback] * @return {void} */ - postTrustedShippingAddress(data, callback) { - this.storeRequestSender.postTrustedShippingAddress(data, callback); + loadInstrumentsWithAddress(data, callback) { + this.storeRequestSender.loadInstrumentsWithAddress(data, callback); } /** diff --git a/src/store/store-request-sender.js b/src/store/store-request-sender.js index e9f32cce..b0cc5d48 100644 --- a/src/store/store-request-sender.js +++ b/src/store/store-request-sender.js @@ -43,7 +43,7 @@ export default class StoreRequestSender { * @param {Function} [callback] * @return {void} */ - getShopperInstruments(data, callback) { + loadInstruments(data, callback) { const url = this.urlHelper.getInstrumentsUrl(data.storeId, data.shopperId); const options = { headers: mapToHeaders(data), @@ -57,7 +57,7 @@ export default class StoreRequestSender { * @param {Function} [callback] * @return {void} */ - postTrustedShippingAddress(data, callback) { + loadInstrumentsWithAddress(data, callback) { const url = this.urlHelper.getTrustedShippingAddressUrl(data.storeId, data.shopperId); const payload = mapToTrustedShippingAddressPayload(data); const options = { diff --git a/test/client/client.spec.js b/test/client/client.spec.js index ec591ebf..39e79640 100644 --- a/test/client/client.spec.js +++ b/test/client/client.spec.js @@ -29,8 +29,8 @@ describe('Client', () => { storeRequestSender = { getShopperToken: jasmine.createSpy('getShopperToken'), - getShopperInstruments: jasmine.createSpy('getShopperInstruments'), - postTrustedShippingAddress: jasmine.createSpy('postTrustedShippingAddress'), + loadInstruments: jasmine.createSpy('loadInstruments'), + loadInstrumentsWithAddress: jasmine.createSpy('loadInstrumentsWithAddress'), postShopperInstrument: jasmine.createSpy('postShopperInstrument'), deleteShopperInstrument: jasmine.createSpy('deleteShopperInstrument'), }; @@ -91,22 +91,22 @@ describe('Client', () => { expect(clientTokenGenerator.generateClientToken).toHaveBeenCalledWith(data, callback); }); - it('request a shopper\'s instruments', () => { + it('load instruments', () => { const callback = () => {}; const data = storeIntrumentDataMock; - client.getShopperInstruments(data, callback); + client.loadInstruments(data, callback); - expect(storeRequestSender.getShopperInstruments).toHaveBeenCalledWith(data, callback); + expect(storeRequestSender.loadInstruments).toHaveBeenCalledWith(data, callback); }); - it('posts a trusted shipping address', () => { + it('load instruments with shipping address', () => { const callback = () => {}; const data = trustedShippingAddressDataMock; - client.postTrustedShippingAddress(data, callback); + client.loadInstrumentsWithAddress(data, callback); - expect(storeRequestSender.postTrustedShippingAddress).toHaveBeenCalledWith(data, callback); + expect(storeRequestSender.loadInstrumentsWithAddress).toHaveBeenCalledWith(data, callback); }); it('posts a new instrument', () => { diff --git a/test/store/store-request-sender.spec.js b/test/store/store-request-sender.spec.js index 28fd6d3d..ab66ff81 100644 --- a/test/store/store-request-sender.spec.js +++ b/test/store/store-request-sender.spec.js @@ -38,7 +38,7 @@ describe('StoreRequestSender', () => { }); it('request a shopper instrument with the appropriately mapped headers', () => { - storeRequestSender.getShopperInstruments(data, () => {}); + storeRequestSender.loadInstruments(data, () => {}); expect(urlHelperMock.getInstrumentsUrl).toHaveBeenCalledWith(data.storeId, data.shopperId); expect(requestSenderMock.sendRequest).toHaveBeenCalled(); @@ -46,7 +46,7 @@ describe('StoreRequestSender', () => { }); it('posts a trusted shipping address with the appropriately mapped headers and payload', () => { - storeRequestSender.postTrustedShippingAddress(data, () => {}); + storeRequestSender.loadInstrumentsWithAddress(data, () => {}); expect(urlHelperMock.getTrustedShippingAddressUrl).toHaveBeenCalledWith(data.storeId, data.shopperId); expect(requestSenderMock.postRequest).toHaveBeenCalled();