Skip to content

Commit 46e3457

Browse files
authored
Merge pull request #13 from paynl/rikbranch
rc-0.2.0
2 parents de5d65e + 3879bfc commit 46e3457

File tree

109 files changed

+5869
-11158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+5869
-11158
lines changed

.gitignore

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Custom added rules
2+
/bin/
3+
4+
# Created by https://www.toptal.com/developers/gitignore/api/composer,phpunit,phpstorm+all
5+
# Edit at https://www.toptal.com/developers/gitignore?templates=composer,phpunit,phpstorm+all
6+
7+
### Composer ###
8+
composer.phar
9+
/vendor/
10+
11+
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
12+
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
13+
# composer.lock
14+
15+
### PhpStorm+all ###
16+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
17+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
18+
19+
# User-specific stuff
20+
.idea/**/workspace.xml
21+
.idea/**/tasks.xml
22+
.idea/**/usage.statistics.xml
23+
.idea/**/dictionaries
24+
.idea/**/shelf
25+
26+
# AWS User-specific
27+
.idea/**/aws.xml
28+
29+
# Generated files
30+
.idea/**/contentModel.xml
31+
32+
# Sensitive or high-churn files
33+
.idea/**/dataSources/
34+
.idea/**/dataSources.ids
35+
.idea/**/dataSources.local.xml
36+
.idea/**/sqlDataSources.xml
37+
.idea/**/dynamic.xml
38+
.idea/**/uiDesigner.xml
39+
.idea/**/dbnavigator.xml
40+
41+
# Gradle
42+
.idea/**/gradle.xml
43+
.idea/**/libraries
44+
45+
# Gradle and Maven with auto-import
46+
# When using Gradle or Maven with auto-import, you should exclude module files,
47+
# since they will be recreated, and may cause churn. Uncomment if using
48+
# auto-import.
49+
# .idea/artifacts
50+
# .idea/compiler.xml
51+
# .idea/jarRepositories.xml
52+
# .idea/modules.xml
53+
# .idea/*.iml
54+
# .idea/modules
55+
# *.iml
56+
# *.ipr
57+
58+
# CMake
59+
cmake-build-*/
60+
61+
# Mongo Explorer plugin
62+
.idea/**/mongoSettings.xml
63+
64+
# File-based project format
65+
*.iws
66+
67+
# IntelliJ
68+
out/
69+
70+
# mpeltonen/sbt-idea plugin
71+
.idea_modules/
72+
73+
# JIRA plugin
74+
atlassian-ide-plugin.xml
75+
76+
# Cursive Clojure plugin
77+
.idea/replstate.xml
78+
79+
# SonarLint plugin
80+
.idea/sonarlint/
81+
82+
# Crashlytics plugin (for Android Studio and IntelliJ)
83+
com_crashlytics_export_strings.xml
84+
crashlytics.properties
85+
crashlytics-build.properties
86+
fabric.properties
87+
88+
# Editor-based Rest Client
89+
.idea/httpRequests
90+
91+
# Android studio 3.1+ serialized cache file
92+
.idea/caches/build_file_checksums.ser
93+
94+
### PhpStorm+all Patch ###
95+
# Ignore everything but code style settings and run configurations
96+
# that are supposed to be shared within teams.
97+
98+
.idea/*
99+
100+
!.idea/codeStyles
101+
!.idea/runConfigurations
102+
103+
### PHPUnit ###
104+
# Covers PHPUnit
105+
# Reference: https://phpunit.de/
106+
107+
# Generated files
108+
.phpunit.result.cache
109+
.phpunit.cache
110+
111+
# PHPUnit
112+
/app/phpunit.xml
113+
/phpunit.xml
114+
115+
# Build data
116+
/build/
117+
118+
# End of https://www.toptal.com/developers/gitignore/api/composer,phpunit,phpstorm+all

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<img src="https://www.pay.nl/uploads/1/brands/main_logo.png" width="100px" style="margin-bottom: -30px"/> <h1 style="position:relative;top:-6px;padding-left:10px;display: inline-block">PHP SDK</h1>
1+
<img src="https://www.pay.nl/uploads/1/brands/main_logo.png" width="100px" style="margin-bottom: -30px"/> <h1 style="position:relative;top:-6px;padding-left:10px;display: inline-block">PHP SDK</h1>
22

33

44
Use this SDK to implement Pay. into your PHP integration.
55
<br>
66

77
#### Requirements
88

9-
> PHP 7.4 or PHP 8+
10-
JSON extension installed
11-
CURL extension installed
12-
9+
> PHP 8.2+
10+
> JSON extension installed
11+
> CURL extension installed
12+
1313
<br>
1414

1515
If requirements are met, go ahead with the [installation and set-up](https://github.com/paynl/php-sdk/wiki/Install) of the SDK!
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace Tests\Unit;
4+
5+
use PayNL\Sdk\Model\Pay\PayOrder;
6+
use PayNL\Sdk\Model\Request\OrderAbortRequest;
7+
use PHPUnit\Framework\TestCase;
8+
9+
class OrderAbortRequestTest extends TestCase
10+
{
11+
/**
12+
* @return void
13+
*/
14+
public function testConstructor(): void
15+
{
16+
$transactionId = '123456';
17+
$orderAbortRequest = new OrderAbortRequest($transactionId);
18+
19+
$this->assertInstanceOf(OrderAbortRequest::class, $orderAbortRequest);
20+
}
21+
22+
/**
23+
* @return void
24+
*/
25+
public function testGetPathParameters(): void
26+
{
27+
$transactionId = '123456';
28+
$orderAbortRequest = new OrderAbortRequest($transactionId);
29+
30+
$pathParameters = $orderAbortRequest->getPathParameters();
31+
32+
$this->assertIsArray($pathParameters);
33+
$this->assertArrayHasKey('transactionId', $pathParameters);
34+
$this->assertSame($transactionId, $pathParameters['transactionId']);
35+
}
36+
37+
/**
38+
* @return void
39+
*/
40+
public function testGetBodyParameters(): void
41+
{
42+
$transactionId = '123456';
43+
$orderAbortRequest = new OrderAbortRequest($transactionId);
44+
45+
$bodyParameters = $orderAbortRequest->getBodyParameters();
46+
47+
$this->assertIsArray($bodyParameters);
48+
$this->assertEmpty($bodyParameters);
49+
}
50+
51+
/**
52+
* @return void
53+
* @throws \PHPUnit\Framework\MockObject\Exception
54+
* @throws \PayNL\Sdk\Exception\PayException
55+
*/
56+
public function testStart(): void
57+
{
58+
$transactionId = '123456';
59+
$orderAbortRequest = $this->getMockBuilder(OrderAbortRequest::class)
60+
->setConstructorArgs([$transactionId])
61+
->onlyMethods(['start'])
62+
->getMock();
63+
64+
$mockPayOrder = $this->createMock(PayOrder::class);
65+
66+
$orderAbortRequest->method('start')->willReturn($mockPayOrder);
67+
68+
$result = $orderAbortRequest->start();
69+
70+
$this->assertInstanceOf(PayOrder::class, $result);
71+
}
72+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace Tests\Unit;
4+
5+
use PayNL\Sdk\Model\Pay\PayOrder;
6+
use PayNL\Sdk\Model\Request\OrderApproveRequest;
7+
use PHPUnit\Framework\TestCase;
8+
9+
class OrderApproveRequestTest extends TestCase
10+
{
11+
/**
12+
* @return void
13+
*/
14+
public function testConstructor(): void
15+
{
16+
$transactionId = '123456';
17+
$orderApproveRequest = new OrderApproveRequest($transactionId);
18+
19+
$this->assertInstanceOf(OrderApproveRequest::class, $orderApproveRequest);
20+
}
21+
22+
/**
23+
* @return void
24+
*/
25+
public function testGetPathParameters(): void
26+
{
27+
$transactionId = '123456';
28+
$orderApproveRequest = new OrderApproveRequest($transactionId);
29+
30+
$pathParameters = $orderApproveRequest->getPathParameters();
31+
32+
$this->assertIsArray($pathParameters);
33+
$this->assertArrayHasKey('transactionId', $pathParameters);
34+
$this->assertSame($transactionId, $pathParameters['transactionId']);
35+
}
36+
37+
/**
38+
* @return void
39+
*/
40+
public function testGetBodyParameters(): void
41+
{
42+
$transactionId = '123456';
43+
$orderApproveRequest = new OrderApproveRequest($transactionId);
44+
45+
$bodyParameters = $orderApproveRequest->getBodyParameters();
46+
47+
$this->assertIsArray($bodyParameters);
48+
$this->assertEmpty($bodyParameters);
49+
}
50+
51+
/**
52+
* @return void
53+
* @throws \PHPUnit\Framework\MockObject\Exception
54+
* @throws \PayNL\Sdk\Exception\PayException
55+
*/
56+
public function testStart(): void
57+
{
58+
$transactionId = '123456';
59+
$orderApproveRequest = $this->getMockBuilder(OrderApproveRequest::class)
60+
->setConstructorArgs([$transactionId])
61+
->onlyMethods(['start'])
62+
->getMock();
63+
64+
$mockPayOrder = $this->createMock(PayOrder::class);
65+
66+
$orderApproveRequest->method('start')->willReturn($mockPayOrder);
67+
68+
$result = $orderApproveRequest->start();
69+
70+
$this->assertInstanceOf(PayOrder::class, $result);
71+
}
72+
}

0 commit comments

Comments
 (0)