Skip to content

Commit

Permalink
Release 5.7.7
Browse files Browse the repository at this point in the history
* Fix gift products only for 1.7.5
refs #34471

* refs #35787 fixbug. wrong order status

* version

* refs #35926 the typo in an upgrade script

* refs #35853 webhook functionality. customization of the order status

* refs #35989
Fix prices sent in HT when group displaying price HT

* version

* refs #35967 missing transaction id

* refs #35927 webhook functionality. Check the event state

* refs #36106
Fix round total on handlings discounts

* refs #36276 webhook functionality. necessity of the employee in context

* small fix

* refs #36159 shortcut on signup page

* small fix

* refs #36457 webhookfunctionality. small fix

* refs #35927 webhooks. order status managing

* module version

* refs #35623 tracking info

* module version

* refs #36733 white list. option enabled

* refs #36733 white list. option list of ips

* refs #36733 paypal availability according to the ip white list

* php-cs-fixer

* Update bug report issue form

* Fix exception thrown on confirmation page (#139)

* Fix exception thrown on confirmation page (#139)

* refs #37072 warning during order creation

* refs #34920 Payment via CB does not work in "IN CONTEXT" mode

* refs #36628 PUI. onboarding button

* webhook. small fix

* refs #37078 paypal checkout. sending address

* refs #37272 compatible with PS 8.0

* refs #37262 compatibility with PS8

* small fix

* compatibility with php 5.6

* small fix

* refs #37369 warnings

* phpstan

* Add lintner php 8.0 and 8.1 (#144)

Co-authored-by: bogdan202 <byampolskiy@202-ecommerce.com>

* refs #37416 warning during webhook-event handling

* refs #37569 option show benefits

* collate cause error during installation (#146)

* refs #37083 MySQL COLLATE causes an error during a module installation

* refs #37083 backward-compatibility.php

* refs #37083 phpcsfixer

* refs #35971 webhook notifications. response code

* refs #37360 IP white-list. style

* refs #35623 tracking info. paypal carriers by country (#148)

* module version

* refs #37735 webhook event handling. order state (#152)

* refs #37879 translations

* refs #35048 translations

* refs #37743 handling the exceptions (#153)

* translations

* refs #34923 use default status if customize one is not set (#155)

* Create SECURITY.md

* refs #37203 test for webhook event. types COMPLETED and PENDING

* refs #37203 unit test for webhook. refund and partial refund

* refs #37203 Readme.md

* refs #37203 unit tests for webhook. events: authorization.voided, capture.denied, capture.reversed

* refs #37203 github workflows

* refs #37203 small fix

* refs #38144 small fix

* refs #37203 test for completed event when a current order state is PS_OS_OUTOFSTOCK_UNPAID

* refs #37203 small modification in Readme.md

* license update

* refs #38341 the alias list for PrestaShop iso country codes (#164)

* Add TLS 1.3 checks (33017) (#160)

* refs #33017 tls verification

* small fix

* Define webhook unit tests (37203) (#158)

* refs #37203 test for webhook event. types COMPLETED and PENDING

* refs #37203 unit test for webhook. refund and partial refund

* refs #37203 Readme.md

* refs #37203 unit tests for webhook. events: authorization.voided, capture.denied, capture.reversed

* refs #37203 github workflows

* refs #37203 small fix

* refs #37203 test for completed event when a current order state is PS_OS_OUTOFSTOCK_UNPAID

* refs #37203 small modification in Readme.md

* refs #36734 test for a case #37743

* module version

* small fix

* composer json settings

* small fix

* Feature/38361 admin page message (#166)

* refs #38361 admin page message

* php-cs-fixer

* refs #38526 wrong paypal-metadata-id

* refs #38628 - FraudNet clientId
Add ClientId for FraudNet Form PUI

* refs #38649 mysql errors (#175)

* refs #38495 redirection mode

* refs #38685 compatibility with PS 8 (#178)

SQL error during updating/installation

* module version

* Feature/38360 card mark (#167)

* refs #38360 mark for credit card

* refs #38360 marks for paypal wallet and pay later

* refs #38360 small fix

* Feature/38495 put paypal button at end (#181)

* refs #38495 move paypal button at end of the page

* refs #38495 credit card

* refs #38495 translations

* php-cs-fixer

* refs #39105 js errors

* refs #38364 redirect mode for alternative method (#180)

* module version

* Payment buttons - on checkout loading (#183)

* refs #38495 - Payment buttons
Check if the conditions approved and enable buttons on payment selection
This is now done when checkbox is hit and when a payment is selected.

* refs #38495 - Payment buttons and loading
Fix BNPL is not correctly loading if payment method selected on loading.
Fix a template variables problem too

---------

Co-authored-by: kgleizes <kgleizes@202-ecommerce.com>
Co-authored-by: Clotaire <52157233+clotairer@users.noreply.github.com>
Co-authored-by: Lorenz Meyer <lorenz@meyer.tl>
Co-authored-by: 202 ecommerce <202-ecommerce@users.noreply.github.com>
Co-authored-by: 202 - Kévin Gleizes <98040531+kgleizes@users.noreply.github.com>
  • Loading branch information
6 people authored Mar 15, 2023
1 parent 81d4d41 commit 381c405
Show file tree
Hide file tree
Showing 66 changed files with 1,011 additions and 1,914 deletions.
24 changes: 24 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Security Policy

The 202ecommerce team and community take security bugs in this PrestaShop modules seriously. We appreciate your efforts to responsibly disclose your findings.

## Supported Versions

Security updates will typically only be applied to the latest release.

## Reporting a Vulnerability

Security issues can be reported by sending an email to tech@202-ecommerce.com, which will go to security team members.
The team will send a response indicating the next steps in handling your report.
After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.

When the security team receives a security bug report, they will assign it to a primary handler.
This person will coordinate the fix and release process, involving the following steps:
- Confirm the problem and determine the affected versions.
- Audit code to find any potential similar problems.
- Prepare fixes for all releases still under maintenance. These fixes will be released as fast as possible.


## Disclosure Policy

In general, public disclosure are made after the issue has been fully identified and a patch is ready to be released.
6 changes: 6 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v2.0.0

# Set php version to avoid error during perform command composer update
- name: Setup PHP
uses: nanasess/setup-php@v3
with:
php-version: '7.3'

# Add vendor folder in cache to make next builds faster
- name: Cache vendor folder
uses: actions/cache@v1
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Unit test
on: [pull_request]
jobs:
# Run PHPUnit against the module and a PrestaShop release
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
strategy:
matrix:
presta-versions: ['1.7.8.7']
steps:
- name: Checkout
uses: actions/checkout@v2.0.0

# Set php version to avoid error during perform command composer update
- name: Setup PHP
uses: nanasess/setup-php@v3
with:
php-version: '7.3'

# Add vendor folder in cache to make next builds faster
- name: Cache vendor folder
uses: actions/cache@v1
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

# Add composer local folder in cache to make next builds faster
- name: Cache composer folder
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php-composer-cache

- run: composer update

# Get Docker images 202ecommerce/prestashop
- name: Get PrestaShop 202 Image (Tag ${{ matrix.presta-versions }})
run: docker run -tid --rm -v $PWD:/var/www/html/modules/paypal --name temp-paypal-unittest-ps 202ecommerce/prestashop:${{ matrix.presta-versions }}

# Clear previous instance of the module in the PrestaShop volume
- name: Install module and play unit test
run: docker exec -t temp-paypal-unittest-ps sh /var/www/html/modules/paypal/202/docker/run_for_unittest.sh
2 changes: 1 addition & 1 deletion 202/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<property name="src-dir" value="${basedir}" />
<property name="TARGETNAME" value="paypal" />
<property name="TARGETBRANCH" value="${env.GIT_BRANCH}" />
<property name="TARGETVERSION" value="5.7.6" />
<property name="TARGETVERSION" value="5.7.7" />
<property name="PHPVERSION" value="5.6" />
<property name="PSVERSION" value="1.7.5.2" />

Expand Down
19 changes: 19 additions & 0 deletions 202/docker/run_for_unittest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e
set -x

/etc/init.d/mariadb start

php /var/www/html/bin/console prestashop:module install paypal -e prod

mysql -h localhost -u root prestashop -e "
TRUNCATE ps_paypal_webhook;
TRUNCATE ps_paypal_order;
"

cd /var/www/html/modules/paypal/

php -dmemory_limit=512M vendor/bin/phpunit -c 202/phpunit.xml

chown www-data:www-data /var/www/html/var -Rf
86 changes: 15 additions & 71 deletions 202/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,76 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ 2007-2022 PayPal
~
~ NOTICE OF LICENSE
~
~ This source file is subject to the Academic Free License (AFL 3.0)
~ that is bundled with this package in the file LICENSE.txt.
~ It is also available through the world-wide-web at this URL:
~ http://opensource.org/licenses/afl-3.0.php
~ If you did not receive a copy of the license and are unable to
~ obtain it through the world-wide-web, please send an email
~ to license@prestashop.com so we can send you a copy immediately.
~
~ DISCLAIMER
~
~ Do not edit or add to this file if you wish to upgrade PrestaShop to newer
~ versions in the future. If you wish to customize PrestaShop for your
~ needs please refer to http://www.prestashop.com for more information.
~
~ @author 2007-2022 PayPal
~ @author 202 ecommerce <tech@202-ecommerce.com>
~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
~ @copyright PayPal
-->

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="true"
syntaxCheck="true"
bootstrap="./build/prestashop/admin-dev/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
<env name="addon_name" value="paypal"/>
<get name="module" value="paypal"/>
</php>

<filter>
<whitelist>
<directory>./build/prestashop/modules/paypal</directory>
<exclude>
<directory>./build/prestashop/modules/paypal/translations</directory>
<directory>./build/prestashop/modules/paypal/views</directory>
<directory>./build/prestashop/modules/paypal/css</directory>
<directory>./build/prestashop/modules/paypal/js</directory>
<directory>./build/prestashop/modules/paypal/img</directory>
<directory>./build/prestashop/modules/paypal/override</directory>
<directory>./build/prestashop/modules/paypal/upgrade</directory>
<directory>./build/prestashop/modules/paypal/sdk</directory>
<directory>./build/prestashop/modules/paypal/202</directory>
<directory>./build/prestashop/modules/paypal/vendor</directory>
<directory>./build/prestashop/modules/paypal/smarty</directory>
<directory>./build/prestashop/modules/paypal/classes/API</directory>
<directory suffix="index.php">./build/prestashop/modules/paypal/</directory>
<directory suffix="index.php">./build/prestashop/modules/paypal/*/</directory>
<directory suffix="index.php">./build/prestashop/modules/paypal/*/*/</directory>
</exclude>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.7/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="phpunit_bootstrap.php"

<logging>
<log type="coverage-php" target="./build/backend.php" title="PayPal" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-html" target="./build/coverage" title="PayPal" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="junit" target="./build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
>
<php>
<ini name="error_reporting" value="-1" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
</php>
<testsuites>
<testsuite name="PayPal">
<directory suffix=".php">tests</directory>
</testsuite>
</testsuites>
</phpunit>
8 changes: 8 additions & 0 deletions 202/phpunit_bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

$basedir = '/var/www/html/';
require_once $basedir . 'config/config.inc.php';

// init a default front controller with context, cart, ///
$controller = new FrontController();
$controller->init();
85 changes: 85 additions & 0 deletions 202/tests/AbstractTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace PaypalTests;

use Cart;
use Configuration;
use DateTime;
use Module;
use PayPal\Api\WebhookEvent;
use PHPUnit\Framework\TestCase;

abstract class AbstractTest extends TestCase
{
protected function createOrderForWebhookEvent(WebhookEvent $event, $idOrderStatus)
{
$module = Module::getInstanceByName('paypal');
$cart = new Cart();
$cart->id_carrier = 0;
$cart->id_customer = $this->getDefaultCustomerId();
$cart->id_address_delivery = $this->getDefaultAddressId();
$cart->id_address_invoice = $this->getDefaultAddressId();
$cart->id_currency = $this->getDefaultCurrencyId();
$cart->save();
$cart->updateQty(1, $this->getDefaultProductId());

$transactionDetail = [
'method' => $this->getDefaultMethod(),
'currency' => $event->getResource()->amount->currency_code,
'payment_status' => $event->getResource()->status,
'payment_method' => 'paypal',
'id_payment' => empty($event->getResource()->supplementary_data->related_ids->order_id) ? '' : $event->getResource()->supplementary_data->related_ids->order_id,
'payment_tool' => '',
'date_transaction' => (new DateTime())->format('Y-m-d H:i:s'),
'transaction_id' => $event->getResource()->id,
'capture' => true,
'intent' => 'CAPTURE',
];

$module->validateOrder(
$cart->id,
$idOrderStatus,
(float) $event->getResource()->amount->value,
'paypal',
null,
$transactionDetail,
$this->getDefaultCurrencyId()
);

return $module->currentOrder;
}

protected function getDefaultCustomerId()
{
return 2;
}

protected function getDefaultAddressId()
{
return 2;
}

protected function getDefaultProductId()
{
return 12;
}

protected function getDefaultCurrencyId()
{
return (int) Configuration::get('PS_CURRENCY_DEFAULT');
}

protected function getDefaultMethod()
{
return 'EC';
}

protected function initWebhookEvent($file)
{
$webhookEvent = new WebhookEvent();
$webhookEvent->fromJson(file_get_contents(__DIR__ . '/dataset/' . $file));

return $webhookEvent;
}

}
Loading

0 comments on commit 381c405

Please sign in to comment.