Skip to content

Commit

Permalink
prep release v7.3.0 (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchen293 authored Apr 10, 2024
1 parent 0a05ddf commit 93737bf
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 42 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## Next Release
## v7.3.0 (2024-04-10)

- Fix payment method funding and deletion failures due to undetermined payment method type
- Adds `refund` function in Insurance service for requesting a refund of standalone insurance.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@easypost/api",
"description": "EasyPost Node Client Library",
"version": "7.2.0",
"version": "7.3.0",
"author": "Easypost Engineering <[email protected]>",
"homepage": "https://easypost.com",
"bin": {
Expand Down
7 changes: 2 additions & 5 deletions src/services/billing_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,9 @@ export default (easypostClient) =>
if (paymentMethodToUse !== undefined && paymentMethods[paymentMethodToUse] !== null) {
paymentMethodID = paymentMethods[paymentMethodToUse].id;
paymentMethodObjectType = paymentMethods[paymentMethodToUse].object;
if (paymentMethodID.startsWith('card_') || paymentMethodObjectType === 'CreditCard') {
if (paymentMethodObjectType === 'CreditCard') {
endpoint = 'credit_cards';
} else if (
paymentMethodID.startsWith('bank_') ||
paymentMethodObjectType === 'BankAccount'
) {
} else if (paymentMethodObjectType === 'BankAccount') {
endpoint = 'bank_accounts';
} else {
throw new InvalidObjectError({ message: errorString });
Expand Down
33 changes: 0 additions & 33 deletions test/services/billing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,37 +81,4 @@ describe('Billing Service', function () {

expect(paymentInfo2).to.deep.equal(['bank_accounts', 'pm_123']);
});

it('get payment info with legacy prefix', async function () {
this.client = new EasyPostClient(process.env.EASYPOST_TEST_API_KEY, {
requestMiddleware: (request) => {
return new MockMiddleware(request, [
new MockRequest(
new MockRequestMatchRule('GET', 'v2\\/payment_methods$'),
new MockRequestResponseInfo(200, {
id: 'summary_123',
primary_payment_method: {
id: 'card_123',
last4: '1234',
// No object field, force use of id prefix to determine type
},
secondary_payment_method: {
id: 'bank_123',
bank_name: 'Mock Bank',
// No object field, force use of id prefix to determine type
},
}),
),
]);
},
});

const paymentInfo = await this.client.Billing._getPaymentInfo('primary');

expect(paymentInfo).to.deep.equal(['credit_cards', 'card_123']);

const paymentInfo2 = await this.client.Billing._getPaymentInfo('secondary');

expect(paymentInfo2).to.deep.equal(['bank_accounts', 'bank_123']);
});
});

0 comments on commit 93737bf

Please sign in to comment.