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

Fix PHP 8.2 and Other Related Issues #640

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
76dc113
fix: Fatal error: Uncaught Error: Class "PhpCsFixer\Finder" not found
mralaminahamed Apr 30, 2024
591629c
added: required and optional properties
mralaminahamed Apr 30, 2024
b81fb0b
chore(composer): Updated to the latest version and config file also
mralaminahamed Apr 30, 2024
fad9d56
added: docker file for 8.1 and 8.2
mralaminahamed Apr 30, 2024
f4e69f4
fix: PHP Coding standards issues
mralaminahamed Apr 30, 2024
c6138da
removed: unused code
mralaminahamed Apr 30, 2024
d580082
add: missing property in Refund class
mralaminahamed Apr 30, 2024
959b1a7
added: missing property in PayIn
mralaminahamed Apr 30, 2024
475e87f
added: missing property in PayIn
mralaminahamed Apr 30, 2024
dd38b0f
Merge branch 'Mangopay:master' into fix/php-related-issues
mralaminahamed Apr 30, 2024
6da6e4f
Revert "fix: PHP Coding standards issues"
mralaminahamed Apr 30, 2024
6c17547
Update MangoPay/PayOut.php
mralaminahamed Apr 30, 2024
a096ea6
update: gitignore and attributes
mralaminahamed Apr 30, 2024
ba9a468
Merge branch 'fix/php-related-issues' of https://github.com/mralamina…
mralaminahamed Apr 30, 2024
96d67ae
added: label properties for KYC Document
mralaminahamed May 2, 2024
c1f8164
update: property doc for KYC $UserId
mralaminahamed May 2, 2024
ce7d988
update: api base, api ubo and its declaration for parameter type
mralaminahamed May 2, 2024
87bfb35
update: php cs fixer config
mralaminahamed May 2, 2024
c31570d
update: missing property for Ubo Declaration
mralaminahamed May 2, 2024
a12582a
Use local namespace for PayOutPaymentDetailsBankWire
mralaminahamed May 4, 2024
aa87640
Use local namespace for PayOutPaymentDetailsBankWire
mralaminahamed May 4, 2024
156a26d
Update Property documentation
mralaminahamed May 4, 2024
089bff7
Delete old install script
mralaminahamed May 4, 2024
964ee7e
delete: php cs fixer cache file
mralaminahamed May 4, 2024
596cca5
update: property documentation for KYC Documentation
mralaminahamed May 4, 2024
cfe79c5
update: Kyc Document class
mralaminahamed May 4, 2024
d77e72b
remove: shell path from docker composer
mralaminahamed May 6, 2024
85d3080
fix: php cs fixer issue at KYC Document property alignment
mralaminahamed May 6, 2024
27520ac
Merge remote-tracking branch 'upstream/master' into fix/php-related-i…
mralaminahamed May 30, 2024
d3f2448
Merge remote-tracking branch 'upstream/master' into fix/php-related-i…
mralaminahamed Jun 3, 2024
6dc14ea
rollback: `see` params for `$Type` in the `KycDocument`
mralaminahamed Jun 3, 2024
0149fb7
refactor: indentation is wrong in `PayOut.php`
mralaminahamed Jun 3, 2024
f205667
refactor: indentation is wrong in `PayOut.php`
mralaminahamed Jun 3, 2024
275dfda
refactor: Change the `@var` type to `object` because of there is many…
mralaminahamed Jun 3, 2024
87f0929
remove: `composer.sh` for php `8.1` and `8.2`
mralaminahamed Jun 3, 2024
ed80f9f
fix: line indents for `PayOut.php`
mralaminahamed Jun 3, 2024
6b9f10f
update: added docker config for `php 8.1` and `php 8.2` to `Makefile`
mralaminahamed Jun 3, 2024
f5303e0
update: added php versions for `php 8.1` and `php 8.2` to `build.yaml`
mralaminahamed Jun 3, 2024
3f3e135
refactor: property type for `PayOut.php`
mralaminahamed Jun 3, 2024
91ca58a
refactor: property type for `PayOut.php` (phpstan)
mralaminahamed Jun 3, 2024
586b770
refactor: property type for `PayOut.php` (phpstan)
mralaminahamed Jun 3, 2024
0268830
Merge branch 'master' into fix/php-related-issues
mralaminahamed Sep 23, 2024
beac573
Merge branch 'master' into fix/php-related-issues
mralaminahamed Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
Makefile export-ignore
/php_env export-ignore
phpunit.xml export-ignore
.php_cs export-ignore
.php-cs-fixer.php export-ignore
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ composer.lock

