Issues (7)

example/subscription.php (1 issue)

Labels
Severity
1
<?php
2
require __DIR__ . "/assets/config.php";
3
require __DIR__ . "/../vendor/autoload.php";
4
5
use RobsonVLeite\CafeApi\Subscriptions;
0 ignored issues
show
The type RobsonVLeite\CafeApi\Subscriptions was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
$subscription = new Subscriptions(
8
    "localhost/fsphp/api/cafe/",
9
    "[email protected]",
10
    "abc123456"
11
);
12
13
/**
14
 * index
15
 */
16
echo "<h1>INDEX</h1>";
17
$index = $subscription->index(null);
18
19
if ($index->error()) {
20
    var_dump($index->error());
21
} else {
22
    var_dump($index->response());
23
}
24
25
26
/**
27
 * create
28
 */
29
echo "<h1>CREATE</h1>";
30
31
$create = $subscription->create([
32
    "plan_id" => 1,
33
    "card_number" => "5240673071216439",
34
    "card_holder_name" => "ANDRE SIQUEIRA",
35
    "card_expiration_date" => "04/23",
36
    "card_cvv" => "526"
37
]);
38
39
if ($create->error()) {
40
    echo "<p class='error'>{$create->error()->message}</p>";
41
} else {
42
    var_dump($create->response());
43
}
44
45
/**
46
 * READ
47
 */
48
echo "<h1>READ</h1>";
49
50
$read = $subscription->read();
51
52
if ($read->error()) {
53
    echo "<p class='error'>{$read->error()->message}</p>";
54
} else {
55
    var_dump($read->response());
56
}
57
58
/**
59
 * UPDATE
60
 */
61
echo "<h1>UPDATE</h1>";
62
63
//$update = $subscription->update(["plan_id" => 2]);
64
$update = $subscription->update([
65
    "card_number" => "4929541567510287",
66
    "card_holder_name" => "ANDRE SIQUEIRA",
67
    "card_expiration_date" => "10/21",
68
    "card_cvv" => "434"
69
]);
70
71
if ($update->error()) {
72
    echo "<p class='error'>{$update->error()->message}</p>";
73
} else {
74
    var_dump($update->response());
75
}