Skip to content

Conversation

@david-ruiz-cko
Copy link

This pull request introduces a new "Payment Setups" feature to the SDK, adding comprehensive support for various payment methods and related entities. It includes new entity classes for customers, orders, payment methods (such as Klarna, STC Pay, Tabby, Bizum), and industry-specific data, as well as updates to the main API class to expose the new functionality. Additionally, it updates the CodeQL GitHub Actions workflow to use the latest version of the CodeQL actions.

Payment Setups Feature Integration:

  • Added a new IPaymentSetupsClient to the CheckoutApi, including initialization and a public accessor method to support the Payment Setups API. (CheckoutApi.cs) [1] [2] [3] [4]

New Payment Setups Entities:

  • Introduced entity classes for Payment Setups, including:
    • Customer information, including nested email, device, and merchant account details (Customer.cs, MerchantAccount.cs) [1] [2]
    • Order structure with items, shipping, sub-merchants, and discounts (Order.cs, OrderSubMerchant.cs) [1] [2]
    • Industry-specific data for airline and accommodation payments (Industry.cs, AirlineData.cs) [1] [2]
    • Settings for redirect URLs after payment (Settings.cs)

Payment Methods Support:

  • Added comprehensive support for multiple payment methods:
    • Klarna, STC Pay, Tabby, and Bizum, each with their own configuration classes and options (Klarna.cs, Stcpay.cs, Tabby.cs, Bizum.cs, KlarnaAccountHolder.cs, PaymentMethods.cs) [1] [2] [3] [4] [5] [6]
    • Common option and action classes for payment methods (PaymentMethodOptions.cs, PaymentMethodOption.cs, PaymentMethodAction.cs, PaymentMethodInitialization.cs) [1] [2] [3] [4]

DevOps & Workflow:

  • Updated the CodeQL GitHub Actions workflow to use version 3 of the CodeQL actions for improved security and analysis (.github/workflows/codeql-analysis.yml) [1] [2]