.*
!.github
!.php_cs
!.php-cs-fixer.php
!.gitignore
!.gitattributes
11 changes: 6 additions & 5 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php

$finder = PhpCsFixer\Finder::create()
$finder = (new PhpCsFixer\Finder())
->in(__DIR__.'/MangoPay')
->in(__DIR__.'/tests')
;

$config = new PhpCsFixer\Config();

return $config->setRules([
return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'fully_qualified_strict_types' => true,
'array_syntax' => ['syntax' => 'short'],
'visibility_required' => ['property', 'method'],// 'const' is removed for old PHP compat
'visibility_required' => [
'elements' => ['property', 'method'], // 'const' is removed for old PHP compat
],
])
->setFinder($finder)
;
59 changes: 36 additions & 23 deletions MangoPay/ApiUboDeclarations.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,32 @@ class ApiUboDeclarations extends Libraries\ApiBase
/**
* Creates a new UBO Declaration for an user.
* @param string $userId The ID of the user
* @return \MangoPay\UboDeclaration UBO Declaration object returned from API
* @return \MangoPay\UboDeclaration|array|object UBO Declaration object returned from API
*/
public function Create($userId)
{
return $this->CreateObject('ubo_declaration_create', null, '\MangoPay\UboDeclaration', $userId);
}

/**
* Gets all UBO Declarations for an user.
* @param string $userId The ID of the user
* @param \MangoPay\Pagination $pagination Pagination object
* @param \MangoPay\Sorting $sorting Sorting object
* @return \MangoPay\UboDeclaration[]|array List of UBO Declarations returned from API
* @throws \MangoPay\Libraries\Exception
*/
public function GetAll($userId, $pagination = null, $sorting = null)
{
return $this->GetList("ubo_declaration_all", $pagination, '\MangoPay\UboDeclaration', $userId, null, $sorting);
}

