-
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.
FEATURE: handle api request to get current balances
- Loading branch information
1 parent
d3bb32b
commit f14aa19
Showing
6 changed files
with
74 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Vinkas\Airwallex; | ||
|
||
use Vinkas\Airwallex\Traits\HandlesApi; | ||
|
||
class Client | ||
{ | ||
use HandlesApi; | ||
|
||
public function getConnector(): Connector | ||
{ | ||
return new Connector(); | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace Vinkas\Airwallex\Http\Balances; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class CurrentRequest extends Request | ||
{ | ||
protected Method $method = Method::GET; | ||
|
||
public function resolveEndpoint(): string | ||
{ | ||
return 'balances/current'; | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
namespace Vinkas\Airwallex\Http\Resources; | ||
|
||
use Saloon\Http\BaseResource; | ||
use Saloon\Http\Response; | ||
use Vinkas\Airwallex\Http\Balances\CurrentRequest; | ||
|
||
class BalancesResource extends BaseResource | ||
{ | ||
public function getCurrent(): Response | ||
{ | ||
return $this->connector->send(new CurrentRequest()); | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace Vinkas\Airwallex\Traits; | ||
|
||
use Vinkas\Airwallex\Http\Resources\BalancesResource; | ||
|
||
trait HandlesApi | ||
{ | ||
public function getBalances(): BalancesResource | ||
{ | ||
return new BalancesResource($this->getConnector()); | ||
} | ||
} |