Skip to content

Commit 8f86314

Browse files
Upgrade to mollie/laravel-mollie v4
- Update mollie/laravel-mollie constraint from ^3.0 to ^4.0 - Remove direct mollie/mollie-api-php dependency (now transitive) - Update Mollie SDK constant references (drop STATUS_/SEQUENCETYPE_ prefixes) - Handle RefundCollection and ApiException constructor changes - Migrate PHPUnit annotations to PHP 8 attributes (#[Test], #[Group]) - Require PHP 8.2+ and Laravel 11+ - Add CI resolve and prefer-lowest jobs
1 parent 5dad218 commit 8f86314

63 files changed

Lines changed: 425 additions & 330 deletions

File tree

Some content is hidden

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

.github/workflows/tests.yaml

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,46 @@ on:
77
- cron: '0 0 * * *'
88

99
jobs:
10-
tests:
10+
resolve:
11+
name: Resolve P${{ matrix.php }} - L${{ matrix.laravel }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: [ 8.4, 8.3, 8.2 ]
17+
laravel: [ 13.*, 12.*, 11.* ]
18+
exclude:
19+
- php: 8.2
20+
laravel: 13.*
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
1124

25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
extensions: curl, dom, intl, json, libxml, mbstring, openssl, zip
30+
tools: composer:v2
31+
32+
- name: Check dependency resolution
33+
run: |
34+
composer require illuminate/support:${{ matrix.laravel }} --no-update --no-interaction
35+
composer update --prefer-stable --prefer-dist --no-interaction --no-progress --dry-run
36+
37+
tests:
38+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
1239
runs-on: ubuntu-latest
40+
needs: resolve
1341
strategy:
1442
fail-fast: true
1543
matrix:
16-
os: [ ubuntu-latest ]
17-
php: [ 8.4, 8.3, 8.2, 8.1 ]
18-
laravel: [ 13.*, 12.*, 11.*, 10.* ]
44+
php: [ 8.4, 8.3, 8.2 ]
45+
laravel: [ 13.*, 12.*, 11.* ]
1946
dependency-version: [ prefer-stable ]
2047
exclude:
21-
- php: 8.1
22-
laravel: 13.*
2348
- php: 8.2
2449
laravel: 13.*
25-
- php: 8.1
26-
laravel: 12.*
27-
28-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
2950

3051
steps:
3152
- name: Checkout code
@@ -41,7 +62,30 @@ jobs:
4162

4263
- name: Install dependencies
4364
run: |
65+
composer require illuminate/support:${{ matrix.laravel }} --no-update --no-interaction
4466
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress
4567
4668
- name: Execute tests
4769
run: vendor/bin/phpunit --coverage-text
70+
71+
prefer-lowest:
72+
name: Prefer lowest (P8.2)
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
78+
- name: Setup PHP
79+
uses: shivammathur/setup-php@v2
80+
with:
81+
php-version: 8.2
82+
extensions: curl, dom, intl, json, libxml, mbstring, openssl, zip
83+
tools: composer:v2
84+
coverage: xdebug
85+
86+
- name: Install lowest dependencies
87+
run: |
88+
composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction --no-progress
89+
90+
- name: Execute tests
91+
run: vendor/bin/phpunit --coverage-text

composer.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,21 @@
3030
}
3131
],
3232
"require": {
33-
"php": "^8.1",
33+
"php": "^8.2",
3434
"ext-json": "*",
3535
"ext-intl": "*",
3636
"dompdf/dompdf": "^2.0|^3.0",
37-
"illuminate/database": "^10|^11|^12|^13",
38-
"illuminate/support": "^10|^11|^12|^13",
39-
"mollie/laravel-mollie": "^3.0",
40-
"mollie/mollie-api-php": "^2.76",
37+
"illuminate/database": "^11|^12|^13",
38+
"illuminate/support": "^11|^12|^13",
39+
"mollie/laravel-mollie": "^4.0",
4140
"moneyphp/money": "^4.1",
4241
"nesbot/carbon": "^2.72|^3.0"
4342
},
4443
"require-dev": {
4544
"guzzlehttp/guzzle": "^7.0",
4645
"mockery/mockery": "^1.4",
47-
"orchestra/testbench": "^8.0|^9.0|^10.0|^11.0",
48-
"phpunit/phpunit": "^10.0|^11.5"
46+
"orchestra/testbench": "^9.0|^10.0|^11.0",
47+
"phpunit/phpunit": "^10.5|^11.5|^12.0|^13.0"
4948
},
5049
"autoload": {
5150
"files": [

src/FirstPayment/FirstPaymentBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function inOrderTo(array $actions = [])
102102
public function getMolliePayload()
103103
{
104104
return array_filter(array_merge([
105-
'sequenceType' => SequenceType::SEQUENCETYPE_FIRST,
105+
'sequenceType' => SequenceType::FIRST,
106106
'method' => $this->method,
107107
'customerId' => $this->owner->asMollieCustomer()->id,
108108
'locale' => Cashier::getLocale($this->owner),

src/Http/Controllers/AftercareWebhookController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ protected function handleRefunds(Order $order, MolliePayment $molliePayment)
7878
$mollieRefund = $this->extractMatchingMollieRefundForLocalRefund($localRefund, $mollieRefunds);
7979

8080
if ($mollieRefund) {
81-
if ($mollieRefund->isTransferred() && $localRefund->mollie_refund_status !== RefundStatus::STATUS_REFUNDED) {
81+
if ($mollieRefund->isTransferred() && $localRefund->mollie_refund_status !== RefundStatus::REFUNDED) {
8282
$localRefund->handleProcessed();
8383
$paymentAmountRefundedHasChanged = true;
84-
} elseif ($mollieRefund->isFailed() && $localRefund->mollie_refund_status !== RefundStatus::STATUS_FAILED) {
84+
} elseif ($mollieRefund->isFailed() && $localRefund->mollie_refund_status !== RefundStatus::FAILED) {
8585
$localRefund->handleFailed();
8686
$paymentAmountRefundedHasChanged = true;
8787
}

src/Http/Controllers/WebhookController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function handleWebhook(Request $request)
2626

2727
if ($order && $order->mollie_payment_status !== $payment->status) {
2828
switch ($payment->status) {
29-
case PaymentStatus::STATUS_PAID:
29+
case PaymentStatus::PAID:
3030
$order->handlePaymentPaid($payment);
3131
$payment->webhookUrl = route('webhooks.mollie.aftercare');
3232

@@ -35,7 +35,7 @@ public function handleWebhook(Request $request)
3535
$updateMolliePayment->execute($payment);
3636

3737
break;
38-
case PaymentStatus::STATUS_FAILED:
38+
case PaymentStatus::FAILED:
3939
$order->handlePaymentFailed($payment);
4040

4141
break;

src/MandatedPayment/MandatedPaymentBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function getPayload(array $overrides = [])
6767
$overrides = array_merge($this->overrides, $overrides);
6868

6969
return array_filter(array_merge([
70-
'sequenceType' => SequenceType::SEQUENCETYPE_RECURRING,
70+
'sequenceType' => SequenceType::RECURRING,
7171
'mandateId' => $this->owner->mollieMandateId(),
7272
'customerId' => $this->owner->mollieCustomerId(),
7373
'locale' => Cashier::getLocale($this->owner),

src/Order/Order.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public function scopePaymentStatus($query, $status)
396396
public function scopePaid($query)
397397
{
398398
return $this
399-
->scopePaymentStatus($query, PaymentStatus::STATUS_PAID)
399+
->scopePaymentStatus($query, PaymentStatus::PAID)
400400
->orWhere('total_due', '=', 0);
401401
}
402402

src/Payment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static function findByMolliePaymentOrCreate(MolliePayment $molliePayment,
137137

138138
$newPayment = static::createFromMolliePayment($molliePayment, $owner, $actions);
139139

140-
if ($newPayment->mollie_payment_status === PaymentStatus::STATUS_PAID) {
140+
if ($newPayment->mollie_payment_status === PaymentStatus::PAID) {
141141
$molliePayment->webhookUrl = route('webhooks.mollie.aftercare');
142142

143143
/** @var UpdateMolliePayment $updateMolliePayment */

src/Refunds/Refund.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function newCollection(array $models = [])
5858
*/
5959
public function scopeWhereUnprocessed(Builder $query)
6060
{
61-
return $query->where('mollie_refund_status', RefundStatus::STATUS_PENDING);
61+
return $query->where('mollie_refund_status', RefundStatus::PENDING);
6262
}
6363

6464
public function items(): HasMany
@@ -85,7 +85,7 @@ public function handleProcessed(): self
8585
$order = Cashier::$orderModel::createProcessedFromItems($orderItems);
8686

8787
$this->order_id = $order->id;
88-
$this->mollie_refund_status = RefundStatus::STATUS_REFUNDED;
88+
$this->mollie_refund_status = RefundStatus::REFUNDED;
8989

9090
$this->save();
9191

@@ -111,7 +111,7 @@ public function handleFailed(): self
111111
$refundItems = $this->items;
112112

113113
DB::transaction(function () use ($refundItems) {
114-
$this->mollie_refund_status = RefundStatus::STATUS_FAILED;
114+
$this->mollie_refund_status = RefundStatus::FAILED;
115115

116116
$this->save();
117117

src/Refunds/RefundBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function addItemsFromOrderItemCollection(OrderItemCollection $orderItems,
7979
protected static function guardOrderIsPaid(Order $order)
8080
{
8181
throw_unless(
82-
$order->mollie_payment_status === PaymentStatus::STATUS_PAID,
82+
$order->mollie_payment_status === PaymentStatus::PAID,
8383
new LogicException('Only paid orders can be refunded')
8484
);
8585
}

0 commit comments

Comments
 (0)