From c945e4ca44d71992260ca34fa3cc5573cd4b816e Mon Sep 17 00:00:00 2001 From: Lucas Miranda Date: Thu, 18 Jun 2026 11:25:38 -0300 Subject: [PATCH 1/7] Change IssuingPurchase to add installmentCount field --- CHANGELOG.md | 2 + .../java/com/starkinfra/IssuingPurchase.java | 103 ++++++++++-------- src/test/java/TestIssuingPurchase.java | 55 +++++++--- 3 files changed, 97 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f0df34..1216578 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ Given a version number MAJOR.MINOR.PATCH, increment: ## [Unreleased] +### Added +- installmentCount attribute to IssuingPurchase resource ## [0.21.0] - 2026-05-28 ### Added diff --git a/src/main/java/com/starkinfra/IssuingPurchase.java b/src/main/java/com/starkinfra/IssuingPurchase.java index 7f28a39..f29387f 100644 --- a/src/main/java/com/starkinfra/IssuingPurchase.java +++ b/src/main/java/com/starkinfra/IssuingPurchase.java @@ -27,6 +27,7 @@ public final class IssuingPurchase extends Resource { * cardId [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * cardEnding [string]: last 4 digits of the card number. ex: "1234" * purpose [string]: purchase purpose. ex: "purchase" + * installmentCount [integer]: quantity of installments. Minimum = 1. ex: 12 * amount [Long]: IssuingPurchase value in cents. Minimum = 0. ex: 1234 (= R$ 12.34) * tax [Long]: IOF amount taxed for international purchases. ex: 1234 (= R$ 12.34) * issuerAmount [Long]: issuer amount. ex: 1234 (= R$ 12.34) @@ -72,6 +73,7 @@ public final class IssuingPurchase extends Resource { public String cardId; public String cardEnding; public String purpose; + public Integer installmentCount; public Long amount; public Long tax; public Long issuerAmount; @@ -116,6 +118,7 @@ public final class IssuingPurchase extends Resource { * @param cardId [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * @param cardEnding [string]: last 4 digits of the card number. ex: "1234" * @param purpose [string]: purchase purpose. ex: "purchase" + * @param installmentCount [integer]: quantity of installments. Minimum = 1. ex: 12 * @param amount [Long]: IssuingPurchase value in cents. Minimum = 0. ex: 1234 (= R$ 12.34) * @param tax [Long]: IOF amount taxed for international purchases. ex: 1234 (= R$ 12.34) * @param issuerAmount [Long]: issuer amount. ex: 1234 (= R$ 12.34) @@ -151,7 +154,7 @@ public final class IssuingPurchase extends Resource { * @param holderId [string]: card holder ID. ex: "5656565656565656" * @param holderTags [list of strings]: tags of the IssuingHolder responsible for this purchase. ex: ["technology", "john snow"] */ - public IssuingPurchase(String id, String holderName, String productId, String cardId, String cardEnding, String purpose, Long amount, + public IssuingPurchase(String id, String holderName, String productId, String cardId, String cardEnding, String purpose, Integer installmentCount, Long amount, Long tax, Long issuerAmount, String issuerCurrencyCode, String issuerCurrencySymbol, Long merchantAmount, String merchantCurrencyCode, String merchantCurrencySymbol, String merchantCategoryCode,String merchantCategoryType, String merchantCountryCode, String acquirerId, String merchantId, @@ -165,6 +168,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca this.cardId = cardId; this.cardEnding = cardEnding; this.purpose = purpose; + this.installmentCount = installmentCount; this.amount = amount; this.tax = tax; this.issuerAmount = issuerAmount; @@ -209,6 +213,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca * cardId [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * cardEnding [string]: last 4 digits of the card number. ex: "1234" * purpose [string]: purchase purpose. ex: "purchase" + * installmentCount [integer]: quantity of installments. Minimum = 1. ex: 12 * amount [Long]: IssuingPurchase value in cents. Minimum = 0. ex: 1234 (= R$ 12.34) * tax [Long]: IOF amount taxed for international purchases. ex: 1234 (= R$ 12.34) * issuerAmount [Long]: issuer amount. ex: 1234 (= R$ 12.34) @@ -246,46 +251,48 @@ public IssuingPurchase(String id, String holderName, String productId, String ca * holderTags [list of strings]: tags of the IssuingHolder responsible for this purchase. ex: ["technology", "john snow"] * @throws Exception error in the request */ + @SuppressWarnings("unchecked") public IssuingPurchase(Map data) throws Exception { super(null); HashMap dataCopy = new HashMap<>(data); - this.holderName = null; - this.productId = null; - this.cardId = null; - this.cardEnding = null; - this.purpose = null; - this.amount = null; - this.tax = null; - this.issuerAmount = null; - this.issuerCurrencyCode = null; - this.issuerCurrencySymbol = null; - this.merchantAmount = null; - this.merchantCurrencyCode = null; - this.merchantCurrencySymbol = null; - this.merchantCategoryCode = null; - this.merchantCategoryType = null; - this.merchantCountryCode = null; - this.acquirerId = null; - this.merchantId = null; - this.merchantName = null; - this.merchantFee = null; - this.walletId = null; - this.methodCode = null; - this.score = null; - this.issuingTransactionIds = null; - this.endToEndId = null; - this.status = null; - this.description = null; - this.metadata = null; - this.zipCode = null; - this.tags = null; - this.updated = null; - this.created = null; - this.isPartialAllowed = null; - this.cardTags = null; - this.holderId = null; - this.holderTags = null; + this.holderName = (String) dataCopy.remove("holderName"); + this.productId = (String) dataCopy.remove("productId"); + this.cardId = (String) dataCopy.remove("cardId"); + this.cardEnding = (String) dataCopy.remove("cardEnding"); + this.purpose = (String) dataCopy.remove("purpose"); + this.installmentCount = (Integer) dataCopy.remove("installmentCount"); + this.amount = (Long) dataCopy.remove("amount"); + this.tax = (Long) dataCopy.remove("tax"); + this.issuerAmount = (Long) dataCopy.remove("issuerAmount"); + this.issuerCurrencyCode = (String) dataCopy.remove("issuerCurrencyCode"); + this.issuerCurrencySymbol = (String) dataCopy.remove("issuerCurrencySymbol"); + this.merchantAmount = (Long) dataCopy.remove("merchantAmount"); + this.merchantCurrencyCode = (String) dataCopy.remove("merchantCurrencyCode"); + this.merchantCurrencySymbol = (String) dataCopy.remove("merchantCurrencySymbol"); + this.merchantCategoryCode = (String) dataCopy.remove("merchantCategoryCode"); + this.merchantCategoryType = (String) dataCopy.remove("merchantCategoryType"); + this.merchantCountryCode = (String) dataCopy.remove("merchantCountryCode"); + this.acquirerId = (String) dataCopy.remove("acquirerId"); + this.merchantId = (String) dataCopy.remove("merchantId"); + this.merchantName = (String) dataCopy.remove("merchantName"); + this.merchantFee = (Long) dataCopy.remove("merchantFee"); + this.walletId = (String) dataCopy.remove("walletId"); + this.methodCode = (String) dataCopy.remove("methodCode"); + this.score = (Number) dataCopy.remove("score"); + this.issuingTransactionIds = (String[]) dataCopy.remove("issuingTransactionIds"); + this.endToEndId = (String) dataCopy.remove("endToEndId"); + this.status = (String) dataCopy.remove("status"); + this.description = (String) dataCopy.remove("description"); + this.metadata = (HashMap) dataCopy.remove("metadata"); + this.zipCode = (String) dataCopy.remove("zipCode"); + this.tags = (String[]) dataCopy.remove("tags"); + this.updated = (String) dataCopy.remove("updated"); + this.created = (String) dataCopy.remove("created"); + this.isPartialAllowed = (Boolean) dataCopy.remove("isPartialAllowed"); + this.cardTags = (String[]) dataCopy.remove("cardTags"); + this.holderId = (String) dataCopy.remove("holderId"); + this.holderTags = (String[]) dataCopy.remove("holderTags"); if (!dataCopy.isEmpty()) { throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]"); @@ -322,7 +329,7 @@ public static IssuingPurchase get(String id, User user) throws Exception{ * @throws Exception error in the request */ public static IssuingPurchase get(String id) throws Exception{ - return Rest.getId(data, id, null); + return IssuingPurchase.get(id, null); } /** @@ -373,7 +380,7 @@ public static Generator query(Map params, User * @throws Exception error in the request */ public static Generator query(Map params) throws Exception{ - return Rest.getStream(data, params, null); + return IssuingPurchase.query(params, null); } /** @@ -389,7 +396,7 @@ public static Generator query(Map params) throw * @throws Exception error in the request */ public static Generator query(User user) throws Exception{ - return Rest.getStream(data, new HashMap<>(), user); + return IssuingPurchase.query(new HashMap<>(), user); } /** @@ -402,15 +409,15 @@ public static Generator query(User user) throws Exception{ * @throws Exception error in the request */ public static Generator query() throws Exception{ - return Rest.getStream(data, new HashMap<>(), null); + return IssuingPurchase.query(new HashMap<>(), null); } public final static class Page { - public List issuingPurchases; + public List purchases; public String cursor; - public Page(List issuingPurchases, String cursor) { - this.issuingPurchases = issuingPurchases; + public Page(List purchases, String cursor) { + this.purchases = purchases; this.cursor = cursor; } } @@ -499,11 +506,11 @@ public static IssuingPurchase.Page page(User user) throws Exception { */ public static IssuingPurchase.Page page(Map params, User user) throws Exception { com.starkcore.utils.Page page = Rest.getPage(data, params, user); - List issuingPurchases = new ArrayList<>(); - for (SubResource issuingPurchase: page.entities) { - issuingPurchases.add((IssuingPurchase) issuingPurchase); + List purchases = new ArrayList<>(); + for (SubResource purchase: page.entities) { + purchases.add((IssuingPurchase) purchase); } - return new IssuingPurchase.Page(issuingPurchases, page.cursor); + return new IssuingPurchase.Page(purchases, page.cursor); } /** diff --git a/src/test/java/TestIssuingPurchase.java b/src/test/java/TestIssuingPurchase.java index bb85698..024e544 100644 --- a/src/test/java/TestIssuingPurchase.java +++ b/src/test/java/TestIssuingPurchase.java @@ -1,11 +1,12 @@ -import com.starkinfra.IssuingCard; import org.junit.Test; import org.junit.Assert; +import static org.junit.Assert.assertThrows; + import com.starkinfra.Settings; import com.starkinfra.IssuingPurchase; import com.starkinfra.utils.Generator; -import com.starkinfra.error.InvalidSignatureError; +import com.starkcore.error.InvalidSignatureError; import java.util.List; import java.util.HashMap; @@ -26,7 +27,7 @@ public void testPage() throws Exception { List ids = new ArrayList<>(); for (int i = 0; i < 2; i++) { IssuingPurchase.Page page = IssuingPurchase.page(params); - for (IssuingPurchase purchase: page.issuingPurchases) { + for (IssuingPurchase purchase: page.purchases) { System.out.println(purchase); if (ids.contains(purchase.id)) { throw new Exception("repeated id"); @@ -53,13 +54,34 @@ public void testQueryGet() throws Exception { Generator purchases = IssuingPurchase.query(params); for (IssuingPurchase purchase : purchases) { - IssuingPurchase purchaseExpected = IssuingPurchase.get(purchase.id); - Assert.assertNotNull(purchase.id, purchaseExpected.id); + Assert.assertNotNull(purchase.id); + String id = IssuingPurchase.get(purchase.id).id; + Assert.assertEquals(id, purchase.id); Assert.assertEquals(HashMap.class, purchase.metadata.getClass()); + System.out.println(purchase.installmentCount); System.out.println(purchase); } } + @Test + public void testQueryInstallmentCount() throws Exception { + Settings.user = utils.User.defaultProject(); + + HashMap params = new HashMap<>(); + params.put("limit", 3); + Generator purchases = IssuingPurchase.query(params); + + int i = 0; + for (IssuingPurchase purchase : purchases) { + i += 1; + IssuingPurchase purchaseExpected = IssuingPurchase.get(purchase.id); + Assert.assertNotNull(purchaseExpected.id); + System.out.println(purchaseExpected.installmentCount); + } + Assert.assertTrue(i > 0); + } + + @Test public void testLogQueryAndGet() throws Exception{ Settings.user = utils.User.defaultProject(); @@ -68,10 +90,15 @@ public void testLogQueryAndGet() throws Exception{ params.put("limit", 3); Generator logs = IssuingPurchase.Log.query(params); + int i = 0; for (IssuingPurchase.Log log : logs) { + i += 1; log = IssuingPurchase.Log.get(log.id); + Assert.assertNotNull(log.id); + Assert.assertNotNull(log.purchase.id); System.out.println(log); } + Assert.assertTrue(i > 0); } @Test @@ -132,12 +159,11 @@ public void testParseMalformedSignature() throws Exception{ String malformedSignature = "something is definitely wrong"; Settings.user = utils.User.defaultProject(); - try{ + InvalidSignatureError invalidSignatureError = assertThrows(InvalidSignatureError.class, () -> { IssuingPurchase.parse(content, malformedSignature); - throw new Error("Signature incorrectly validated"); - } catch (InvalidSignatureError e){ - System.out.println("Signature correctly rejected"); - } + }); + + Assert.assertEquals("The provided signature is not valid", invalidSignatureError.getMessage()); } @Test @@ -146,12 +172,11 @@ public void testParseInvalidSignature() throws Exception{ String invalidSignature = "MEUCIQDOpo1j+V40pNZK2URL2786UQK/8mDXon9ayEd8U0/l7AIgYXtIZJBTs8zCRR3vmted6Ehz/qfw1GRut/eYyvf1yOk="; Settings.user = utils.User.defaultProject(); - try{ + InvalidSignatureError invalidSignatureError = assertThrows(InvalidSignatureError.class, () -> { IssuingPurchase.parse(content, invalidSignature); - throw new Error("Signature incorrectly validated"); - } catch (InvalidSignatureError e){ - System.out.println("Signature correctly rejected"); - } + }); + + Assert.assertEquals("The provided signature and content do not match the Stark Infra public key", invalidSignatureError.getMessage()); } static IssuingPurchase example() throws Exception{ From cd58a3c7f82f214337bba7985d29b026c12e154a Mon Sep 17 00:00:00 2001 From: Lucas Miranda Date: Thu, 18 Jun 2026 11:37:55 -0300 Subject: [PATCH 2/7] Add IssuingBillingInvoice resource --- CHANGELOG.md | 1 + README.md | 32 ++ .../com/starkinfra/IssuingBillingInvoice.java | 368 ++++++++++++++++++ src/test/java/TestIssuingBillingInvoice.java | 101 +++++ 4 files changed, 502 insertions(+) create mode 100644 src/main/java/com/starkinfra/IssuingBillingInvoice.java create mode 100644 src/test/java/TestIssuingBillingInvoice.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 1216578..9b343b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Given a version number MAJOR.MINOR.PATCH, increment: ## [Unreleased] ### Added +- IssuingBillingInvoice resource - installmentCount attribute to IssuingPurchase resource ## [0.21.0] - 2026-05-28 diff --git a/README.md b/README.md index ed3da3e..66d817a 100755 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ This SDK version is compatible with the Stark Infra API v2. - [Invoices](#create-issuinginvoices): Add money to your issuing balance - [Withdrawals](#create-issuingwithdrawals): Send money back to your Workspace from your issuing balance - [Balance](#get-your-issuingbalance): View your issuing balance + - [BillingInvoices](#query-issuingbillinginvoices): View the invoices charged to your issuing balance - [Transactions](#query-issuingtransactions): View the transactions that have affected your issuing balance - [Enums](#issuing-enums): Query enums related to the issuing purchases, such as merchant categories, countries and card purchase methods - [Pix](#Pix) @@ -649,6 +650,37 @@ IssuingDesign design = IssuingDesign.get("5747368922185728"); System.out.println(design); ``` +### Query IssuingBillingInvoices + +You can get a list of issuing billing invoices given some filters. + +```java +import com.starkinfra.*; +import com.starkinfra.utils.Generator; + +HashMap params = new HashMap<>(); +params.put("limit", 3); +params.put("after", "2019-04-01"); +params.put("before", "2030-04-30"); +Generator invoices = IssuingBillingInvoice.query(params); + +for (IssuingBillingInvoice invoice : invoices) { + System.out.println(invoice); +} +``` + +### Get an IssuingBillingInvoice + +Information on a single issuing billing invoice may be retrieved by its id. + +```java +import com.starkinfra.*; + +IssuingBillingInvoice invoice = IssuingBillingInvoice.get("5656565656565656"); + +System.out.println(invoice); +``` + ### Query IssuingEmbossingKits You can get a list of created embossing kits given some filters. diff --git a/src/main/java/com/starkinfra/IssuingBillingInvoice.java b/src/main/java/com/starkinfra/IssuingBillingInvoice.java new file mode 100644 index 0000000..976a652 --- /dev/null +++ b/src/main/java/com/starkinfra/IssuingBillingInvoice.java @@ -0,0 +1,368 @@ +package com.starkinfra; + +import com.starkinfra.utils.Rest; +import com.starkinfra.utils.Resource; +import com.starkinfra.utils.Generator; +import com.starkcore.utils.SubResource; + +import java.util.Map; +import java.util.List; +import java.util.HashMap; +import java.util.ArrayList; + + +public final class IssuingBillingInvoice extends Resource { + /** + * IssuingBillingInvoice object + *

