Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Given a version number MAJOR.MINOR.PATCH, increment:


## [Unreleased]
### Added
- Tax as a valid payment request

## [2.24.1] - 2024-05-09
### Changed
Expand Down
7 changes: 6 additions & 1 deletion sdk/paymentRequest/paymentRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { Transaction } = require('../transaction/transaction.js');
const { Transfer } = require('../transfer/transfer.js');
const { UtilityPayment } = require('../utilityPayment/utilityPayment.js');
const { BrcodePayment } = require('../brcodePayment/brcodePayment.js');
const { TaxPayment } = require('../taxPayment/taxPayment.js');
const rest = require('../utils/rest.js');
const check = require('starkcore').check;
const Resource = require('starkcore').Resource;
Expand Down Expand Up @@ -68,7 +69,8 @@ const parsePayment = function (payment, type) {
', transaction' +
', boleto-payment' +
', brcode-payment' +
'or utility-payment';
', tax-payment' +
' or utility-payment';
}

if (payment instanceof Transfer)
Expand All @@ -81,6 +83,8 @@ const parsePayment = function (payment, type) {
type = 'brcode-payment';
if (payment instanceof UtilityPayment)
type = 'utility-payment';
if (payment instanceof TaxPayment)
type = 'tax-payment';

if (type)
return { 'payment': payment, 'type': type };
Expand All @@ -91,6 +95,7 @@ const parsePayment = function (payment, type) {
', a starkbank.Transaction' +
', a starkbank.BoletoPayment' +
', a starkbank.BrcodePayment' +
', a starkbank.TaxPayment' +
' or a starkbank.UtilityPayment' +
', but not a ' + typeof (payment)
);
Expand Down