diff --git a/src/main/java/com/mangopay/core/deserializer/PayInDeserializer.java b/src/main/java/com/mangopay/core/deserializer/PayInDeserializer.java index 99055633..7616d1ee 100644 --- a/src/main/java/com/mangopay/core/deserializer/PayInDeserializer.java +++ b/src/main/java/com/mangopay/core/deserializer/PayInDeserializer.java @@ -49,6 +49,8 @@ public PayIn deserialize(JsonElement json, Type typeOfT, JsonDeserializationCont payInPaymentDetailsCard.setBankName(object.get("BankName").getAsString()); if (object.has("CardInfo") && !object.get("CardInfo").isJsonNull()) payInPaymentDetailsCard.setCardInfo((CardInfo) context.deserialize(object.get("CardInfo"), CardInfo.class)); + if (object.has("PaymentCategory") && !object.get("PaymentCategory").isJsonNull()) + payInPaymentDetailsCard.setPaymentCategory(object.get("PaymentCategory").getAsString()); payIn.setPaymentDetails(payInPaymentDetailsCard); break; case PREAUTHORIZED: diff --git a/src/main/java/com/mangopay/core/serializer/PayInSerializer.java b/src/main/java/com/mangopay/core/serializer/PayInSerializer.java index d20a9517..8f52e4f9 100644 --- a/src/main/java/com/mangopay/core/serializer/PayInSerializer.java +++ b/src/main/java/com/mangopay/core/serializer/PayInSerializer.java @@ -35,6 +35,7 @@ public JsonElement serialize(PayIn src, Type typeOfSrc, JsonSerializationContext object.add("IpAddress", context.serialize(((PayInPaymentDetailsCard) src.getPaymentDetails()).getIpAddress())); object.add("Bic", context.serialize(((PayInPaymentDetailsCard) src.getPaymentDetails()).getBic())); object.add("BankName", context.serialize(((PayInPaymentDetailsCard) src.getPaymentDetails()).getBankName())); + object.add("PaymentCategory", context.serialize(((PayInPaymentDetailsCard) src.getPaymentDetails()).getPaymentCategory())); break; case "PayInPaymentDetailsPreAuthorized": object.add("PreauthorizationId", context.serialize(((PayInPaymentDetailsPreAuthorized) src.getPaymentDetails()).getPreauthorizationId())); diff --git a/src/main/java/com/mangopay/entities/Card.java b/src/main/java/com/mangopay/entities/Card.java index 31237be9..6facdcc9 100644 --- a/src/main/java/com/mangopay/entities/Card.java +++ b/src/main/java/com/mangopay/entities/Card.java @@ -195,6 +195,11 @@ public String getCardHolderName() { return cardHolderName; } + public Card setCardHolderName(String cardHolderName) { + this.cardHolderName = cardHolderName; + return this; + } + /** * Gets the collection of read-only fields names. * diff --git a/src/main/java/com/mangopay/entities/CardPreAuthorization.java b/src/main/java/com/mangopay/entities/CardPreAuthorization.java index 68d5d0b5..4d1d1b30 100644 --- a/src/main/java/com/mangopay/entities/CardPreAuthorization.java +++ b/src/main/java/com/mangopay/entities/CardPreAuthorization.java @@ -152,6 +152,9 @@ public class CardPreAuthorization extends EntityBase { @SerializedName("CardInfo") private CardInfo cardInfo; + @SerializedName("PaymentCategory") + private String paymentCategory; + public CardInfo getCardInfo() { return cardInfo; } @@ -355,6 +358,15 @@ public void setCulture(CultureCode culture) { this.culture = culture; } + public String getPaymentCategory() { + return paymentCategory; + } + + public CardPreAuthorization setPaymentCategory(String paymentCategory) { + this.paymentCategory = paymentCategory; + return this; + } + /** * Gets map which property is an object and what type of object. * To be overridden in child class if has any sub objects. diff --git a/src/main/java/com/mangopay/entities/CardValidation.java b/src/main/java/com/mangopay/entities/CardValidation.java index 4d56a9f5..17246555 100644 --- a/src/main/java/com/mangopay/entities/CardValidation.java +++ b/src/main/java/com/mangopay/entities/CardValidation.java @@ -103,6 +103,9 @@ public class CardValidation extends EntityBase { @SerializedName("CardInfo") private CardInfo cardInfo; + @SerializedName("PaymentCategory") + private String paymentCategory; + public String getAuthorId() { return authorId; } @@ -245,6 +248,15 @@ public CardValidation setSecureMode(SecureMode secureMode) { return this; } + public String getPaymentCategory() { + return paymentCategory; + } + + public CardValidation setPaymentCategory(String paymentCategory) { + this.paymentCategory = paymentCategory; + return this; + } + /** * Gets map which property is an object and what type of object. * To be overridden in child class if has any sub objects. diff --git a/src/main/java/com/mangopay/entities/Refund.java b/src/main/java/com/mangopay/entities/Refund.java index f16a9496..f6d85593 100644 --- a/src/main/java/com/mangopay/entities/Refund.java +++ b/src/main/java/com/mangopay/entities/Refund.java @@ -46,6 +46,9 @@ public class Refund extends Transaction { @SerializedName("Reference") private String reference; + @SerializedName("StatementDescriptor") + private String statementDescriptor; + public String getInitialTransactionId() { return initialTransactionId; } @@ -94,6 +97,15 @@ public void setReference(String reference) { this.reference = reference; } + public String getStatementDescriptor() { + return statementDescriptor; + } + + public Refund setStatementDescriptor(String statementDescriptor) { + this.statementDescriptor = statementDescriptor; + return this; + } + /** * Gets map which property is an object and what type of object. * diff --git a/src/main/java/com/mangopay/entities/subentities/PayInPaymentDetailsCard.java b/src/main/java/com/mangopay/entities/subentities/PayInPaymentDetailsCard.java index 0904ddcf..b2179d31 100644 --- a/src/main/java/com/mangopay/entities/subentities/PayInPaymentDetailsCard.java +++ b/src/main/java/com/mangopay/entities/subentities/PayInPaymentDetailsCard.java @@ -58,6 +58,9 @@ public class PayInPaymentDetailsCard extends Dto implements PayInPaymentDetails @SerializedName("CardInfo") private CardInfo cardInfo; + @SerializedName("PaymentCategory") + private String paymentCategory; + public PayInPaymentDetailsCard() { } @@ -148,6 +151,15 @@ public PayInPaymentDetailsCard setCardInfo(CardInfo cardInfo) { return this; } + public String getPaymentCategory() { + return paymentCategory; + } + + public PayInPaymentDetailsCard setPaymentCategory(String paymentCategory) { + this.paymentCategory = paymentCategory; + return this; + } + public PayInPaymentDetailsCard(CardType cardType, String cardId, String statementDescriptor, Shipping shipping) { this.cardType = cardType; this.cardId = cardId; diff --git a/src/test/java/com/mangopay/core/BaseTest.java b/src/test/java/com/mangopay/core/BaseTest.java index ad668943..75cffb9e 100644 --- a/src/test/java/com/mangopay/core/BaseTest.java +++ b/src/test/java/com/mangopay/core/BaseTest.java @@ -634,6 +634,7 @@ private PayIn getPayInCardDirect(String userId) throws Exception { ((PayInPaymentDetailsCard) payIn.getPaymentDetails()).setCardType(card.getCardType()); ((PayInPaymentDetailsCard) payIn.getPaymentDetails()).setBrowserInfo(getNewBrowserInfo()); ((PayInPaymentDetailsCard) payIn.getPaymentDetails()).setIpAddress("2001:0620:0000:0000:0211:24FF:FE80:C12C"); + ((PayInPaymentDetailsCard) payIn.getPaymentDetails()).setPaymentCategory("TelephoneOrder"); // execution type as DIRECT payIn.setExecutionDetails(new PayInExecutionDetailsDirect()); @@ -1209,6 +1210,7 @@ protected CardPreAuthorization getPreAuthorization() throws Exception { cardPreAuthorization.setCardId(getCardRegistration.getCardId()); cardPreAuthorization.setSecureModeReturnUrl("http://test.com"); cardPreAuthorization.setCulture(CultureCode.FR); + cardPreAuthorization.setPaymentCategory("TelephoneOrder"); cardPreAuthorization.setBrowserInfo(getNewBrowserInfo()); cardPreAuthorization.setIpAddress("2001:0620:0000:0000:0211:24FF:FE80:C12C"); @@ -1236,6 +1238,7 @@ protected CardValidation createJohnsCardValidation() throws Exception { cardValidation.setAuthorId(user.getId()); cardValidation.setSecureModeReturnUrl("http://test.com"); cardValidation.setSecureMode(SecureMode.NO_CHOICE); + cardValidation.setPaymentCategory("TelephoneOrder"); cardValidation.setBrowserInfo(getNewBrowserInfo()); cardValidation.setIpAddress("2001:0620:0000:0000:0211:24FF:FE80:C12C"); diff --git a/src/test/java/com/mangopay/core/CardApiImplTest.java b/src/test/java/com/mangopay/core/CardApiImplTest.java index 45ce4c31..ad8b00e5 100644 --- a/src/test/java/com/mangopay/core/CardApiImplTest.java +++ b/src/test/java/com/mangopay/core/CardApiImplTest.java @@ -60,6 +60,7 @@ public void validateCard() throws Exception{ assertNotNull(cardValidation.getId()); assertNotNull(cardValidation.getSecureMode()); assertEquals(TransactionType.CARD_VALIDATION, cardValidation.getType()); + assertEquals("TelephoneOrder", cardValidation.getPaymentCategory()); } @Test @@ -76,11 +77,13 @@ public void disableCard() throws Exception{ CardApi cardApi = api.getCardApi(); PayIn payIn = getNewPayInCardDirect(); Card card = cardApi.get(((PayInPaymentDetailsCard) payIn.getPaymentDetails()).getCardId()); + card.setCardHolderName("placeholder name"); assertTrue(card.isActive()); Card update = cardApi.disable(card); assertFalse(update.isActive()); + assertEquals("placeholder name", card.getCardHolderName()); } } diff --git a/src/test/java/com/mangopay/core/CardPreAuthorizationApiImplTest.java b/src/test/java/com/mangopay/core/CardPreAuthorizationApiImplTest.java index bc9c5ce4..ecb335ff 100644 --- a/src/test/java/com/mangopay/core/CardPreAuthorizationApiImplTest.java +++ b/src/test/java/com/mangopay/core/CardPreAuthorizationApiImplTest.java @@ -27,6 +27,7 @@ public void createCardPreAuthorization() throws Exception { assertTrue((cardPreAuthorization.getCulture()) == CultureCode.FR); assertNull(cardPreAuthorization.getPayInId()); assertNotNull(cardPreAuthorization.getRemainingFunds()); + assertEquals("TelephoneOrder", cardPreAuthorization.getPaymentCategory()); } @Test diff --git a/src/test/java/com/mangopay/core/PayInApiImplTest.java b/src/test/java/com/mangopay/core/PayInApiImplTest.java index f3430a36..1a22c159 100644 --- a/src/test/java/com/mangopay/core/PayInApiImplTest.java +++ b/src/test/java/com/mangopay/core/PayInApiImplTest.java @@ -69,6 +69,7 @@ public void createCardDirect() { UserNatural user = this.getJohn(); check(user, payIn, wallet, beforeWallet); + assertEquals("TelephoneOrder", ((PayInPaymentDetailsCard) payIn.getPaymentDetails()).getPaymentCategory()); } catch (Exception ex) { fail(ex.getMessage()); }