Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,17 @@ Split::remove($split, $params);

```

### Apple Pay **TODO**
### Apple Pay
```php
use Myckhel\Paystack\Support\ApplePay;

ApplePay::createDomain($params);

ApplePay::listDomains($params);

ApplePay::removeDomain($params);
```

### Subaccounts
```php
use Myckhel\Paystack\Support\SubAccount;
Expand Down
15 changes: 15 additions & 0 deletions src/Http/Controllers/ApplePayController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Myckhel\Paystack\Http\Controllers;

use Myckhel\Paystack\Support\ApplePay;

class ApplePayController extends Controller
{
function __call($method, $args)
{
return $args
? ApplePay::$method($args[0], request()->all())
: ApplePay::$method(request()->all());
}
}
47 changes: 47 additions & 0 deletions src/Support/ApplePay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace Myckhel\Paystack\Support;

use Myckhel\Paystack\Traits\Request;

/**
* The Apple Pay API allows you register your application's
* top-level domain or subdomain
*
*/
class ApplePay
{
use Request;

/**
* Register a top-level domain or subdomain for your Apple Pay integration.
*
* @return \Illuminate\Http\Response
*/
static function createDomain($params = [])
{
return self::post("/apple-pay/domain", $params);
}

/**
* Lists all registered domains on your integration.
* Returns an empty array if no domains have been added.
*
* @return \Illuminate\Http\Response
*/
static function listDomains($params = [])
{
return self::get("/apple-pay/domain", $params);
}

/**
* Unregister a top-level domain or subdomain previously used
* for your Apple Pay integration.
*
* @return \Illuminate\Http\Response
*/
static function removeDomain($params = [])
{
return self::delete("/apple-pay/domain", $params);
}
}
6 changes: 6 additions & 0 deletions src/routes.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Illuminate\Support\Facades\Route;
use Myckhel\Paystack\Http\Controllers\ApplePayController;
use Myckhel\Paystack\Http\Controllers\CustomerController;
use Myckhel\Paystack\Http\Controllers\DedicatedVirtualAccountController;
use Myckhel\Paystack\Http\Controllers\TransactionController;
Expand Down Expand Up @@ -55,6 +56,10 @@
'post,dedicated_account/split' => 'dva,split',
'delete,dedicated_account/split' => 'dva,removeSplit',
'get,dedicated_account/available_providers' => 'dva,providers',
// apple pay
'post,apple-pay/domain' => 'apple,createDomain',
'get,apple-pay/domain' => 'apple,listDomains',
'delete,apple-pay/domain' => 'apple,removeDomain',
];

$controls = [
Expand All @@ -64,6 +69,7 @@
'split' => SplitController::class,
'customer' => CustomerController::class,
'dva' => DedicatedVirtualAccountController::class,
'apple' => ApplePayController::class,
];

collect($routes)->map(function ($route, $index) use ($controls) {
Expand Down