-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from ostdotcom/develop
Redemptions API.
- Loading branch information
Showing
12 changed files
with
339 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ php: | |
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
env: | ||
- BUILD_ENV=TRAVIS | ||
before_install: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.2 | ||
2.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* RedeemableSkus class | ||
*/ | ||
|
||
namespace OST; | ||
|
||
use OST\Base; | ||
|
||
/** | ||
* Class encapsulating methods to interact with API's for RedeemableSkus module | ||
*/ | ||
class RedeemableSkus extends Base | ||
{ | ||
|
||
const PREFIX = '/redeemable-skus'; | ||
|
||
/** | ||
* List RedeemableSkus | ||
* | ||
* @param array $params params for fetching redeemable skus list | ||
* | ||
* @return object | ||
* | ||
*/ | ||
public function getList(array $params = array()) | ||
{ | ||
return $this->requestObj->get($this->getPrefix() . '/', $params); | ||
} | ||
|
||
/** | ||
* Get RedeemableSku details of a uuid | ||
* | ||
* @param array $params params for fetching details of a redeemable sku | ||
* | ||
* @return object | ||
* | ||
*/ | ||
public function get(array $params = array()) | ||
{ | ||
return $this->requestObj->get($this->getPrefix() . '/' . $this->getRedeemableSkuId($params) . '/', $params); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Redemptions class | ||
*/ | ||
|
||
namespace OST; | ||
|
||
use OST\Base; | ||
|
||
/** | ||
* Class encapsulating methods to interact with API's for Redemptions module | ||
*/ | ||
class Redemptions extends Base | ||
{ | ||
|
||
const PREFIX = '/users'; | ||
const SUFFIX = '/redemptions'; | ||
|
||
/** | ||
* List Redemptions of a user | ||
* | ||
* @param array $params params for fetching redemptions list | ||
* | ||
* @return object | ||
* | ||
*/ | ||
public function getList(array $params = array()) | ||
{ | ||
return $this->requestObj->get($this->getPrefix() . '/' . $this->getUserId($params) . $this->getSuffix() . '/', $params); | ||
} | ||
|
||
/** | ||
* Get Redemption details of a uuid | ||
* | ||
* @param array $params params for fetching details of a redemption | ||
* | ||
* @return object | ||
* | ||
*/ | ||
public function get(array $params = array()) | ||
{ | ||
return $this->requestObj->get($this->getPrefix() . '/' . $this->getUserId($params) . $this->getSuffix() . '/' . $this->getRedemptionId($params) . '/', $params); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: aman | ||
* Date: 2020-02-20 | ||
* Time: 16:44 | ||
*/ | ||
$filepath = realpath (dirname(__FILE__)); | ||
require_once($filepath."/ServiceTestBase.php"); | ||
|
||
final class RedeemableSkusTest extends ServiceTestBase | ||
{ | ||
/** | ||
* | ||
* Get a redemption info | ||
* | ||
* @test | ||
* | ||
* @throws Exception | ||
*/ | ||
public function get() | ||
{ | ||
$redeemableSkusService = $this->ostObj->services->redeemableSkus; | ||
$params = array(); | ||
$params['redeemable_sku_id'] = $this->environmentVariables['redeemableSkuId']; | ||
$response = $redeemableSkusService->get($params)->wait(); | ||
$this->isSuccessResponse($response); | ||
} | ||
|
||
/** | ||
* | ||
* Get all redeemableSkus | ||
* | ||
* @test | ||
* | ||
* @throws Exception | ||
*/ | ||
public function getList() | ||
{ | ||
$ostObj = $this->instantiateOSTSDKForV2Api(); | ||
$redeemableSkusService = $ostObj->services->redeemableSkus; | ||
$params = array(); | ||
$response = $redeemableSkusService->getList($params)->wait(); | ||
$this->isSuccessResponse($response); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: aman | ||
* Date: 2020-02-20 | ||
* Time: 16:44 | ||
*/ | ||
$filepath = realpath (dirname(__FILE__)); | ||
require_once($filepath."/ServiceTestBase.php"); | ||
|
||
final class RedemptionsTest extends ServiceTestBase | ||
{ | ||
/** | ||
* | ||
* Get a redemption info | ||
* | ||
* @test | ||
* | ||
* @throws Exception | ||
*/ | ||
public function get() | ||
{ | ||
$redemptionsService = $this->ostObj->services->redemptions; | ||
$params = array(); | ||
$params['user_id'] = $this->environmentVariables['userId']; | ||
$params['redemption_id'] = $this->environmentVariables['redemptionId']; | ||
$response = $redemptionsService->get($params)->wait(); | ||
$this->isSuccessResponse($response); | ||
} | ||
|
||
/** | ||
* | ||
* Get all redemptions for a user | ||
* | ||
* @test | ||
* | ||
* @throws Exception | ||
*/ | ||
public function getList() | ||
{ | ||
$ostObj = $this->instantiateOSTSDKForV2Api(); | ||
$redemptionsService = $ostObj->services->redemptions; | ||
$params = array(); | ||
$params['user_id'] = $this->environmentVariables['userId']; | ||
$response = $redemptionsService->getList($params)->wait(); | ||
$this->isSuccessResponse($response); | ||
} | ||
|
||
} |
Oops, something went wrong.