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 11 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 .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.*
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved
!.gitignore
!.gitattributes
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

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

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'fully_qualified_strict_types' => true,
'array_syntax' => ['syntax' => 'short'],
'visibility_required' => [
'elements' => ['property', 'method'], // 'const' is removed for old PHP compat
],
])
->setFinder($finder)
;
17 changes: 0 additions & 17 deletions .php_cs

This file was deleted.

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: 25 additions & 1 deletion MangoPay/PayOut.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
*/
class PayOut extends Transaction
{
/**
* The unique identifier of the bank account.
* @var string
*/
public $BankAccountId;

/**
* 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.
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved
* @var string
*/
public $BankWireRef;

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

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

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

/**
* Payout mode requested, default is 'STANDARD', Allowed values are
* 'STANDARD', 'INSTANT_PAYMENT', 'INSTANT_PAYMENT_ONLY'
* @var string
*/
public $PayoutModeRequested = 'STANDARD';
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved

/**
* 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
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"
}
}
28 changes: 28 additions & 0 deletions php_env/PHP_8.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM php:8.1-cli

# Update and import specific required librairies

RUN apt-get update && apt-get install -y apt-utils
RUN apt-get install -y \
unzip \
libicu-dev \
libonig-dev \
gcc \
wget \
zlib1g-dev \
libzip-dev

# Parametrize PHP

RUN docker-php-ext-install mbstring
RUN docker-php-ext-install intl
RUN docker-php-ext-install zip
RUN docker-php-ext-install pcntl
RUN docker-php-source delete

# Install composer
COPY composer.sh /
RUN chmod +x composer.sh
RUN /composer.sh
RUN mv composer.phar /usr/local/bin/composer
RUN mkdir /.composer && chmod o+rwx /.composer
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 17 additions & 0 deletions php_env/PHP_8.1/composer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved

EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved
28 changes: 28 additions & 0 deletions php_env/PHP_8.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM php:8.2-cli

# Update and import specific required librairies

RUN apt-get update && apt-get install -y apt-utils
RUN apt-get install -y \
unzip \
libicu-dev \
libonig-dev \
gcc \
wget \
zlib1g-dev \
libzip-dev

# Parametrize PHP

RUN docker-php-ext-install mbstring
RUN docker-php-ext-install intl
RUN docker-php-ext-install zip
RUN docker-php-ext-install pcntl
RUN docker-php-source delete

# Install composer
COPY composer.sh /
RUN chmod +x composer.sh
RUN /composer.sh
RUN mv composer.phar /usr/local/bin/composer
RUN mkdir /.composer && chmod o+rwx /.composer
17 changes: 17 additions & 0 deletions php_env/PHP_8.2/composer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved

EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
mralaminahamed marked this conversation as resolved.
Show resolved Hide resolved