Skip to content

Commit

Permalink
fix: migrate ProrationMode to ReplacementMode
Browse files Browse the repository at this point in the history
  • Loading branch information
t-tonchim committed Jul 9, 2024
1 parent 9377af9 commit 5d10f4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/iap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ export const requestSubscription = (
const {
subscriptionOffers,
purchaseTokenAndroid,
prorationModeAndroid = -1,
replacementModeAndroid = -1,
obfuscatedAccountIdAndroid,
obfuscatedProfileIdAndroid,
isOfferPersonalized,
Expand All @@ -807,7 +807,7 @@ export const requestSubscription = (
ANDROID_ITEM_TYPE_SUBSCRIPTION,
subscriptionOffers?.map((so) => so.sku),
purchaseTokenAndroid,
prorationModeAndroid,
replacementModeAndroid,
obfuscatedAccountIdAndroid,
obfuscatedProfileIdAndroid,
subscriptionOffers?.map((so) => so.offerToken),
Expand Down
4 changes: 2 additions & 2 deletions src/modules/android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
InstallSourceAndroid,
Product,
ProductType,
ProrationModesAndroid,
Purchase,
PurchaseResult,
ReplacementModesAndroid,
Sku,
} from '../types';
import type * as Android from '../types/android';
Expand Down Expand Up @@ -39,7 +39,7 @@ export type BuyItemByType = (
type: string,
skus: Sku[],
purchaseToken: string | undefined,
prorationMode: ProrationModesAndroid | -1,
replacementModeAndroid: ReplacementModesAndroid | -1,
obfuscatedAccountId: string | undefined,
obfuscatedProfileId: string | undefined,
subscriptionOffers: string[],
Expand Down
16 changes: 8 additions & 8 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import type * as Apple from './apple';

export type Sku = string;

export enum ProrationModesAndroid {
IMMEDIATE_WITH_TIME_PRORATION = 1,
IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,
IMMEDIATE_WITHOUT_PRORATION = 3,
DEFERRED = 4,
IMMEDIATE_AND_CHARGE_FULL_PRICE = 5,
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,
export enum ReplacementModesAndroid {
UNKNOWN_REPLACEMENT_MODE = 0,
WITH_TIME_PRORATION = 1,
CHARGE_PRORATED_PRICE = 2,
WITHOUT_PRORATION = 3,
CHARGE_FULL_PRICE = 5,
DEFERRED = 6,
}

export enum PurchaseStateAndroid {
Expand Down Expand Up @@ -254,7 +254,7 @@ export interface SubscriptionOffer {

export interface RequestSubscriptionAndroid extends RequestPurchaseBaseAndroid {
purchaseTokenAndroid?: string;
prorationModeAndroid?: ProrationModesAndroid;
replacementModeAndroid?: ReplacementModesAndroid;
subscriptionOffers: SubscriptionOffer[];
}

Expand Down

0 comments on commit 5d10f4f

Please sign in to comment.