/**
* Gets an UBO Declaration.
* @param string $userId
* @param string $uboDeclarationId
* @return UboDeclaration UBO Declaration object returned from API
* @param string $userId The ID of the user
* @param string $uboDeclarationId UBO Declaration identifier
* @return UboDeclaration|array|object UBO Declaration object returned from API
* @throws \MangoPay\Libraries\Exception
*/
public function Get($userId, $uboDeclarationId)
{
Expand All @@ -35,8 +44,8 @@ public function Get($userId, $uboDeclarationId)

/**
* Gets an UBO Declaration directly by Id.
* @param string $uboDeclarationId
* @return UboDeclaration UBO Declaration object returned from API
* @param string $uboDeclarationId UBO Declaration identifier
* @return UboDeclaration|array|object UBO Declaration object returned from API
*/
public function GetById($uboDeclarationId)
{
Expand All @@ -45,10 +54,11 @@ public function GetById($uboDeclarationId)

/**
* Creates a new UBO for the specified arguments
* @param string $userId int
* @param string $uboDeclarationId int
* @param Ubo $ubo
* @return Ubo UBO object returned from API
* @param string $userId The ID of the user
* @param string $uboDeclarationId The ID of the UBO declaration
* @param Ubo $ubo The UBO object to be created
* @return Ubo|array|object UBO object returned from API
* @throws \MangoPay\Libraries\ResponseException
*/
public function CreateUbo($userId, $uboDeclarationId, $ubo)
{
Expand All @@ -60,10 +70,10 @@ public function CreateUbo($userId, $uboDeclarationId, $ubo)

/**
* Updates an UBO
* @param string $userId
* @param string $uboDeclarationId
* @param Ubo $ubo
* @return Ubo UBO object returned from API
* @param string $userId The ID of the user
* @param string $uboDeclarationId The ID of the UBO declaration
* @param Ubo $ubo The UBO object to be updated
* @return Ubo|array|object UBO object returned from API
*/
public function UpdateUbo($userId, $uboDeclarationId, $ubo)
{
Expand All @@ -72,10 +82,11 @@ public function UpdateUbo($userId, $uboDeclarationId, $ubo)

/**
* Gets an UBO
* @param string $userId
* @param string $uboDeclarationId
* @param string $uboId
* @return Ubo UBO object returned from API
* @param string $userId The ID of the user
* @param string $uboDeclarationId The ID of the UBO declaration
* @param string $uboId The ID of the UBO
* @return \MangoPay\Ubo|array|object UBO object returned from API
* @throws \MangoPay\Libraries\Exception
*/
public function GetUbo($userId, $uboDeclarationId, $uboId)
{
Expand All @@ -84,9 +95,9 @@ public function GetUbo($userId, $uboDeclarationId, $uboId)

/**
* Updates an UBO Declaration with the status <code>VALIDATION_ASKED</code>.
* @param string $userId
* @param string $uboDeclarationId
* @return UboDeclaration
* @param string $userId The ID of the user
* @param string $uboDeclarationId The ID of the UBO declaration
* @return \MangoPay\UboDeclaration|array|object
*/
public function SubmitForValidation($userId, $uboDeclarationId)
{
Expand All @@ -98,8 +109,10 @@ public function SubmitForValidation($userId, $uboDeclarationId)

/**
* Gets an UBO Declaration.
* @param string $uboDeclarationId
* @return UboDeclaration UBO Declaration object returned from API
* @param string $uboDeclarationId UBO Declaration identifier
* @return \MangoPay\UboDeclaration|array|object UBO Declaration object returned from API
* @throws \MangoPay\Libraries\Exception
* @throws \Exception
*/
public function GetUboDeclarationById($uboDeclarationId)
{
Expand Down
34 changes: 31 additions & 3 deletions MangoPay/KycDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,58 @@
namespace MangoPay;

/**
* KYC document entity
* KYC document entity.
*/
class KycDocument extends Libraries\Document
{
/**
* The type of the document for the user verification.
*
* @var string
*
* @see \MangoPay\KycDocumentType
* @see https://mangopay.com/docs/endpoints/kyc-documents#kyc-document-object
*/
public $Type;

/**
* The label of KYC document type.
*
* @var string
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved
* @see \MangoPay\KycDocumentStatus
*/
public $TypeLabel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add this property? I don't see it in the docs :D

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* The status of the KYC document.
*
* @var string
*
* @see KycDocumentStatus
*/
public $Status;

/**
* The label of KYC document status.
*
* @var string
*/
public $StatusLabel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add this property? I don't see it in the docs :D (correct me if I'm wrong)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* The unique identifier of the user.
*
* @var string
*/
public $UserId;

/**
* More information regarding why the document has been rejected.
* The series of codes providing more precision regarding the reason why the identity proof document was refused.
* You can review the explanations for each code in the Flags list.
*
* @var array
*
* @see KycDocumentRefusedReasonType
* @see https://mangopay.com/docs/concepts/users/verification/document-process#flags-list
*/
public $Flags;
}
4 changes: 2 additions & 2 deletions MangoPay/Libraries/ApiBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ protected function GetRequestType($key)
/**
* Create object in API
* @param string $methodKey Key with request data
* @param object $entity Entity object
* @param object|null $entity Entity object
* @param object $responseClassName Name of entity class from response
* @param string $entityId Entity identifier
* @return object Response data
Expand Down Expand Up @@ -302,7 +302,7 @@ protected function CreateObject($methodKey, $entity, $responseClassName = null,
/**
* Get entity object from API
* @param string $methodKey Key with request data
* @param object $responseClassName Name of entity class from response
* @param string $responseClassName Name of entity class from response
* @param array $params path variable in urls
* @return object Response data
* @throws Exception
Expand Down
43 changes: 43 additions & 0 deletions MangoPay/PayIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ class PayIn extends Transaction
*/
public $CreditedWalletId;

/**
* The mode applied for the 3DS protocol for CB, Visa, and Mastercard.
* Default values: DEFAULT. Allowed values: DEFAULT, FORCE, NO_CHOICE
*
* @var string
*/
public $SecureMode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this to the PayIn class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* The 3DS protocol version to be applied to the transaction. Allowing values: V1, V2_1
*
* @see https://mangopay.com/docs/concepts/payments/payment-methods/card/3ds
* @see https://mangopay.com/docs/endpoints/direct-card-payins#direct-card-payin-object
* @var string
*/
public $Requested3DSVersion;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this to the PayIn class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* PaymentType {CARD, BANK_WIRE, DIRECT_DEBIT, PAYPAL, PAYCONIQ }
* @var string
Expand Down Expand Up @@ -43,6 +60,32 @@ class PayIn extends Transaction
*/
public $RecurringPayinRegistrationId;

/**
* The IP address of the end user initiating the transaction, in IPV4 or IPV6 format.
* @var string
*/
public $IpAddress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this to the PayIn class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* Information about the browser used by the end user (author) to perform the payment.
* @var BrowserInfo
*/
public $BrowserInfo;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this to the PayIn class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* Information about the end user billing address. If left empty, the default values will be automatically taken into account.
* Default values: FirstName, LastName, and Address information of the Shipping object if any, otherwise the user (author).
* @var Billing
*/
public $Billing;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this to the PayIn class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* Information about the end user’s shipping address. If left empty, the default values will be automatically taken into account.
* Default values: FirstName, LastName, and Address information of the Billing object, if supplied, otherwise of the user (author).
* @var Shipping
*/
public $Shipping;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this to the PayIn class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* Get array with mapping which property depends on other property
* @return array
Expand Down
26 changes: 26 additions & 0 deletions MangoPay/PayOut.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
*/
class PayOut extends Transaction
{
/**
* The unique identifier of the bank account.
*
* @var string
*/
public $BankAccountId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this to the PayOut class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* Custom description to appear on the user’s bank statement along with the platform name.
* The recommended length is 12 characters – strings longer than this may be truncated depending on the bank.
* @var string
*/
public $BankWireRef;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding this to the PayOut class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* Debited wallet Id
* @var string
Expand All @@ -19,12 +33,24 @@ class PayOut extends Transaction
*/
public $PaymentType;

/**
* One of PayOutPaymentDetails implementations, depending on $PaymentType
* @var PayOutPaymentDetailsBankWire
*/
public $PayoutPaymentDetails;

mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved
/**
* One of PayOutPaymentDetails implementations, depending on $PaymentType
* @var object
*/
public $MeanOfPaymentDetails;

/**
* Payout mode requested, default is 'STANDARD', Allowed values are
* 'STANDARD', 'INSTANT_PAYMENT', 'INSTANT_PAYMENT_ONLY'
* @var string
*/
public $PayoutModeRequested;

/**
* Get array with mapping which property depends on other property
Expand Down
6 changes: 6 additions & 0 deletions MangoPay/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class Refund extends Transaction
*/
public $RefundReason;

/**
* Message related to the refund
* @var string
*/
public $RefundReasonMessage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add this param? I don't see it in the docs (correct me if I'm wrong)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* @var string
*/
Expand Down
9 changes: 8 additions & 1 deletion MangoPay/UboDeclaration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
class UboDeclaration extends Libraries\EntityBase
{
/**
* @var int Unix timestamp, Date of process
* The Declaration process date.
* @var int Unix timestamp, Date of the process
*/
public $ProcessedDate;

Expand All @@ -19,6 +20,12 @@ class UboDeclaration extends Libraries\EntityBase
*/
public $Status;

/**
* The output status of Declaration status.
* @var string
*/
public $OutputStatus;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add this param? I don't see it in the docs (correct me if I'm wrong)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was identified in both the documentation and PHP SDK. I verified its existence through debug logs and implemented it accordingly.


/**
* List of reasons why the declaration was refused.
* @var string
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
},
"require-dev": {
"phpunit/phpunit": ">=5.7.27 <10",
"friendsofphp/php-cs-fixer": "^2.18"
"friendsofphp/php-cs-fixer": "^3.54"
}
}
Loading