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

v5 of MyOnlineStore / omnipay-klarna-checkout #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
33 changes: 0 additions & 33 deletions .circleci/config.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test

on:
push:
branches-ignore:
- 'master'
tags-ignore:
- '**'

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
- uses: actions/cache@v2
with:
path: vendor
key: php-7.4-vendor-${{ hashFiles('**/composer.json') }}
restore-keys: php-7.4-vendor-
- run: composer install --no-interaction --no-ansi
- id: set-php-versions
run: echo "::set-output name=php-versions::$(vendor/bin/devtools list:php-versions)"
- id: set-tools
run: echo "::set-output name=tools::$(vendor/bin/devtools list:enabled-tools)"
outputs:
php-versions: ${{ steps.set-php-versions.outputs.php-versions }}
tools: ${{ steps.set-tools.outputs.tools }}

test:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ${{ fromJson(needs.setup.outputs.php-versions) }}
tool: ${{ fromJson(needs.setup.outputs.tools) }}
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-values: date.timezone=Europe/Amsterdam, assert.exception=1, zend.assertions=1
- uses: actions/cache@v2
with:
path: vendor
key: php-${{ matrix.php-version }}-vendor-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php-version }}-vendor-
- run: composer install --no-interaction --no-ansi

- run: vendor/bin/devtools ${{ matrix.tool }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.DS_Store
.idea
.phpunit.result.cache
vendor
composer.lock
phpunit.xml
/.phpcs-cache
14 changes: 0 additions & 14 deletions .scrutinizer.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# NO LONGER MAINTAINED
This repository is no longer being maintained.

# Omnipay: Klarna Checkout
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Scrutinizer Build](https://img.shields.io/scrutinizer/build/g/MyOnlineStore/omnipay-klarna-checkout.svg?style=flat-square)](https://github.com/MyOnlineStore/omnipay-klarna-checkout)
Expand Down
17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@
}
},
"require": {
"php": "^7.0",
"omnipay/common": "~3",
"php": "^7.4 | ^8.0",
"omnipay/common": "^3.1",
"ext-json": "*"
},
"require-dev": {
"myonlinestore/coding-standard": "^1.0",
"omnipay/tests": "~3"
"myonlinestore/coding-standard": "^3.1",
"myonlinestore/php-devtools": "^0.2",
"omnipay/tests": "^4.1",
"vimeo/psalm": "^4.18"
},
"config": {
"vendor-dir": "vendor",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true
}
}
}
19 changes: 15 additions & 4 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
<file>./</file>

<arg value="sp"/>
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg value="sp"/>

<file>src</file>
<file>tests</file>

<rule ref="vendor/myonlinestore/coding-standard/MyOnlineStore/ruleset.xml"/>
<rule ref="vendor/myonlinestore/coding-standard/MyOnlineStore/ruleset.xml">
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
</rule>
</ruleset>
24 changes: 10 additions & 14 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
<phpunit bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>

