Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/Reseller/PaymentsMollieTest.php
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | public function testMandates(): void | ||||
// Test creating a mandate (valid input) | // Test creating a mandate (valid input) | ||||
$post = ['amount' => 20.10, 'balance' => 0]; | $post = ['amount' => 20.10, 'balance' => 0]; | ||||
$response = $this->actingAs($reseller)->post("api/v4/payments/mandate", $post); | $response = $this->actingAs($reseller)->post("api/v4/payments/mandate", $post); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$this->assertSame('success', $json['status']); | $this->assertSame('success', $json['status']); | ||||
$this->assertRegExp('|^https://www.mollie.com|', $json['redirectUrl']); | $this->assertMatchesRegularExpression('|^https://www.mollie.com|', $json['redirectUrl']); | ||||
// Assert the proper payment amount has been used | // Assert the proper payment amount has been used | ||||
$payment = Payment::where('id', $json['id'])->first(); | $payment = Payment::where('id', $json['id'])->first(); | ||||
$this->assertSame(2010, $payment->amount); | $this->assertSame(2010, $payment->amount); | ||||
$this->assertSame($wallet->id, $payment->wallet_id); | $this->assertSame($wallet->id, $payment->wallet_id); | ||||
$this->assertSame(\config('app.name') . " Auto-Payment Setup", $payment->description); | $this->assertSame(\config('app.name') . " Auto-Payment Setup", $payment->description); | ||||
$this->assertSame(PaymentProvider::TYPE_MANDATE, $payment->type); | $this->assertSame(PaymentProvider::TYPE_MANDATE, $payment->type); | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | public function testStore(): void | ||||
// Successful payment | // Successful payment | ||||
$post = ['amount' => '12.34', 'currency' => 'CHF', 'methodId' => 'creditcard']; | $post = ['amount' => '12.34', 'currency' => 'CHF', 'methodId' => 'creditcard']; | ||||
$response = $this->actingAs($reseller)->post("api/v4/payments", $post); | $response = $this->actingAs($reseller)->post("api/v4/payments", $post); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$this->assertSame('success', $json['status']); | $this->assertSame('success', $json['status']); | ||||
$this->assertRegExp('|^https://www.mollie.com|', $json['redirectUrl']); | $this->assertMatchesRegularExpression('|^https://www.mollie.com|', $json['redirectUrl']); | ||||
} | } | ||||
/** | /** | ||||
* Test listing a pending payment | * Test listing a pending payment | ||||
* | * | ||||
* @group mollie | * @group mollie | ||||
*/ | */ | ||||
public function testListingPayments(): void | public function testListingPayments(): void | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |