Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align types for DeferSubscription method. #262

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playstore/validator.go
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ type IABSubscription interface {
CancelSubscription(context.Context, string, string, string) error
RefundSubscription(context.Context, string, string, string) error
RevokeSubscription(context.Context, string, string, string) error
DeferSubscription(context.Context, string, string, string, *androidpublisher.SubscriptionPurchasesDeferRequest) error
DeferSubscription(context.Context, string, string, string, *androidpublisher.SubscriptionPurchasesDeferRequest) (*androidpublisher.SubscriptionPurchasesDeferResponse, error)
Copy link
Contributor Author

@folone folone Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligning this method definition with

func (c *Client) DeferSubscription(ctx context.Context, packageName string, subscriptionID string, token string,
req *androidpublisher.SubscriptionPurchasesDeferRequest) (*androidpublisher.SubscriptionPurchasesDeferResponse, error) {

}

// The IABSubscriptionV2 type is an interface for subscriptionV2 service
20 changes: 20 additions & 0 deletions playstore/validator_test.go
Original file line number Diff line number Diff line change
@@ -257,6 +257,26 @@ func TestRevokeSubscription(t *testing.T) {
// TODO Normal scenario
}

func TestDeferSubscription(t *testing.T) {
t.Parallel()

ctx := context.Background()
client, _ := New(jsonKey)
deferralInfo := &androidpublisher.SubscriptionPurchasesDeferRequest{
DeferralInfo: &androidpublisher.SubscriptionDeferralInfo{
DesiredExpiryTimeMillis: 1234567890,
ExpectedExpiryTimeMillis: 1234567890,
},
}
expectedStr := "googleapi: Error 404: No application was found for the given package name., applicationNotFound"
_, actual := client.DeferSubscription(ctx, "package", "productID", "purchaseToken", deferralInfo)

if actual == nil || actual.Error() != expectedStr {
t.Errorf("got %v\nwant %v", actual, expectedStr)
}
// TODO Normal scenario
}

func TestGetSubscriptionOffer(t *testing.T) {
t.Parallel()
// Exception scenario
Loading