+ * The IssuingBillingInvoice object displays the information of the invoices + * charged to your issuing balance. These objects are not created by the user, + * but are returned by the API when an invoice is generated and can be + * retrieved to see the information available. + *

+ * Parameters: + * id [string]: unique id returned when the IssuingBillingInvoice is created. ex: "5656565656565656" + * taxId [string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: "20.018.183/0001-80" + * name [string]: payer name. ex: "Iron Bank S.A." + * fine [number]: fine amount charged in cents. ex: 200 (= R$ 2.00) + * interest [number]: interest amount charged in cents. ex: 100 (= R$ 1.00) + * amount [Long]: invoice amount in cents. ex: 1234 (= R$ 12.34) + * nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) + * status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" + * brcode [string]: BR Code for the invoice payment. ex: "00020101021226930014br.gov.bcb.pix..." + * link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.com/invoice/123" + * due [string]: due datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * start [string]: billing cycle start datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * end [string]: billing cycle end datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * created [string]: creation datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * updated [string]: latest update datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * + */ + static ClassData data = new ClassData(IssuingBillingInvoice.class, "IssuingBillingInvoice"); + + public String taxId; + public String name; + public Number fine; + public Number interest; + public Long amount; + public Long nominalAmount; + public String status; + public String brcode; + public String link; + public String due; + public String start; + public String end; + public String created; + public String updated; + + /** + * IssuingBillingInvoice object + *

+ * The IssuingBillingInvoice object displays the information of the invoices + * charged to your issuing balance. These objects are not created by the user, + * but are returned by the API when an invoice is generated and can be + * retrieved to see the information available. + *

+ * Parameters: + * @param id [string]: unique id returned when the IssuingBillingInvoice is created. ex: "5656565656565656" + * @param taxId [string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: "20.018.183/0001-80" + * @param name [string]: payer name. ex: "Iron Bank S.A." + * @param fine [number]: fine amount charged in cents. ex: 200 (= R$ 2.00) + * @param interest [number]: interest amount charged in cents. ex: 100 (= R$ 1.00) + * @param amount [Long]: invoice amount in cents. ex: 1234 (= R$ 12.34) + * @param nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) + * @param status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" + * @param brcode [string]: BR Code for the invoice payment. ex: "00020101021226930014br.gov.bcb.pix..." + * @param link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.com/invoice/123" + * @param due [string]: due datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * @param start [string]: billing cycle start datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * @param end [string]: billing cycle end datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * @param created [string]: creation datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * @param updated [string]: latest update datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + */ + public IssuingBillingInvoice(String id, String taxId, String name, Number fine, Number interest, Long amount, + Long nominalAmount, String status, String brcode, String link, String due, + String start, String end, String created, String updated + ) { + super(id); + this.taxId = taxId; + this.name = name; + this.fine = fine; + this.interest = interest; + this.amount = amount; + this.nominalAmount = nominalAmount; + this.status = status; + this.brcode = brcode; + this.link = link; + this.due = due; + this.start = start; + this.end = end; + this.created = created; + this.updated = updated; + } + + /** + * IssuingBillingInvoice object + *

+ * The IssuingBillingInvoice object displays the information of the invoices + * charged to your issuing balance. These objects are not created by the user, + * but are returned by the API when an invoice is generated and can be + * retrieved to see the information available. + *

+ * Attributes (return-only): + * @param data map of properties for the IssuingBillingInvoice + * id [string]: unique id returned when the IssuingBillingInvoice is created. ex: "5656565656565656" + * taxId [string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: "20.018.183/0001-80" + * name [string]: payer name. ex: "Iron Bank S.A." + * fine [number]: fine amount charged in cents. ex: 200 (= R$ 2.00) + * interest [number]: interest amount charged in cents. ex: 100 (= R$ 1.00) + * amount [Long]: invoice amount in cents. ex: 1234 (= R$ 12.34) + * nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) + * status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" + * brcode [string]: BR Code for the invoice payment. ex: "00020101021226930014br.gov.bcb.pix..." + * link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.com/invoice/123" + * due [string]: due datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * start [string]: billing cycle start datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * end [string]: billing cycle end datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * created [string]: creation datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * updated [string]: latest update datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" + * @throws Exception error in the request + */ + public IssuingBillingInvoice(Map data) throws Exception { + super(null); + HashMap dataCopy = new HashMap<>(data); + + this.taxId = (String) dataCopy.remove("taxId"); + this.name = (String) dataCopy.remove("name"); + this.fine = (Number) dataCopy.remove("fine"); + this.interest = (Number) dataCopy.remove("interest"); + this.amount = (Long) dataCopy.remove("amount"); + this.nominalAmount = (Long) dataCopy.remove("nominalAmount"); + this.status = (String) dataCopy.remove("status"); + this.brcode = (String) dataCopy.remove("brcode"); + this.link = (String) dataCopy.remove("link"); + this.due = (String) dataCopy.remove("due"); + this.start = (String) dataCopy.remove("start"); + this.end = (String) dataCopy.remove("end"); + this.created = (String) dataCopy.remove("created"); + this.updated = (String) dataCopy.remove("updated"); + + if (!dataCopy.isEmpty()) { + throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]"); + } + } + + /** + * Retrieve a specific IssuingBillingInvoice + *

+ * Receive a single IssuingBillingInvoice object previously created in the Stark Infra API by passing its id + *

+ * Parameters: + * @param id [string]: object unique id. ex: "5656565656565656" + *

+ * Return: + * @return IssuingBillingInvoice object with updated attributes + * @throws Exception error in the request + */ + public static IssuingBillingInvoice get(String id) throws Exception { + return IssuingBillingInvoice.get(id, null); + } + + /** + * Retrieve a specific IssuingBillingInvoice + *

+ * Receive a single IssuingBillingInvoice object previously created in the Stark Infra API by passing its id + *

+ * Parameters: + * @param id [string]: object unique id. ex: "5656565656565656" + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return IssuingBillingInvoice object with updated attributes + * @throws Exception error in the request + */ + public static IssuingBillingInvoice get(String id, User user) throws Exception { + return Rest.getId(data, id, user); + } + + /** + * Retrieve IssuingBillingInvoices + *

+ * Receive a generator of IssuingBillingInvoice objects previously created in the Stark Infra API. + * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. + *

+ * Parameters: + * @param params parameters for the query + * limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35 + * after [string, default null]: date filter for objects created only after specified date. ex: "2020-04-29" + * before [string, default null]: date filter for objects created only before specified date. ex: "2020-04-30" + * status [list of strings, default null]: filter for status of retrieved objects. ex: "created" or "paid" + * tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"] + * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] + *

+ * Return: + * @return generator of IssuingBillingInvoice objects with updated attributes + * @throws Exception error in the request + */ + public static Generator query(Map params) throws Exception { + return IssuingBillingInvoice.query(params, null); + } + + /** + * Retrieve IssuingBillingInvoices + *

+ * Receive a generator of IssuingBillingInvoice objects previously created in the Stark Infra API. + * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. + *

+ * Parameters: + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return generator of IssuingBillingInvoice objects with updated attributes + * @throws Exception error in the request + */ + public static Generator query(User user) throws Exception { + return IssuingBillingInvoice.query(new HashMap<>(), user); + } + + /** + * Retrieve IssuingBillingInvoices + *

+ * Receive a generator of IssuingBillingInvoice objects previously created in the Stark Infra API. + * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. + *

+ * Return: + * @return generator of IssuingBillingInvoice objects with updated attributes + * @throws Exception error in the request + */ + public static Generator query() throws Exception { + return IssuingBillingInvoice.query(new HashMap<>(), null); + } + + /** + * Retrieve IssuingBillingInvoices + *

+ * Receive a generator of IssuingBillingInvoice objects previously created in the Stark Infra API. + * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. + *

+ * Parameters: + * @param params map of parameters for the query + * limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35 + * after [string, default null]: date filter for objects created only after specified date. ex: "2020-04-29" + * before [string, default null]: date filter for objects created only before specified date. ex: "2020-04-30" + * status [list of strings, default null]: filter for status of retrieved objects. ex: "created" or "paid" + * tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"] + * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return generator of IssuingBillingInvoice objects with updated attributes + * @throws Exception error in the request + */ + public static Generator query(Map params, User user) throws Exception { + return Rest.getStream(data, params, user); + } + + public final static class Page { + public List invoices; + public String cursor; + + public Page(List invoices, String cursor) { + this.invoices = invoices; + this.cursor = cursor; + } + } + + /** + * Retrieve paged IssuingBillingInvoices + *

+ * Receive a list of up to 100 IssuingBillingInvoice objects previously created in the Stark Infra API and the cursor to the next page. + * Use this function instead of query if you want to manually page your requests. + *

+ * Parameters: + * @param params map of parameters for the query + * cursor [string, default null]: cursor returned on the previous page function call + * limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 35 + * after [string, default null]: date filter for objects created only after specified date. ex: "2020-04-29" + * before [string, default null]: date filter for objects created only before specified date. ex: "2020-04-30" + * status [list of strings, default null]: filter for status of retrieved objects. ex: "created" or "paid" + * tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"] + * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] + *

+ * Return: + * @return IssuingBillingInvoice.Page object: + * IssuingBillingInvoice.Page.invoices: list of IssuingBillingInvoice objects with updated attributes + * IssuingBillingInvoice.Page.cursor: cursor to retrieve the next page of IssuingBillingInvoice objects + * @throws Exception error in the request + */ + public static Page page(Map params) throws Exception { + return page(params, null); + } + + /** + * Retrieve paged IssuingBillingInvoices + *

+ * Receive a list of up to 100 IssuingBillingInvoice objects previously created in the Stark Infra API and the cursor to the next page. + * Use this function instead of query if you want to manually page your requests. + *

+ * Parameters: + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return IssuingBillingInvoice.Page object: + * IssuingBillingInvoice.Page.invoices: list of IssuingBillingInvoice objects with updated attributes + * IssuingBillingInvoice.Page.cursor: cursor to retrieve the next page of IssuingBillingInvoice objects + * @throws Exception error in the request + */ + public static Page page(User user) throws Exception { + return page(new HashMap<>(), user); + } + + /** + * Retrieve paged IssuingBillingInvoices + *

+ * Receive a list of up to 100 IssuingBillingInvoice objects previously created in the Stark Infra API and the cursor to the next page. + * Use this function instead of query if you want to manually page your requests. + *

+ * Return: + * @return IssuingBillingInvoice.Page object: + * IssuingBillingInvoice.Page.invoices: list of IssuingBillingInvoice objects with updated attributes + * IssuingBillingInvoice.Page.cursor: cursor to retrieve the next page of IssuingBillingInvoice objects + * @throws Exception error in the request + */ + public static Page page() throws Exception { + return page(new HashMap<>(), null); + } + + /** + * Retrieve paged IssuingBillingInvoices + *

+ * Receive a list of up to 100 IssuingBillingInvoice objects previously created in the Stark Infra API and the cursor to the next page. + * Use this function instead of query if you want to manually page your requests. + *

+ * Parameters: + * @param params map of parameters for the query + * cursor [string, default null]: cursor returned on the previous page function call + * limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 35 + * after [string, default null]: date filter for objects created only after specified date. ex: "2020-04-29" + * before [string, default null]: date filter for objects created only before specified date. ex: "2020-04-30" + * status [list of strings, default null]: filter for status of retrieved objects. ex: "created" or "paid" + * tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"] + * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return IssuingBillingInvoice.Page object: + * IssuingBillingInvoice.Page.invoices: list of IssuingBillingInvoice objects with updated attributes + * IssuingBillingInvoice.Page.cursor: cursor to retrieve the next page of IssuingBillingInvoice objects + * @throws Exception error in the request + */ + public static Page page(Map params, User user) throws Exception { + com.starkcore.utils.Page page = Rest.getPage(data, params, user); + List invoices = new ArrayList<>(); + for (SubResource invoice: page.entities) { + invoices.add((IssuingBillingInvoice) invoice); + } + return new Page(invoices, page.cursor); + } +} diff --git a/src/test/java/TestIssuingBillingInvoice.java b/src/test/java/TestIssuingBillingInvoice.java new file mode 100644 index 0000000..98ff6b0 --- /dev/null +++ b/src/test/java/TestIssuingBillingInvoice.java @@ -0,0 +1,101 @@ +import org.junit.Test; + +import com.starkinfra.Settings; +import com.starkinfra.IssuingBillingInvoice; +import com.starkinfra.utils.Generator; + +import java.util.List; +import java.util.HashMap; +import java.util.ArrayList; +import java.util.Collections; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + + +public class TestIssuingBillingInvoice { + + @Test + public void testQueryGet() throws Exception { + Settings.user = utils.User.defaultProject(); + + HashMap params = new HashMap<>(); + params.put("limit", 3); + params.put("after", "2019-04-01"); + params.put("before", "2030-04-30"); + Generator invoices = IssuingBillingInvoice.query(params); + + int i = 0; + for (IssuingBillingInvoice invoice : invoices) { + i += 1; + invoice = IssuingBillingInvoice.get(invoice.id); + assertNotNull(invoice.id); + } + assertTrue(i > 0); + } + + @Test + public void testQueryIds() throws Exception { + Settings.user = utils.User.defaultProject(); + + HashMap params = new HashMap<>(); + params.put("limit", 10); + Generator invoices = IssuingBillingInvoice.query(params); + + int i = 0; + ArrayList invoiceIdsExpected = new ArrayList<>(); + for (IssuingBillingInvoice invoice : invoices) { + i += 1; + assertNotNull(invoice.id); + invoiceIdsExpected.add(invoice.id); + } + + params.put("ids", invoiceIdsExpected.toArray(new String[0])); + Generator invoicesResult = IssuingBillingInvoice.query(params); + + int n = 0; + ArrayList invoiceIdsResult = new ArrayList<>(); + for (IssuingBillingInvoice invoice : invoicesResult) { + n += 1; + assertNotNull(invoice.id); + invoiceIdsResult.add(invoice.id); + } + + Collections.sort(invoiceIdsExpected); + Collections.sort(invoiceIdsResult); + assertTrue(i > 0); + assertTrue(n > 0); + assertEquals(invoiceIdsExpected, invoiceIdsResult); + } + + @Test + public void testPage() throws Exception { + Settings.user = utils.User.defaultProject(); + + HashMap params = new HashMap<>(); + params.put("limit", 2); + params.put("after", "2019-04-01"); + params.put("before", "2030-04-30"); + params.put("cursor", null); + + List ids = new ArrayList<>(); + for (int i = 0; i < 2; i++) { + IssuingBillingInvoice.Page page = IssuingBillingInvoice.page(params); + for (IssuingBillingInvoice invoice : page.invoices) { + if (ids.contains(invoice.id)) { + throw new Exception("repeated id"); + } + ids.add(invoice.id); + } + if (page.cursor == null) { + break; + } + params.put("cursor", page.cursor); + } + + if (ids.size() != 4) { + throw new Exception("ids.size() != 4"); + } + } +} From c6086857eff9a5468c35616cb2bc85126eeccedf Mon Sep 17 00:00:00 2001 From: Lucas Miranda Date: Thu, 18 Jun 2026 14:39:49 -0300 Subject: [PATCH 3/7] Add IssuingBillingTransaction resource --- CHANGELOG.md | 1 + README.md | 20 ++ .../starkinfra/IssuingBillingTransaction.java | 338 ++++++++++++++++++ .../java/TestIssuingBillingTransaction.java | 92 +++++ 4 files changed, 451 insertions(+) create mode 100644 src/main/java/com/starkinfra/IssuingBillingTransaction.java create mode 100644 src/test/java/TestIssuingBillingTransaction.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b343b0..21020d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Given a version number MAJOR.MINOR.PATCH, increment: ## [Unreleased] ### Added - IssuingBillingInvoice resource +- IssuingBillingTransaction resource - installmentCount attribute to IssuingPurchase resource ## [0.21.0] - 2026-05-28 diff --git a/README.md b/README.md index 66d817a..a34bee3 100755 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ This SDK version is compatible with the Stark Infra API v2. - [Withdrawals](#create-issuingwithdrawals): Send money back to your Workspace from your issuing balance - [Balance](#get-your-issuingbalance): View your issuing balance - [BillingInvoices](#query-issuingbillinginvoices): View the invoices charged to your issuing balance + - [BillingTransactions](#query-issuingbillingtransactions): View the transactions charged to your issuing balance - [Transactions](#query-issuingtransactions): View the transactions that have affected your issuing balance - [Enums](#issuing-enums): Query enums related to the issuing purchases, such as merchant categories, countries and card purchase methods - [Pix](#Pix) @@ -681,6 +682,25 @@ IssuingBillingInvoice invoice = IssuingBillingInvoice.get("5656565656565656"); System.out.println(invoice); ``` +### Query IssuingBillingTransactions + +You can get a list of issuing billing transactions given some filters. + +```java +import com.starkinfra.*; +import com.starkinfra.utils.Generator; + +HashMap params = new HashMap<>(); +params.put("limit", 3); +params.put("after", "2019-04-01"); +params.put("before", "2030-04-30"); +Generator transactions = IssuingBillingTransaction.query(params); + +for (IssuingBillingTransaction transaction : transactions) { + System.out.println(transaction); +} +``` + ### Query IssuingEmbossingKits You can get a list of created embossing kits given some filters. diff --git a/src/main/java/com/starkinfra/IssuingBillingTransaction.java b/src/main/java/com/starkinfra/IssuingBillingTransaction.java new file mode 100644 index 0000000..dc8056b --- /dev/null +++ b/src/main/java/com/starkinfra/IssuingBillingTransaction.java @@ -0,0 +1,338 @@ +package com.starkinfra; + +import com.starkinfra.utils.Rest; +import com.starkinfra.utils.Resource; +import com.starkinfra.utils.Generator; +import com.starkcore.utils.SubResource; + +import java.util.Map; +import java.util.List; +import java.util.HashMap; +import java.util.ArrayList; + + +public final class IssuingBillingTransaction extends Resource { + /** + * IssuingBillingTransaction object + *

