Skip to content

Commit

Permalink
order and subscription divided
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekrem BOZKURT committed May 18, 2020
1 parent 04f1f97 commit 4e22c94
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 36 deletions.
65 changes: 65 additions & 0 deletions src/Teknasyon/HuaweiMobileService/OrderPublisher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace Teknasyon\HuaweiMobileService;

use Teknasyon\HuaweiMobileService\InAppPurchase\Resource\CancelledPurchases;
use Teknasyon\HuaweiMobileService\InAppPurchase\Resource\PurchasesOrders;

class OrderPublisher
{
public $purchases_orders;
public $purchases_subscriptions;
public $cancelled_purchases;

public $rootUrl;
public $version;
public $serviceName;
private $client;

/**
* @param $client
* @param string $rootUrl The root URL used for requests to the service.
*/
public function __construct($client, $rootUrl = null)
{
$this->client = $client;
$this->rootUrl = $rootUrl ?: 'https://subscr-dre.iap.hicloud.com/';
$this->version = 'v2';
$this->serviceName = 'hmsPublisher';

$this->purchases_orders = new PurchasesOrders(
$this,
'orders',
array(
'methods' => array(
'get' => array(
'path' => '/applications/purchases/tokens/verify',
'httpMethod' => 'POST',
'parameters' => array(),
),
)
)
);

$this->cancelled_purchases = new CancelledPurchases(
$this,
'cancelled',
array(
'methods' => array(
'cancelledList' => array(
'path' => '/applications/' . $this->version . '/purchases/cancelledList',
'httpMethod' => 'POST',
'parameters' => array(),
),
)
)
);
}

public function getClient()
{
return $this->client;
}

}

7 changes: 3 additions & 4 deletions src/Teknasyon/HuaweiMobileService/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Teknasyon\HuaweiMobileService;

use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Monolog\Logger;
use Psr\Http\Message\ResponseInterface;
use Teknasyon\HuaweiMobileService\HuaweiClient as Client;
Expand Down Expand Up @@ -31,9 +30,9 @@ class Resource
/**
* Resource constructor.
*
* @param Publisher $service
* @param string $resourceName
* @param array $resource
* @param SubscriptionPublisher|OrderPublisher $service
* @param string $resourceName
* @param array $resource
*/
public function __construct($service, $resourceName, $resource)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace Teknasyon\HuaweiMobileService;

use Teknasyon\HuaweiMobileService\InAppPurchase\Resource\CancelledPurchases;
use Teknasyon\HuaweiMobileService\InAppPurchase\Resource\PurchasesOrders;
use Teknasyon\HuaweiMobileService\InAppPurchase\Resource\PurchasesSubscriptions;

class Publisher
class SubscriptionPublisher
{
public $purchases_orders;
public $purchases_subscriptions;
Expand All @@ -24,7 +22,7 @@ class Publisher
public function __construct($client, $rootUrl = null)
{
$this->client = $client;
$this->rootUrl = $rootUrl ?: 'https://subscr-drru.iap.hicloud.com/';
$this->rootUrl = $rootUrl ?: 'https://subscr-dre.iap.hicloud.com/';
$this->version = 'v2';
$this->serviceName = 'hmsPublisher';

Expand Down Expand Up @@ -61,34 +59,6 @@ public function __construct($client, $rootUrl = null)
)
)
);

$this->purchases_orders = new PurchasesOrders(
$this,
'orders',
array(
'methods' => array(
'get' => array(
'path' => '/applications/purchases/tokens/verify',
'httpMethod' => 'POST',
'parameters' => array(),
),
)
)
);

$this->cancelled_purchases = new CancelledPurchases(
$this,
'cancelled',
array(
'methods' => array(
'cancelledList' => array(
'path' => '/applications/' . $this->version . '/purchases/cancelledList',
'httpMethod' => 'POST',
'parameters' => array(),
),
)
)
);
}

public function getClient()
Expand Down

0 comments on commit 4e22c94

Please sign in to comment.