-
-
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.
Create a constructor overload for payment method specific payment req…
…uests (#384)
- Loading branch information
1 parent
e4af109
commit bf99b47
Showing
11 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
9 changes: 8 additions & 1 deletion
9
src/Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/ApplePayPaymentRequest.cs
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
7 changes: 7 additions & 0 deletions
7
...Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/BankTransferPaymentRequest.cs
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
7 changes: 7 additions & 0 deletions
7
src/Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/CreditCardPaymentRequest.cs
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
9 changes: 8 additions & 1 deletion
9
src/Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/GiftcardPaymentRequest.cs
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
7 changes: 7 additions & 0 deletions
7
src/Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/IDealPaymentRequest.cs
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
9 changes: 8 additions & 1 deletion
9
src/Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/KbcPaymentRequest.cs
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
7 changes: 7 additions & 0 deletions
7
src/Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/PayPalPaymentRequest.cs
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
9 changes: 8 additions & 1 deletion
9
src/Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/PaySafeCardPaymentRequest.cs
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
7 changes: 7 additions & 0 deletions
7
src/Mollie.Api/Models/Payment/Request/PaymentSpecificParameters/SepaDirectDebitRequest.cs
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
39 changes: 39 additions & 0 deletions
39
tests/Mollie.Tests.Unit/Models/Payment/Request/PaymentRequestTests.cs
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,39 @@ | ||
using System; | ||
using FluentAssertions; | ||
using Mollie.Api.Models; | ||
using Mollie.Api.Models.Payment; | ||
using Mollie.Api.Models.Payment.Request; | ||
using Mollie.Api.Models.Payment.Request.PaymentSpecificParameters; | ||
using Xunit; | ||
|
||
namespace Mollie.Tests.Unit.Models.Payment.Request; | ||
|
||
public class PaymentRequestTests { | ||
[Theory] | ||
[InlineData(PaymentMethod.CreditCard, typeof(CreditCardPaymentRequest))] | ||
[InlineData(PaymentMethod.Ideal, typeof(IdealPaymentRequest))] | ||
public void CreatePaymentRequest(string paymentMethod, Type expectedType) { | ||
var amount = new Amount(Currency.EUR, 50m); | ||
var description = "my-description"; | ||
var paymentRequest = new PaymentRequest() { | ||
Amount = amount, | ||
Description = description | ||
}; | ||
switch (paymentMethod) { | ||
case PaymentMethod.CreditCard: | ||
paymentRequest = new CreditCardPaymentRequest(paymentRequest) { | ||
CardToken = "card-token" | ||
}; | ||
break; | ||
case PaymentMethod.Ideal: | ||
paymentRequest = new IdealPaymentRequest(paymentRequest) { | ||
Issuer = "ideal_issuer" | ||
}; | ||
break; | ||
} | ||
|
||
paymentRequest.Should().BeOfType(expectedType); | ||
paymentRequest.Amount.Should().Be(amount); | ||
paymentRequest.Description.Should().Be(description); | ||
} | ||
} |