-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improvements/pp 45058 #39
Conversation
*/ | ||
public function __construct($auth = null, $productionmode = false) | ||
public function __construct($auth = null, $productionmode = false, $requestHandler = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
*/ | ||
public function __construct($auth = null, $productionmode = false) | ||
public function __construct($auth = null, $productionmode = false, $requestHandler = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
@@ -134,10 +171,10 @@ public function cancelPayment($merchantPaymentId) | |||
* @param boolean $agreeSimilarTransaction If set to true, payment duplication check will be bypassed | |||
* @return mixed | |||
*/ | |||
public function createPaymentAuth($payload, $agreeSimilarTransaction=false) | |||
public function createPaymentAuth($payload, $agreeSimilarTransaction = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method createPaymentAuth
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Code Climate has analyzed commit f758870 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 57.2% (5% is the threshold). This pull request will bring the total coverage in the repository to 54.5% (11.6% change). View more on Code Climate. |
Black Duck Security ReportMerging #39 into master will not change security risk. |
- Added payload typechecks in payments controller - Static analysis bugfixes
@@ -134,11 +167,9 @@ public function cancelPayment($merchantPaymentId) | |||
* @param boolean $agreeSimilarTransaction If set to true, payment duplication check will be bypassed | |||
* @return mixed | |||
*/ | |||
public function createPaymentAuth($payload, $agreeSimilarTransaction=false) | |||
public function createPaymentAuth($payload, $agreeSimilarTransaction = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method createPaymentAuth
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Conflicts: src/Controllers/Payment.php
- Added BasePaymentPayload class for overlapping payment DTO classes - Refactored Create Payment Payload to extend BasePaymentPayload - Refactored ContinuousPayment Payload to use BasePaymentPayload as well - Misc. housekeeping
@@ -134,11 +128,9 @@ public function cancelPayment($merchantPaymentId) | |||
* @param boolean $agreeSimilarTransaction If set to true, payment duplication check will be bypassed | |||
* @return mixed | |||
*/ | |||
public function createPaymentAuth($payload, $agreeSimilarTransaction=false) | |||
public function createPaymentAuth($payload, $agreeSimilarTransaction = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
src/Models/BasePaymentPayload.php
Outdated
* @param array $orderItems | ||
* @return self | ||
*/ | ||
public function setOrderItems($orderItems) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
Conflicts: src/core/Controller.php
- Removed overlapping methods fropm older DTO classes - Refactored JWT class to not use static methods - Added BasePaymentPayload to Preauth - Created new base class BasePaymentInfo to remove duplicates from CreateQrPayload and BasePaymentPayload - Included coverage report to repo for sonarcloud
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks really good, great job @paypay-ayas !
build/logs/clover.xml
Outdated
<line num="61" type="stmt" count="1"/> | ||
<metrics loc="63" ncloc="46" classes="1" methods="3" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="23" coveredstatements="20" elements="26" coveredelements="21"/> | ||
</file> | ||
<file name="/mnt/3CA6FA93A6FA4D40/projects/backend/robosoft/paypayopa-sdk-php/src/Controllers/Code.php"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this file committed?
Looks like a generated file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to commit clover report so that we get coverage report on sonarcloud as well. This file contains the coverage report that I generate locally.
* @param array $data | ||
* @return array | ||
*/ | ||
private function doSimilarTransactionCall($url,$options,$data){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is only used for Payment now, however wouldn't it be better to place it in the same class as doCall
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had considered the same as well but thought that this function will most likely always be invoked in the case of creating transactions which is the purview of methods in the payments class. Other controller classes won't have any use for it. doCall is boilerplate for HTTP calls in general so its ok for it to reside in the controller class. Its always possible to move doSimilarTransactionCall
to Controller class as a protected function without it affecting overall functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, for now it is fine
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
All Submissions:
New Feature Submissions:
Changes to Core Features: