Skip to content

Commit bc993f6

Browse files
Add holderId and softDescriptor to MerchantSession and MerchantPurchase
1 parent 8189aea commit bc993f6

5 files changed

Lines changed: 29 additions & 4 deletions

File tree

src/main/java/com/starkbank/MerchantPurchase.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class MerchantPurchase extends Resource {
2424
public String holderName;
2525
public String holderEmail;
2626
public String holderPhone;
27+
public String holderId;
28+
public String softDescriptor;
2729
public String fundingType;
2830
public String challengeMode;
2931
public String billingCountryCode;
@@ -45,13 +47,15 @@ public class MerchantPurchase extends Resource {
4547
public String[] tags;
4648
public String updated;
4749

48-
public MerchantPurchase(String id, long amount, int installmentCount, String holderName, String holderEmail, String holderPhone, String fundingType, String billingCountryCode, String billingCity, String billingStateCode, String billingStreetLine1, String billingStreetLine2, String billingZipCode, Map<String, Object> metadata, String cardEnding, String cardId, String challengeMode, String challengeUrl, String created, String currencyCode, String endToEndId, int fee, String network, String source, String status, String[] tags, String updated) {
50+
public MerchantPurchase(String id, long amount, int installmentCount, String holderName, String holderEmail, String holderPhone, String holderId, String softDescriptor, String fundingType, String billingCountryCode, String billingCity, String billingStateCode, String billingStreetLine1, String billingStreetLine2, String billingZipCode, Map<String, Object> metadata, String cardEnding, String cardId, String challengeMode, String challengeUrl, String created, String currencyCode, String endToEndId, int fee, String network, String source, String status, String[] tags, String updated) {
4951
super(id);
5052
this.amount = amount;
5153
this.installmentCount = installmentCount;
5254
this.holderName = holderName;
5355
this.holderEmail = holderEmail;
5456
this.holderPhone = holderPhone;
57+
this.holderId = holderId;
58+
this.softDescriptor = softDescriptor;
5559
this.fundingType = fundingType;
5660
this.billingCountryCode = billingCountryCode;
5761
this.billingCity = billingCity;
@@ -85,6 +89,8 @@ public MerchantPurchase(Map<String, Object> data) throws Exception {
8589
this.holderName = (String) dataCopy.remove("holderName");
8690
this.holderEmail = (String) dataCopy.remove("holderEmail");
8791
this.holderPhone = (String) dataCopy.remove("holderPhone");
92+
this.holderId = (String) dataCopy.remove("holderId");
93+
this.softDescriptor = (String) dataCopy.remove("softDescriptor");
8894
this.fundingType = (String) dataCopy.remove("fundingType");
8995
this.billingCountryCode = (String) dataCopy.remove("billingCountryCode");
9096
this.billingCity = (String) dataCopy.remove("billingCity");

src/main/java/com/starkbank/MerchantSession.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,23 @@ public class MerchantSession extends Resource {
2424
public List<AllowedInstallment> allowedInstallments;
2525
public List<String> allowedIps;
2626
public String challengeMode;
27+
public String holderId;
28+
public String softDescriptor;
2729
public String created;
2830
public Number expiration;
2931
public String status;
3032
public String[] tags;
3133
public String updated;
3234
public String uuid;
3335

34-
public MerchantSession(String id, List<String> allowedFundingTypes, List<AllowedInstallment> allowedInstallments, List<String> allowedIps, String challengeMode, String created, Number expiration, String status, String[] tags, String updated, String uuid) {
36+
public MerchantSession(String id, List<String> allowedFundingTypes, List<AllowedInstallment> allowedInstallments, List<String> allowedIps, String challengeMode, String holderId, String softDescriptor, String created, Number expiration, String status, String[] tags, String updated, String uuid) {
3537
super(id);
3638
this.allowedFundingTypes = allowedFundingTypes;
3739
this.allowedInstallments = allowedInstallments;
3840
this.allowedIps = allowedIps;
3941
this.challengeMode = challengeMode;
42+
this.holderId = holderId;
43+
this.softDescriptor = softDescriptor;
4044
this.created = created;
4145
this.expiration = expiration;
4246
this.status = status;
@@ -53,6 +57,8 @@ public MerchantSession(Map<String, Object> data) throws Exception {
5357
this.allowedFundingTypes = (List<String>) dataCopy.remove("allowedFundingTypes");
5458
this.allowedInstallments = parseAllowedInstallments((List<Object>) dataCopy.remove("allowedInstallments"));
5559
this.challengeMode = (String) dataCopy.remove("challengeMode");
60+
this.holderId = (String) dataCopy.remove("holderId");
61+
this.softDescriptor = (String) dataCopy.remove("softDescriptor");
5662
this.expiration = (Number) dataCopy.remove("expiration");
5763
this.tags = (String[]) dataCopy.remove("tags");
5864
this.uuid = null;
@@ -186,6 +192,8 @@ public final static class Purchase extends Resource {
186192
public String holderName;
187193
public String holderEmail;
188194
public String holderPhone;
195+
public String holderId;
196+
public String softDescriptor;
189197
public String fundingType;
190198
public String billingCountryCode;
191199
public String billingCity;
@@ -201,7 +209,7 @@ public final static class Purchase extends Resource {
201209
public String[] tags;
202210
public String update;
203211

204-
public Purchase(String id, Long amount, Integer installmentCount, String cardId, String cardExpiration, String cardNumber, String cardSecurityCode, String holderName, String holderEmail, String holderPhone, String fundingType, String billingCountryCode, String billingCity, String billingStateCode, String billingStreetLine1, String billingStreetLine2, String billingZipCode, String challengeMode, Map<String, Object> metadata) {
212+
public Purchase(String id, Long amount, Integer installmentCount, String cardId, String cardExpiration, String cardNumber, String cardSecurityCode, String holderName, String holderEmail, String holderPhone, String holderId, String softDescriptor, String fundingType, String billingCountryCode, String billingCity, String billingStateCode, String billingStreetLine1, String billingStreetLine2, String billingZipCode, String challengeMode, Map<String, Object> metadata) {
205213
super(id);
206214
this.amount = amount;
207215
this.installmentCount = installmentCount;
@@ -212,6 +220,8 @@ public Purchase(String id, Long amount, Integer installmentCount, String cardId,
212220
this.holderName = holderName;
213221
this.holderEmail = holderEmail;
214222
this.holderPhone = holderPhone;
223+
this.holderId = holderId;
224+
this.softDescriptor = softDescriptor;
215225
this.fundingType = fundingType;
216226
this.billingCountryCode = billingCountryCode;
217227
this.billingCity = billingCity;
@@ -246,6 +256,8 @@ public Purchase(Map<String, Object> data) throws Exception {
246256
this.billingZipCode = (String) dataCopy.remove("billingZipCode");
247257
this.metadata = (Map<String, Object>) dataCopy.remove("metadata");
248258
this.tags = (String[]) dataCopy.remove("tags");
259+
this.holderId = (String) dataCopy.remove("holderId");
260+
this.softDescriptor = (String) dataCopy.remove("softDescriptor");
249261
this.challengeMode = null;
250262
this.network = null;
251263
this.source = null;

src/test/java/TestMerchantPurchase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ public class TestMerchantPurchase {
1616
@Test
1717
public void testCreate() throws Exception {
1818
Settings.user = utils.User.defaultProject();
19+
Settings.timeout = 20;
20+
1921
MerchantSession merchantSession = MerchantSession.create(exampleMerchantSession("disabled"));
2022
MerchantSession.Purchase purchase = MerchantSession.purchase(merchantSession.uuid, examplePurchaseChallengeModeDisable());
2123

22-
System.out.println(exampleMerchantPurchase(purchase.cardId));
2324
MerchantPurchase merchantPurchase = MerchantPurchase.create(exampleMerchantPurchase(purchase.cardId));
2425
System.out.println(merchantPurchase);
2526
Assert.assertNotNull(merchantPurchase.id);

src/test/java/TestMerchantSession.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public void testLogs() throws Exception {
125125
@Test
126126
public void testMerchantSessionPurchaseChallengeModeDisabled() throws Exception {
127127
Settings.user = utils.User.defaultProject();
128+
Settings.timeout = 20;
128129

129130
MerchantSession merchantSession = MerchantSession.create(exampleMerchantSession("disabled"));
130131

src/test/java/utils/MerchantSession.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public static com.starkbank.MerchantSession exampleMerchantSession(String challe
2626
data.put("allowedInstallments", allowedInstallments);
2727
data.put("expiration", 3600);
2828
data.put("challengeMode", challengeMode);
29+
data.put("holderId", "5656565656565656");
30+
data.put("softDescriptor", "Stark Bank");
2931

3032
data.put("tags", new String[]{"Stark", "Suit"});
3133

@@ -42,6 +44,9 @@ public static com.starkbank.MerchantSession.Purchase examplePurchaseChallengeMod
4244
purchaseData.put("holderName", "Margaery Tyrell");
4345
purchaseData.put("holderEmail", "margaery.tyrell@starkbank.com");
4446
purchaseData.put("holderPhone", "11998663456");
47+
purchaseData.put("holderId", "5656565656565656");
48+
purchaseData.put("softDescriptor", "Stark Bank");
49+
4550
purchaseData.put("fundingType", "credit");
4651
purchaseData.put("billingCountryCode", "BRA");
4752
purchaseData.put("billingCity", "Sao Paulo");

0 commit comments

Comments
 (0)