Skip to content

Commit 16d472d

Browse files
authored
Merge pull request #262 from folone/gl/defer-subscription-fix
Align types for `DeferSubscription` method.
2 parents 784c6b7 + f50950f commit 16d472d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

playstore/validator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type IABSubscription interface {
3434
CancelSubscription(context.Context, string, string, string) error
3535
RefundSubscription(context.Context, string, string, string) error
3636
RevokeSubscription(context.Context, string, string, string) error
37-
DeferSubscription(context.Context, string, string, string, *androidpublisher.SubscriptionPurchasesDeferRequest) error
37+
DeferSubscription(context.Context, string, string, string, *androidpublisher.SubscriptionPurchasesDeferRequest) (*androidpublisher.SubscriptionPurchasesDeferResponse, error)
3838
}
3939

4040
// The IABSubscriptionV2 type is an interface for subscriptionV2 service

playstore/validator_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,26 @@ func TestRevokeSubscription(t *testing.T) {
257257
// TODO Normal scenario
258258
}
259259

260+
func TestDeferSubscription(t *testing.T) {
261+
t.Parallel()
262+
263+
ctx := context.Background()
264+
client, _ := New(jsonKey)
265+
deferralInfo := &androidpublisher.SubscriptionPurchasesDeferRequest{
266+
DeferralInfo: &androidpublisher.SubscriptionDeferralInfo{
267+
DesiredExpiryTimeMillis: 1234567890,
268+
ExpectedExpiryTimeMillis: 1234567890,
269+
},
270+
}
271+
expectedStr := "googleapi: Error 404: No application was found for the given package name., applicationNotFound"
272+
_, actual := client.DeferSubscription(ctx, "package", "productID", "purchaseToken", deferralInfo)
273+
274+
if actual == nil || actual.Error() != expectedStr {
275+
t.Errorf("got %v\nwant %v", actual, expectedStr)
276+
}
277+
// TODO Normal scenario
278+
}
279+
260280
func TestGetSubscriptionOffer(t *testing.T) {
261281
t.Parallel()
262282
// Exception scenario

0 commit comments

Comments
 (0)