Skip to content

Commit

Permalink
added new fields to serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaimoiseanu committed Mar 27, 2024
1 parent 285e5be commit 1a27483
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@ public PayIn deserialize(JsonElement json, Type typeOfT, JsonDeserializationCont
if (object.has("CancelURL") && !object.get("CancelURL").isJsonNull()) {
payInPaymentDetailsPayPal.setCancelUrl(object.get("CancelURL").getAsString());
}
if (object.has("PaypalPayerID") && !object.get("PaypalPayerID").isJsonNull()) {
payInPaymentDetailsPayPal.setPaypalOrderID(object.get("PaypalPayerID").getAsString());
}
if (object.has("BuyerCountry") && !object.get("BuyerCountry").isJsonNull()) {
payInPaymentDetailsPayPal.setBuyerCountry(object.get("BuyerCountry").getAsString());
}
if (object.has("BuyerFirstname") && !object.get("BuyerFirstname").isJsonNull()) {
payInPaymentDetailsPayPal.setBuyerFirstName(object.get("BuyerFirstname").getAsString());
}
if (object.has("BuyerLastname") && !object.get("BuyerLastname").isJsonNull()) {
payInPaymentDetailsPayPal.setBuyerLastName(object.get("BuyerLastname").getAsString());
}
if (object.has("BuyerPhone") && !object.get("BuyerPhone").isJsonNull()) {
payInPaymentDetailsPayPal.setBuyerPhone(object.get("BuyerPhone").getAsString());
}
if (object.has("PaypalOrderID") && !object.get("PaypalOrderID").isJsonNull()) {
payInPaymentDetailsPayPal.setPaypalOrderID(object.get("PaypalOrderID").getAsString());
}
if (object.has("Trackings") && !object.get("Trackings").isJsonNull()) {
payInPaymentDetailsPayPal.setTrackings((PayPalWebTrackingData) context.deserialize(object.get("Trackings"), PayPalWebTrackingData.class));
}

payIn.setPaymentDetails(payInPaymentDetailsPayPal);
break;
case PAYCONIQ:
Expand Down Expand Up @@ -181,7 +203,8 @@ public PayIn deserialize(JsonElement json, Type typeOfT, JsonDeserializationCont
case KLARNA:
PayInPaymentDetailsKlarna payInPaymentDetailsKlarna = new PayInPaymentDetailsKlarna();
if (object.has("LineItems") && !object.get("LineItems").isJsonNull()) {
Type listType = new TypeToken<ArrayList<LineItem>>(){}.getType();
Type listType = new TypeToken<ArrayList<LineItem>>() {
}.getType();
payInPaymentDetailsKlarna.setLineItems((List<LineItem>) context.deserialize(object.get("LineItems"), listType));
}
if (object.has("Shipping") && !object.get("Shipping").isJsonNull())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ public JsonElement serialize(PayIn src, Type typeOfSrc, JsonSerializationContext
object.add("ShippingPreference", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getShippingPreference()));
object.add("Reference", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getReference()));
object.add("CancelURL", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getCancelUrl()));
object.add("PaypalPayerID", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getPaypalPayerId()));
object.add("BuyerCountry", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getBuyerCountry()));
object.add("BuyerFirstname", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getBuyerFirstName()));
object.add("BuyerLastname", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getBuyerLastName()));
object.add("BuyerPhone", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getBuyerPhone()));
object.add("PaypalOrderID", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getPaypalOrderID()));
object.add("Trackings", context.serialize(((PayInPaymentDetailsPayPal) src.getPaymentDetails()).getTrackings()));
break;
case "PayInPaymentDetailsPayconiq":
object.add("Country", context.serialize(((PayInPaymentDetailsPayconiq) src.getPaymentDetails()).getCountry()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public class PayInPaymentDetailsPayPal extends Dto implements PayInPaymentDetail
private String buyerCountry;

@SerializedName("BuyerFirstname")
private String buyerFirstname;
private String buyerFirstName;

@SerializedName("BuyerLastname")
private String buyerLastname;
private String buyerLastName;

@SerializedName("BuyerPhone")
private String buyerPhone;
Expand Down Expand Up @@ -165,20 +165,20 @@ public void setBuyerCountry(String buyerCountry) {
this.buyerCountry = buyerCountry;
}

public String getBuyerFirstname() {
return buyerFirstname;
public String getBuyerFirstName() {
return buyerFirstName;
}

public void setBuyerFirstname(String buyerFirstname) {
this.buyerFirstname = buyerFirstname;
public void setBuyerFirstName(String buyerFirstname) {
this.buyerFirstName = buyerFirstname;
}

public String getBuyerLastname() {
return buyerLastname;
public String getBuyerLastName() {
return buyerLastName;
}

public void setBuyerLastname(String buyerLastname) {
this.buyerLastname = buyerLastname;
public void setBuyerLastName(String buyerLastname) {
this.buyerLastName = buyerLastname;
}

public String getBuyerPhone() {
Expand Down

0 comments on commit 1a27483

Please sign in to comment.