1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Xsolla\SDK\Tests\Integration\API; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @group api |
7
|
|
|
*/ |
8
|
|
|
class ProjectSettingsTest extends AbstractAPITest |
9
|
|
|
{ |
10
|
|
|
protected static $createdProjectId; |
11
|
|
|
|
12
|
|
|
protected $project; |
13
|
|
|
|
14
|
|
|
public function setUp() |
15
|
|
|
{ |
16
|
|
|
parent::setUp(); |
17
|
|
|
$this->project = array( |
18
|
|
|
'descriptor' => 'demo', |
19
|
|
|
'name' => array( |
20
|
|
|
'en' => 'Demo Project for Universal Protocol', |
21
|
|
|
), |
22
|
|
|
'url' => 'http://xsolla.com', |
23
|
|
|
'description' => array(), |
24
|
|
|
'payment_url' => 'https://mygame.com/sample.universal.php', |
25
|
|
|
'key' => 'KEY', |
26
|
|
|
'return_url' => 'http://mygame.com/return.php', |
27
|
|
|
'user_billing_enabled' => true, |
28
|
|
|
'show_user_in_paystation' => true, |
29
|
|
|
'locale_list' => array( |
30
|
|
|
'en', |
31
|
|
|
), |
32
|
|
|
'components' => array( |
33
|
|
|
'virtual_currency' => array( |
34
|
|
|
'enabled' => true, |
35
|
|
|
'custom_name' => array( |
36
|
|
|
'en' => 'Virtual currency custom name', |
37
|
|
|
), |
38
|
|
|
), |
39
|
|
|
'items' => array( |
40
|
|
|
'enabled' => true, |
41
|
|
|
'custom_name' => array( |
42
|
|
|
'en' => 'Items custom name', |
43
|
|
|
), |
44
|
|
|
), |
45
|
|
|
'simple_checkout' => array( |
46
|
|
|
'enabled' => true, |
47
|
|
|
'custom_name' => array( |
48
|
|
|
'en' => 'Simple checkout custom name', |
49
|
|
|
), |
50
|
|
|
), |
51
|
|
|
'subscriptions' => array( |
52
|
|
|
'enabled' => true, |
53
|
|
|
'custom_name' => array( |
54
|
|
|
'en' => 'Subscriptions custom name', |
55
|
|
|
), |
56
|
|
|
), |
57
|
|
|
), |
58
|
|
|
'send_json_to_paystation' => false, |
59
|
|
|
'is_external_id_required' => false, |
60
|
|
|
'ipn_enabled' => true, |
61
|
|
|
); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function testCreateProject() |
65
|
|
|
{ |
66
|
|
|
$response = $this->xsollaClient->CreateProject( |
67
|
|
|
array( |
68
|
|
|
'merchant_id' => $this->merchantId, |
69
|
|
|
'request' => $this->project, |
70
|
|
|
) |
71
|
|
|
); |
72
|
|
|
static::assertArrayHasKey('id', $response); |
73
|
|
|
static::$createdProjectId = $response['id']; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @depends testCreateProject |
78
|
|
|
*/ |
79
|
|
|
public function testGetProject() |
80
|
|
|
{ |
81
|
|
|
$response = $this->xsollaClient->GetProject( |
82
|
|
|
array( |
83
|
|
|
'project_id' => static::$createdProjectId, |
84
|
|
|
) |
85
|
|
|
); |
86
|
|
|
static::assertInternalType('array', $response); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @depends testCreateProject |
91
|
|
|
*/ |
92
|
|
|
public function testUpdateProject() |
93
|
|
|
{ |
94
|
|
|
$this->xsollaClient->UpdateProject( |
95
|
|
|
array( |
96
|
|
|
'project_id' => static::$createdProjectId, |
97
|
|
|
'request' => $this->project, |
98
|
|
|
) |
99
|
|
|
); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function testListProjects() |
103
|
|
|
{ |
104
|
|
|
$response = $this->xsollaClient->ListProjects( |
105
|
|
|
array( |
106
|
|
|
'merchant_id' => $this->merchantId, |
107
|
|
|
) |
108
|
|
|
); |
109
|
|
|
static::assertInternalType('array', $response); |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|