Skip to content

Commit

Permalink
Merge pull request #38 from valetanddama/master
Browse files Browse the repository at this point in the history
Added missing parameters for GET requests
  • Loading branch information
ipanyukov authored Oct 26, 2016
2 parents 313249f + 2237c72 commit 11f8f02
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file.

## [Unreleased](https://github.com/xsolla/xsolla-sdk-php/compare/v2.6.0...master)
### Fixed
* Added missing parameters for GET requests

## [v2.6.0](https://github.com/xsolla/xsolla-sdk-php/compare/v2.5.0...v2.6.0) - 2016-05-31
### Added
Expand Down
3 changes: 2 additions & 1 deletion build/test-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
'api_key' => 'API_KEY',
));

$webhookServer = WebhookServer::create(function () {}, 'PROJECT_SECRET_KEY');
$webhookServer = WebhookServer::create(function () {
}, 'PROJECT_SECRET_KEY');
2 changes: 1 addition & 1 deletion src/API/PaymentUI/PaymentUIScriptRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function send($token, $isSandbox = false)
public static function render($token, $isSandbox = false)
{
$template =
<<<EOF
<<<'EOF'
<script>
var options = {
access_token: '%s',
Expand Down
107 changes: 106 additions & 1 deletion src/API/Resources/xsolla-2015-07-23.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,31 @@
'type' => 'integer',
'required' => true,
),
'external_id' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
'limit' => array(
'location' => 'query',
'type' => 'integer',
'required' => false,
),
'offset' => array(
'location' => 'query',
'type' => 'integer',
'required' => false,
),
'group_id' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
'product_id' => array(
'location' => 'query',
'type' => 'integer',
'required' => false,
),
),
),
'CreateSubscriptionProduct' => array(
Expand Down Expand Up @@ -214,6 +239,11 @@
'type' => 'string',
'required' => false,
),
'product_id' => array(
'location' => 'query',
'type' => 'integer',
'required' => false,
),
'limit' => array(
'location' => 'query',
'type' => 'integer',
Expand Down Expand Up @@ -296,6 +326,16 @@
'type' => 'string',
'required' => false,
),
'plan_id' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
'product_id' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
),
),
'ListUserSubscriptionPayments' => array(
Expand Down Expand Up @@ -581,6 +621,21 @@
'type' => 'integer',
'required' => true,
),
'offset' => array(
'location' => 'query',
'type' => 'integer',
'required' => false,
),
'limit' => array(
'location' => 'query',
'type' => 'integer',
'required' => false,
),
'has_price' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
),
),
'CreateVirtualItemsGroup' => array(
Expand Down Expand Up @@ -805,7 +860,7 @@
'type' => 'string',
'required' => false,
),
'phone' => array(
'user_requisites' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
Expand Down Expand Up @@ -847,6 +902,11 @@
'type' => 'string',
'required' => true,
),
'transaction_type' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
),
),
'RechargeWalletUserBalance' => array(
Expand Down Expand Up @@ -1414,6 +1474,11 @@
'type' => 'string',
'required' => true,
),
'status' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
),
),
'ListPaymentsRegistry' => array(
Expand Down Expand Up @@ -1487,6 +1552,11 @@
'type' => 'boolean',
'required' => true,
),
'status' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
),
),
'ListTransfersRegistry' => array(
Expand Down Expand Up @@ -1573,6 +1643,41 @@
'static' => true,
'required' => true,
),
'datetime_from' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
'datetime_to' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
'status' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
'type' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
'offset' => array(
'location' => 'query',
'type' => 'integer',
'required' => false,
),
'limit' => array(
'location' => 'query',
'type' => 'integer',
'required' => false,
),
'sender' => array(
'location' => 'query',
'type' => 'string',
'required' => false,
),
),
),
'ListSupportTicketComments' => array(
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/API/XsollaAPIException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class XsollaAPIException extends XsollaException
);

protected static $messageTemplate =
<<<EOF
<<<'EOF'
Xsolla API Error Response:
Previous Exception:
Expand Down
17 changes: 15 additions & 2 deletions tests/Integration/API/ReportsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,29 @@ public function testSearchPaymentsRegistry()
static::assertInternalType('array', $response);
}

public function testSearchPaymentsRegistryWithParams()
{
$response = static::$xsollaClient->SearchPaymentsRegistry(array(
'format' => 'json',
'type' => 'all',
'limit' => 2,
'offset' => 0,
'status' => 'created',
));
static::assertInternalType('array', $response);
}

