Skip to content

Commit

Permalink
fix: custom agg json serializer (#1502)
Browse files Browse the repository at this point in the history
* fix: remove json parse

* fix: tests
  • Loading branch information
keellyp authored May 16, 2024
1 parent 0e4538c commit b6e5288
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions src/core/serializers/__tests__/serializePlanInput.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,14 +786,8 @@ describe('serializePlanInput()', () => {
perTransactionMaxAmount: undefined,
rate: '5',
volumeRanges: undefined,
customProperties: {
ranges: [
{ from: 0, to: 100, thirdPart: '0.13', firstPart: '0.12' },
{ from: 101, to: 2000, thirdPart: '0.10', firstPart: '0.09' },
{ from: 2001, to: 5000, thirdPart: '0.08', firstPart: '0.07' },
{ from: 5001, to: null, thirdPart: '0.06', firstPart: '0.05' },
],
},
customProperties:
'{"ranges":[{"from":0,"to":100,"thirdPart":"0.13","firstPart":"0.12"},{"from":101,"to":2000,"thirdPart":"0.10","firstPart":"0.09"},{"from":2001,"to":5000,"thirdPart":"0.08","firstPart":"0.07"},{"from":5001,"to":null,"thirdPart":"0.06","firstPart":"0.05"}]}',
},
taxCodes: [],
},
Expand Down
2 changes: 1 addition & 1 deletion src/core/serializers/serializePlanInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const serializeProperties = (properties: Properties, chargeModel: ChargeModelEnu
}
: { perTransactionMinAmount: undefined, perTransactionMaxAmount: undefined }),
...(chargeModel === ChargeModelEnum.Custom
? { customProperties: JSON.parse(properties?.customProperties) }
? { customProperties: properties?.customProperties }
: { customProperties: undefined }),
}
}
Expand Down

0 comments on commit b6e5288

Please sign in to comment.