-
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.
- Loading branch information
Showing
34 changed files
with
709 additions
and
527 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use Swervpaydev\SDK\Swervpay; | ||
use Swervpaydev\SDK\Enums\CardProvider; | ||
use Swervpaydev\SDK\Enums\Currency; | ||
use Swervpaydev\SDK\Enums\CardType; | ||
|
||
|
||
$swervpay = new Swervpay([ | ||
'business_id' => 'bsn_fAYcWSUXz3TogChv7BgH', | ||
'secret_key' => 'sk_dev_MfTiTSC31IZrz7DOBEow', | ||
'base_uri' => 'http://localhost:8888/api/v1/' | ||
]); | ||
|
||
|
||
// Get all cards | ||
$cards = $swervpay->card()->gets([ | ||
'limit' => 10, | ||
'page' => 1, | ||
])->toArray(); | ||
|
||
print_r($cards); | ||
|
||
|
||
// Get a card | ||
$card = $swervpay->card()->get('<CARD_ID>'); | ||
|
||
print_r($card); | ||
|
||
|
||
// Create a card | ||
$newCard = $swervpay->card()->create([ | ||
'customer_id' => 'cus_5f3e5e3e5e3e5e3e5e3e5e3e', | ||
'amount' => 1000, | ||
'currency' => Currency::USD, | ||
'provider' => CardProvider::Mastercard, | ||
'type' => CardType::Default, | ||
// Optional only mandatory on when card type is lite | ||
'name_on_card' => 'User Ten', | ||
]); |
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,38 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use Swervpaydev\SDK\Swervpay; | ||
|
||
|
||
$swervpay = new Swervpay([ | ||
'business_id' => '<BUSINESS_ID>', | ||
'secret_key' => '<SECRET_ID>', | ||
]); | ||
|
||
// Create a customer | ||
$newCustomer = $swervpay->customer()->create([ | ||
'first_name' => 'User', | ||
'last_name' => 'Ten', | ||
'email' => 'user10@mailinator.com', | ||
'country' => 'Nigeria', | ||
'middle_name' => 'Middle', | ||
]); | ||
|
||
print_r($newCustomer); | ||
|
||
// Get a customer | ||
|
||
$customers = $swervpay->customer()->gets([ | ||
'limit' => 10, | ||
'page' => 1, | ||
])->toArray(); | ||
|
||
print_r($customers); | ||
|
||
|
||
// Get a customer | ||
|
||
$customer = $swervpay->customer()->get('<CUSTOMER_ID>'); | ||
|
||
print_r($customer); |
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,24 @@ | ||
<?php | ||
|
||
namespace Swervpaydev\SDK\Enums; | ||
|
||
/** | ||
* Enum CardProvider | ||
* | ||
* This enum represents the different card providers that are supported. | ||
* Currently, it includes Mastercard and Visa. | ||
* | ||
* @package Swervpaydev\SDK\Enums | ||
*/ | ||
enum CardProvider: string | ||
{ | ||
/** | ||
* Represents a Mastercard card provider. | ||
*/ | ||
case Mastercard = 'MASTERCARD'; | ||
|
||
/** | ||
* Represents a Visa card provider. | ||
*/ | ||
case Visa = 'VISA'; | ||
} |
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,29 @@ | ||
<?php | ||
|
||
namespace Swervpaydev\SDK\Enums; | ||
|
||
/** | ||
* Enum CardType | ||
* | ||
* This enum represents the different types of cards that are supported. | ||
* Currently, it includes Lite, Default, and Cooperate. | ||
* | ||
* @package Swervpaydev\SDK\Enums | ||
*/ | ||
enum CardType: string | ||
{ | ||
/** | ||
* Represents a Lite card type. | ||
*/ | ||
case Lite = 'LITE'; | ||
|
||
/** | ||
* Represents a Default card type. | ||
*/ | ||
case Default = 'DEFAULT'; | ||
|
||
/** | ||
* Represents a Cooperate card type. | ||
*/ | ||
case Cooperate = 'COORPERATE'; | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Swervpaydev\SDK\Enums; | ||
|
||
/** | ||
* Enum Currency | ||
* | ||
* This enum represents the different types of currencies that are supported. | ||
* Currently, it includes Nigerian Naira (NGN) and United States Dollar (USD). | ||
* | ||
* @package Swervpaydev\SDK\Enums | ||
*/ | ||
enum Currency: string | ||
{ | ||
/** | ||
* Represents Nigerian Naira (NGN). | ||
*/ | ||
case NGN = 'NGN'; | ||
|
||
/** | ||
* Represents United States Dollar (USD). | ||
*/ | ||
case USD = 'USD'; | ||
} |
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
Oops, something went wrong.