Skip to content

Commit 5459f90

Browse files
authored
Merge pull request #82 from unzerdev/develop
Release 1.1.5.0
2 parents 4184b40 + 68f840f commit 5459f90

35 files changed

+896
-104
lines changed

.php_cs renamed to .php-cs-fixer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44
->in(__DIR__.'/src')
55
->in(__DIR__.'/test');
66

7-
return PhpCsFixer\Config::create()
7+
$config = new PhpCsFixer\Config();
8+
return $config
89
->setUsingCache(false)
910
->setRules(
1011
array(
1112
'@PSR2' => true,
1213
'no_blank_lines_after_phpdoc' => true,
1314
'phpdoc_add_missing_param_annotation' => true,
1415
'native_function_casing' => true,
15-
'method_separation' => true,
16+
'class_attributes_separation' => ['elements' => ['method' => 'one']],
1617
'method_argument_space' => true,
1718
'no_empty_statement' => true,
1819
'no_leading_import_slash' => true,
1920
'no_multiline_whitespace_around_double_arrow' => true,
20-
'no_multiline_whitespace_before_semicolons' => true,
21+
'multiline_whitespace_before_semicolons' => true,
2122
'no_singleline_whitespace_before_semicolons' => true,
2223
'no_spaces_around_offset' => true,
2324
'no_trailing_comma_in_singleline_array' => true,

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
55

6+
## [1.1.5.0](https://github.com/unzerdev/php-sdk/compare/1.1.4.2..1.1.5.0)
7+
### Added
8+
* Add Support for basket `v2` resource.
9+
### Changed
10+
* Add support for payment state `create` which can occur when using payment pages.
11+
* Examples:
12+
* Use `v2/basket` resource for secured payment methods and payment pages.
13+
* Remove broken image-URLs of payment page examples.
14+
* Several minor improvements.
15+
616
## [1.1.4.2](https://github.com/unzerdev/php-sdk/compare/1.1.4.1..1.1.4.2)
717
### Added
818
* Enable PHP 8.1 compatibility.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"require-dev": {
1111
"phpunit/phpunit": ">6.5 <10.0",
12-
"friendsofphp/php-cs-fixer": "^2.0"
12+
"friendsofphp/php-cs-fixer": "^3.0"
1313
},
1414
"suggest": {
1515
"ext-curl": "*"

examples/Applepay/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ function setupApplePaySession() {
206206
amount: 12.99
207207
},
208208
supportedNetworks: ['amex', 'visa', 'masterCard', 'discover'],
209-
merchantCapabilities: ['supports3DS', 'supportsEMV', 'supportsCredit', 'supportsDebit'],
209+
merchantCapabilities: ['supports3DS', 'supportsCredit', 'supportsDebit'],
210210
requiredShippingContactFields: ['postalAddress', 'name', 'phone', 'email'],
211211
requiredBillingContactFields: ['postalAddress', 'name', 'phone', 'email'],
212212
lineItems: [

examples/EmbeddedPayPage/Controller.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@
7878
$orderId = 'o' . str_replace(['0.', ' '], '', microtime(false));
7979

8080
// ... however you can customize the Payment Page using additional parameters.
81-
$paypage->setLogoImage('https://dev.unzer.com/wp-content/uploads/2020/09/Unzer__PrimaryLogo_Raspberry_RGB.png')
82-
->setShopName('My Test Shop')
81+
$paypage->setShopName('My Test Shop')
8382
->setTagline('Try and stop us from being awesome!')
8483
->setOrderId($orderId)
8584
->setInvoiceId('i' . microtime(true));
@@ -88,10 +87,17 @@
8887
$paypage->setEffectiveInterestRate(4.99);
8988

9089
// ... a Basket is mandatory for InstallmentSecured
91-
$basketItem = (new BasketItem('Hat', 100.00, 119.00, 1))
92-
->setAmountGross(119.0)
93-
->setAmountVat(19.0);
94-
$basket = new Basket($orderId, 119.0, 'EUR', [$basketItem]);
90+
$basketItem = (new BasketItem())
91+
->setAmountPerUnitGross(119.00)
92+
->setVat(19.00)
93+
->setQuantity(1)
94+
->setBasketItemReferenceId('item1')
95+
->setTitle('Hat');
96+
97+
$basket = new Basket($orderId);
98+
$basket->setTotalValueGross(119.00)
99+
->addBasketItem($basketItem)
100+
->setCurrencyCode('EUR');
95101

96102
if ($transactionType === 'charge') {
97103
$unzer->initPayPageCharge($paypage, $customer, $basket);

examples/HostedPayPage/Controller.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ function redirect($url, $merchantMessage = '', $clientMessage = '')
8484
$orderId = 'o' . str_replace(['0.', ' '], '', microtime(false));
8585

8686
// ... however you can customize the Payment Page using additional parameters.
87-
$paypage->setLogoImage('https://dev.unzer.com/wp-content/uploads/2020/09/Unzer__PrimaryLogo_Raspberry_RGB.png')
88-
->setFullPageImage('https://dev.unzer.com/wp-content/uploads/2020/09/01_Unzer_Ambitious_RGB_LoRes.jpg')
89-
->setShopName('My Test Shop')
87+
$paypage->setShopName('My Test Shop')
9088
->setShopDescription('Best shop in the whole world!')
9189
->setTagline('Try and stop us from being awesome!')
9290
->setOrderId('OrderNr' . $orderId)
@@ -101,10 +99,17 @@ function redirect($url, $merchantMessage = '', $clientMessage = '')
10199
$paypage->setEffectiveInterestRate(4.99);
102100

103101
// ... a Basket is mandatory for InstallmentSecured
104-
$basketItem = (new BasketItem('Hat', 100.00, 119.00, 1))
105-
->setAmountGross(119.0)
106-
->setAmountVat(19.0);
107-
$basket = new Basket($orderId, 119.0, 'EUR', [$basketItem]);
102+
$basketItem = (new BasketItem())
103+
->setAmountPerUnitGross(119.00)
104+
->setVat(19.00)
105+
->setQuantity(1)
106+
->setBasketItemReferenceId('item1')
107+
->setTitle('Hat');
108+
109+
$basket = new Basket($orderId);
110+
$basket->setTotalValueGross(119.00)
111+
->addBasketItem($basketItem)
112+
->setCurrencyCode('EUR');
108113

109114
if ($transactionType === 'charge') {
110115
$unzer->initPayPageCharge($paypage, $customer, $basket);

examples/InstallmentSecured/Controller.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,17 @@ function redirect($url, $merchantMessage = '', $clientMessage = '')
8787
->setEmail('[email protected]');
8888

8989
// A Basket is mandatory for Installment Secured payment type
90-
$basketItem = (new BasketItem('Hat', 100.00, 119.00, 1))
91-
->setAmountGross(119.0)
92-
->setAmountVat(19.0);
93-
$basket = (new Basket($orderId, 119.0, 'EUR', [$basketItem]))->setAmountTotalVat(19.0);
90+
$basketItem = (new BasketItem())
91+
->setAmountPerUnitGross(119.00)
92+
->setVat(19)
93+
->setQuantity(1)
94+
->setBasketItemReferenceId('item1')
95+
->setTitle('Hat');
96+
97+
$basket = new Basket($orderId);
98+
$basket->setTotalValueGross(119.00)
99+
->addBasketItem($basketItem)
100+
->setCurrencyCode('EUR');
94101

95102
// initialize the payment
96103
$authorize = $unzer->authorize(

examples/InvoiceSecured/Controller.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,17 @@ function redirect($url, $merchantMessage = '', $clientMessage = '')
7171
$orderId = 'o' . str_replace(['0.', ' '], '', microtime(false));
7272

7373
// A Basket is mandatory for Invoice Secured payment type
74-
$basketItem = (new BasketItem('Hat', 100.00, 119.00, 1))
75-
->setAmountGross(119.0)
76-
->setAmountVat(19.0);
77-
$basket = new Basket($orderId, 119.0, 'EUR', [$basketItem]);
74+
$basketItem = (new BasketItem())
75+
->setAmountPerUnitGross(119.00)
76+
->setVat(19.00)
77+
->setQuantity(1)
78+
->setBasketItemReferenceId('item1')
79+
->setTitle('Hat');
80+
81+
$basket = new Basket($orderId);
82+
$basket->setTotalValueGross(119.00)
83+
->addBasketItem($basketItem)
84+
->setCurrencyCode('EUR');
7885

7986
$transaction = $unzer->charge(119.0, 'EUR', $paymentTypeId, CONTROLLER_URL, $customerId, $orderId, null, $basket);
8087

examples/SepaDirectDebitSecured/Controller.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,17 @@ function redirect($url, $merchantMessage = '', $clientMessage = '')
6767
$orderId = 'o' . str_replace(['0.', ' '], '', microtime(false));
6868

6969
// A Basket is mandatory for SEPA direct debit secured payment type
70-
$basketItem = (new BasketItem('Hat', 100.00, 119.00, 1))
71-
->setAmountGross(119.0)
72-
->setAmountVat(19.0);
73-
$basket = new Basket($orderId, 119.0, 'EUR', [$basketItem]);
70+
$basketItem = (new BasketItem())
71+
->setAmountPerUnitGross(119.00)
72+
->setVat(19.00)
73+
->setQuantity(1)
74+
->setBasketItemReferenceId('item1')
75+
->setTitle('Hat');
76+
77+
$basket = new Basket($orderId);
78+
$basket->setTotalValueGross(119.00)
79+
->addBasketItem($basketItem)
80+
->setCurrencyCode('EUR');
7481

7582
$transaction = $unzer->charge(119.0, 'EUR', $paymentTypeId, CONTROLLER_URL, $customerId, $orderId, null, $basket);
7683

examples/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function printMessage($type, $title, $text)
327327
server and redirected to a given RedirectUrl.
328328
</div>
329329
</div>
330-
<div class="ui attached white button" onclick="location.href='https://docs.unzer.com/accept-payments/accept-payments-payment-page';">
330+
<div class="ui attached white button" onclick="location.href='https://docs.unzer.com/online-payments/payment-pages/integrate-hpp/';">
331331
Documentation
332332
</div>
333333
<div id="tryHostedPayPageExample" class="ui bottom attached green button" onclick="location.href='HostedPayPage/';">
@@ -344,7 +344,7 @@ function printMessage($type, $title, $text)
344344
The Payment Page will be shown as an Overlay in your own shop.
345345
</div>
346346
</div>
347-
<div class="ui attached white button" onclick="location.href='https://docs.unzer.com/accept-payments/accept-payments-payment-page';">
347+
<div class="ui attached white button" onclick="location.href='https://docs.unzer.com/online-payments/payment-pages/integrate-epp/';">
348348
Documentation
349349
</div>
350350
<div id="tryEmbeddedPayPageExample" class="ui bottom attached green button" onclick="location.href='EmbeddedPayPage/';">

0 commit comments

Comments
 (0)