From 4e22c9431c1450796ad2dc31db8fa46b17d5de06 Mon Sep 17 00:00:00 2001 From: Ekrem BOZKURT Date: Tue, 19 May 2020 02:35:47 +0300 Subject: [PATCH] order and subscription divided --- .../HuaweiMobileService/OrderPublisher.php | 65 +++++++++++++++++++ .../HuaweiMobileService/Resource.php | 7 +- ...ublisher.php => SubscriptionPublisher.php} | 34 +--------- 3 files changed, 70 insertions(+), 36 deletions(-) create mode 100644 src/Teknasyon/HuaweiMobileService/OrderPublisher.php rename src/Teknasyon/HuaweiMobileService/{Publisher.php => SubscriptionPublisher.php} (65%) diff --git a/src/Teknasyon/HuaweiMobileService/OrderPublisher.php b/src/Teknasyon/HuaweiMobileService/OrderPublisher.php new file mode 100644 index 0000000..fd68c98 --- /dev/null +++ b/src/Teknasyon/HuaweiMobileService/OrderPublisher.php @@ -0,0 +1,65 @@ +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; + } + +} + diff --git a/src/Teknasyon/HuaweiMobileService/Resource.php b/src/Teknasyon/HuaweiMobileService/Resource.php index 70af4fd..02e1f71 100644 --- a/src/Teknasyon/HuaweiMobileService/Resource.php +++ b/src/Teknasyon/HuaweiMobileService/Resource.php @@ -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; @@ -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) { diff --git a/src/Teknasyon/HuaweiMobileService/Publisher.php b/src/Teknasyon/HuaweiMobileService/SubscriptionPublisher.php similarity index 65% rename from src/Teknasyon/HuaweiMobileService/Publisher.php rename to src/Teknasyon/HuaweiMobileService/SubscriptionPublisher.php index 4d37b1a..14dc1ba 100644 --- a/src/Teknasyon/HuaweiMobileService/Publisher.php +++ b/src/Teknasyon/HuaweiMobileService/SubscriptionPublisher.php @@ -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; @@ -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'; @@ -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()