-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the payment billing/shipping address properties (#381)
- Loading branch information
1 parent
7ba1bcb
commit 06ba339
Showing
5 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,4 @@ public record AddressObject { | |
/// </summary> | ||
public string? Country { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace Mollie.Api.Models.Payment; | ||
|
||
public record PaymentAddressDetails : AddressObject { | ||
/// <summary> | ||
/// The person’s organization, if applicable. | ||
/// </summary> | ||
public string? OrganizationName { get; set; } | ||
|
||
/// <summary> | ||
/// The title of the person, for example Mr. or Mrs.. | ||
/// </summary> | ||
public string? Title { get; set; } | ||
|
||
/// <summary> | ||
/// The given name (first name) of the person. | ||
/// </summary> | ||
public string? GivenName { get; set; } | ||
|
||
/// <summary> | ||
/// The family name (surname) of the person. | ||
/// </summary> | ||
public string? FamilyName { get; set; } | ||
|
||
/// <summary> | ||
/// The email address of the person. | ||
/// </summary> | ||
public string? Email { get; set; } | ||
|
||
/// <summary> | ||
/// The phone number of the person. Some payment methods require this information. If you have it, you | ||
/// should pass it so that your customer does not have to enter it again in the checkout. Must be in | ||
/// the E.164 format. For example +31208202070. | ||
/// </summary> | ||
public string? Phone { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -363,6 +363,19 @@ public async Task CanCreatePaymentWithCustomMetaDataClass() { | |
[DefaultRetryFact] | ||
public async Task CanCreatePaymentWithLines() { | ||
// Arrange | ||
var address = new PaymentAddressDetails { | ||
Title = "Mr", | ||
GivenName = "John", | ||
FamilyName = "Doe", | ||
OrganizationName = "Mollie", | ||
StreetAndNumber = "Keizersgracht 126", | ||
Email = "[email protected]", | ||
City = "Amsterdam", | ||
Country = "NL", | ||
Phone = "+31600000000", | ||
Region = "Zuid-Holland", | ||
PostalCode = "1015CW" | ||
}; | ||
PaymentRequest paymentRequest = new PaymentRequest() { | ||
Amount = new Amount(Currency.EUR, 90m), | ||
Description = "Description", | ||
|
@@ -382,14 +395,18 @@ public async Task CanCreatePaymentWithLines() { | |
VatAmount = new Amount(Currency.EUR, 15.62m), | ||
VatRate = "21.00" | ||
} | ||
} | ||
}, | ||
ShippingAddress = address, | ||
BillingAddress = address | ||
}; | ||
|
||
// Act | ||
PaymentResponse result = await _paymentClient.CreatePaymentAsync(paymentRequest); | ||
|
||
// Assert | ||
result.Lines.Should().BeEquivalentTo(paymentRequest.Lines); | ||
result.BillingAddress.Should().BeEquivalentTo(paymentRequest.BillingAddress); | ||
result.ShippingAddress.Should().BeEquivalentTo(paymentRequest.ShippingAddress); | ||
} | ||
|
||
[DefaultRetryFact] | ||
|