Skip to content

Commit e1664e3

Browse files
committed
fix: billing account data format
ref issue #636
1 parent 244f0d6 commit e1664e3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/routes/billingAccounts/get.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ chai.should();
1212

1313
// demo data which might be returned by the `SalesforceService.query`
1414
const billingAccountData = {
15-
sfBillingAccountId: '123',
1615
tcBillingAccountId: 123123,
17-
name: 'Billing Account 1',
18-
startDate: '2021-02-10T18:51:27Z',
19-
endDate: '2021-03-10T18:51:27Z',
16+
markup: '12',
2017
};
2118

2219
describe('Project Billing Accounts list', () => {

src/services/salesforceService.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ class SalesforceService {
9696
logger.debug(_.get(res, 'data.records', []));
9797
}
9898
const billingAccounts = _.get(res, 'data.records', []).map(o => ({
99-
tcBillingAccountId: _.get(o, 'TopCoder_Billing_Account_Id__c'),
99+
tcBillingAccountId: util.parseIntStrictly(
100+
_.get(o, 'TopCoder_Billing_Account_Id__c'),
101+
10,
102+
null, // fallback to null if cannot parse
103+
),
100104
markup: _.get(o, 'Mark_Up__c'),
101105
}));
102106
return billingAccounts.length > 0 ? billingAccounts[0] : {};

0 commit comments

Comments
 (0)