-
Notifications
You must be signed in to change notification settings - Fork 29
App Payment Setups Support #507
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
base: master
Are you sure you want to change the base?
Conversation
| { | ||
| // Act & Assert | ||
| Should.Throw<CheckoutArgumentException>(() => | ||
| CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", (PaymentSetupsRequest)null)); |
Check warning
Code scanning / CodeQL
Useless upcast Warning test
null
PaymentSetupsRequest
Show autofix suggestion
Hide autofix suggestion
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.
-
Copy modified line R104
| @@ -101,7 +101,7 @@ | ||
| { | ||
| // Act & Assert | ||
| Should.Throw<CheckoutArgumentException>(() => | ||
| CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", (PaymentSetupsRequest)null)); | ||
| CheckoutUtils.ValidateParams("paymentSetupsCreateRequest", null)); | ||
| } | ||
|
|
||
| [Fact] |
| { | ||
| // Act & Assert | ||
| Should.Throw<CheckoutArgumentException>(() => | ||
| CheckoutUtils.ValidateParams("id", (string)null)); |
Check warning
Code scanning / CodeQL
Useless upcast Warning test
null
String
Show autofix suggestion
Hide autofix suggestion
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.
-
Copy modified line R112
| @@ -109,7 +109,7 @@ | ||
| { | ||
| // Act & Assert | ||
| Should.Throw<CheckoutArgumentException>(() => | ||
| CheckoutUtils.ValidateParams("id", (string)null)); | ||
| CheckoutUtils.ValidateParams("id", null)); | ||
| } | ||
|
|
||
| [Fact] |
| { | ||
| // Act & Assert | ||
| Should.Throw<CheckoutArgumentException>(() => | ||
| CheckoutUtils.ValidateParams("id", (string)null)); |
Check warning
Code scanning / CodeQL
Useless upcast Warning test
null
String
Show autofix suggestion
Hide autofix suggestion
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.
-
Copy modified line R120
| @@ -117,7 +117,7 @@ | ||
| { | ||
| // Act & Assert | ||
| Should.Throw<CheckoutArgumentException>(() => | ||
| CheckoutUtils.ValidateParams("id", (string)null)); | ||
| CheckoutUtils.ValidateParams("id", null)); | ||
| } | ||
|
|
||
| private PaymentSetupsRequest CreateValidPaymentSetupsRequest() |
| catch | ||
| { | ||
| return new LoggerFactory(); | ||
| } |
Check notice
Code scanning / CodeQL
Generic catch clause Note test
Show autofix suggestion
Hide autofix suggestion
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.
-
Copy modified line R64 -
Copy modified lines R68-R71
| @@ -61,10 +61,14 @@ | ||
| { | ||
| return new NLogLoggerFactory(); | ||
| } | ||
| catch | ||
| catch (TypeLoadException) | ||
| { | ||
| return new LoggerFactory(); | ||
| } | ||
| catch (System.IO.FileNotFoundException) | ||
| { | ||
| return new LoggerFactory(); | ||
| } | ||
| } | ||
| } | ||
|
|
…nfirmPaymentSetup method
…t-payment-setups' into feature/new-endpoint-payment-setups
|




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:
IPaymentSetupsClientto theCheckoutApi, including initialization and a public accessor method to support the Payment Setups API. (CheckoutApi.cs) [1] [2] [3] [4]New Payment Setups Entities:
Customer.cs,MerchantAccount.cs) [1] [2]Order.cs,OrderSubMerchant.cs) [1] [2]Industry.cs,AirlineData.cs) [1] [2]Settings.cs)Payment Methods Support:
Klarna.cs,Stcpay.cs,Tabby.cs,Bizum.cs,KlarnaAccountHolder.cs,PaymentMethods.cs) [1] [2] [3] [4] [5] [6]PaymentMethodOptions.cs,PaymentMethodOption.cs,PaymentMethodAction.cs,PaymentMethodInitialization.cs) [1] [2] [3] [4]DevOps & Workflow:
.github/workflows/codeql-analysis.yml) [1] [2]