Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the way we can use payment method specific payment requests #384

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

Viincenttt
Copy link
Owner

@Viincenttt Viincenttt commented Jul 9, 2024

Suggestion to improve issue mentioned in #380

Example code:

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;
        }

@Viincenttt Viincenttt marked this pull request as ready for review July 10, 2024 17:37
@Viincenttt Viincenttt merged commit bf99b47 into development Jul 10, 2024
1 check passed
@Viincenttt Viincenttt deleted the feat/improve_paymentrequest_inheritance branch July 10, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant