Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Support TaxWithholdingEvents in financial events
Browse files Browse the repository at this point in the history
  • Loading branch information
tusbar committed Jan 8, 2021
1 parent 3b4ac89 commit ef5c18e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions __tests__/lib/client/models/__snapshots__/finances.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,7 @@ Object {
],
},
],
"taxWithholdingEventList": Array [],
"tdsReimbursementEventList": Array [
Object {
"postedDate": 1969-07-21T02:56:03.000Z,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ Object {
],
},
],
"taxWithholdingEventList": Array [],
"tdsReimbursementEventList": Array [],
},
"nextToken": null,
Expand Down Expand Up @@ -502,6 +503,7 @@ Object {
],
},
],
"taxWithholdingEventList": Array [],
"tdsReimbursementEventList": Array [
Object {
"postedDate": 2019-08-01T16:18:15.000Z,
Expand Down Expand Up @@ -704,6 +706,7 @@ Object {
],
"serviceProviderCreditEventList": Array [],
"shipmentEventList": Array [],
"taxWithholdingEventList": Array [],
"tdsReimbursementEventList": Array [],
},
"nextToken": "e21hcmtldHBsYWNlSWQ6bnVsbCxtYXhSZXN1bHRzUGVyUGFnZTowLHNlYXJjaFF1ZXJ5Q2hlY2tzdW06bnVsbCxxdWVyeVBhZ2luYXRpb25Ub2tlbjoidDB3V25MNXFLWkRIZ2p5ZzB3ZHRWODVnV0htVExVMkM0XzlsMHpRMG9HVXFZOVhTdjFyWUNWUE8teGxWRnF3N0ZyaDIyY3lQX0VTOXYxendQNUVvc0t0V1NKM1YyQkRJdWcyWFpXdm1KVmdPVktBdzNIMXUyVHBiTGoxVmRmY3Z6ZlU1WlpNaEpsQ0RKUnYxRk16am13Y1YyQ1BoOXNWMU1xNUZqamxUMlRCeFBkSjdEa3BkbENISElVZ094aHVTN3ZfZlFCUWYyWWJYZ2l3NHNxZXkwNnQyaVBucm5PdnAzRTdKbW4xcnc1UTlaTGV1Ymk5WUV6UGJ6UnhjRmh2VUFKdlQ5U2U3eERIdHVMUzNJVWFRODBubVhja3JLeWt3dVZKeWZXQm5CY3p0bjZTbVRHenJmZ1VOanFMWFFNT2giLHNlYXJjaFF1ZXJ5Om51bGwsdG9rZW5DcmVhdGlvbkRhdGU6MTQ4NTg2MjY5ODI1NCxzZWxsZXJJZDoiQTM1SlMxREpITjdGViJ9",
Expand Down
4 changes: 4 additions & 0 deletions lib/client/parsers/finances/financial-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const parseAffordabilityExpenseEvent = require('./affordability-expense-event')
const parseAffordabilityExpenseReversalEvent = require('./affordability-expense-reversal-event')
const parseNetworkComminglingTransactionEvent = require('./network-commingling-transaction-event')
const parseTDSReimbursementEvent = require('./tds-reimbursement-event')
const parseTaxWithholdingEvent = require('./tax-withholding-event')

module.exports = (key, node) => ({
shipmentEventList: select(`${key}/finances:ShipmentEventList/finances:ShipmentEvent`, node).map(n => {
Expand Down Expand Up @@ -95,5 +96,8 @@ module.exports = (key, node) => ({
}),
tdsReimbursementEventList: select(`${key}/finances:TDSReimbursementEventList/finances:TDSReimbursementEvent`, node).map(n => {
return parseTDSReimbursementEvent('.', n)
}),
taxWithholdingEventList: select(`${key}/finances:TaxWithholdingEventList/finances:TaxWithholdingEvent`, node).map(n => {
return parseTaxWithholdingEvent('.', n)
})
})
13 changes: 13 additions & 0 deletions lib/client/parsers/finances/tax-withholding-event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const nullable = require('../nullable')

const {parseDate} = require('../base')

const parseCurrencyAmount = require('./currency-amount')
const parseTaxWithholdingPeriod = require('./tax-withholding-period')

module.exports = (key, node) => ({
baseAmount: nullable(parseCurrencyAmount, `${key}/finances:BaseAmount`, node),
withheldAmount: nullable(parseCurrencyAmount, `${key}/finances:WithheldAmount`, node),
postedDate: parseDate(`${key}/finances:PostedDate`, node),
taxWithholdingPeriod: nullable(parseTaxWithholdingPeriod, `${key}/finances:TaxWithholdingPeriod`, node)
})
6 changes: 6 additions & 0 deletions lib/client/parsers/finances/tax-withholding-period.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const {parseNumber} = require('../base')

module.exports = (key, node) => ({
startDateMillis: parseNumber(`${key}/finances:StartDateMillis`, node),
endDateMillis: parseNumber(`${key}/finances:EndDateMillis`, node)
})

0 comments on commit ef5c18e

Please sign in to comment.