feat: finalize provider parity and SEO/frontend route coverage

This commit is contained in:
Dwindi Ramadhana
2026-02-04 09:32:25 +07:00
parent a4d2031117
commit 0c45435db9
14 changed files with 550 additions and 57 deletions

View File

@@ -2,6 +2,7 @@
namespace Tests\Feature;
use Illuminate\Support\Facades\Http;
use Tests\TestCase;
class ApiV1EndpointsTest extends TestCase
@@ -96,6 +97,70 @@ class ApiV1EndpointsTest extends TestCase
->assertJsonPath('plan', 'pro');
}
public function test_license_verify_uses_gumroad_live_payload_mapping(): void
{
config()->set('dewemoji.billing.mode', 'live');
config()->set('dewemoji.license.accept_all', false);
config()->set('dewemoji.license.pro_keys', []);
config()->set('dewemoji.billing.providers.gumroad.enabled', true);
config()->set('dewemoji.billing.providers.gumroad.verify_url', 'https://api.gumroad.com/v2/licenses/verify');
config()->set('dewemoji.billing.providers.gumroad.product_ids', ['prod_123']);
config()->set('dewemoji.billing.providers.mayar.enabled', false);
Http::fake([
'https://api.gumroad.com/*' => Http::response([
'success' => true,
'purchase' => [
'product_id' => 'prod_123',
'recurrence' => 'monthly',
],
], 200),
]);
$response = $this->postJson('/v1/license/verify', [
'key' => 'gum-live-key',
]);
$response
->assertOk()
->assertJsonPath('ok', true)
->assertJsonPath('source', 'gumroad')
->assertJsonPath('product_id', 'prod_123');
}
public function test_license_verify_uses_mayar_live_payload_mapping(): void
{
config()->set('dewemoji.billing.mode', 'live');
config()->set('dewemoji.license.accept_all', false);
config()->set('dewemoji.license.pro_keys', []);
config()->set('dewemoji.billing.providers.gumroad.enabled', false);
config()->set('dewemoji.billing.providers.mayar.enabled', true);
config()->set('dewemoji.billing.providers.mayar.verify_url', 'https://api.mayar.id/v1/license/verify');
config()->set('dewemoji.billing.providers.mayar.api_key', 'secret');
Http::fake([
'https://api.mayar.id/*' => Http::response([
'success' => true,
'data' => [
'valid' => true,
'product_id' => 'mayar_prod_1',
'type' => 'lifetime',
'expires_at' => null,
],
], 200),
]);
$response = $this->postJson('/v1/license/verify', [
'key' => 'mayar-live-key',
]);
$response
->assertOk()
->assertJsonPath('ok', true)
->assertJsonPath('source', 'mayar')
->assertJsonPath('product_id', 'mayar_prod_1');
}
public function test_emoji_detail_by_slug_endpoint_returns_item(): void
{
config()->set('dewemoji.billing.mode', 'sandbox');