public function testListPaymentsRegistry()
{
$response = static::$xsollaClient->ListPaymentsRegistry(array(
'format' => 'json',
'datetime_from' => '2015-01-01T00:00:00 UTC',
'datetime_to' => '2015-01-02T00:00:00 UTC',
'datetime_from' => '2015-01-01',
'datetime_to' => '2015-01-02',
'in_transfer_currency' => false,
'limit' => 2,
'offset' => 0,
'show_total' => true,
'status' => 'done',
));
static::assertInternalType('array', $response);
}
Expand Down
37 changes: 37 additions & 0 deletions tests/Integration/API/SubscriptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function testListSubscriptionPlans()
{
$response = static::$xsollaClient->ListSubscriptionPlans(array(
'project_id' => static::$projectId,
'limit' => 100,
));
static::assertInternalType('array', $response);
}
Expand Down Expand Up @@ -116,6 +117,22 @@ public function testCreateSubscriptionProduct()
static::$productId = $response['product_id'];
}

/**
* @depends testCreateSubscriptionProduct
*/
public function testListSubscriptionPlansWithParams()
{
$response = static::$xsollaClient->ListSubscriptionPlans(array(
'project_id' => static::$projectId,
'limit' => 100,
'offset' => 0,
'product_id' => static::$productId,
'group_id' => $this->product['group_id'],
'external_id' => 12345,
));
static::assertInternalType('array', $response);
}

/**
* @depends testCreateSubscriptionProduct
*/
Expand Down Expand Up @@ -148,6 +165,15 @@ public function testListSubscriptionProducts()
static::assertInternalType('array', $response);
}

public function testListSubscriptionProductsWithParams()
{
$response = static::$xsollaClient->ListSubscriptionProducts(array(
'project_id' => static::$projectId,
'product_id' => static::$productId,
));
static::assertInternalType('array', $response);
}

public function testUpdateSubscription()
{
static::markTestIncomplete('We haven\'t active subscriptions in test project.');
Expand All @@ -162,6 +188,17 @@ public function testListSubscriptions()
static::assertInternalType('array', $response);
}

public function testListSubscriptionWithParams()
{
$response = static::$xsollaClient->ListSubscriptions(array(
'project_id' => static::$projectId,
'user_id' => static::$userId,
'plan_id' => static::$planId,
'product_id' => static::$productId,
));
static::assertInternalType('array', $response);
}

public function testListUserSubscriptionPayments()
{
$response = static::$xsollaClient->ListUserSubscriptionPayments(array(
Expand Down
15 changes: 15 additions & 0 deletions tests/Integration/API/SupportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ public function testListSupportTickets()
static::assertInternalType('array', $response);
}

public function testListSupportTicketsWithParams()
{
$response = static::$xsollaClient->ListSupportTickets(array(
'merchant_id' => static::$merchantId,
'datetime_from' => '2015-01-01T00:00:00Z',
'datetime_to' => '2015-01-02T00:00:00Z',
'status' => 'solved',
'type' => 'question',
'offset' => 0,
'limit' => 100,
'sender' => 'user',
));
static::assertInternalType('array', $response);
}

public function testListSupportTicketComments()
{
static::markTestIncomplete('We haven\'t support tickets in test account for comments testing.');
Expand Down
11 changes: 11 additions & 0 deletions tests/Integration/API/VirtualItemsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ public function testListVirtualItems()
static::assertInternalType('array', $response);
}

public function testListVirtualItemsWithParams()
{
$response = static::$xsollaClient->ListVirtualItems(array(
'project_id' => static::$projectId,
'offset' => 0,
'limit' => 100,
'has_price' => 'virtual_currency',
));
static::assertInternalType('array', $response);
}

public function testCreateVirtualItemsGroup()
{
$response = static::$xsollaClient->CreateVirtualItemsGroup(array(
Expand Down
27 changes: 25 additions & 2 deletions tests/Integration/API/WalletTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,36 @@ public function testListWalletUsers()
static::assertInternalType('array', $response);
}

public function testListWalletUsersWithParams()
{
$response = static::$xsollaClient->ListWalletUsers(array(
'project_id' => static::$projectId,
'limit' => 1,
'offset' => 0,
'user_requisites' => static::$userId,
));
static::assertInternalType('array', $response);
}

public function testListWalletUserOperations()
{
$response = static::$xsollaClient->ListWalletUserOperations(array(
'project_id' => static::$projectId,
'user_id' => static::$userId,
'datetime_from' => '2015-01-01T00:00:00 UTC',
'datetime_to' => '2016-01-01T00:00:00 UTC',
'datetime_from' => '2015-01-01T00:00:00Z',
'datetime_to' => '2016-01-01T00:00:00Z',
));
static::assertInternalType('array', $response);
}

public function testListWalletUserOperationsWithParams()
{
$response = static::$xsollaClient->ListWalletUserOperations(array(
'project_id' => static::$projectId,
'user_id' => static::$userId,
'datetime_from' => '2015-01-01T00:00:00Z',
'datetime_to' => '2016-01-01T00:00:00Z',
'transaction_type' => 'payment',
));
static::assertInternalType('array', $response);
}
Expand Down
1 change: 0 additions & 1 deletion tests/Resources/Scripts/webhook_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
break;
default:
$callback = function () {

};
}
$server = WebhookServer::create($callback, ServerTest::PROJECT_SECRET_KEY);
Expand Down

0 comments on commit 11f8f02

Please sign in to comment.