-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added API endpoint to move multiple charges to a different wallet.
- Loading branch information
Showing
12 changed files
with
442 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Request\Charge; | ||
|
||
use App\Database\Charge; | ||
use Spiral\Filters\Attribute\Input\Data; | ||
use Spiral\Filters\Model\Filter; | ||
use Spiral\Filters\Model\FilterDefinitionInterface; | ||
use Spiral\Filters\Model\HasFilterDefinition; | ||
use Spiral\Validator\FilterDefinition; | ||
|
||
class MoveRequest extends Filter implements HasFilterDefinition | ||
{ | ||
/** | ||
* @var array<array-key, string> | ||
*/ | ||
#[Data] | ||
public array $chargeIds = []; | ||
|
||
public function filterDefinition(): FilterDefinitionInterface | ||
{ | ||
return new FilterDefinition(validationRules: [ | ||
'chargeIds' => [ | ||
['array::of', ['entity:exists', Charge::class]], | ||
], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Feature\Bootloader; | ||
|
||
use App\Bootloader\GoogleApiBootloader; | ||
use App\Config\GoogleApiConfig; | ||
use Google\Client; | ||
use Tests\Fixtures; | ||
use Tests\TestCase; | ||
|
||
class GoogleApiBootloaderTest extends TestCase | ||
{ | ||
public function testResolve(): void | ||
{ | ||
$config = $this->getContainer()->get(GoogleApiConfig::class); | ||
|
||
$class = new \ReflectionClass($config); | ||
$class->getProperty('config')->setValue($config, [ | ||
'clientId' => Fixtures::string(), | ||
'clientSecret' => Fixtures::string(), | ||
'projectId' => Fixtures::string(), | ||
'authUri' => Fixtures::url(), | ||
'tokenUri' => Fixtures::url(), | ||
'authProviderX509CertUrl' => Fixtures::url(), | ||
'redirectUris' => [Fixtures::url()], | ||
]); | ||
|
||
$bootloader = new GoogleApiBootloader($config); | ||
$bootloader->boot($this->getContainer()); | ||
|
||
$client = $this->getContainer()->get(Client::class); | ||
|
||
$this->assertInstanceOf(Client::class, $client); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Feature\Config; | ||
|
||
use App\Config\GoogleApiConfig; | ||
use Tests\Fixtures; | ||
use Tests\TestCase; | ||
|
||
class GoogleApiConfigTest extends TestCase | ||
{ | ||
public function testConfigs(): void | ||
{ | ||
/** @var \App\Config\GoogleApiConfig $config */ | ||
$config = $this->getContainer()->get(GoogleApiConfig::class); | ||
|
||
$class = new \ReflectionClass($config); | ||
$class->getProperty('config')->setValue($config, [ | ||
'clientId' => Fixtures::string(), | ||
'clientSecret' => Fixtures::string(), | ||
'projectId' => Fixtures::string(), | ||
'authUri' => Fixtures::url(), | ||
'tokenUri' => Fixtures::url(), | ||
'authProviderX509CertUrl' => Fixtures::url(), | ||
'redirectUris' => [Fixtures::url()], | ||
]); | ||
|
||
$this->assertNotEmpty($config->getClientId()); | ||
$this->assertNotEmpty($config->getClientSecret()); | ||
$this->assertNotEmpty($config->getProjectId()); | ||
$this->assertNotEmpty($config->getAuthUri()); | ||
$this->assertNotEmpty($config->getTokenUri()); | ||
$this->assertNotEmpty($config->getAuthProviderX509CertUrl()); | ||
$this->assertNotEmpty($config->getRedirectUris()); | ||
} | ||
} |
Oops, something went wrong.