Skip to content

Commit

Permalink
fix: Adding missing connection for SK2 intro offers
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaw-Signaturize authored and hyochan committed Dec 15, 2023
1 parent e67a52e commit 00a0e52
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/types/appleSk2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const productSk2Map = ({
description,
displayName,
price,
currency,
currency,
displayPrice,
}: ProductSk2): ProductIOS => {
const prod: ProductIOS = {
Expand All @@ -62,7 +62,7 @@ export const productSk2Map = ({
type: 'iap',
price: String(price),
localizedPrice: displayPrice,
currency
currency,
};
return prod;
};
Expand All @@ -88,6 +88,17 @@ export const subscriptionSk2Map = ({
subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,
subscriptionPeriodUnitIOS:
subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,
introductoryPriceAsAmountIOS: subscription?.introductoryOffer?.displayPrice,
introductoryPricePaymentModeIOS:
subscription?.introductoryOffer?.paymentMode.toUpperCase() as
| ''
| 'FREETRIAL'
| 'PAYASYOUGO'
| 'PAYUPFRONT',
introductoryPriceNumberOfPeriodsIOS:
subscription?.introductoryOffer?.period?.value?.toString(),
introductoryPriceSubscriptionPeriodIOS: subscription?.introductoryOffer
?.period?.unit as SubscriptionIosPeriod,
};
return prod;
};
Expand Down Expand Up @@ -138,12 +149,12 @@ export type SubscriptionStatus =
| 'subscribed';

/**
* Renewal info for whole subscription group.
* see: https://developer.apple.com/documentation/storekit/product/subscriptioninfo/status/3822294-renewalinfo
* WARN:
* - autoRenewPreference is serialised as autoRenewProductId in jsonRepresentation
* - renewalDate is available in jsonRepresentation (will change with Xcode 15 https://developer.apple.com/forums/thread/738833)
*/
* Renewal info for whole subscription group.
* see: https://developer.apple.com/documentation/storekit/product/subscriptioninfo/status/3822294-renewalinfo
* WARN:
* - autoRenewPreference is serialised as autoRenewProductId in jsonRepresentation
* - renewalDate is available in jsonRepresentation (will change with Xcode 15 https://developer.apple.com/forums/thread/738833)
*/
export type RenewalInfo = {
jsonRepresentation?: string;
willAutoRenew: boolean;
Expand Down

0 comments on commit 00a0e52

Please sign in to comment.