Skip to content

Commit 014c189

Browse files
authored
[Subscription] Cancel google subscription(#386)
1 parent d787aa5 commit 014c189

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/Subscription.php

+8
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,12 @@ public function get(): SubscriptionPurchase
202202

203203
return $this->googleGetResponse;
204204
}
205+
206+
/**
207+
* @throws GuzzleException
208+
*/
209+
public function cancel(): EmptyResponse
210+
{
211+
return $this->createSubscription()->cancel();
212+
}
205213
}

tests/Facades/SubscriptionTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,18 @@ public function test_it_handles_the_21007_error_from_the_app_store()
116116

117117
$this->assertTrue($response->getStatus()->isValid());
118118
}
119+
120+
/** @test */
121+
public function cancel_google_subscription(): void
122+
{
123+
$this->expectNotToPerformAssertions();
124+
125+
$client = GoogleClientFactory::mock(new Response());
126+
127+
Subscription::googlePlay($client)
128+
->packageName('com.twigano.fashion')
129+
->id($this->itemId)
130+
->token($this->token)
131+
->cancel();
132+
}
119133
}

0 commit comments

Comments
 (0)