Skip to content

Commit

Permalink
Merge pull request #497 from Adyen/develop
Browse files Browse the repository at this point in the history
Release v15.0.0-beta
  • Loading branch information
jillingk authored Apr 18, 2023
2 parents ca1ed9e + 916b474 commit d38ce4f
Show file tree
Hide file tree
Showing 873 changed files with 433,159 additions and 363 deletions.
14 changes: 14 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
changelog:
categories:
- title: Breaking Changes 🛠
labels:
- Breaking change
- title: New Features 💎
labels:
- Feature
- title: Fixes ⛑️
labels:
- Fix
- title: Other Changes 🖇️
labels:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: sed -i "s;`pwd`/;;g" build/*.xml

- name: Run PHP Code Sniffer
run: vendor/bin/phpcs
run: vendor/bin/phpcs --exclude=Generic.Files.LineLength

- name: Make sure project files are compilable
run: find -L . -path ./vendor -prune -o -path ./tests -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PHP Library Models

on: [ workflow_dispatch ]

jobs:
generate:
runs-on: ubuntu-latest
name: Generate Models
steps:
- uses: actions/checkout@v3
- run: make models
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v1
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run PHP Code Sniffer
run: vendor/bin/phpcbf src/Adyen/Model/** || true
- name: Set PR variables
id: vars
run: |
cd target/spec
echo ::set-output name=pr_title::"Update models"
echo ::set-output name=pr_body::"OpenAPI spec or templates produced new models on $(date +%d-%m-%Y) \
by [commit](https://github.com/Adyen/adyen-openapi/commit/$(git rev-parse HEAD))."
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
committer: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
author: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
base: develop
branch: automation/models
title: ${{ steps.vars.outputs.pr_title }}
body: ${{ steps.vars.outputs.pr_body }}
add-paths: |
src/Adyen/Model
40 changes: 40 additions & 0 deletions .github/workflows/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PHP Library Models and Services

on: [ workflow_dispatch ]

jobs:
generate:
runs-on: ubuntu-latest
name: Generate Models
steps:
- uses: actions/checkout@v3
- run: make all
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v1
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run PHP Code Sniffer
run: vendor/bin/phpcbf src/Adyen/Service/** src/Adyen/Model/** || true
- name: Set PR variables
id: vars
run: |
cd target/spec
echo ::set-output name=pr_title::"Update models+services"
echo ::set-output name=pr_body::"OpenAPI spec or templates produced new models and services on $(date +%d-%m-%Y) \
by [commit](https://github.com/Adyen/adyen-openapi/commit/$(git rev-parse HEAD))."
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
committer: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
author: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
base: develop
branch: automation/services
title: ${{ steps.vars.outputs.pr_title }}
body: ${{ steps.vars.outputs.pr_body }}
add-paths: |
src/Adyen/Model
src/Adyen/Service
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ composer.lock
/build/
.php_cs.cache
.phpunit.result.cache

# Automation
/target/
74 changes: 53 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,74 +1,106 @@
openapi-generator-version:=6.3.0
openapi-generator-version:=6.4.0
openapi-generator-url:=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$(openapi-generator-version)/openapi-generator-cli-$(openapi-generator-version).jar
openapi-generator-jar:=target/openapi-generator-cli.jar
openapi-generator-cli:=java -jar $(openapi-generator-jar)

generator:=php
services:=Checkout
modelGen:=BalanceControl BalancePlatform Checkout StoredValue Payments Payout Management LegalEntityManagement Transfers BinLookup StoredValue POSTerminalManagement Recurring
models:=src/Adyen/Model
output:=target/out

# Generate models (for each service)
models: $(services)
models: $(modelGen)

Binlookup: spec=BinLookupService-v52
BalanceControl: spec=BalanceControlService-v1
BalancePlatform: spec=BalancePlatformService-v2
BinLookup: spec=BinLookupService-v54
Checkout: spec=CheckoutService-v70
storedValue: spec=StoredValueService-v46
posterminalmanagement: spec=TfmAPIService-v1
payments: spec=PaymentService-v68
recurring: spec=RecurringService-v68
payout: spec=PayoutService-v68
management: spec=ManagementService-v1
management: resourceClass=Management
balanceplatform: spec=BalancePlatformService-v2
DataProtection: spec=DataProtectionService-v1
StoredValue: spec=StoredValueService-v46
POSTerminalManagement: spec=TfmAPIService-v1
Payments: spec=PaymentService-v68
Recurring: spec=RecurringService-v68
Payout: spec=PayoutService-v68
Management: spec=ManagementService-v1
LegalEntityManagement: spec=LegalEntityService-v3
Transfers: spec=TransferService-v3
Transfers: service=transfers
legalentitymanagement: spec=LegalEntityService-v2

# Classic Platforms
marketpay/account: spec=AccountService-v6
marketpay/fund: spec=FundService-v6
marketpay/configuration: spec=NotificationConfigurationService-v6
marketpay/webhooks: spec=MarketPayNotificationService-v6
hop: spec=HopService-v6

$(services): target/spec $(openapi-generator-jar)
$(modelGen): target/spec $(openapi-generator-jar)
rm -rf $(models)/$@ $(output)
$(openapi-generator-cli) generate \
-i target/spec/json/$(spec).json \
-g $(generator) \
-o $(output) \
-c ./templates/config.yaml \
-t ./templates \
--inline-schema-name-mappings PaymentDonationRequest_paymentMethod=CheckoutPaymentMethod \
--model-package Model\\$@ \
--api-package Service\\$@ \
--reserved-words-mappings configuration=configuration \
--ignore-file-override ./.openapi-generator-ignore \
--skip-validate-spec \
--additional-properties variableNamingConvention=camelCase \
--additional-properties invokerPackage=Adyen \
--additional-properties packageName=Adyen
rm -rf src/Adyen/Service/$@ src/Adyen/Model/$@
mv $(output)/lib/Model/$@ $(models)/$@
mv $(output)/lib//ObjectSerializer.php $(models)/$@

Checkout: target/spec $(openapi-generator-jar)
# Service Generation; split up in to templates based on the size of the service. That is, some services have no subgroups and are thus generated in one single file, others are grouped in a directory.

Services:=BalancePlatform Checkout StoredValue Payments Payout Management LegalEntityManagement Transfers
SingleFileServices:=BalanceControl BinLookup DataProtection StoredValue POSTerminalManagement Recurring

all: $(Services) $(SingleFileServices)

$(Services): target/spec $(openapi-generator-jar)
rm -rf $(models)/$@ $(output)
$(openapi-generator-cli) generate \
-i target/spec/json/$(spec).json \
-g $(generator) \
-o $(output) \
-c ./templates/config.yaml \
-t ./templates \
--inline-schema-name-mappings PaymentDonationRequest_paymentMethod=CheckoutPaymentMethod \
--model-package Model\\$@ \
--api-package Service\\$@ \
--inline-schema-name-mappings BankAccountInfo_accountIdentification=BankAccount \
--reserved-words-mappings configuration=configuration \
--ignore-file-override ./.openapi-generator-ignore \
--skip-validate-spec \
--additional-properties variableNamingConvention=camelCase \
--additional-properties invokerPackage=Adyen \
--additional-properties packageName=Adyen
rm -rf src/Adyen/Service/$@ src/Adyen/Model/$@
mv $(output)/lib/Model/$@ $(models)/$@
mv $(output)/lib//ObjectSerializer.php $(models)/$@
mv $(output)/lib/ObjectSerializer.php $(models)/$@
mkdir src/Adyen/Service/$@
mv $(output)/lib/Service/* src/Adyen/Service

$(SingleFileServices): target/spec $(openapi-generator-jar)
rm -rf $(models)/$@ $(output)
$(openapi-generator-cli) generate \
-i target/spec/json/$(spec).json \
-g $(generator) \
-o $(output) \
-c templates/config.yaml \
--model-package Model\\$@ \
--api-package Service\\$@ \
--inline-schema-name-mappings PaymentDonationRequest_paymentMethod=CheckoutPaymentMethod \
--reserved-words-mappings configuration=configuration \
--skip-validate-spec \
--additional-properties variableNamingConvention=camelCase \
--additional-properties customApi=$@ \
--additional-properties invokerPackage=Adyen \
--additional-properties packageName=Adyen
rm -rf src/Adyen/Service/$@Api src/Adyen/Model/$@
mv $(output)/lib/Model/$@ $(models)/$@
mv $(output)/lib/ObjectSerializer.php $(models)/$@
mv $(output)/lib/Service/$@/GeneralApiSingle.php src/Adyen/Service/$@Api.php

# Checkout spec (and patch version)
target/spec:
git clone https://github.com/Adyen/adyen-openapi.git target/spec
Expand Down
Loading

0 comments on commit d38ce4f

Please sign in to comment.