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.
- Loading branch information
Showing
12 changed files
with
98 additions
and
21 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 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Cash APP Environment | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here, you specify whether your Cash App integration is in production. | ||
| When the value is false, the application uses sandbox a which | ||
| allows Cash App API integration without moving any money. | ||
| | ||
| @see https://developers.cash.app/docs/api/partner-onboarding/integrating-with-cash-app-pay/comparison | ||
| | ||
*/ | ||
|
||
'production' => env(key: 'CASH_PRODUCTION', default: false), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Cash APP Base Urls | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here, you specify either "sandbox" or "production." The "sandbox" is used | ||
| for testing API integration without moving any money. The "production" | ||
| means your application is live, using Pay Kit for the production. | ||
| | ||
| | ||
*/ | ||
|
||
'urls' => [ | ||
'sandbox' => env(key: 'CASH_APP_SANDBOX_URL', default: 'https://sandbox.api.cash.app'), | ||
'production' => env(key: 'CASH_APP_PRODUCTION_URL', default: 'https://api.cash.app'), | ||
] | ||
]; |
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
{ | ||
"preset": "psr12" | ||
"preset": "psr12", | ||
"rules": { | ||
"binary_operator_spaces": { | ||
"operators": { | ||
"=>": "align_single_space_minimal" | ||
} | ||
}, | ||
"array_syntax": { | ||
"syntax": "short" | ||
} | ||
} | ||
} |
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 @@ | ||
<?php | ||
|
||
namespace NjoguAmos\CashApp\Connectors; | ||
|
||
use Saloon\Http\Connector; | ||
|
||
class CashAppBaseConnector extends Connector | ||
{ | ||
public function resolveBaseUrl(): string | ||
{ | ||
if (config(key: 'cashapp.production')) { | ||
return config(key: 'cashapp.urls.production') ; | ||
} | ||
|
||
return config(key: 'cashapp.urls.sandbox'); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,5 @@ | ||
<?php | ||
|
||
arch(description: 'it will not use debugging functions') | ||
->expect(value: ['dd', 'dump', 'ray']) | ||
->each->not->toBeUsed(); |
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,20 @@ | ||
<?php | ||
|
||
namespace Njoguamos\CashApp\Tests; | ||
|
||
use NjoguAmos\CashApp\Connectors\CashAppBaseConnector; | ||
|
||
it(description: 'resolves to the correct base url', closure: function (bool $isProduction, string $baseUrl) { | ||
config()->set( | ||
key: 'cashapp.production', | ||
value: $isProduction | ||
); | ||
|
||
$connector = new CashAppBaseConnector(); | ||
|
||
expect(value: $connector->resolveBaseUrl()) | ||
->toBe(expected: $baseUrl); | ||
})->with([ | ||
'production' => [true, 'https://api.cash.app'], | ||
'staging' => [false, 'https://sandbox.api.cash.app'] | ||
]); |