Skip to content

Commit

Permalink
Merge pull request #342 from Mangopay/feature/add-payout-payment-ref
Browse files Browse the repository at this point in the history
Adds PaymentRef to PayOut object for refunding bank wire pay-in
  • Loading branch information
iulian03 authored Dec 13, 2024
2 parents 0706a7b + 2ef8b7b commit 0704c46
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.mangopay.core.deserializer;

import com.google.gson.*;
import com.mangopay.core.Money;
import com.mangopay.core.enumerations.PayoutMode;
import com.mangopay.entities.PayOut;
import com.mangopay.entities.subentities.FallbackReason;
import com.mangopay.entities.subentities.PayOutPaymentDetailsBankWire;
import com.mangopay.entities.subentities.PayOutPaymentRef;

import java.lang.reflect.Type;

Expand All @@ -21,6 +21,8 @@ public PayOut deserialize(JsonElement json, Type typeOfT, JsonDeserializationCon
meanOfPaymentDetails.setBankAccountId(object.get("BankAccountId").getAsString());
if (object.has("BankWireRef") && !object.get("BankWireRef").isJsonNull())
meanOfPaymentDetails.setBankWireRef(object.get("BankWireRef").getAsString());
if (object.has("PaymentRef") && !object.get("PaymentRef").isJsonNull())
meanOfPaymentDetails.setPaymentRef((PayOutPaymentRef) context.deserialize(object.get("PaymentRef"), PayOutPaymentRef.class));
if (object.has("ModeRequested") && !object.get("ModeRequested").isJsonNull())
meanOfPaymentDetails.setPayoutModeRequested(PayoutMode.valueOf(object.get("ModeRequested").getAsString()));
if (object.has("ModeApplied") && !object.get("ModeApplied").isJsonNull())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public class PayOutPaymentDetailsBankWire extends Dto implements PayOutPaymentDe
@SerializedName("BankWireRef")
private String bankWireRef;

/**
* Payment reference provided for the payout.
*/
@SerializedName("PaymentRef")
private PayOutPaymentRef paymentRef;

/**
* The requested payout mode.
*/
Expand Down Expand Up @@ -82,6 +88,14 @@ public void setBankWireRef(String bankWireRef) {
this.bankWireRef = bankWireRef;
}

public PayOutPaymentRef getPaymentRef() {
return paymentRef;
}

public void setPaymentRef(PayOutPaymentRef paymentRef) {
this.paymentRef = paymentRef;
}

public PayoutMode getPayoutModeRequested() {
return payoutModeRequested;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.mangopay.entities.subentities;

import com.google.gson.annotations.SerializedName;

public class PayOutPaymentRef {

// Only valid PaymentRef reasonType is PAYIN_REFUND
@SerializedName("ReasonType")
private String reasonType;

@SerializedName("ReferenceId")
private String referenceId;

public String getReasonType() {
return reasonType;
}

public void setReasonType(String reasonType) {
this.reasonType = reasonType;
}

public String getReferenceId() {
return referenceId;
}

public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/com/mangopay/core/mangopay.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Mon Aug 26 15:10:34 EEST 2024
#Wed Dec 11 22:22:55 EET 2024
version=2.38.2

0 comments on commit 0704c46

Please sign in to comment.