@@ -20,16 +20,18 @@ const (
20
20
HostSandBox = "https://api.storekit-sandbox.itunes.apple.com"
21
21
HostProduction = "https://api.storekit.itunes.apple.com"
22
22
23
- PathLookUp = "/inApps/v1/lookup/{orderId}"
24
- PathTransactionHistory = "/inApps/v1/history/{originalTransactionId}"
25
- PathTransactionInfo = "/inApps/v1/transactions/{transactionId}"
26
- PathRefundHistory = "/inApps/v2/refund/lookup/{originalTransactionId}"
27
- PathGetALLSubscriptionStatus = "/inApps/v1/subscriptions/{originalTransactionId}"
28
- PathConsumptionInfo = "/inApps/v1/transactions/consumption/{originalTransactionId}"
29
- PathExtendSubscriptionRenewalDate = "/inApps/v1/subscriptions/extend/{originalTransactionId}"
30
- PathGetNotificationHistory = "/inApps/v1/notifications/history"
31
- PathRequestTestNotification = "/inApps/v1/notifications/test"
32
- PathGetTestNotificationStatus = "/inApps/v1/notifications/test/{testNotificationToken}"
23
+ PathLookUp = "/inApps/v1/lookup/{orderId}"
24
+ PathTransactionHistory = "/inApps/v1/history/{originalTransactionId}"
25
+ PathTransactionInfo = "/inApps/v1/transactions/{transactionId}"
26
+ PathRefundHistory = "/inApps/v2/refund/lookup/{originalTransactionId}"
27
+ PathGetALLSubscriptionStatus = "/inApps/v1/subscriptions/{originalTransactionId}"
28
+ PathConsumptionInfo = "/inApps/v1/transactions/consumption/{originalTransactionId}"
29
+ PathExtendSubscriptionRenewalDate = "/inApps/v1/subscriptions/extend/{originalTransactionId}"
30
+ PathExtendSubscriptionRenewalDateForAll = "/inApps/v1/subscriptions/extend/mass/"
31
+ PathGetStatusOfSubscriptionRenewalDate = "/inApps/v1/subscriptions/extend/mass/{productId}/{requestIdentifier}"
32
+ PathGetNotificationHistory = "/inApps/v1/notifications/history"
33
+ PathRequestTestNotification = "/inApps/v1/notifications/test"
34
+ PathGetTestNotificationStatus = "/inApps/v1/notifications/test/{testNotificationToken}"
33
35
)
34
36
35
37
type StoreConfig struct {
@@ -275,6 +277,40 @@ func (a *StoreClient) ExtendSubscriptionRenewalDate(ctx context.Context, origina
275
277
return statusCode , nil
276
278
}
277
279
280
+ // ExtendSubscriptionRenewalDateForAll https://developer.apple.com/documentation/appstoreserverapi/extend_subscription_renewal_dates_for_all_active_subscribers
281
+ func (a * StoreClient ) ExtendSubscriptionRenewalDateForAll (ctx context.Context , body MassExtendRenewalDateRequest ) (statusCode int , err error ) {
282
+ URL := HostProduction + PathExtendSubscriptionRenewalDateForAll
283
+ if a .Token .Sandbox {
284
+ URL = HostSandBox + PathExtendSubscriptionRenewalDateForAll
285
+ }
286
+
287
+ bodyBuf := new (bytes.Buffer )
288
+ err = json .NewEncoder (bodyBuf ).Encode (body )
289
+ if err != nil {
290
+ return 0 , err
291
+ }
292
+
293
+ statusCode , _ , err = a .Do (ctx , http .MethodPost , URL , bodyBuf )
294
+ if err != nil {
295
+ return statusCode , err
296
+ }
297
+ return statusCode , nil
298
+ }
299
+
300
+ // GetSubscriptionRenewalDataStatus https://developer.apple.com/documentation/appstoreserverapi/get_status_of_subscription_renewal_date_extensions
301
+ func (a * StoreClient ) GetSubscriptionRenewalDataStatus (ctx context.Context , productId , requestIdentifier string ) (statusCode int , err error ) {
302
+ URL := HostProduction + PathGetStatusOfSubscriptionRenewalDate
303
+ if a .Token .Sandbox {
304
+ URL = HostSandBox + PathGetStatusOfSubscriptionRenewalDate
305
+ }
306
+ URL = strings .Replace (URL , "{productId}" , productId , - 1 )
307
+ URL = strings .Replace (URL , "{requestIdentifier}" , requestIdentifier , - 1 )
308
+
309
+ statusCode , _ , err = a .Do (ctx , http .MethodGet , URL , nil )
310
+
311
+ return statusCode , nil
312
+ }
313
+
278
314
// GetNotificationHistory https://developer.apple.com/documentation/appstoreserverapi/get_notification_history
279
315
// Note: Notification history is available starting on June 6, 2022. Use a startDate of June 6, 2022 or later in your request.
280
316
func (a * StoreClient ) GetNotificationHistory (ctx context.Context , body NotificationHistoryRequest ) (responses []NotificationHistoryResponseItem , err error ) {
0 commit comments