<testsuites>
<testsuite name="Omnipay Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
</phpunit>
146 changes: 146 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.18.1@dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb">
<file src="src/AuthenticationRequestHeaderProvider.php">
<PossiblyNullArgument occurrences="2">
<code>$request-&gt;getSecret()</code>
<code>$request-&gt;getUsername()</code>
</PossiblyNullArgument>
</file>
<file src="src/Gateway.php">
<LessSpecificReturnStatement occurrences="1">
<code>$this</code>
</LessSpecificReturnStatement>
<MissingReturnType occurrences="5">
<code>authorize</code>
<code>capture</code>
<code>refund</code>
<code>setBaseUrl</code>
<code>void</code>
</MissingReturnType>
<MoreSpecificReturnType occurrences="1">
<code>self</code>
</MoreSpecificReturnType>
</file>
<file src="src/Item.php">
<MissingReturnType occurrences="6">
<code>setMerchantData</code>
<code>setTaxRate</code>
<code>setTotalAmount</code>
<code>setTotalDiscountAmount</code>
<code>setTotalTaxAmount</code>
<code>setType</code>
</MissingReturnType>
</file>
<file src="src/ItemBag.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>ItemInterface[]</code>
</ImplementedReturnTypeMismatch>
<MissingReturnType occurrences="1">
<code>add</code>
</MissingReturnType>
<PossiblyInvalidArgument occurrences="1">
<code>$item</code>
</PossiblyInvalidArgument>
</file>
<file src="src/Message/AbstractOrderRequest.php">
<PossiblyNullReference occurrences="1">
<code>getAmount</code>
</PossiblyNullReference>
</file>
<file src="src/Message/AbstractRequest.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>Money|null</code>
</ImplementedReturnTypeMismatch>
<MissingReturnType occurrences="2">
<code>setLocale</code>
<code>setTaxAmount</code>
</MissingReturnType>
<PossiblyInvalidArgument occurrences="1">
<code>$items</code>
</PossiblyInvalidArgument>
</file>
<file src="src/Message/AcknowledgeRequest.php">
<PropertyNotSetInConstructor occurrences="1">
<code>AcknowledgeRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/AuthorizeRequest.php">
<ImplicitToStringCast occurrences="1">
<code>$response-&gt;getBody()</code>
</ImplicitToStringCast>
<PropertyNotSetInConstructor occurrences="1">
<code>AuthorizeRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/AuthorizeResponse.php">
<InvalidNullableReturnType occurrences="2">
<code>getRedirectData</code>
<code>getRedirectUrl</code>
</InvalidNullableReturnType>
<MissingParamType occurrences="2">
<code>$data</code>
<code>$renderUrl</code>
</MissingParamType>
<NullableReturnStatement occurrences="2">
<code>$this-&gt;renderUrl</code>
<code>null</code>
</NullableReturnStatement>
</file>
<file src="src/Message/CaptureRequest.php">
<PropertyNotSetInConstructor occurrences="1">
<code>CaptureRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/ExtendAuthorizationRequest.php">
<PropertyNotSetInConstructor occurrences="1">
<code>ExtendAuthorizationRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/FetchTransactionRequest.php">
<PossiblyUndefinedVariable occurrences="1">
<code>$responseData</code>
</PossiblyUndefinedVariable>
<PropertyNotSetInConstructor occurrences="1">
<code>FetchTransactionRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/RefundRequest.php">
<PropertyNotSetInConstructor occurrences="1">
<code>RefundRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/UpdateCustomerAddressRequest.php">
<PossiblyNullReference occurrences="2">
<code>getArrayCopy</code>
<code>getArrayCopy</code>
</PossiblyNullReference>
<PropertyNotSetInConstructor occurrences="1">
<code>UpdateCustomerAddressRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/UpdateCustomerAddressResponse.php">
<RedundantCastGivenDocblockType occurrences="1">
<code>(int) $statusCode</code>
</RedundantCastGivenDocblockType>
</file>
<file src="src/Message/UpdateMerchantReferencesRequest.php">
<PropertyNotSetInConstructor occurrences="1">
<code>UpdateMerchantReferencesRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/UpdateTransactionRequest.php">
<PropertyNotSetInConstructor occurrences="1">
<code>UpdateTransactionRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Message/VoidRequest.php">
<PropertyNotSetInConstructor occurrences="1">
<code>VoidRequest</code>
</PropertyNotSetInConstructor>
</file>
<file src="vendor/omnipay/common/src/Common/ParametersTrait.php">
<MissingDocblockType occurrences="1">
<code>public function initialize(array $parameters = [])</code>
</MissingDocblockType>
</file>
</files>
16 changes: 16 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
errorBaseline="psalm-baseline.xml"
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
6 changes: 3 additions & 3 deletions src/AuthenticationRequestHeaderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ final class AuthenticationRequestHeaderProvider
public function getHeaders(AbstractRequest $request): array
{
return [
'Authorization' => sprintf(
'Authorization' => \sprintf(
'Basic %s',
base64_encode(
sprintf(
\base64_encode(
\sprintf(
'%s:%s',
$request->getUsername(),
$request->getSecret()
Expand Down
Loading