Skip to content

Commit

Permalink
Improve the way we can use payment method specific payment requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed Jul 9, 2024
1 parent b75101b commit e26764f
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record ApplePayPaymentRequest : PaymentRequest {
public ApplePayPaymentRequest()
{
Method = PaymentMethod.ApplePay;
}

[SetsRequiredMembers]
public ApplePayPaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.ApplePay;
}

/// <summary>
/// Optional - The Apple Pay Payment Token object (encoded as JSON) that is part of the result of authorizing a payment
/// request. The token contains the payment information needed to authorize the payment.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record BankTransferPaymentRequest : PaymentRequest {
public BankTransferPaymentRequest() {
Method = PaymentMethod.BankTransfer;
}

[SetsRequiredMembers]
public BankTransferPaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.BankTransfer;
}

/// <summary>
/// Optional - Consumer's e-mail address, to automatically send the bank transfer details to. Please note: the payment
/// instructions will be sent immediately when creating the payment. if you don't specify the locale parameter, the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record CreditCardPaymentRequest : PaymentRequest {
public CreditCardPaymentRequest() {
Method = PaymentMethod.CreditCard;
}

[SetsRequiredMembers]
public CreditCardPaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.CreditCard;
}

/// <summary>
/// The card holder�s address details. We advise to provide these details to improve the credit card
/// fraud protection, and thus improve conversion.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record GiftcardPaymentRequest : PaymentRequest {
public GiftcardPaymentRequest() {
Method = PaymentMethod.GiftCard;
}

[SetsRequiredMembers]
public GiftcardPaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.GiftCard;
}

/// <summary>
/// The gift card brand to use for the payment. These issuers are not dynamically available through the Issuers API,
/// but can be retrieved by using the issuers include in the Methods API. If you need a brand not in the list, contact
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record IdealPaymentRequest : PaymentRequest {
public IdealPaymentRequest() {
Method = PaymentMethod.Ideal;
}

[SetsRequiredMembers]
public IdealPaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.Ideal;
}

/// <summary>
/// (Optional) iDEAL issuer id. The id could for example be ideal_INGBNL2A. The returned paymentUrl will then directly
/// point to the ING web site.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record KbcPaymentRequest : PaymentRequest {
public KbcPaymentRequest() {
Method = PaymentMethod.Kbc;
}

[SetsRequiredMembers]
public KbcPaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.Kbc;
}

/// <summary>
/// The issuer to use for the KBC/CBC payment. These issuers are not dynamically available through the Issuers API,
/// but can be retrieved by using the issuers include in the Methods API. See the Mollie.Api.Models.Payment.Request.KbcIssuer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record PayPalPaymentRequest : PaymentRequest {
public PayPalPaymentRequest() {
Method = PaymentMethod.PayPal;
}

[SetsRequiredMembers]
public PayPalPaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.PayPal;
}

/// <summary>
/// The shipping address details. We advise to provide these details to improve PayPal�s fraud protection,
/// and thus improve conversion.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record PaySafeCardPaymentRequest : PaymentRequest {
public PaySafeCardPaymentRequest() {
Method = PaymentMethod.PaySafeCard;
}

[SetsRequiredMembers]
public PaySafeCardPaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.PaySafeCard;
}

/// <summary>
/// Used for consumer identification. For example, you could use the consumer’s IP address.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters
{
public record Przelewy24PaymentRequest : PaymentRequest
Expand All @@ -7,6 +9,11 @@ public Przelewy24PaymentRequest()
Method = PaymentMethod.Przelewy24;
}

[SetsRequiredMembers]
public Przelewy24PaymentRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.Przelewy24;
}

/// <summary>
/// Consumer�s email address, this is required for Przelewy24 payments.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using System.Diagnostics.CodeAnalysis;

namespace Mollie.Api.Models.Payment.Request.PaymentSpecificParameters {
public record SepaDirectDebitRequest : PaymentRequest {
public SepaDirectDebitRequest() {
Method = PaymentMethod.DirectDebit;
}

[SetsRequiredMembers]
public SepaDirectDebitRequest(PaymentRequest paymentRequest) : base(paymentRequest) {
Method = PaymentMethod.DirectDebit;
}

/// <summary>
/// Optional - Beneficiary name of the account holder.
/// </summary>
Expand Down

0 comments on commit e26764f

Please sign in to comment.