Skip to content

Commit

Permalink
fixed klarna
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Nov 2, 2023
1 parent a4a74e6 commit d4db931
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ public PayIn deserialize(JsonElement json, Type typeOfT, JsonDeserializationCont
payInPaymentDetailsKlarna.setBilling((Billing) context.deserialize(object.get("Billing"), Billing.class));
if (object.has("PaymentMethod") && !object.get("PaymentMethod").isJsonNull())
payInPaymentDetailsKlarna.setPaymentMethod(object.get("PaymentMethod").getAsString());
if (object.has("MerchantOrderId") && !object.get("MerchantOrderId").isJsonNull())
payInPaymentDetailsKlarna.setMerchantOrderId(object.get("MerchantOrderId").getAsString());
if (object.has("Reference") && !object.get("Reference").isJsonNull())
payInPaymentDetailsKlarna.setReference(object.get("Reference").getAsString());
if (object.has("Country") && !object.get("Country").isJsonNull())
payInPaymentDetailsKlarna.setCountry((CountryIso) context.deserialize(object.get("Country"), CountryIso.class));
if (object.has("Culture") && !object.get("Culture").isJsonNull())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public JsonElement serialize(PayIn src, Type typeOfSrc, JsonSerializationContext
object.add("Shipping", context.serialize(((PayInPaymentDetailsKlarna) src.getPaymentDetails()).getShipping()));
object.add("Billing", context.serialize(((PayInPaymentDetailsKlarna) src.getPaymentDetails()).getBilling()));
object.add("PaymentMethod", context.serialize(((PayInPaymentDetailsKlarna) src.getPaymentDetails()).getPaymentMethod()));
object.add("MerchantOrderId", context.serialize(((PayInPaymentDetailsKlarna) src.getPaymentDetails()).getMerchantOrderId()));
object.add("Reference", context.serialize(((PayInPaymentDetailsKlarna) src.getPaymentDetails()).getReference()));
object.add("Country", context.serialize(((PayInPaymentDetailsKlarna) src.getPaymentDetails()).getCountry()));
object.add("Culture", context.serialize(((PayInPaymentDetailsKlarna) src.getPaymentDetails()).getCulture()));
object.add("Phone", context.serialize(((PayInPaymentDetailsKlarna) src.getPaymentDetails()).getPhone()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.mangopay.entities.subentities;

import com.google.gson.annotations.SerializedName;
import com.mangopay.core.*;
import com.mangopay.core.Billing;
import com.mangopay.core.Dto;
import com.mangopay.core.LineItem;
import com.mangopay.core.Shipping;
import com.mangopay.core.enumerations.CountryIso;
import com.mangopay.core.enumerations.CultureCode;
import com.mangopay.core.interfaces.PayInPaymentDetails;
Expand All @@ -28,8 +31,8 @@ public class PayInPaymentDetailsKlarna extends Dto implements PayInPaymentDetail
@SerializedName("PaymentMethod")
private String paymentMethod;

@SerializedName("MerchantOrderId")
private String merchantOrderId;
@SerializedName("Reference")
private String reference;

@SerializedName("Country")
private CountryIso country;
Expand Down Expand Up @@ -82,12 +85,12 @@ public PayInPaymentDetailsKlarna setPaymentMethod(String paymentMethod) {
return this;
}

public String getMerchantOrderId() {
return merchantOrderId;
public String getReference() {
return reference;
}

public PayInPaymentDetailsKlarna setMerchantOrderId(String merchantOrderId) {
this.merchantOrderId = merchantOrderId;
public PayInPaymentDetailsKlarna setReference(String reference) {
this.reference = reference;
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/mangopay/core/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ private PayIn getPayInKlarnaWeb(String userId) throws Exception {
.setShipping(this.getNewShipping())
.setBilling(this.getNewBilling())
.setPaymentMethod("")
.setMerchantOrderId("afd48-879d-48fg")
.setReference("afd48-879d-48fg")
.setCountry(CountryIso.FR)
.setCulture(CultureCode.FR)
.setPhone("351#269458236")
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/mangopay/core/PayInApiImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ public void testDirectGooglepayPayin() {
}

@Test
@Ignore("Cannot generate payment data in tests")
public void testDirectGooglepayV2Payin() {
try {
Wallet wallet = getJohnsWallet();
Expand Down

0 comments on commit d4db931

Please sign in to comment.