This repository has been archived by the owner on May 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from njoguamos/add-ability-to-list-brands
Add ability to list brands
- Loading branch information
Showing
14 changed files
with
189 additions
and
36 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
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 NjoguAmos\CashApp\Requests\Network\Brands; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class ListBrandsRequest extends Request | ||
{ | ||
protected Method $method = Method::GET; | ||
|
||
public function resolveEndpoint(): string | ||
{ | ||
return '/networks/brands'; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
use NjoguAmos\CashApp\CashApp; | ||
use NjoguAmos\CashApp\Requests\Network\Brands\ListBrandsRequest; | ||
|
||
it(description: 'can successfully get brands from cash app API', closure: function () { | ||
$mockClient = mockRequest( | ||
request: ListBrandsRequest::class, | ||
jsonFile: 'network/list-brands.json' | ||
); | ||
|
||
/** @noinspection PhpUnhandledExceptionInspection */ | ||
$brands = CashApp::listBrands(); | ||
|
||
$mockClient->assertSent(value: ListBrandsRequest::class); | ||
|
||
$mockClient->assertSentCount(count: 1); | ||
}); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,23 @@ | ||
<?php | ||
|
||
use NjoguAmos\CashApp\Tests\TestCase; | ||
use Saloon\Http\Faking\MockClient; | ||
use Saloon\Http\Faking\MockResponse; | ||
use Illuminate\Support\Facades\File; | ||
use Saloon\Config; | ||
|
||
uses(TestCase::class)->in(__DIR__); | ||
Config::preventStrayRequests(); | ||
|
||
uses(TestCase::class) | ||
->in(__DIR__); | ||
|
||
function mockRequest(string $request, string $jsonFile, int $status = 200, array $headers = []): MockClient | ||
{ | ||
return MockClient::global([ | ||
$request => MockResponse::make( | ||
body: File::json('tests/fixtures/'.$jsonFile), | ||
status: $status, | ||
headers: $headers | ||
), | ||
]); | ||
} |
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,17 @@ | ||
{ | ||
"brands": [ | ||
{ | ||
"id": "string", | ||
"name": "string", | ||
"created_at": "2021-01-01T00:00:00Z", | ||
"updated_at": "2021-01-01T00:00:00Z", | ||
"reference_id": "example-id", | ||
"color": "#ffffff", | ||
"profile_image_url": "https://franklin-assets.s3.amazonaws.com/merchants/assets/v3/generic/m_category_business.png", | ||
"metadata": { | ||
"my-meta": "meta-value" | ||
} | ||
} | ||
], | ||
"cursor": "string" | ||
} |