Skip to content

Commit

Permalink
Merge pull request #125 from Mangopay/MPSDK-255-Add-paypal-buyer-acco…
Browse files Browse the repository at this point in the history
…unt-email-on-payin-paypal-response

Added PayPal buyer account email to PayPal response
  • Loading branch information
mickaelpois authored Aug 28, 2018
2 parents 1fc0855 + f1b033c commit 419fd39
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class PayInPaymentDetailsPayPal extends Dto implements PayInPaymentDetail
@SerializedName("ShippingAddress")
private ShippingAddress shippingAddress;

@SerializedName("PaypalBuyerAccountEmail")
private String paypalBuyerAccountEmail;

public ShippingAddress getShippingAddress() {
return shippingAddress;
}
Expand All @@ -35,4 +38,13 @@ public Map<String, Type> getSubObjects() {

return subObjects;
}

public String getPaypalBuyerAccountEmail() {
return paypalBuyerAccountEmail;
}

public PayInPaymentDetailsPayPal setPaypalBuyerAccountEmail(String paypalBuyerAccountEmail) {
this.paypalBuyerAccountEmail = paypalBuyerAccountEmail;
return this;
}
}
15 changes: 15 additions & 0 deletions src/test/java/com/mangopay/core/PayInApiImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,19 @@ public void getPayInRefunds() throws Exception {
assertTrue("Second page does not contain second refund", secondPage.get(0).getId().equals(secondRefund.getId()));

}

@Test
public void testPayPalAccountEmail() throws Exception {
String payInId = "54088959";
String payPalBuyerEmail = "[email protected]";
PayIn payIn = this.api.getPayInApi().get(payInId);

assertNotNull("PayIn is null", payIn);
assertEquals("Payment is not of PayPal type", PayInPaymentType.PAYPAL, payIn.getPaymentType());

PayInPaymentDetailsPayPal paymentDetails = (PayInPaymentDetailsPayPal) payIn.getPaymentDetails();
assertNotNull("Payment details are null", paymentDetails);
assertNotNull("Payment account email is not null", paymentDetails.getPaypalBuyerAccountEmail());
assertEquals("Expected PayPal buyer account doesn't match", payPalBuyerEmail, paymentDetails.getPaypalBuyerAccountEmail());
}
}

0 comments on commit 419fd39

Please sign in to comment.