@david-ruiz-cko david-ruiz-cko requested a review from a team November 26, 2025 15:42
{
// Act & Assert
Should.Throw<CheckoutArgumentException>(() =>
CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", (PaymentSetupsRequest)null));

Check warning

Code scanning / CodeQL

Useless upcast Warning test

There is no need to upcast from
null
to
PaymentSetupsRequest
- the conversion can be done implicitly.

Copilot Autofix

AI 6 days ago

The problem is a redundant explicit cast of null to PaymentSetupsRequest in the method call CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", (PaymentSetupsRequest)null). To fix it, simply remove the explicit cast and pass null directly, as this is clearer and idiomatic in C#. The change should only affect the line of code where the cast is unnecessary, i.e., line 104 in test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs. No extra imports or additional code changes are necessary.


Suggested changeset 1
test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
--- a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
+++ b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
@@ -101,7 +101,7 @@
         {
             // Act & Assert
             Should.Throw<CheckoutArgumentException>(() =>
-                CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", (PaymentSetupsRequest)null));
+                CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", null));
         }
 
         [Fact]
EOF
@@ -101,7 +101,7 @@
{
// Act & Assert
Should.Throw<CheckoutArgumentException>(() =>
CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", (PaymentSetupsRequest)null));
CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", null));
}

[Fact]
Copilot is powered by AI and may make mistakes. Always verify output.
{
// Act & Assert
Should.Throw<CheckoutArgumentException>(() =>
CheckoutUtils.ValidateParams("id", (string)null));

Check warning

Code scanning / CodeQL

Useless upcast Warning test

There is no need to upcast from
null
to
String
- the conversion can be done implicitly.

Copilot Autofix

AI 6 days ago

To fix this issue, remove the explicit cast (string)null for the null argument passed to CheckoutUtils.ValidateParams in line 112. Pass only null which is implicitly of type string in this method call. This only requires editing the code on line 112; no additional imports or changes elsewhere are needed.


Suggested changeset 1
test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
--- a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
+++ b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
@@ -109,7 +109,7 @@
         {
             // Act & Assert
             Should.Throw<CheckoutArgumentException>(() =>
-                CheckoutUtils.ValidateParams("id", (string)null));
+                CheckoutUtils.ValidateParams("id", null));
         }
 
         [Fact]
EOF
@@ -109,7 +109,7 @@
{
// Act & Assert
Should.Throw<CheckoutArgumentException>(() =>
CheckoutUtils.ValidateParams("id", (string)null));
CheckoutUtils.ValidateParams("id", null));
}

[Fact]
Copilot is powered by AI and may make mistakes. Always verify output.
{
// Act & Assert
Should.Throw<CheckoutArgumentException>(() =>
CheckoutUtils.ValidateParams("id", (string)null));

Check warning

Code scanning / CodeQL

Useless upcast Warning test

There is no need to upcast from
null
to
String
- the conversion can be done implicitly.

Copilot Autofix

AI 6 days ago

To fix the issue, simply remove the redundant explicit cast (string)null. Instead, just pass null directly as the parameter. Review all method calls in this file to CheckoutUtils.ValidateParams that use (string)null and replace them with null. Specifically, for line 120 in test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs, replace
CheckoutUtils.ValidateParams("id", (string)null)
with
CheckoutUtils.ValidateParams("id", null).
No imports or auxiliary definitions are required for this fix.


Suggested changeset 1
test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
--- a/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
+++ b/test/CheckoutSdkTest/HandlePaymentsAndPayouts/PaymentSetups/PaymentSetupsIntegrationTest.cs
@@ -117,7 +117,7 @@
         {
             // Act & Assert
             Should.Throw<CheckoutArgumentException>(() =>
-                CheckoutUtils.ValidateParams("id", (string)null));
+                CheckoutUtils.ValidateParams("id", null));
         }
 
         private PaymentSetupsRequest CreateValidPaymentSetupsRequest()
EOF
@@ -117,7 +117,7 @@
{
// Act & Assert
Should.Throw<CheckoutArgumentException>(() =>
CheckoutUtils.ValidateParams("id", (string)null));
CheckoutUtils.ValidateParams("id", null));
}

private PaymentSetupsRequest CreateValidPaymentSetupsRequest()
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +39 to +42
catch
{
return new LoggerFactory();
}

Check notice

Code scanning / CodeQL

Generic catch clause Note test

Generic catch clause.

Copilot Autofix

AI 6 days ago

To fix the problem, the catch block at line 64 should be changed to catch only explicitly anticipated exceptions—such as TypeLoadException, FileNotFoundException, or possibly Exception, with rethrowing for truly unknown exceptions if desired. In this context, the fallback is used if NLog cannot be instantiated, which may commonly throw TypeLoadException, FileNotFoundException, or related .NET loader exceptions.

The single best way to fix it is to replace the catch-all with explicit catch blocks for known failures (for instance, TypeLoadException and FileNotFoundException). Optionally, an additional catch block for Exception could be added to avoid crashing the test fixture, but at the very least the generic catch should be removed.

Edit the catch block in TestLoggerFactoryHelper.CreateInstance() (lines 64-67) to only catch the expected exceptions. Add necessary using System.IO; if not already present.

Suggested changeset 1
test/CheckoutSdkTest/SandboxTestFixture.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/test/CheckoutSdkTest/SandboxTestFixture.cs b/test/CheckoutSdkTest/SandboxTestFixture.cs
--- a/test/CheckoutSdkTest/SandboxTestFixture.cs
+++ b/test/CheckoutSdkTest/SandboxTestFixture.cs
@@ -61,10 +61,14 @@
             {
                 return new NLogLoggerFactory();
             }
-            catch
+            catch (TypeLoadException)
             {
                 return new LoggerFactory();
             }
+            catch (System.IO.FileNotFoundException)
+            {
+                return new LoggerFactory();
+            }
         }
     }
 
EOF
@@ -61,10 +61,14 @@
{
return new NLogLoggerFactory();
}
catch
catch (TypeLoadException)
{
return new LoggerFactory();
}
catch (System.IO.FileNotFoundException)
{
return new LoggerFactory();
}
}
}

Copilot is powered by AI and may make mistakes. Always verify output.
@armando-rodriguez-cko armando-rodriguez-cko changed the title Feature/new endpoint payment setups App Payment Setups Support Nov 27, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants