Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
86 changes: 0 additions & 86 deletions .github/workflows/analysis.yaml

This file was deleted.

99 changes: 85 additions & 14 deletions .github/workflows/sylius.yaml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,76 @@
name: Sylius
name: CI

'on':
push:
branches:
- develop
- qa
- master
paths-ignore:
- README.md
pull_request:
branches:
- test-develop-ci
- test-master-ci
paths-ignore:
- README.md

jobs:
sylius:
quality:
name: PHP Quality
runs-on: ubuntu-latest
env:
APP_ENV: test
steps:
-
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: date.timezone=UTC
extensions: intl
tools: symfony
coverage: none
-
name: 'Composer - Get Cache Directory'
id: composer-cache
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
-
name: 'Composer - Set cache'
uses: actions/cache@v4
with:
path: '${{ steps.composer-cache.outputs.dir }}'
key: 'php-8.2-symfony-6.4-composer-${{ hashFiles(''**/composer.json'') }}'
restore-keys: 'php-8.2-symfony-6.4-composer-'
-
name: 'Composer - Github Auth'
run: 'composer config -g github-oauth.github.com ${{ github.token }}'
-
name: 'Composer - Remove version field for validation'
run: |
jq 'del(.version)' composer.json > composer.json.tmp
mv composer.json.tmp composer.json
-
name: 'Composer - Validate'
run: 'composer validate --strict'
-
name: 'Composer - Restrict Symfony version'
run: 'composer config extra.symfony.require "^6.4"'
-
name: 'Composer - Install dependencies'
run: 'composer install --no-progress'
id: end-of-setup
-
name: 'ECS - Coding Standard'
run: 'composer ecs'
if: 'always() && steps.end-of-setup.outcome == ''success'''
-
name: 'PHPStan - Static Analysis'
run: 'composer phpstan'
if: 'always() && steps.end-of-setup.outcome == ''success'''

sylius-matrix:
name: 'PHPUnit-Behat (PHP ${{ matrix.php }} Sylius ${{ matrix.sylius }} Symfony ${{ matrix.symfony }})'
runs-on: ubuntu-latest
needs: [quality]
if: github.base_ref == 'test-develop-ci'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -43,11 +100,11 @@ jobs:
coverage: none
-
name: 'Setup Node'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node }}'
-
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: 'Composer - Get Cache Directory'
id: composer-cache
Expand Down Expand Up @@ -83,7 +140,7 @@ jobs:
run: 'make install -e SYLIUS_VERSION=${{ matrix.sylius }} SYMFONY_VERSION=${{ matrix.symfony }}'
id: end-of-setup-sylius
-
name: 'Doctrine Schema Validate - Run'
name: 'Doctrine Schema Validate'
run: 'vendor/bin/console doctrine:schema:validate --skip-sync'
-
name: 'Run PHPUnit'
Expand All @@ -93,8 +150,8 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: ./tests/Application/etc/build
name: 'logs-php${{ matrix.php }}-sylius${{ matrix.sylius }}-sf${{ matrix.symfony }}'
path: ./tests/TestApplication/etc/build
services:
mariadb:
image: 'mariadb:10.4.11'
Expand All @@ -103,3 +160,17 @@ jobs:
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
options: '--health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3'

# -----------------------------------------------------------------------
# 4. SONARCLOUD — code quality analysis (develop PRs only)
# -----------------------------------------------------------------------
sonarcloud:
if: always() && !failure() && !cancelled() && github.base_ref == 'test-develop-ci'
needs: sylius-matrix
uses: payplug/template-ci/.github/workflows/sonarcloud.yml@main
with:
project-name: 'github-payplug-payplug-syliuspayplugplugin'
src-folder: 'src/'
secrets:
sonar-orga: ${{ secrets.SONAR_ORGA }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
35 changes: 32 additions & 3 deletions .github/workflows/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# ⚠️ Requirements
Reviewer, please take a look at those requirements:
## Description
<!-- Provide a clear summary of the changes and the problem it solves. -->
<!-- Include any relevant context or background information. -->

- [ ] Check that plugin version has been upgrated and are identical in both `composer.json` and `src/PayPlugSyliusPayPlugPlugin.php` files
**Motivation:**

**Related issue(s):** Closes #

---

## Type of Change
<!-- check the corresponding checkbox(es) with an "x" -->
- 🐛 Bug fix (non-breaking change that fixes an issue) [ ]
- ✨ New feature (non-breaking change that adds functionality) [ ]
- 💥 Breaking change (fix or feature that causes existing functionality to change and that could impact other libs) [ ]
- 🔧 Refactor (no functional changes, code improvement only) [ ]
- 📦 Dependency update [ ]
- 🔒 Security fix [ ]
- 📝 Documentation update [ ]

---

## Checklist
### Code Quality
- [ ] Code is linted and formatted
- [ ] No unnecessary commented-out code or debug logs
- [ ] No hardcoded values (use env variables or config)

### Testing
- [ ] Unit tests added / updated

### Security & Ops
- [ ] No sensitive data or secrets introduced
- [ ] Logging and error handling are appropriate
1 change: 1 addition & 0 deletions .phpunit.result.cache

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![License](https://img.shields.io/packagist/l/payplug/sylius-payplug-plugin.svg)](https://github.com/payplug/SyliusPayPlugPlugin/blob/master/LICENSE)
[![CI - Analysis](https://github.com/payplug/SyliusPayPlugPlugin/actions/workflows/analysis.yaml/badge.svg?branch=master)](https://github.com/payplug/SyliusPayPlugPlugin/actions/workflows/analysis.yaml)
[![CI - Sylius](https://github.com/payplug/SyliusPayPlugPlugin/actions/workflows/sylius.yaml/badge.svg?branch=master)](https://github.com/payplug/SyliusPayPlugPlugin/actions/workflows/sylius.yaml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=github-payplug-payplug-syliuspayplugplugin&metric=alert_status&token=af29f9f3fbb3a74caff4e4a4d168bddab858f4dc)](https://sonarcloud.io/summary/new_code?id=github-payplug-payplug-syliuspayplugplugin)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=github-payplug-payplug-syliuspayplugplugin&metric=duplicated_lines_density&token=af29f9f3fbb3a74caff4e4a4d168bddab858f4dc)](https://sonarcloud.io/summary/new_code?id=github-payplug-payplug-syliuspayplugplugin)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=github-payplug-payplug-syliuspayplugplugin&metric=code_smells&token=af29f9f3fbb3a74caff4e4a4d168bddab858f4dc)](https://sonarcloud.io/summary/new_code?id=github-payplug-payplug-syliuspayplugplugin)
[![Version](https://img.shields.io/packagist/v/payplug/sylius-payplug-plugin.svg)](https://packagist.org/packages/payplug/sylius-payplug-plugin)
[![Total Downloads](https://poser.pugx.org/payplug/sylius-payplug-plugin/downloads)](https://packagist.org/packages/payplug/sylius-payplug-plugin)

Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "payplug/sylius-payplug-plugin",
"type": "sylius-plugin",
"version": "2.0.0.",
"keywords": [
"sylius",
"sylius-plugin",
Expand Down Expand Up @@ -47,7 +48,7 @@
"phpstan/phpstan-webmozart-assert": "2.0.0",
"phpunit/phpunit": "^9.6",
"rector/rector": "2.0.4",
"sylius-labs/coding-standard": "4.4.0",
"sylius-labs/coding-standard": "^4.4",
"sylius/test-application": "^2.1.0@alpha",
"symfony/apache-pack": "*",
"symfony/browser-kit": "^6.4|| ^7.2",
Expand Down Expand Up @@ -80,10 +81,10 @@
}
},
"scripts": {
"ecs": "ecs check -c rulesets/ecs.php --ansi --clear-cache .",
"fix-ecs": "@ecs --fix",
"phpmd": "phpmd src ansi rulesets/.php_md.xml",
"phpstan": "phpstan analyse src -c rulesets/phpstan.neon",
"ecs": "ecs check -c ruleset/ecs.php --ansi --clear-cache",
"fix-ecs": "@ecs --fix --memory-limit=4G",
"phpmd": "phpmd src ansi ruleset/.php_md.xml",
"phpstan": "phpstan analyse src -c ruleset/phpstan.neon",
"phpunit": "phpunit tests/PHPUnit --colors=always",
"tests": [
"@ecs",
Expand Down
21 changes: 21 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,27 @@ services:
- name: sylius.payment_request.provider.http_response
gateway_factory: !php/const PayPlug\SyliusPayPlugPlugin\Gateway\AmericanExpressGatewayFactory::FACTORY_NAME

## Scalapay Payplug Gateway ##
payplug_sylius_payplug_plugin.command_provider.payplug_scalapay:
class: Sylius\Bundle\PaymentBundle\CommandProvider\ActionsCommandProvider
arguments:
- !tagged_locator
tag: payplug_sylius_payplug_plugin.command_provider.payplug_scalapay
index_by: 'action'
tags:
- name: sylius.payment_request.command_provider
gateway_factory: !php/const PayPlug\SyliusPayPlugPlugin\Gateway\ScalapayGatewayFactory::FACTORY_NAME
payplug_sylius_payplug_plugin.provider.order_pay.http_response.payplug_scalapay:
class: Sylius\Bundle\PaymentBundle\Provider\ActionsHttpResponseProvider
arguments:
- !tagged_locator
tag: payplug_sylius_payplug_plugin.http_response_provider.payplug_scalapay
index_by: action
tags:
- name: sylius.payment_request.provider.http_response
gateway_factory: !php/const PayPlug\SyliusPayPlugPlugin\Gateway\ScalapayGatewayFactory::FACTORY_NAME


## Apple Pay Payplug Gateway ##
payplug_sylius_payplug_plugin.command_provider.payplug_apple_pay:
class: Sylius\Bundle\PaymentBundle\CommandProvider\ActionsCommandProvider
Expand Down
9 changes: 9 additions & 0 deletions config/services/client.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,14 @@
method="create"/>
<argument type="string" key="$factoryName">american_express</argument><!-- Gateway factory name -->
</service>

<service id="payplug_sylius_payplug_plugin.api_client.scalapay"
class="PayPlug\SyliusPayPlugPlugin\ApiClient\PayPlugApiClient"
public="true"
lazy="true">
<factory service="PayPlug\SyliusPayPlugPlugin\ApiClient\PayPlugApiClientFactory"
method="create"/>
<argument type="string" key="$factoryName">payplug_scalapay</argument><!-- Gateway factory name -->
</service>
</services>
</container>
8 changes: 8 additions & 0 deletions config/services/gateway.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,13 @@
<tag name="payum.gateway_factory_builder"
factory="payplug_american_express"/>
</service>

<!-- Gateway Scalapay by PayPlug -->
<service id="payplug_sylius_payplug_plugin.gateway_factory.scalapay"
class="Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder">
<argument type="string">PayPlug\SyliusPayPlugPlugin\Gateway\ScalapayGatewayFactory</argument>
<tag name="payum.gateway_factory_builder"
factory="payplug_scalapay"/>
</service>
</services>
</container>
6 changes: 6 additions & 0 deletions config/twig_hooks/admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ sylius_twig_hooks:
'sylius_admin.payment_method.create.content.form.sections.gateway_configuration.payplug_american_express': &amexGateway
live_checkbox: *liveCheckbox

'sylius_admin.payment_method.create.content.form.sections.gateway_configuration.payplug_scalapay': &scalapayGateway
live_checkbox: *liveCheckbox

'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.payplug':
<<: *payplugGateway
renew_oauth: &renewOAuth
Expand All @@ -47,3 +50,6 @@ sylius_twig_hooks:
'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.payplug_american_express':
<<: *amexGateway
renew_oauth: *renewOAuth
'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.payplug_scalapay':
<<: *scalapayGateway
renew_oauth: *renewOAuth
3 changes: 3 additions & 0 deletions config/twig_hooks/shop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ sylius_twig_hooks:
'sylius_shop.shared.form.select_payment.payment.choice.details#payplug_american_express':
american_express:
template: '@PayPlugSyliusPayPlugPlugin/shop/select_payment/_american_express.html.twig'
'sylius_shop.shared.form.select_payment.payment.choice.details#payplug_scalapay':
scalapay:
template: '@PayPlugSyliusPayPlugPlugin/shop/select_payment/_scalapay.html.twig'
Loading
Loading