Skip to content

Commit

Permalink
feat: adds ConfigTest, removes NotificationService
Browse files Browse the repository at this point in the history
  • Loading branch information
kajetan-nobel committed Sep 26, 2023
1 parent 1d20e51 commit b4553a2
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 109 deletions.
2 changes: 2 additions & 0 deletions src/DTO/Casts/TransactionDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* @property-read PaymentMethod $paymentMethod
* @property-read PaymentMethodCode $paymentMethodCode
* @property-read PaymentProfileDto|null $paymentProfile
* @property-read string|null $statusCode
* @property-read string|null $statusCodeDescription
*/
class TransactionDto extends BaseDto
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

declare(strict_types=1);

namespace Routegroup\Imoje\Payment\DTO\Responses;
namespace Routegroup\Imoje\Payment\DTO\Notifications;

use Routegroup\Imoje\Payment\DTO\BaseDto;
use Routegroup\Imoje\Payment\DTO\Casts\PaymentDto;

/**
* @property-read PaymentDto $payment
*/
class CancelledResponseDto extends ResponseDto
class CancelledNotificationDto extends BaseDto
{
protected array $casts = [
'payment' => PaymentDto::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

declare(strict_types=1);

namespace Routegroup\Imoje\Payment\DTO\Responses;
namespace Routegroup\Imoje\Payment\DTO\Notifications;

use Routegroup\Imoje\Payment\DTO\BaseDto;
use Routegroup\Imoje\Payment\DTO\Casts\PaymentDto;
use Routegroup\Imoje\Payment\DTO\Casts\TransactionDto;

/**
* @property-read TransactionDto $transaction
* @property-read PaymentDto $payment
*/
class OneClickResponseDto extends ResponseDto
class OneClickNotificationDto extends BaseDto
{
protected array $casts = [
'transaction' => TransactionDto::class,
Expand Down
73 changes: 0 additions & 73 deletions src/Services/NotificationService.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Lib/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
],
fn (Api $api) => $api->createRefund(RefundRequestDto::factory()->make(), '$transaction_id$'),
RefundResponseDto::class,
],
],
'successfully calls get profile' => [
fn (Api $api) => [
$api->url->createProfileIdUrl('$profile_id$') => Http::response(ProfileResponseDto::factory()->make()->toArray()),
Expand Down
15 changes: 15 additions & 0 deletions tests/Lib/ConfigTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

use Routegroup\Imoje\Payment\Lib\Config;
use Routegroup\Imoje\Payment\Types\Environment;

it('gets config from services.imoje', function (): void {
$config = app(Config::class);

expect($config)
->merchantId->toEqual(config('services.imoje.merchant_id'))
->serviceId->toEqual(config('services.imoje.service_id'))
->serviceKey->toEqual(config('services.imoje.service_key'))
->apiKey->toEqual(config('services.imoje.api_key'))
->env->toEqual(Environment::from(config('services.imoje.env')));
});
31 changes: 0 additions & 31 deletions tests/Services/NotificationServiceTest.php

This file was deleted.

0 comments on commit b4553a2

Please sign in to comment.