Skip to content

Commit

Permalink
Merge pull request #85 from icatalina/PAYMENTS-4759
Browse files Browse the repository at this point in the history
fix(instruments): PAYMENTS-4759 Remove POST instrument for api/v2
  • Loading branch information
icatalina authored Oct 10, 2019
2 parents c6ef46f + 29928a8 commit 703c072
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 58 deletions.
16 changes: 0 additions & 16 deletions src/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,6 @@ export default class Client {
this.storeRequestSender.loadInstrumentsWithAddress(data, callback);
}

/**
* @param {Object} data
* @param {string} data.storeId
* @param {string} data.customerId
* @param {string} data.currencyCode
* @param {CreditCard} data.creditCard
* @param {AddressData} data.billingAddress
* @param {boolean} data.defaultInstrument
* @param {string} data.providerName
* @param {Function} [callback]
* @return {void}
*/
postShopperInstrument(data, callback) {
this.storeRequestSender.postShopperInstrument(data, callback);
}

/**
* @param {Object} data
* @param {string} data.storeId
Expand Down
20 changes: 0 additions & 20 deletions src/store/store-request-sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { DELETE, POST } from '../common/http-request/method-types';
import UrlHelper from './url-helper';
import {
mapToHeaders,
mapToInstrumentPayload,
mapToTrustedShippingAddressPayload,
} from './v2/mappers';

Expand Down Expand Up @@ -76,25 +75,6 @@ export default class StoreRequestSender {
this.requestSender.postRequest(url, payload, options, callback);
}

/**
* @param {Object} data
* @param {Function} [callback]
* @return {void}
*/
postShopperInstrument(data, callback) {
const url = this.urlHelper.getInstrumentsUrl(
data.storeId,
data.customerId,
data.currencyCode
);
const payload = mapToInstrumentPayload(data);
const options = {
headers: mapToHeaders(data),
};

this.requestSender.postRequest(url, payload, options, callback);
}

/**
* @param {Object} data
* @param {Function} [callback]
Expand Down
10 changes: 0 additions & 10 deletions test/client/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('Client', () => {
getShopperToken: jasmine.createSpy('getShopperToken'),
loadInstruments: jasmine.createSpy('loadInstruments'),
loadInstrumentsWithAddress: jasmine.createSpy('loadInstrumentsWithAddress'),
postShopperInstrument: jasmine.createSpy('postShopperInstrument'),
deleteShopperInstrument: jasmine.createSpy('deleteShopperInstrument'),
};

Expand Down Expand Up @@ -109,15 +108,6 @@ describe('Client', () => {
expect(storeRequestSender.loadInstrumentsWithAddress).toHaveBeenCalledWith(data, callback);
});

it('posts a new instrument', () => {
const callback = () => {};
const data = storeIntrumentDataMock;

client.postShopperInstrument(data, callback);

expect(storeRequestSender.postShopperInstrument).toHaveBeenCalledWith(data, callback);
});

it('deletes an instrument', () => {
const callback = () => {};
const data = storeIntrumentDataMock;
Expand Down
12 changes: 0 additions & 12 deletions test/store/store-request-sender.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ describe('StoreRequestSender', () => {
expect(mappers.mapToTrustedShippingAddressPayload).toHaveBeenCalled();
});

it('posts a new shopper instrument with the appropriately mapped headers and payload', () => {
storeRequestSender.postShopperInstrument(data, () => {});

expect(urlHelperMock.getInstrumentsUrl).toHaveBeenCalledWith(
data.storeId,
data.customerId,
data.currencyCode
);
expect(requestSenderMock.postRequest).toHaveBeenCalled();
expect(mappers.mapToHeaders).toHaveBeenCalled();
});

it('requests the deletion of a shopper\'s payment instrument', () => {
storeRequestSender.deleteShopperInstrument(data, () => {});

Expand Down

0 comments on commit 703c072

Please sign in to comment.