-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.php
More file actions
39 lines (32 loc) · 1019 Bytes
/
helpers.php
File metadata and controls
39 lines (32 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
use Stripe\Charge;
if (! function_exists('include_route_files')) {
/**
* Loops through a folder and requires all PHP files
* Searches sub-directories as well.
*
* @param $folder
*/
function include_route_files($folder)
{
try {
$rdi = new recursiveDirectoryIterator($folder);
$it = new recursiveIteratorIterator($rdi);
while ($it->valid()) {
if (! $it->isDot() && $it->isFile() && $it->isReadable() && $it->current()->getExtension() === 'php') {
require $it->key();
}
$it->next();
}
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
if (! function_exists('is_refunded')) {
function is_refunded($id)
{
$charge = (Charge::retrieve(['id' => $id, 'expand' => ['balance_transaction']], ['api_key' => config('services.stripe.secret')]))->toArray();
return $charge['amount_refunded'];
}
}