+ * The IssuingBillingTransaction object displays the information of the + * transactions charged to your issuing balance. These objects are not created + * by the user, but are returned by the API when an invoice is generated and + * can be retrieved to see the information available. + *

+ * Parameters: + * id [string]: unique id returned when the IssuingBillingTransaction is created. ex: "5656565656565656" + * amount [Long]: transaction amount in cents. ex: 1234 (= R$ 12.34) + * invoiceId [string]: parent IssuingBillingInvoice id. May be null. ex: "5656565656565656" + * installment [integer]: installment number. ex: 1 + * installmentCount [integer]: total installment count. ex: 12 + * balance [Long]: remaining issuing balance in cents. ex: 1234 (= R$ 12.34) + * holderName [string]: card holder name. ex: "Tony Stark" + * source [string]: transaction source. ex: "purchase" + * externalId [string]: external transaction id. ex: "my-external-id-123456" + * description [string]: transaction description. ex: "Coffee shop" + * cardEnding [string]: last 4 digits of the card number. ex: "1234" + * tax [number]: tax amount charged in cents. ex: 100 (= R$ 1.00) + * rate [number]: tax rate as a percentage. ex: 1.5 + * merchantAmount [Long]: merchant amount in cents. ex: 1234 (= R$ 12.34) + * merchantCurrencyCode [string]: merchant currency code (ISO 4217). ex: "BRL" + * created [string]: creation datetime for the IssuingBillingTransaction. ex: "2020-03-10 10:30:00.000000+00:00" + * + */ + static ClassData data = new ClassData(IssuingBillingTransaction.class, "IssuingBillingTransaction"); + + public Long amount; + public String invoiceId; + public Integer installment; + public Integer installmentCount; + public Long balance; + public String holderName; + public String source; + public String externalId; + public String description; + public String cardEnding; + public Number tax; + public Number rate; + public Long merchantAmount; + public String merchantCurrencyCode; + public String created; + + /** + * IssuingBillingTransaction object + *

+ * The IssuingBillingTransaction object displays the information of the + * transactions charged to your issuing balance. These objects are not created + * by the user, but are returned by the API when an invoice is generated and + * can be retrieved to see the information available. + *

+ * Parameters: + * @param id [string]: unique id returned when the IssuingBillingTransaction is created. ex: "5656565656565656" + * @param amount [Long]: transaction amount in cents. ex: 1234 (= R$ 12.34) + * @param invoiceId [string]: parent IssuingBillingInvoice id. May be null. ex: "5656565656565656" + * @param installment [integer]: installment number. ex: 1 + * @param installmentCount [integer]: total installment count. ex: 12 + * @param balance [Long]: remaining issuing balance in cents. ex: 1234 (= R$ 12.34) + * @param holderName [string]: card holder name. ex: "Tony Stark" + * @param source [string]: transaction source. ex: "purchase" + * @param externalId [string]: external transaction id. ex: "my-external-id-123456" + * @param description [string]: transaction description. ex: "Coffee shop" + * @param cardEnding [string]: last 4 digits of the card number. ex: "1234" + * @param tax [number]: tax amount charged in cents. ex: 100 (= R$ 1.00) + * @param rate [number]: tax rate as a percentage. ex: 1.5 + * @param merchantAmount [Long]: merchant amount in cents. ex: 1234 (= R$ 12.34) + * @param merchantCurrencyCode [string]: merchant currency code (ISO 4217). ex: "BRL" + * @param created [string]: creation datetime for the IssuingBillingTransaction. ex: "2020-03-10 10:30:00.000000+00:00" + */ + public IssuingBillingTransaction(String id, Long amount, String invoiceId, Integer installment, + Integer installmentCount, Long balance, String holderName, String source, + String externalId, String description, String cardEnding, Number tax, + Number rate, Long merchantAmount, String merchantCurrencyCode, String created + ) { + super(id); + this.amount = amount; + this.invoiceId = invoiceId; + this.installment = installment; + this.installmentCount = installmentCount; + this.balance = balance; + this.holderName = holderName; + this.source = source; + this.externalId = externalId; + this.description = description; + this.cardEnding = cardEnding; + this.tax = tax; + this.rate = rate; + this.merchantAmount = merchantAmount; + this.merchantCurrencyCode = merchantCurrencyCode; + this.created = created; + } + + /** + * IssuingBillingTransaction object + *

+ * The IssuingBillingTransaction object displays the information of the + * transactions charged to your issuing balance. These objects are not created + * by the user, but are returned by the API when an invoice is generated and + * can be retrieved to see the information available. + *

+ * Attributes (return-only): + * @param data map of properties for the IssuingBillingTransaction + * id [string]: unique id returned when the IssuingBillingTransaction is created. ex: "5656565656565656" + * amount [Long]: transaction amount in cents. ex: 1234 (= R$ 12.34) + * invoiceId [string]: parent IssuingBillingInvoice id. May be null. ex: "5656565656565656" + * installment [integer]: installment number. ex: 1 + * installmentCount [integer]: total installment count. ex: 12 + * balance [Long]: remaining issuing balance in cents. ex: 1234 (= R$ 12.34) + * holderName [string]: card holder name. ex: "Tony Stark" + * source [string]: transaction source. ex: "purchase" + * externalId [string]: external transaction id. ex: "my-external-id-123456" + * description [string]: transaction description. ex: "Coffee shop" + * cardEnding [string]: last 4 digits of the card number. ex: "1234" + * tax [number]: tax amount charged in cents. ex: 100 (= R$ 1.00) + * rate [number]: tax rate as a percentage. ex: 1.5 + * merchantAmount [Long]: merchant amount in cents. ex: 1234 (= R$ 12.34) + * merchantCurrencyCode [string]: merchant currency code (ISO 4217). ex: "BRL" + * created [string]: creation datetime for the IssuingBillingTransaction. ex: "2020-03-10 10:30:00.000000+00:00" + * @throws Exception error in the request + */ + public IssuingBillingTransaction(Map data) throws Exception { + super(null); + HashMap dataCopy = new HashMap<>(data); + + this.amount = null; + this.invoiceId = null; + this.installment = null; + this.installmentCount = null; + this.balance = null; + this.holderName = null; + this.source = null; + this.externalId = null; + this.description = null; + this.cardEnding = null; + this.tax = null; + this.rate = null; + this.merchantAmount = null; + this.merchantCurrencyCode = null; + this.created = null; + + if (!dataCopy.isEmpty()) { + throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]"); + } + } + + /** + * Retrieve IssuingBillingTransactions + *

+ * Receive a generator of IssuingBillingTransaction objects previously created in the Stark Infra API. + * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. + *

+ * Parameters: + * @param params parameters for the query + * limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35 + * after [string, default null]: date filter for objects created only after specified date. ex: "2020-04-29" + * before [string, default null]: date filter for objects created only before specified date. ex: "2020-04-30" + * invoiceId [string, default null]: filter for transactions of a specific IssuingBillingInvoice. ex: "5656565656565656" + * tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"] + *

+ * Return: + * @return generator of IssuingBillingTransaction objects with updated attributes + * @throws Exception error in the request + */ + public static Generator query(Map params) throws Exception { + return IssuingBillingTransaction.query(params, null); + } + + /** + * Retrieve IssuingBillingTransactions + *

+ * Receive a generator of IssuingBillingTransaction objects previously created in the Stark Infra API. + * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. + *

+ * Parameters: + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return generator of IssuingBillingTransaction objects with updated attributes + * @throws Exception error in the request + */ + public static Generator query(User user) throws Exception { + return IssuingBillingTransaction.query(new HashMap<>(), user); + } + + /** + * Retrieve IssuingBillingTransactions + *

+ * Receive a generator of IssuingBillingTransaction objects previously created in the Stark Infra API. + * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. + *

+ * Return: + * @return generator of IssuingBillingTransaction objects with updated attributes + * @throws Exception error in the request + */ + public static Generator query() throws Exception { + return IssuingBillingTransaction.query(new HashMap<>(), null); + } + + /** + * Retrieve IssuingBillingTransactions + *

+ * Receive a generator of IssuingBillingTransaction objects previously created in the Stark Infra API. + * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. + *

+ * Parameters: + * @param params map of parameters for the query + * limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35 + * after [string, default null]: date filter for objects created only after specified date. ex: "2020-04-29" + * before [string, default null]: date filter for objects created only before specified date. ex: "2020-04-30" + * invoiceId [string, default null]: filter for transactions of a specific IssuingBillingInvoice. ex: "5656565656565656" + * tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"] + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return generator of IssuingBillingTransaction objects with updated attributes + * @throws Exception error in the request + */ + public static Generator query(Map params, User user) throws Exception { + return Rest.getStream(data, params, user); + } + + public final static class Page { + public List transactions; + public String cursor; + + public Page(List transactions, String cursor) { + this.transactions = transactions; + this.cursor = cursor; + } + } + + /** + * Retrieve paged IssuingBillingTransactions + *

+ * Receive a list of up to 100 IssuingBillingTransaction objects previously created in the Stark Infra API and the cursor to the next page. + * Use this function instead of query if you want to manually page your requests. + *

+ * Parameters: + * @param params map of parameters for the query + * cursor [string, default null]: cursor returned on the previous page function call + * limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 35 + * after [string, default null]: date filter for objects created only after specified date. ex: "2020-04-29" + * before [string, default null]: date filter for objects created only before specified date. ex: "2020-04-30" + * invoiceId [string, default null]: filter for transactions of a specific IssuingBillingInvoice. ex: "5656565656565656" + * tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"] + *

+ * Return: + * @return IssuingBillingTransaction.Page object: + * IssuingBillingTransaction.Page.transactions: list of IssuingBillingTransaction objects with updated attributes + * IssuingBillingTransaction.Page.cursor: cursor to retrieve the next page of IssuingBillingTransaction objects + * @throws Exception error in the request + */ + public static Page page(Map params) throws Exception { + return page(params, null); + } + + /** + * Retrieve paged IssuingBillingTransactions + *

+ * Receive a list of up to 100 IssuingBillingTransaction objects previously created in the Stark Infra API and the cursor to the next page. + * Use this function instead of query if you want to manually page your requests. + *

+ * Parameters: + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return IssuingBillingTransaction.Page object: + * IssuingBillingTransaction.Page.transactions: list of IssuingBillingTransaction objects with updated attributes + * IssuingBillingTransaction.Page.cursor: cursor to retrieve the next page of IssuingBillingTransaction objects + * @throws Exception error in the request + */ + public static Page page(User user) throws Exception { + return page(new HashMap<>(), user); + } + + /** + * Retrieve paged IssuingBillingTransactions + *

+ * Receive a list of up to 100 IssuingBillingTransaction objects previously created in the Stark Infra API and the cursor to the next page. + * Use this function instead of query if you want to manually page your requests. + *

+ * Return: + * @return IssuingBillingTransaction.Page object: + * IssuingBillingTransaction.Page.transactions: list of IssuingBillingTransaction objects with updated attributes + * IssuingBillingTransaction.Page.cursor: cursor to retrieve the next page of IssuingBillingTransaction objects + * @throws Exception error in the request + */ + public static Page page() throws Exception { + return page(new HashMap<>(), null); + } + + /** + * Retrieve paged IssuingBillingTransactions + *

+ * Receive a list of up to 100 IssuingBillingTransaction objects previously created in the Stark Infra API and the cursor to the next page. + * Use this function instead of query if you want to manually page your requests. + *

+ * Parameters: + * @param params map of parameters for the query + * cursor [string, default null]: cursor returned on the previous page function call + * limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 35 + * after [string, default null]: date filter for objects created only after specified date. ex: "2020-04-29" + * before [string, default null]: date filter for objects created only before specified date. ex: "2020-04-30" + * invoiceId [string, default null]: filter for transactions of a specific IssuingBillingInvoice. ex: "5656565656565656" + * tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"] + * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call + *

+ * Return: + * @return IssuingBillingTransaction.Page object: + * IssuingBillingTransaction.Page.transactions: list of IssuingBillingTransaction objects with updated attributes + * IssuingBillingTransaction.Page.cursor: cursor to retrieve the next page of IssuingBillingTransaction objects + * @throws Exception error in the request + */ + public static Page page(Map params, User user) throws Exception { + com.starkcore.utils.Page page = Rest.getPage(data, params, user); + List transactions = new ArrayList<>(); + for (SubResource transaction: page.entities) { + transactions.add((IssuingBillingTransaction) transaction); + } + return new Page(transactions, page.cursor); + } +} diff --git a/src/test/java/TestIssuingBillingTransaction.java b/src/test/java/TestIssuingBillingTransaction.java new file mode 100644 index 0000000..5451be7 --- /dev/null +++ b/src/test/java/TestIssuingBillingTransaction.java @@ -0,0 +1,92 @@ +import org.junit.Test; + +import com.starkinfra.Settings; +import com.starkinfra.IssuingBillingInvoice; +import com.starkinfra.IssuingBillingTransaction; +import com.starkinfra.utils.Generator; + +import java.util.List; +import java.util.HashMap; +import java.util.ArrayList; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + + +public class TestIssuingBillingTransaction { + + @Test + public void testQuery() throws Exception { + Settings.user = utils.User.defaultProject(); + + HashMap params = new HashMap<>(); + params.put("limit", 3); + params.put("after", "2019-04-01"); + params.put("before", "2030-04-30"); + Generator transactions = IssuingBillingTransaction.query(params); + + int i = 0; + for (IssuingBillingTransaction transaction : transactions) { + i += 1; + assertNotNull(transaction.id); + } + assertTrue(i > 0); + } + + @Test + public void testPage() throws Exception { + Settings.user = utils.User.defaultProject(); + + HashMap params = new HashMap<>(); + params.put("limit", 2); + params.put("after", "2019-04-01"); + params.put("before", "2030-04-30"); + params.put("cursor", null); + + List ids = new ArrayList<>(); + for (int i = 0; i < 2; i++) { + IssuingBillingTransaction.Page page = IssuingBillingTransaction.page(params); + for (IssuingBillingTransaction transaction : page.transactions) { + if (ids.contains(transaction.id)) { + throw new Exception("repeated id"); + } + ids.add(transaction.id); + } + if (page.cursor == null) { + break; + } + params.put("cursor", page.cursor); + } + + if (ids.size() != 4) { + throw new Exception("ids.size() != 4"); + } + } + + @Test + public void testQueryInvoiceId() throws Exception { + Settings.user = utils.User.defaultProject(); + + HashMap invoiceParams = new HashMap<>(); + invoiceParams.put("limit", 1); + Generator invoices = IssuingBillingInvoice.query(invoiceParams); + + String invoiceId = null; + for (IssuingBillingInvoice invoice : invoices) { + invoiceId = invoice.id; + } + assertNotNull(invoiceId); + + HashMap params = new HashMap<>(); + params.put("limit", 3); + params.put("invoiceId", invoiceId); + Generator transactions = IssuingBillingTransaction.query(params); + + int i = 0; + for (IssuingBillingTransaction transaction : transactions) { + i += 1; + assertNotNull(transaction.id); + } + assertTrue(i >= 0); + } +} From 80fc595db591fb450b5bbf73a76995de64535bf7 Mon Sep 17 00:00:00 2001 From: Lucas Miranda Date: Wed, 24 Jun 2026 17:30:58 -0300 Subject: [PATCH 4/7] Add return-only issuing fields --- .../java/com/starkinfra/IssuingBalance.java | 10 ++++++++- src/main/java/com/starkinfra/IssuingCard.java | 8 ++++++- .../java/com/starkinfra/IssuingProduct.java | 8 ++++++- .../java/com/starkinfra/IssuingPurchase.java | 16 ++++++++++++-- src/main/java/com/starkinfra/IssuingRule.java | 21 ++++++++++++++++++- .../java/com/starkinfra/IssuingStock.java | 8 ++++++- .../java/com/starkinfra/IssuingToken.java | 14 ++++++++++++- .../java/com/starkinfra/MerchantCategory.java | 7 ++++++- 8 files changed, 83 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/starkinfra/IssuingBalance.java b/src/main/java/com/starkinfra/IssuingBalance.java index a5bb035..f6f26fb 100644 --- a/src/main/java/com/starkinfra/IssuingBalance.java +++ b/src/main/java/com/starkinfra/IssuingBalance.java @@ -21,6 +21,8 @@ public final class IssuingBalance extends Resource { * Parameters: * id [string]: unique id returned when IssuingBalance is created. ex: "5656565656565656" * amount [Long]: current issuing balance amount of the Workspace in cents. ex: 200 (= R$ 2.00) + * limit [Long]: current issuing balance limit of the Workspace in cents. ex: 200 (= R$ 2.00) + * maxLimit [Long]: maximum issuing balance limit of the Workspace in cents. ex: 200 (= R$ 2.00) * currency [string]: currency of the current workspace. Expect others to be added eventually. ex: "BRL" * updated [string]: latest update datetime for the IssuingBalance. ex: "2020-03-10 10:30:00.000000+00:00" * @@ -28,6 +30,8 @@ public final class IssuingBalance extends Resource { static ClassData data = new ClassData(IssuingBalance.class, "IssuingBalance"); public Long amount; + public Long limit; + public Long maxLimit; public String currency; public String updated; @@ -42,12 +46,16 @@ public final class IssuingBalance extends Resource { * Parameters: * @param id [string]: unique id returned when IssuingBalance is created. ex: "5656565656565656" * @param amount [Long]: current issuing balance amount of the workspace in cents. ex: 200 (= R$ 2.00) + * @param limit [Long]: current issuing balance limit of the workspace in cents. ex: 200 (= R$ 2.00) + * @param maxLimit [Long]: maximum issuing balance limit of the workspace in cents. ex: 200 (= R$ 2.00) * @param currency [string]: currency of the current workspace. Expect others to be added eventually. ex: "BRL" * @param updated [string]: latest update datetime for the IssuingBalance. ex: "2020-03-10 10:30:00.000000+00:00" */ - public IssuingBalance(String id, Long amount, String currency, String updated) { + public IssuingBalance(String id, Long amount, Long limit, Long maxLimit, String currency, String updated) { super(id); this.amount = amount; + this.limit = limit; + this.maxLimit = maxLimit; this.currency = currency; this.updated = updated; } diff --git a/src/main/java/com/starkinfra/IssuingCard.java b/src/main/java/com/starkinfra/IssuingCard.java index d270bee..0fb123c 100644 --- a/src/main/java/com/starkinfra/IssuingCard.java +++ b/src/main/java/com/starkinfra/IssuingCard.java @@ -40,6 +40,7 @@ public final class IssuingCard extends Resource { * holderId [string]: card holder unique id. ex: "5656565656565656" * type [string]: card type. ex: "virtual" * status [string]: current IssuingCard status. ex: "canceled" or "active" + * isPinDefined [Boolean]: whether the card has a PIN defined. ex: true * number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00" @@ -65,6 +66,7 @@ public final class IssuingCard extends Resource { public String holderId; public String type; public String status; + public Boolean isPinDefined; public String number; public String securityCode; public String expiration; @@ -98,6 +100,7 @@ public final class IssuingCard extends Resource { * @param holderId [string]: card holder unique id. ex: "5656565656565656" * @param type [string]: card type. ex: "virtual" * @param status [string]: current IssuingCard status. ex: "canceled" or "active" + * @param isPinDefined [Boolean]: whether the card has a PIN defined. ex: true * @param number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * @param securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * @param expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00" @@ -107,7 +110,7 @@ public final class IssuingCard extends Resource { public IssuingCard(String holderName, String holderTaxId, String holderExternalId, String displayName, List rules, String productId, String[] tags, String streetLine1, String streetLine2, String district, String city, String stateCode, String zipCode, String id, String holderId, - String type, String status, String number, String securityCode, String expiration, + String type, String status, Boolean isPinDefined, String number, String securityCode, String expiration, String updated, String created ) { super(id); @@ -127,6 +130,7 @@ public IssuingCard(String holderName, String holderTaxId, String holderExternalI this.holderId = holderId; this.type = type; this.status = status; + this.isPinDefined = isPinDefined; this.number = number; this.securityCode = securityCode; this.expiration = expiration; @@ -166,6 +170,7 @@ public IssuingCard(String holderName, String holderTaxId, String holderExternalI * holderId [string]: card holder unique id. ex: "5656565656565656" * type [string]: card type. ex: "virtual" * status [string]: current IssuingCard status. ex: "canceled" or "active" + * isPinDefined [Boolean]: whether the card has a PIN defined. ex: true * number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00". @@ -193,6 +198,7 @@ public IssuingCard(Map data) throws Exception { this.holderId = null; this.type = (String) dataCopy.remove("type"); this.status = null; + this.isPinDefined = null; this.number = null; this.securityCode = null; this.expiration = null; diff --git a/src/main/java/com/starkinfra/IssuingProduct.java b/src/main/java/com/starkinfra/IssuingProduct.java index a8d1f73..dfa36a8 100644 --- a/src/main/java/com/starkinfra/IssuingProduct.java +++ b/src/main/java/com/starkinfra/IssuingProduct.java @@ -23,6 +23,7 @@ public final class IssuingProduct extends Resource { * network [string]: card network flag. ex: "mastercard" * fundingType [string]: type of funding used for payment. ex: "credit", "debit" * holderType [string]: holder type. ex: "business", "individual" + * customerType [string]: customer type. ex: "business", "individual" * code [string]: internal code from card flag informing the product. ex: "MRW", "MCO", "MWB", "MCS" * created [string]: creation datetime for the IssuingProduct. ex: "2020-03-10 10:30:00.000000+00:00" * @@ -32,6 +33,7 @@ public final class IssuingProduct extends Resource { public String network; public String fundingType; public String holderType; + public String customerType; public String code; public String created; @@ -45,15 +47,17 @@ public final class IssuingProduct extends Resource { * @param network [string]: card network flag. ex: "mastercard" * @param fundingType [string]: type of funding used for payment. ex: "credit", "debit" * @param holderType [string]: holder type. ex: "business", "individual" + * @param customerType [string]: customer type. ex: "business", "individual" * @param code [string]: internal code from card flag informing the product. ex: "MRW", "MCO", "MWB", "MCS" * @param created [string]: creation datetime for the IssuingProduct. ex: "2020-03-10 10:30:00.000000+00:00" */ - public IssuingProduct(String id, String network, String fundingType, String code, String holderType, String created) { + public IssuingProduct(String id, String network, String fundingType, String code, String holderType, String customerType, String created) { super(id); this.network = network; this.fundingType = fundingType; this.code = code; this.holderType = holderType; + this.customerType = customerType; this.created = created; } @@ -67,6 +71,7 @@ public IssuingProduct(String id, String network, String fundingType, String code * network [string]: card network flag. ex: "mastercard" * fundingType [string]: type of funding used for payment. ex: "credit", "debit" * holderType [string]: holder type. ex: "business", "individual" + * customerType [string]: customer type. ex: "business", "individual" * code [string]: internal code from card flag informing the product. ex: "MRW", "MCO", "MWB", "MCS" * created [string]: creation datetime for the IssuingProduct. ex: "2020-03-10 10:30:00.000000+00:00" * @throws Exception error in the request @@ -79,6 +84,7 @@ public IssuingProduct(Map data) throws Exception { this.fundingType = null; this.code = null; this.holderType = null; + this.customerType = null; this.created = null; if (!dataCopy.isEmpty()) { diff --git a/src/main/java/com/starkinfra/IssuingPurchase.java b/src/main/java/com/starkinfra/IssuingPurchase.java index f29387f..cb4a1fe 100644 --- a/src/main/java/com/starkinfra/IssuingPurchase.java +++ b/src/main/java/com/starkinfra/IssuingPurchase.java @@ -38,6 +38,7 @@ public final class IssuingPurchase extends Resource { * merchantCurrencySymbol [string]: merchant currency symbol. ex: "$" * merchantCategoryCode [string]: merchant category code. ex: "fastFoodRestaurants" * merchantCategoryType [string]: merchant category type. ex "food" + * merchantCategoryNumber [integer]: merchant category number. ex: 5814 * merchantCountryCode [string]: merchant country code. ex: "USA" * acquirerId [string]: acquirer ID. ex: "5656565656565656" * merchantId [string]: merchant ID. ex: "5656565656565656" @@ -53,6 +54,7 @@ public final class IssuingPurchase extends Resource { * id [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * issuingTransactionIds [list of strings]: list of ledger transaction ids linked to this Purchase * status [string]: current IssuingPurchase status. ex: "approved", "canceled", "denied", "confirmed" or "voided" + * confirmed [Boolean]: whether the IssuingPurchase has been confirmed. ex: true * description [string]: IssuingPurchase description. ex: "Office Supplies" * metadata [Hashmap object]: Hashmap object used to store additional information about the IssuingPurchase object. ex: { authorizationId: "OjZAqj" } * zipCode [string]: zip code of the merchant location. ex: "02101234" @@ -84,6 +86,7 @@ public final class IssuingPurchase extends Resource { public String merchantCurrencySymbol; public String merchantCategoryCode; public String merchantCategoryType; + public Integer merchantCategoryNumber; public String merchantCountryCode; public String acquirerId; public String merchantId; @@ -96,6 +99,7 @@ public final class IssuingPurchase extends Resource { public String[] tags; public String[] issuingTransactionIds; public String status; + public Boolean confirmed; public String description; public HashMap metadata; public String zipCode; @@ -129,6 +133,7 @@ public final class IssuingPurchase extends Resource { * @param merchantCurrencySymbol [string]: merchant currency symbol. ex: "$" * @param merchantCategoryCode [string]: merchant category code. ex: "fastFoodRestaurants" * @param merchantCategoryType [string]: merchant category type. ex "food" + * @param merchantCategoryNumber [integer]: merchant category number. ex: 5814 * @param merchantCountryCode [string]: merchant country code. ex: "USA" * @param acquirerId [string]: acquirer ID. ex: "5656565656565656" * @param merchantId [string]: merchant ID. ex: "5656565656565656" @@ -143,6 +148,7 @@ public final class IssuingPurchase extends Resource { * @param id [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * @param issuingTransactionIds [list of strings]: list of ledger transaction ids linked to this Purchase * @param status [string]: current IssuingPurchase status. ex: "approved", "canceled", "denied", "confirmed" or "voided" + * @param confirmed [Boolean]: whether the IssuingPurchase has been confirmed. ex: true * @param description [string]: IssuingPurchase description. ex: "Office Supplies" * @param metadata [Hashmap object]: Hashmap object used to store additional information about the IssuingPurchase object. ex: { authorizationId: "OjZAqj" } * @param zipCode [string]: zip code of the merchant location. ex: "02101234" @@ -157,9 +163,9 @@ public final class IssuingPurchase extends Resource { public IssuingPurchase(String id, String holderName, String productId, String cardId, String cardEnding, String purpose, Integer installmentCount, Long amount, Long tax, Long issuerAmount, String issuerCurrencyCode, String issuerCurrencySymbol, Long merchantAmount, String merchantCurrencyCode, String merchantCurrencySymbol, - String merchantCategoryCode,String merchantCategoryType, String merchantCountryCode, String acquirerId, String merchantId, + String merchantCategoryCode,String merchantCategoryType, Integer merchantCategoryNumber, String merchantCountryCode, String acquirerId, String merchantId, String merchantName, Long merchantFee, String walletId, String methodCode, Number score, - String[] issuingTransactionIds, String endToEndId, String status, String description, HashMap metadata, String[] tags, String zipCode, + String[] issuingTransactionIds, String endToEndId, String status, Boolean confirmed, String description, HashMap metadata, String[] tags, String zipCode, String updated, String created, Boolean isPartialAllowed, String[] cardTags, String holderId, String[] holderTags ) { super(id); @@ -179,6 +185,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca this.merchantCurrencySymbol = merchantCurrencySymbol; this.merchantCategoryCode = merchantCategoryCode; this.merchantCategoryType = merchantCategoryType; + this.merchantCategoryNumber = merchantCategoryNumber; this.merchantCountryCode = merchantCountryCode; this.acquirerId = acquirerId; this.merchantId = merchantId; @@ -191,6 +198,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca this.tags = tags; this.issuingTransactionIds = issuingTransactionIds; this.status = status; + this.confirmed = confirmed; this.description = description; this.metadata = metadata; this.zipCode = zipCode; @@ -224,6 +232,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca * merchantCurrencySymbol [string]: merchant currency symbol. ex: "$" * merchantCategoryCode [string]: merchant category code. ex: "fastFoodRestaurants" * merchantCategoryType [string]: merchant category type. ex "food" + * merchantCategoryNumber [integer]: merchant category number. ex: 5814 * merchantCountryCode [string]: merchant country code. ex: "USA" * acquirerId [string]: acquirer ID. ex: "5656565656565656" * merchantId [string]: merchant ID. ex: "5656565656565656" @@ -239,6 +248,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca * id [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * issuingTransactionIds [list of strings]: list of ledger transaction ids linked to this Purchase * status [string]: current IssuingPurchase status. ex: "approved", "canceled", "denied", "confirmed" or "voided" + * confirmed [Boolean]: whether the IssuingPurchase has been confirmed. ex: true * description [string]: IssuingPurchase description. ex: "Office Supplies" * metadata [Hashmap object]: Hashmap object used to store additional information about the IssuingPurchase object. ex: { authorizationId: "OjZAqj" } * zipCode [string]: zip code of the merchant location. ex: "02101234" @@ -272,6 +282,7 @@ public IssuingPurchase(Map data) throws Exception { this.merchantCurrencySymbol = (String) dataCopy.remove("merchantCurrencySymbol"); this.merchantCategoryCode = (String) dataCopy.remove("merchantCategoryCode"); this.merchantCategoryType = (String) dataCopy.remove("merchantCategoryType"); + this.merchantCategoryNumber = (Integer) dataCopy.remove("merchantCategoryNumber"); this.merchantCountryCode = (String) dataCopy.remove("merchantCountryCode"); this.acquirerId = (String) dataCopy.remove("acquirerId"); this.merchantId = (String) dataCopy.remove("merchantId"); @@ -283,6 +294,7 @@ public IssuingPurchase(Map data) throws Exception { this.issuingTransactionIds = (String[]) dataCopy.remove("issuingTransactionIds"); this.endToEndId = (String) dataCopy.remove("endToEndId"); this.status = (String) dataCopy.remove("status"); + this.confirmed = (Boolean) dataCopy.remove("confirmed"); this.description = (String) dataCopy.remove("description"); this.metadata = (HashMap) dataCopy.remove("metadata"); this.zipCode = (String) dataCopy.remove("zipCode"); diff --git a/src/main/java/com/starkinfra/IssuingRule.java b/src/main/java/com/starkinfra/IssuingRule.java index dbb1e20..eed155d 100644 --- a/src/main/java/com/starkinfra/IssuingRule.java +++ b/src/main/java/com/starkinfra/IssuingRule.java @@ -27,6 +27,9 @@ public final class IssuingRule extends Resource { * counterAmount [Long]: current rule spent amount. ex: 1000 * currencySymbol [string]: currency symbol. ex: "R$" * currencyName [string]: currency name. ex: "Brazilian Real" + * schedule [string]: schedule time for the rule to be applied. ex: "every monday, wednesday from 00:00 to 23:59 in America/Sao_Paulo" + * purposes [list of strings]: list of purposes for spending restrictions. ex: ["purchase", "withdrawal"] + * merchants [list of strings]: list of merchants accepted by the rule. ex: ["5656565656565656", "4545454545454545"] * */ static ClassData data = new ClassData(IssuingRule.class, "IssuingRule"); @@ -41,6 +44,9 @@ public final class IssuingRule extends Resource { public Number counterAmount; public String currencySymbol; public String currencyName; + public String schedule; + public String[] purposes; + public String[] merchants; /** * IssuingRule object @@ -59,10 +65,14 @@ public final class IssuingRule extends Resource { * @param counterAmount [Long]: current rule spent amount. ex: 1000 * @param currencySymbol [string]: currency symbol. ex: "R$" * @param currencyName [string]: currency name. ex: "Brazilian Real" + * @param schedule [string]: schedule time for the rule to be applied. ex: "every monday, wednesday from 00:00 to 23:59 in America/Sao_Paulo" + * @param purposes [list of strings]: list of purposes for spending restrictions. ex: ["purchase", "withdrawal"] + * @param merchants [list of strings]: list of merchants accepted by the rule. ex: ["5656565656565656", "4545454545454545"] */ public IssuingRule(String id, String name, Long amount, String interval, String currencyCode, List categories, List countries, List methods, - Long counterAmount, String currencySymbol, String currencyName + Long counterAmount, String currencySymbol, String currencyName, + String schedule, String[] purposes, String[] merchants ) { super(id); this.name = name; @@ -75,6 +85,9 @@ public IssuingRule(String id, String name, Long amount, String interval, String this.counterAmount = counterAmount; this.currencySymbol = currencySymbol; this.currencyName = currencyName; + this.schedule = schedule; + this.purposes = purposes; + this.merchants = merchants; } /** @@ -99,6 +112,9 @@ public IssuingRule(String id, String name, Long amount, String interval, String * counterAmount [Long]: current rule spent amount. ex: 1000 * currencySymbol [string]: currency symbol. ex: "R$" * currencyName [string]: currency name. ex: "Brazilian Real" + * schedule [string]: schedule time for the rule to be applied. ex: "every monday, wednesday from 00:00 to 23:59 in America/Sao_Paulo" + * purposes [list of strings]: list of purposes for spending restrictions. ex: ["purchase", "withdrawal"] + * merchants [list of strings]: list of merchants accepted by the rule. ex: ["5656565656565656", "4545454545454545"] * @throws Exception error in the request */ public IssuingRule(Map data) throws Exception { @@ -115,6 +131,9 @@ public IssuingRule(Map data) throws Exception { this.counterAmount = null; this.currencySymbol = null; this.currencyName = null; + this.schedule = null; + this.purposes = null; + this.merchants = null; if (!dataCopy.isEmpty()) { throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]"); diff --git a/src/main/java/com/starkinfra/IssuingStock.java b/src/main/java/com/starkinfra/IssuingStock.java index c7ee5c2..fc7579c 100644 --- a/src/main/java/com/starkinfra/IssuingStock.java +++ b/src/main/java/com/starkinfra/IssuingStock.java @@ -22,6 +22,7 @@ public final class IssuingStock extends Resource { * balance [integer]: [EXPANDABLE] current stock balance. ex: 1000 * designId [string]: IssuingDesign unique id. ex: "5656565656565656" * embosserId [string]: Embosser unique id. ex: "5656565656565656" + * embosserName [string]: Embosser name. ex: "Embosser Name" * updated [string]: latest update datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * created [string]: creation datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * @@ -31,6 +32,7 @@ public final class IssuingStock extends Resource { public Integer balance; public String designId; public String embosserId; + public String embosserName; public String updated; public String created; @@ -43,16 +45,18 @@ public final class IssuingStock extends Resource { * @param balance [integer]: [EXPANDABLE] current stock balance. ex: 1000 * @param designId [string]: IssuingDesign unique id. ex: "5656565656565656" * @param embosserId [string]: Embosser unique id. ex: "5656565656565656" + * @param embosserName [string]: Embosser name. ex: "Embosser Name" * @param updated [string]: latest update datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * @param created [string]: creation datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" */ public IssuingStock( - String id, Integer balance, String designId, String embosserId, String updated, String created + String id, Integer balance, String designId, String embosserId, String embosserName, String updated, String created ) { super(id); this.balance = balance; this.designId = designId; this.embosserId = embosserId; + this.embosserName = embosserName; this.updated = updated; this.created = created; } @@ -67,6 +71,7 @@ public IssuingStock( * balance [integer]: [EXPANDABLE] current stock balance. ex: 1000 * designId [string]: IssuingDesign unique id. ex: "5656565656565656" * embosserId [string]: Embosser unique id. ex: "5656565656565656" + * embosserName [string]: Embosser name. ex: "Embosser Name" * updated [string]: latest update datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * created [string]: creation datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * @throws Exception error in the request @@ -79,6 +84,7 @@ public IssuingStock(Map data) throws Exception { this.balance = null; this.designId = null; this.embosserId = null; + this.embosserName = null; this.updated = null; this.created = null; diff --git a/src/main/java/com/starkinfra/IssuingToken.java b/src/main/java/com/starkinfra/IssuingToken.java index 547d9b0..c42ba25 100644 --- a/src/main/java/com/starkinfra/IssuingToken.java +++ b/src/main/java/com/starkinfra/IssuingToken.java @@ -24,6 +24,8 @@ public class IssuingToken extends Resource { * cardId [string]: card ID which the token is bounded to. ex: "5656565656565656" * walletId [string]: wallet provider which the token is bounded to. ex: "google" * walletName [string]: wallet name. ex: "GOOGLE" + * walletDeviceScore [number]: wallet device score. ex: 7.6 + * walletAccountScore [number]: wallet account score. ex: 7.6 * merchantId [string]: merchant unique id. ex: "5656565656565656" * id [string]: unique id returned when IssuingToken is created. ex: "5656565656565656" * externalId [string]: a unique string among all your IssuingTokens, used to avoid resource duplication. ex: "DSHRMC00002626944b0e3b539d4d459281bdba90c2588791" @@ -47,6 +49,8 @@ public class IssuingToken extends Resource { public String cardId; public String walletId; public String walletName; + public Number walletDeviceScore; + public Number walletAccountScore; public String merchantId; public String externalId; public String[] tags; @@ -74,6 +78,8 @@ public class IssuingToken extends Resource { * @param cardId [string]: card ID which the token is bounded to. ex: "5656565656565656" * @param walletId [string]: wallet provider which the token is bounded to. ex: "google" * @param walletName [string]: wallet name. ex: "GOOGLE" + * @param walletDeviceScore [number]: wallet device score. ex: 7.6 + * @param walletAccountScore [number]: wallet account score. ex: 7.6 * @param merchantId [string]: merchant unique id. ex: "5656565656565656" * @param id [string]: unique id returned when IssuingToken is created. ex: "5656565656565656" * @param externalId [string]: a unique string among all your IssuingTokens, used to avoid resource duplication. ex: "DSHRMC00002626944b0e3b539d4d459281bdba90c2588791" @@ -92,7 +98,7 @@ public class IssuingToken extends Resource { * @param walletInstanceId [string]: unique id referred to the wallet app in the current device. ex: "71583be4777eb89aaf0345eebeb82594f096615ed17862d0" * */ - public IssuingToken(String cardId, String walletId, String walletName, String merchantId, String id, + public IssuingToken(String cardId, String walletId, String walletName, Number walletDeviceScore, Number walletAccountScore, String merchantId, String id, String externalId, String [] tags, String status, String created, String updated, String activationCode, String methodCode, String deviceType, String deviceName, String deviceSerialNumber, String deviceOsName, String deviceOsVersion, String deviceImei, @@ -103,6 +109,8 @@ public IssuingToken(String cardId, String walletId, String walletName, String me this.cardId = cardId; this.walletId = walletId; this.walletName = walletName; + this.walletDeviceScore = walletDeviceScore; + this.walletAccountScore = walletAccountScore; this.merchantId = merchantId; this.externalId = externalId; this.tags = tags; @@ -129,6 +137,8 @@ public IssuingToken(String cardId, String walletId, String walletName, String me * cardId [string]: card ID which the token is bounded to. ex: "5656565656565656" * walletId [string]: wallet provider which the token is bounded to. ex: "google" * walletName [string]: wallet name. ex: "GOOGLE" + * walletDeviceScore [number]: wallet device score. ex: 7.6 + * walletAccountScore [number]: wallet account score. ex: 7.6 * merchantId [string]: merchant unique id. ex: "5656565656565656" * Attributes (IssuingToken only): * id [string]: unique id returned when IssuingToken is created. ex: "5656565656565656" @@ -156,6 +166,8 @@ public IssuingToken(Map data) throws Exception { this.cardId = null; this.walletId = null; this.walletName = null; + this.walletDeviceScore = null; + this.walletAccountScore = null; this.merchantId = null; this.externalId = null; this.tags = null; diff --git a/src/main/java/com/starkinfra/MerchantCategory.java b/src/main/java/com/starkinfra/MerchantCategory.java index 9517aab..507d3b8 100644 --- a/src/main/java/com/starkinfra/MerchantCategory.java +++ b/src/main/java/com/starkinfra/MerchantCategory.java @@ -22,6 +22,7 @@ public final class MerchantCategory extends SubResource { * type [string]: category's type. ex: "pets", "food" * name [string]: category's name. ex: "Veterinary services", "Fast food restaurants" * number [string]: category's number. ex: "742", "5814" + * group [string]: category's group. ex: "services", "food" * */ static SubResource.ClassData data = new SubResource.ClassData(MerchantCategory.class, "MerchantCategory"); @@ -30,6 +31,7 @@ public final class MerchantCategory extends SubResource { public String type; public String name; public String number; + public String group; /** * MerchantCategory object @@ -43,11 +45,12 @@ public final class MerchantCategory extends SubResource { * @param code [string]: category's code. ex: "veterinaryServices", "fastFoodRestaurants" * @param type [string]: category's type. ex: "pets", "food" */ - public MerchantCategory(String code, String type, String name, String number) { + public MerchantCategory(String code, String type, String name, String number, String group) { this.code = code; this.type = type; this.name = name; this.number = number; + this.group = group; } /** @@ -66,6 +69,7 @@ public MerchantCategory(String code, String type, String name, String number) { * Attributes (return-only): * name [string]: category's name. ex: "Veterinary services", "Fast food restaurants" * number [string]: category's number. ex: "742", "5814" + * group [string]: category's group. ex: "services", "food" * @throws Exception error in the request */ public MerchantCategory(Map data) throws Exception { @@ -75,6 +79,7 @@ public MerchantCategory(Map data) throws Exception { this.type = (String) dataCopy.remove("type"); this.name = null; this.number = null; + this.group = null; if (!dataCopy.isEmpty()) { throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]"); From ec1a0e3a69be59457a3adb802849795863dbae09 Mon Sep 17 00:00:00 2001 From: Lucas Miranda Date: Thu, 25 Jun 2026 14:33:11 -0300 Subject: [PATCH 5/7] Change IssuingBillingInvoice link example --- src/main/java/com/starkinfra/IssuingBillingInvoice.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/starkinfra/IssuingBillingInvoice.java b/src/main/java/com/starkinfra/IssuingBillingInvoice.java index 976a652..f241c48 100644 --- a/src/main/java/com/starkinfra/IssuingBillingInvoice.java +++ b/src/main/java/com/starkinfra/IssuingBillingInvoice.java @@ -30,7 +30,7 @@ public final class IssuingBillingInvoice extends Resource { * nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) * status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" * brcode [string]: BR Code for the invoice payment. ex: "00020101021226930014br.gov.bcb.pix..." - * link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.com/invoice/123" + * link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.sandbox.starkbank.com/billinginvoicelink/97de4d51e8984c459639a645ce920abb" * due [string]: due datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" * start [string]: billing cycle start datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" * end [string]: billing cycle end datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" @@ -73,7 +73,7 @@ public final class IssuingBillingInvoice extends Resource { * @param nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) * @param status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" * @param brcode [string]: BR Code for the invoice payment. ex: "00020101021226930014br.gov.bcb.pix..." - * @param link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.com/invoice/123" + * @param link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.sandbox.starkbank.com/billinginvoicelink/97de4d51e8984c459639a645ce920abb" * @param due [string]: due datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" * @param start [string]: billing cycle start datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" * @param end [string]: billing cycle end datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" @@ -120,7 +120,7 @@ public IssuingBillingInvoice(String id, String taxId, String name, Number fine, * nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) * status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" * brcode [string]: BR Code for the invoice payment. ex: "00020101021226930014br.gov.bcb.pix..." - * link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.com/invoice/123" + * link [string]: public invoice webpage URL. ex: "https://starkbank-card-issuer.sandbox.starkbank.com/billinginvoicelink/97de4d51e8984c459639a645ce920abb" * due [string]: due datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" * start [string]: billing cycle start datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" * end [string]: billing cycle end datetime for the IssuingBillingInvoice. ex: "2020-03-10 10:30:00.000000+00:00" From fa8341db470ca08d52f182c403c0f9e1f50fd01f Mon Sep 17 00:00:00 2001 From: Lucas Miranda Date: Wed, 1 Jul 2026 16:12:48 -0300 Subject: [PATCH 6/7] Change issuing docstrings, confirmed to datetime, and remove IssuingToken url --- .../java/com/starkinfra/IssuingBalance.java | 8 ++++---- .../com/starkinfra/IssuingBillingInvoice.java | 12 ++++++------ .../starkinfra/IssuingBillingTransaction.java | 12 ++++++------ src/main/java/com/starkinfra/IssuingCard.java | 6 +++--- .../java/com/starkinfra/IssuingProduct.java | 6 +++--- .../java/com/starkinfra/IssuingPurchase.java | 18 +++++++++--------- src/main/java/com/starkinfra/IssuingStock.java | 6 +++--- src/main/java/com/starkinfra/IssuingToken.java | 13 ++++++------- 8 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/starkinfra/IssuingBalance.java b/src/main/java/com/starkinfra/IssuingBalance.java index f6f26fb..c751380 100644 --- a/src/main/java/com/starkinfra/IssuingBalance.java +++ b/src/main/java/com/starkinfra/IssuingBalance.java @@ -21,8 +21,8 @@ public final class IssuingBalance extends Resource { * Parameters: * id [string]: unique id returned when IssuingBalance is created. ex: "5656565656565656" * amount [Long]: current issuing balance amount of the Workspace in cents. ex: 200 (= R$ 2.00) - * limit [Long]: current issuing balance limit of the Workspace in cents. ex: 200 (= R$ 2.00) - * maxLimit [Long]: maximum issuing balance limit of the Workspace in cents. ex: 200 (= R$ 2.00) + * limit [Long]: Spending limit of the balance + * maxLimit [Long]: Maximum spending limit. This field is currently always equal to limit * currency [string]: currency of the current workspace. Expect others to be added eventually. ex: "BRL" * updated [string]: latest update datetime for the IssuingBalance. ex: "2020-03-10 10:30:00.000000+00:00" * @@ -46,8 +46,8 @@ public final class IssuingBalance extends Resource { * Parameters: * @param id [string]: unique id returned when IssuingBalance is created. ex: "5656565656565656" * @param amount [Long]: current issuing balance amount of the workspace in cents. ex: 200 (= R$ 2.00) - * @param limit [Long]: current issuing balance limit of the workspace in cents. ex: 200 (= R$ 2.00) - * @param maxLimit [Long]: maximum issuing balance limit of the workspace in cents. ex: 200 (= R$ 2.00) + * @param limit [Long]: Spending limit of the balance + * @param maxLimit [Long]: Maximum spending limit. This field is currently always equal to limit * @param currency [string]: currency of the current workspace. Expect others to be added eventually. ex: "BRL" * @param updated [string]: latest update datetime for the IssuingBalance. ex: "2020-03-10 10:30:00.000000+00:00" */ diff --git a/src/main/java/com/starkinfra/IssuingBillingInvoice.java b/src/main/java/com/starkinfra/IssuingBillingInvoice.java index f241c48..63c8646 100644 --- a/src/main/java/com/starkinfra/IssuingBillingInvoice.java +++ b/src/main/java/com/starkinfra/IssuingBillingInvoice.java @@ -24,8 +24,8 @@ public final class IssuingBillingInvoice extends Resource { * id [string]: unique id returned when the IssuingBillingInvoice is created. ex: "5656565656565656" * taxId [string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: "20.018.183/0001-80" * name [string]: payer name. ex: "Iron Bank S.A." - * fine [number]: fine amount charged in cents. ex: 200 (= R$ 2.00) - * interest [number]: interest amount charged in cents. ex: 100 (= R$ 1.00) + * fine [number]: Fine percentage applied when paid after the due date. ex: 2.0 + * interest [number]: Monthly interest percentage applied when paid after the due date. ex: 1.0 * amount [Long]: invoice amount in cents. ex: 1234 (= R$ 12.34) * nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) * status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" @@ -67,8 +67,8 @@ public final class IssuingBillingInvoice extends Resource { * @param id [string]: unique id returned when the IssuingBillingInvoice is created. ex: "5656565656565656" * @param taxId [string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: "20.018.183/0001-80" * @param name [string]: payer name. ex: "Iron Bank S.A." - * @param fine [number]: fine amount charged in cents. ex: 200 (= R$ 2.00) - * @param interest [number]: interest amount charged in cents. ex: 100 (= R$ 1.00) + * @param fine [number]: Fine percentage applied when paid after the due date. ex: 2.0 + * @param interest [number]: Monthly interest percentage applied when paid after the due date. ex: 1.0 * @param amount [Long]: invoice amount in cents. ex: 1234 (= R$ 12.34) * @param nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) * @param status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" @@ -114,8 +114,8 @@ public IssuingBillingInvoice(String id, String taxId, String name, Number fine, * id [string]: unique id returned when the IssuingBillingInvoice is created. ex: "5656565656565656" * taxId [string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: "20.018.183/0001-80" * name [string]: payer name. ex: "Iron Bank S.A." - * fine [number]: fine amount charged in cents. ex: 200 (= R$ 2.00) - * interest [number]: interest amount charged in cents. ex: 100 (= R$ 1.00) + * fine [number]: Fine percentage applied when paid after the due date. ex: 2.0 + * interest [number]: Monthly interest percentage applied when paid after the due date. ex: 1.0 * amount [Long]: invoice amount in cents. ex: 1234 (= R$ 12.34) * nominalAmount [Long]: nominal amount in cents. ex: 1234 (= R$ 12.34) * status [string]: current IssuingBillingInvoice status. ex: "created" or "paid" diff --git a/src/main/java/com/starkinfra/IssuingBillingTransaction.java b/src/main/java/com/starkinfra/IssuingBillingTransaction.java index dc8056b..4e9f10b 100644 --- a/src/main/java/com/starkinfra/IssuingBillingTransaction.java +++ b/src/main/java/com/starkinfra/IssuingBillingTransaction.java @@ -32,8 +32,8 @@ public final class IssuingBillingTransaction extends Resource { * externalId [string]: external transaction id. ex: "my-external-id-123456" * description [string]: transaction description. ex: "Coffee shop" * cardEnding [string]: last 4 digits of the card number. ex: "1234" - * tax [number]: tax amount charged in cents. ex: 100 (= R$ 1.00) - * rate [number]: tax rate as a percentage. ex: 1.5 + * tax [number]: IOF amount in cents applied to the transaction + * rate [number]: Conversion rate applied to international transactions * merchantAmount [Long]: merchant amount in cents. ex: 1234 (= R$ 12.34) * merchantCurrencyCode [string]: merchant currency code (ISO 4217). ex: "BRL" * created [string]: creation datetime for the IssuingBillingTransaction. ex: "2020-03-10 10:30:00.000000+00:00" @@ -77,8 +77,8 @@ public final class IssuingBillingTransaction extends Resource { * @param externalId [string]: external transaction id. ex: "my-external-id-123456" * @param description [string]: transaction description. ex: "Coffee shop" * @param cardEnding [string]: last 4 digits of the card number. ex: "1234" - * @param tax [number]: tax amount charged in cents. ex: 100 (= R$ 1.00) - * @param rate [number]: tax rate as a percentage. ex: 1.5 + * @param tax [number]: IOF amount in cents applied to the transaction + * @param rate [number]: Conversion rate applied to international transactions * @param merchantAmount [Long]: merchant amount in cents. ex: 1234 (= R$ 12.34) * @param merchantCurrencyCode [string]: merchant currency code (ISO 4217). ex: "BRL" * @param created [string]: creation datetime for the IssuingBillingTransaction. ex: "2020-03-10 10:30:00.000000+00:00" @@ -127,8 +127,8 @@ public IssuingBillingTransaction(String id, Long amount, String invoiceId, Integ * externalId [string]: external transaction id. ex: "my-external-id-123456" * description [string]: transaction description. ex: "Coffee shop" * cardEnding [string]: last 4 digits of the card number. ex: "1234" - * tax [number]: tax amount charged in cents. ex: 100 (= R$ 1.00) - * rate [number]: tax rate as a percentage. ex: 1.5 + * tax [number]: IOF amount in cents applied to the transaction + * rate [number]: Conversion rate applied to international transactions * merchantAmount [Long]: merchant amount in cents. ex: 1234 (= R$ 12.34) * merchantCurrencyCode [string]: merchant currency code (ISO 4217). ex: "BRL" * created [string]: creation datetime for the IssuingBillingTransaction. ex: "2020-03-10 10:30:00.000000+00:00" diff --git a/src/main/java/com/starkinfra/IssuingCard.java b/src/main/java/com/starkinfra/IssuingCard.java index 0fb123c..69bacdb 100644 --- a/src/main/java/com/starkinfra/IssuingCard.java +++ b/src/main/java/com/starkinfra/IssuingCard.java @@ -40,7 +40,7 @@ public final class IssuingCard extends Resource { * holderId [string]: card holder unique id. ex: "5656565656565656" * type [string]: card type. ex: "virtual" * status [string]: current IssuingCard status. ex: "canceled" or "active" - * isPinDefined [Boolean]: whether the card has a PIN defined. ex: true + * isPinDefined [Boolean]: Whether the card has a PIN defined. Returned only when "expand=isPinDefined" is informed in the request * number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00" @@ -100,7 +100,7 @@ public final class IssuingCard extends Resource { * @param holderId [string]: card holder unique id. ex: "5656565656565656" * @param type [string]: card type. ex: "virtual" * @param status [string]: current IssuingCard status. ex: "canceled" or "active" - * @param isPinDefined [Boolean]: whether the card has a PIN defined. ex: true + * @param isPinDefined [Boolean]: Whether the card has a PIN defined. Returned only when "expand=isPinDefined" is informed in the request * @param number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * @param securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * @param expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00" @@ -170,7 +170,7 @@ public IssuingCard(String holderName, String holderTaxId, String holderExternalI * holderId [string]: card holder unique id. ex: "5656565656565656" * type [string]: card type. ex: "virtual" * status [string]: current IssuingCard status. ex: "canceled" or "active" - * isPinDefined [Boolean]: whether the card has a PIN defined. ex: true + * isPinDefined [Boolean]: Whether the card has a PIN defined. Returned only when "expand=isPinDefined" is informed in the request * number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00". diff --git a/src/main/java/com/starkinfra/IssuingProduct.java b/src/main/java/com/starkinfra/IssuingProduct.java index dfa36a8..d4bada9 100644 --- a/src/main/java/com/starkinfra/IssuingProduct.java +++ b/src/main/java/com/starkinfra/IssuingProduct.java @@ -23,7 +23,7 @@ public final class IssuingProduct extends Resource { * network [string]: card network flag. ex: "mastercard" * fundingType [string]: type of funding used for payment. ex: "credit", "debit" * holderType [string]: holder type. ex: "business", "individual" - * customerType [string]: customer type. ex: "business", "individual" + * customerType [string]: Same as holderType. Kept for backward compatibility * code [string]: internal code from card flag informing the product. ex: "MRW", "MCO", "MWB", "MCS" * created [string]: creation datetime for the IssuingProduct. ex: "2020-03-10 10:30:00.000000+00:00" * @@ -47,7 +47,7 @@ public final class IssuingProduct extends Resource { * @param network [string]: card network flag. ex: "mastercard" * @param fundingType [string]: type of funding used for payment. ex: "credit", "debit" * @param holderType [string]: holder type. ex: "business", "individual" - * @param customerType [string]: customer type. ex: "business", "individual" + * @param customerType [string]: Same as holderType. Kept for backward compatibility * @param code [string]: internal code from card flag informing the product. ex: "MRW", "MCO", "MWB", "MCS" * @param created [string]: creation datetime for the IssuingProduct. ex: "2020-03-10 10:30:00.000000+00:00" */ @@ -71,7 +71,7 @@ public IssuingProduct(String id, String network, String fundingType, String code * network [string]: card network flag. ex: "mastercard" * fundingType [string]: type of funding used for payment. ex: "credit", "debit" * holderType [string]: holder type. ex: "business", "individual" - * customerType [string]: customer type. ex: "business", "individual" + * customerType [string]: Same as holderType. Kept for backward compatibility * code [string]: internal code from card flag informing the product. ex: "MRW", "MCO", "MWB", "MCS" * created [string]: creation datetime for the IssuingProduct. ex: "2020-03-10 10:30:00.000000+00:00" * @throws Exception error in the request diff --git a/src/main/java/com/starkinfra/IssuingPurchase.java b/src/main/java/com/starkinfra/IssuingPurchase.java index cb4a1fe..1076ee2 100644 --- a/src/main/java/com/starkinfra/IssuingPurchase.java +++ b/src/main/java/com/starkinfra/IssuingPurchase.java @@ -38,7 +38,7 @@ public final class IssuingPurchase extends Resource { * merchantCurrencySymbol [string]: merchant currency symbol. ex: "$" * merchantCategoryCode [string]: merchant category code. ex: "fastFoodRestaurants" * merchantCategoryType [string]: merchant category type. ex "food" - * merchantCategoryNumber [integer]: merchant category number. ex: 5814 + * merchantCategoryNumber [integer]: MCC number of the merchant category. ex: 5814 * merchantCountryCode [string]: merchant country code. ex: "USA" * acquirerId [string]: acquirer ID. ex: "5656565656565656" * merchantId [string]: merchant ID. ex: "5656565656565656" @@ -54,7 +54,7 @@ public final class IssuingPurchase extends Resource { * id [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * issuingTransactionIds [list of strings]: list of ledger transaction ids linked to this Purchase * status [string]: current IssuingPurchase status. ex: "approved", "canceled", "denied", "confirmed" or "voided" - * confirmed [Boolean]: whether the IssuingPurchase has been confirmed. ex: true + * confirmed [string]: Confirmation datetime. Null until the purchase is confirmed. ex: "2020-03-10 10:30:00.000000+00:00" * description [string]: IssuingPurchase description. ex: "Office Supplies" * metadata [Hashmap object]: Hashmap object used to store additional information about the IssuingPurchase object. ex: { authorizationId: "OjZAqj" } * zipCode [string]: zip code of the merchant location. ex: "02101234" @@ -99,7 +99,7 @@ public final class IssuingPurchase extends Resource { public String[] tags; public String[] issuingTransactionIds; public String status; - public Boolean confirmed; + public String confirmed; public String description; public HashMap metadata; public String zipCode; @@ -133,7 +133,7 @@ public final class IssuingPurchase extends Resource { * @param merchantCurrencySymbol [string]: merchant currency symbol. ex: "$" * @param merchantCategoryCode [string]: merchant category code. ex: "fastFoodRestaurants" * @param merchantCategoryType [string]: merchant category type. ex "food" - * @param merchantCategoryNumber [integer]: merchant category number. ex: 5814 + * @param merchantCategoryNumber [integer]: MCC number of the merchant category. ex: 5814 * @param merchantCountryCode [string]: merchant country code. ex: "USA" * @param acquirerId [string]: acquirer ID. ex: "5656565656565656" * @param merchantId [string]: merchant ID. ex: "5656565656565656" @@ -148,7 +148,7 @@ public final class IssuingPurchase extends Resource { * @param id [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * @param issuingTransactionIds [list of strings]: list of ledger transaction ids linked to this Purchase * @param status [string]: current IssuingPurchase status. ex: "approved", "canceled", "denied", "confirmed" or "voided" - * @param confirmed [Boolean]: whether the IssuingPurchase has been confirmed. ex: true + * @param confirmed [string]: Confirmation datetime. Null until the purchase is confirmed. ex: "2020-03-10 10:30:00.000000+00:00" * @param description [string]: IssuingPurchase description. ex: "Office Supplies" * @param metadata [Hashmap object]: Hashmap object used to store additional information about the IssuingPurchase object. ex: { authorizationId: "OjZAqj" } * @param zipCode [string]: zip code of the merchant location. ex: "02101234" @@ -165,7 +165,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca Long merchantAmount, String merchantCurrencyCode, String merchantCurrencySymbol, String merchantCategoryCode,String merchantCategoryType, Integer merchantCategoryNumber, String merchantCountryCode, String acquirerId, String merchantId, String merchantName, Long merchantFee, String walletId, String methodCode, Number score, - String[] issuingTransactionIds, String endToEndId, String status, Boolean confirmed, String description, HashMap metadata, String[] tags, String zipCode, + String[] issuingTransactionIds, String endToEndId, String status, String confirmed, String description, HashMap metadata, String[] tags, String zipCode, String updated, String created, Boolean isPartialAllowed, String[] cardTags, String holderId, String[] holderTags ) { super(id); @@ -232,7 +232,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca * merchantCurrencySymbol [string]: merchant currency symbol. ex: "$" * merchantCategoryCode [string]: merchant category code. ex: "fastFoodRestaurants" * merchantCategoryType [string]: merchant category type. ex "food" - * merchantCategoryNumber [integer]: merchant category number. ex: 5814 + * merchantCategoryNumber [integer]: MCC number of the merchant category. ex: 5814 * merchantCountryCode [string]: merchant country code. ex: "USA" * acquirerId [string]: acquirer ID. ex: "5656565656565656" * merchantId [string]: merchant ID. ex: "5656565656565656" @@ -248,7 +248,7 @@ public IssuingPurchase(String id, String holderName, String productId, String ca * id [string]: unique id returned when IssuingPurchase is created. ex: "5656565656565656" * issuingTransactionIds [list of strings]: list of ledger transaction ids linked to this Purchase * status [string]: current IssuingPurchase status. ex: "approved", "canceled", "denied", "confirmed" or "voided" - * confirmed [Boolean]: whether the IssuingPurchase has been confirmed. ex: true + * confirmed [string]: Confirmation datetime. Null until the purchase is confirmed. ex: "2020-03-10 10:30:00.000000+00:00" * description [string]: IssuingPurchase description. ex: "Office Supplies" * metadata [Hashmap object]: Hashmap object used to store additional information about the IssuingPurchase object. ex: { authorizationId: "OjZAqj" } * zipCode [string]: zip code of the merchant location. ex: "02101234" @@ -294,7 +294,7 @@ public IssuingPurchase(Map data) throws Exception { this.issuingTransactionIds = (String[]) dataCopy.remove("issuingTransactionIds"); this.endToEndId = (String) dataCopy.remove("endToEndId"); this.status = (String) dataCopy.remove("status"); - this.confirmed = (Boolean) dataCopy.remove("confirmed"); + this.confirmed = (String) dataCopy.remove("confirmed"); this.description = (String) dataCopy.remove("description"); this.metadata = (HashMap) dataCopy.remove("metadata"); this.zipCode = (String) dataCopy.remove("zipCode"); diff --git a/src/main/java/com/starkinfra/IssuingStock.java b/src/main/java/com/starkinfra/IssuingStock.java index fc7579c..d059147 100644 --- a/src/main/java/com/starkinfra/IssuingStock.java +++ b/src/main/java/com/starkinfra/IssuingStock.java @@ -22,7 +22,7 @@ public final class IssuingStock extends Resource { * balance [integer]: [EXPANDABLE] current stock balance. ex: 1000 * designId [string]: IssuingDesign unique id. ex: "5656565656565656" * embosserId [string]: Embosser unique id. ex: "5656565656565656" - * embosserName [string]: Embosser name. ex: "Embosser Name" + * embosserName [string]: Name of the embosser that holds this stock * updated [string]: latest update datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * created [string]: creation datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * @@ -45,7 +45,7 @@ public final class IssuingStock extends Resource { * @param balance [integer]: [EXPANDABLE] current stock balance. ex: 1000 * @param designId [string]: IssuingDesign unique id. ex: "5656565656565656" * @param embosserId [string]: Embosser unique id. ex: "5656565656565656" - * @param embosserName [string]: Embosser name. ex: "Embosser Name" + * @param embosserName [string]: Name of the embosser that holds this stock * @param updated [string]: latest update datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * @param created [string]: creation datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" */ @@ -71,7 +71,7 @@ public IssuingStock( * balance [integer]: [EXPANDABLE] current stock balance. ex: 1000 * designId [string]: IssuingDesign unique id. ex: "5656565656565656" * embosserId [string]: Embosser unique id. ex: "5656565656565656" - * embosserName [string]: Embosser name. ex: "Embosser Name" + * embosserName [string]: Name of the embosser that holds this stock * updated [string]: latest update datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * created [string]: creation datetime for the IssuingStock. ex: "2020-03-10 10:30:00.000000+00:00" * @throws Exception error in the request diff --git a/src/main/java/com/starkinfra/IssuingToken.java b/src/main/java/com/starkinfra/IssuingToken.java index c42ba25..e0d95c9 100644 --- a/src/main/java/com/starkinfra/IssuingToken.java +++ b/src/main/java/com/starkinfra/IssuingToken.java @@ -24,8 +24,8 @@ public class IssuingToken extends Resource { * cardId [string]: card ID which the token is bounded to. ex: "5656565656565656" * walletId [string]: wallet provider which the token is bounded to. ex: "google" * walletName [string]: wallet name. ex: "GOOGLE" - * walletDeviceScore [number]: wallet device score. ex: 7.6 - * walletAccountScore [number]: wallet account score. ex: 7.6 + * walletDeviceScore [number]: Device score informed by the digital wallet. + * walletAccountScore [number]: Account score informed by the digital wallet * merchantId [string]: merchant unique id. ex: "5656565656565656" * id [string]: unique id returned when IssuingToken is created. ex: "5656565656565656" * externalId [string]: a unique string among all your IssuingTokens, used to avoid resource duplication. ex: "DSHRMC00002626944b0e3b539d4d459281bdba90c2588791" @@ -54,7 +54,6 @@ public class IssuingToken extends Resource { public String merchantId; public String externalId; public String[] tags; - public String url; public String status; public String created; public String updated; @@ -78,8 +77,8 @@ public class IssuingToken extends Resource { * @param cardId [string]: card ID which the token is bounded to. ex: "5656565656565656" * @param walletId [string]: wallet provider which the token is bounded to. ex: "google" * @param walletName [string]: wallet name. ex: "GOOGLE" - * @param walletDeviceScore [number]: wallet device score. ex: 7.6 - * @param walletAccountScore [number]: wallet account score. ex: 7.6 + * @param walletDeviceScore [number]: Device score informed by the digital wallet. + * @param walletAccountScore [number]: Account score informed by the digital wallet * @param merchantId [string]: merchant unique id. ex: "5656565656565656" * @param id [string]: unique id returned when IssuingToken is created. ex: "5656565656565656" * @param externalId [string]: a unique string among all your IssuingTokens, used to avoid resource duplication. ex: "DSHRMC00002626944b0e3b539d4d459281bdba90c2588791" @@ -137,8 +136,8 @@ public IssuingToken(String cardId, String walletId, String walletName, Number wa * cardId [string]: card ID which the token is bounded to. ex: "5656565656565656" * walletId [string]: wallet provider which the token is bounded to. ex: "google" * walletName [string]: wallet name. ex: "GOOGLE" - * walletDeviceScore [number]: wallet device score. ex: 7.6 - * walletAccountScore [number]: wallet account score. ex: 7.6 + * walletDeviceScore [number]: Device score informed by the digital wallet. + * walletAccountScore [number]: Account score informed by the digital wallet * merchantId [string]: merchant unique id. ex: "5656565656565656" * Attributes (IssuingToken only): * id [string]: unique id returned when IssuingToken is created. ex: "5656565656565656" From de9e53052a7ac71a990d834e12b8cdb55585fc32 Mon Sep 17 00:00:00 2001 From: Lucas Miranda Date: Wed, 1 Jul 2026 18:40:42 -0300 Subject: [PATCH 7/7] Change IssuingRule docstrings and remove merchants field --- src/main/java/com/starkinfra/IssuingRule.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/starkinfra/IssuingRule.java b/src/main/java/com/starkinfra/IssuingRule.java index eed155d..0459599 100644 --- a/src/main/java/com/starkinfra/IssuingRule.java +++ b/src/main/java/com/starkinfra/IssuingRule.java @@ -27,9 +27,8 @@ public final class IssuingRule extends Resource { * counterAmount [Long]: current rule spent amount. ex: 1000 * currencySymbol [string]: currency symbol. ex: "R$" * currencyName [string]: currency name. ex: "Brazilian Real" - * schedule [string]: schedule time for the rule to be applied. ex: "every monday, wednesday from 00:00 to 23:59 in America/Sao_Paulo" - * purposes [list of strings]: list of purposes for spending restrictions. ex: ["purchase", "withdrawal"] - * merchants [list of strings]: list of merchants accepted by the rule. ex: ["5656565656565656", "4545454545454545"] + * schedule [string]: Optional schedule dictating when the rule can be used. Some examples: "everyday from 09:00 to 18:00 in America/Sao_Paulo" - every day, 09:00-18:00 Sao Paulo time; "every monday, wednesday, friday from 08:00 to 12:00 in America/Sao_Paulo" - only those weekdays, mornings; "every saturday, sunday" - weekends, all day, in UTC + * purposes [list of strings]: Optional list of transaction purposes the rule applies to. Options: "purchase", "withdrawal", "verification". The rule then limits only purchases of those purposes; omit it to allow any purposes. Example: ["purchase", "verification"] if you want us to automatically deny withdrawal. * */ static ClassData data = new ClassData(IssuingRule.class, "IssuingRule"); @@ -46,7 +45,6 @@ public final class IssuingRule extends Resource { public String currencyName; public String schedule; public String[] purposes; - public String[] merchants; /** * IssuingRule object @@ -65,14 +63,13 @@ public final class IssuingRule extends Resource { * @param counterAmount [Long]: current rule spent amount. ex: 1000 * @param currencySymbol [string]: currency symbol. ex: "R$" * @param currencyName [string]: currency name. ex: "Brazilian Real" - * @param schedule [string]: schedule time for the rule to be applied. ex: "every monday, wednesday from 00:00 to 23:59 in America/Sao_Paulo" - * @param purposes [list of strings]: list of purposes for spending restrictions. ex: ["purchase", "withdrawal"] - * @param merchants [list of strings]: list of merchants accepted by the rule. ex: ["5656565656565656", "4545454545454545"] + * @param schedule [string]: Optional schedule dictating when the rule can be used. Some examples: "everyday from 09:00 to 18:00 in America/Sao_Paulo" - every day, 09:00-18:00 Sao Paulo time; "every monday, wednesday, friday from 08:00 to 12:00 in America/Sao_Paulo" - only those weekdays, mornings; "every saturday, sunday" - weekends, all day, in UTC + * @param purposes [list of strings]: Optional list of transaction purposes the rule applies to. Options: "purchase", "withdrawal", "verification". The rule then limits only purchases of those purposes; omit it to allow any purposes. Example: ["purchase", "verification"] if you want us to automatically deny withdrawal. */ public IssuingRule(String id, String name, Long amount, String interval, String currencyCode, List categories, List countries, List methods, Long counterAmount, String currencySymbol, String currencyName, - String schedule, String[] purposes, String[] merchants + String schedule, String[] purposes ) { super(id); this.name = name; @@ -87,7 +84,6 @@ public IssuingRule(String id, String name, Long amount, String interval, String this.currencyName = currencyName; this.schedule = schedule; this.purposes = purposes; - this.merchants = merchants; } /** @@ -112,9 +108,8 @@ public IssuingRule(String id, String name, Long amount, String interval, String * counterAmount [Long]: current rule spent amount. ex: 1000 * currencySymbol [string]: currency symbol. ex: "R$" * currencyName [string]: currency name. ex: "Brazilian Real" - * schedule [string]: schedule time for the rule to be applied. ex: "every monday, wednesday from 00:00 to 23:59 in America/Sao_Paulo" - * purposes [list of strings]: list of purposes for spending restrictions. ex: ["purchase", "withdrawal"] - * merchants [list of strings]: list of merchants accepted by the rule. ex: ["5656565656565656", "4545454545454545"] + * schedule [string]: Optional schedule dictating when the rule can be used. Some examples: "everyday from 09:00 to 18:00 in America/Sao_Paulo" - every day, 09:00-18:00 Sao Paulo time; "every monday, wednesday, friday from 08:00 to 12:00 in America/Sao_Paulo" - only those weekdays, mornings; "every saturday, sunday" - weekends, all day, in UTC + * purposes [list of strings]: Optional list of transaction purposes the rule applies to. Options: "purchase", "withdrawal", "verification". The rule then limits only purchases of those purposes; omit it to allow any purposes. Example: ["purchase", "verification"] if you want us to automatically deny withdrawal. * @throws Exception error in the request */ public IssuingRule(Map data) throws Exception { @@ -133,7 +128,6 @@ public IssuingRule(Map data) throws Exception { this.currencyName = null; this.schedule = null; this.purposes = null; - this.merchants = null; if (!dataCopy.isEmpty()) { throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]");