Änderungen (relevant):
- Add‑on Checkout auf Transactions + Transaction‑ID speichern: app/Services/Addons/EventAddonCheckoutService.php
- Paket/Marketing Checkout auf Transactions: app/Services/Paddle/PaddleCheckoutService.php
- Gift‑Voucher Checkout: Customer anlegen/finden + Transactions: app/Services/GiftVouchers/
GiftVoucherCheckoutService.php
- Tests aktualisiert: tests/Feature/Tenant/EventAddonCheckoutTest.php, tests/Unit/PaddleCheckoutServiceTest.php,
tests/Unit/GiftVoucherCheckoutServiceTest.php
This commit is contained in:
@@ -37,12 +37,18 @@ class GiftVoucherCheckoutServiceTest extends TestCase
|
||||
$client = Mockery::mock(PaddleClient::class);
|
||||
$client->shouldReceive('post')
|
||||
->once()
|
||||
->with('/checkout/links', Mockery::on(function ($payload) {
|
||||
->with('/customers', Mockery::on(function ($payload) {
|
||||
return $payload['email'] === 'buyer@example.com';
|
||||
}))
|
||||
->andReturn(['data' => ['id' => 'ctm_123']]);
|
||||
$client->shouldReceive('post')
|
||||
->once()
|
||||
->with('/transactions', Mockery::on(function ($payload) {
|
||||
return $payload['items'][0]['price_id'] === 'pri_a'
|
||||
&& $payload['customer_email'] === 'buyer@example.com'
|
||||
&& $payload['customer_id'] === 'ctm_123'
|
||||
&& $payload['custom_data']['type'] === 'gift_voucher';
|
||||
}))
|
||||
->andReturn(['data' => ['url' => 'https://paddle.test/checkout/123', 'expires_at' => '2025-12-31T00:00:00Z', 'id' => 'chk_123']]);
|
||||
->andReturn(['data' => ['checkout' => ['url' => 'https://paddle.test/checkout/123'], 'id' => 'txn_123']]);
|
||||
|
||||
$this->app->instance(PaddleClient::class, $client);
|
||||
|
||||
@@ -57,6 +63,6 @@ class GiftVoucherCheckoutServiceTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->assertSame('https://paddle.test/checkout/123', $checkout['checkout_url']);
|
||||
$this->assertSame('chk_123', $checkout['id']);
|
||||
$this->assertSame('txn_123', $checkout['id']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user