Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/PaymentsMollieTest.php
Show First 20 Lines • Show All 365 Lines • ▼ Show 20 Lines | public function testMandateParams(): void | ||||
$plan->save(); | $plan->save(); | ||||
$user->setSetting('plan_id', $plan->id); | $user->setSetting('plan_id', $plan->id); | ||||
$response = $this->actingAs($user)->get("api/v4/payments/mandate"); | $response = $this->actingAs($user)->get("api/v4/payments/mandate"); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$this->assertSame((int) ceil(Payment::MIN_AMOUNT / 100), $json['amount']); | $this->assertEquals(round(Payment::MIN_AMOUNT / 100, 2), $json['amount']); | ||||
$this->assertSame((int) ceil(($plan->cost() * $plan->months) / 100), $json['minAmount']); | $this->assertEquals(round($plan->cost() * $plan->months / 100, 2), $json['minAmount']); | ||||
// TODO: Test more cases | // TODO: Test more cases | ||||
// TODO: Test user unrestricting if mandate is valid | // TODO: Test user unrestricting if mandate is valid | ||||
} | } | ||||
/** | /** | ||||
* Test creating a payment and receiving a status via webhook | * Test creating a payment and receiving a status via webhook | ||||
* | * | ||||
▲ Show 20 Lines • Show All 810 Lines • Show Last 20 Lines |