Skip to content

Commit

Permalink
Add missing properties to BoletoPayment, DarfPayment and TaxPayment r…
Browse files Browse the repository at this point in the history
…esources
  • Loading branch information
massaru-stark committed Nov 12, 2021
1 parent dd09128 commit 3637462
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Given a version number MAJOR.MINOR.PATCH, increment:


## [Unreleased]
### Added
- 'transactionIds' property to BoletoPayment and TaxPayment resources
- 'fee', 'transactionIds', 'created' and 'updated' properties to DarfPayment resource

## [2.9.2] - 2021-11-10
### Changed
Expand Down
6 changes: 4 additions & 2 deletions sdk/boletoPayment/boletoPayment.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ class BoletoPayment extends Resource {
* Attributes (return-only):
* @param id [string, default null]: unique id returned when payment is created. ex: '5656565656565656'
* @param status [string, default null]: current payment status. ex: 'success' or 'failed'
* @param transactionIds [list of strings, default null]: ledger transaction ids linked to this BoletoPayment. ex: ['19827356981273']
* @param fee [integer, default null]: fee charged when boleto payment is created. ex: 200 (= R$ 2.00)
* @param created [string, default null]: creation datetime for the payment. ex: '2020-03-10 10:30:00.000'
*
*/
constructor({ taxId, description, scheduled, line, barCode, tags, id, status, amount, fee, created }) {
constructor({ taxId, description, scheduled, line, barCode, tags, id, status, amount, transactionIds, fee, created }) {
super(id);
this.taxId = taxId;
this.description = description;
Expand All @@ -42,8 +43,9 @@ class BoletoPayment extends Resource {
this.tags = tags;
this.status = status;
this.amount = amount;
this.transactionIds = transactionIds;
this.fee = fee;
this.created = created;
this.created = check.date(created);
}
}

Expand Down
40 changes: 39 additions & 1 deletion sdk/darfPayment/darfPayment.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,43 @@ const Resource = require('../utils/resource').Resource;

class DarfPayment extends Resource {

/**
*
* TaxPayment object
*
* @description When you initialize a DarfPayment, the entity will not be automatically
* created in the Stark Bank API. The 'create' function sends the objects
* to the Stark Bank API and returns the list of created objects.
*
* Parameters (required):
* @param description [string]: Text to be displayed in your statement (min. 10 characters). ex: "payment ABC"
* @param revenueCode [string]: 4-digit tax code assigned by Federal Revenue. ex: "5948"
* @param taxId [string]: tax id (formatted or unformatted) of the payer. ex: "12.345.678/0001-95"
* @param competence [string]: competence month of the service. ex: ex: '2020-03-10'
* @param nominalAmount [int]: amount due in cents without fee or interest. ex: 23456 (= R$ 234.56)
* @param fineAmount [int]: fixed amount due in cents for fines. ex: 234 (= R$ 2.34)
* @param interestAmount [int]: amount due in cents for interest. ex: 456 (= R$ 4.56)
* @param due [string]: due date for payment. ex: ex: '2020-03-10'
*
* Parameters (optional):
* @param referenceNumber [string]: number assigned to the region of the tax. ex: "08.1.17.00-4"
* @param scheduled [string, default today]: payment scheduled date. ex: '2020-03-10'
* @param tags [list of strings]: list of strings for tagging
*
* Attributes (return-only):
* @param id [string, default null]: unique id returned when payment is created. ex: "5656565656565656"
* @param status [string, default null]: current payment status. ex: "success" or "failed"
* @param amount [int, default null]: Total amount due calculated from other amounts. ex: 24146 (= R$ 241.46)
* @param fee [integer, default null]: fee charged when the DarfPayment is processed. ex: 0 (= R$ 0.00)
* @param transactionIds [list of strings, default null]: ledger transaction ids linked to this DarfPayment. ex: ['19827356981273']
* @param updated [string, default null]: latest update datetime for the payment. ex: '2020-03-10 10:30:00.000'
* @param created [string, default null]: creation datetime for the payment. ex: '2020-03-10 10:30:00.000'
*
*/
constructor({
revenueCode, taxId, competence, referenceNumber, fineAmount, interestAmount,
due, description, tags, scheduled, status, amount, nominalAmount, id
due, description, tags, scheduled, status, amount, nominalAmount, fee,
transactionIds, updated, created, id
}) {
super(id);
this.revenueCode = revenueCode;
Expand All @@ -22,6 +56,10 @@ class DarfPayment extends Resource {
this.status = status;
this.amount = amount;
this.nominalAmount = nominalAmount;
this.transactionIds = transactionIds;
this.fee = fee;
this.updated = check.date(updated);
this.created = check.date(created);
}
}

Expand Down
4 changes: 3 additions & 1 deletion sdk/taxPayment/taxPayment.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ class TaxPayment extends Resource {
* @param status [string, default null]: current payment status. ex: 'success' or 'failed'
* @param amount [int, default null]: amount automatically calculated from line or bar_code. ex: 23456 (= R$ 234.56)
* @param fee [integer, default null]: fee charged when the tax payment is created. ex: 200 (= R$ 2.00)
* @param transactionIds [list of strings, default null]: ledger transaction ids linked to this TaxPayment. ex: ['19827356981273']
* @param updated [string, default null]: latest update datetime for the payment. ex: '2020-03-10 10:30:00.000'
* @param created [string, default null]: creation datetime for the payment. ex: '2020-03-10 10:30:00.000'
*
*/
constructor({
description, scheduled, line, barCode, tags,
amount, status, type, updated, created, fee, id,
amount, status, type, transactionIds, updated, created, fee, id,
}) {
super(id);
this.barCode = barCode;
Expand All @@ -46,6 +47,7 @@ class TaxPayment extends Resource {
this.amount = amount;
this.status = status;
this.type = type;
this.transactionIds = transactionIds;
this.updated = updated;
this.created = created;
this.fee = fee;
Expand Down

0 comments on commit 3637462

Please sign in to comment.