feat(in-app-purchase-2): feat(in-app-purchase-2): update types and add getApplicationUsername function (#3320)

* Fixing interface types.

* Adding applicationUsername.
This commit is contained in:
Nick Vahalik 2020-03-22 06:00:42 -04:00 committed by GitHub
parent 2d1e2db9cd
commit 664e257442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ export interface IAPProduct {
description: string; description: string;
priceMicros: string; priceMicros: number;
price: string; price: string;
@ -57,9 +57,9 @@ export interface IAPProduct {
downloaded?: boolean; downloaded?: boolean;
lastRenewalDate?: Date; lastRenewalDate?: string;
expiryDate?: Date; expiryDate?: string;
introPrice?: string; introPrice?: string;
@ -156,41 +156,41 @@ export interface IAPProduct {
export interface IAPProductEvents { export interface IAPProductEvents {
/** Called when product data is loaded from the store. */ /** Called when product data is loaded from the store. */
loaded: (callback: IAPQueryCallback) => void; loaded: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when any change occured to a product. */ /** Called when any change occured to a product. */
updated: (callback: IAPQueryCallback) => void; updated: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when an order failed. The `err` parameter is an IAPError object. */ /** Called when an order failed. The `err` parameter is an IAPError object. */
error: (callback: IAPQueryCallback) => void; error: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when a product order is approved. */ /** Called when a product order is approved. */
approved: (callback: IAPQueryCallback) => void; approved: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when a non-consumable product or subscription is owned. */ /** Called when a non-consumable product or subscription is owned. */
owned: (callback: IAPQueryCallback) => void; owned: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when a product order is cancelled by the user. */ /** Called when a product order is cancelled by the user. */
cancelled: (callback: IAPQueryCallback) => void; cancelled: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when an order is refunded by the user. */ /** Called when an order is refunded by the user. */
refunded: (callback: IAPQueryCallback) => void; refunded: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when product has just been registered. */ /** Called when product has just been registered. */
registered: (callback: IAPQueryCallback) => void; registered: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when the product details have been successfully loaded. */ /** Called when the product details have been successfully loaded. */
valid: (callback: IAPQueryCallback) => void; valid: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when the product cannot be loaded from the store. */ /** Called when the product cannot be loaded from the store. */
invalid: (callback: IAPQueryCallback) => void; invalid: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when an order has just been requested. */ /** Called when an order has just been requested. */
requested: (callback: IAPQueryCallback) => void; requested: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when the purchase process has been initiated. */ /** Called when the purchase process has been initiated. */
initiated: (callback: IAPQueryCallback) => void; initiated: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when the purchase process has completed. */ /** Called when the purchase process has completed. */
finished: (callback: IAPQueryCallback) => void; finished: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when receipt validation successful. */ /** Called when receipt validation successful. */
verified: (callback: IAPQueryCallback) => void; verified: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when receipt verification failed. */ /** Called when receipt verification failed. */
unverified: (callback: IAPQueryCallback) => void; unverified: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when validation find a subscription to be expired. */ /** Called when validation find a subscription to be expired. */
expired: (callback: IAPQueryCallback) => void; expired: (callback: IAPQueryCallback) => IAPProductEvents;
/** Called when content download is started. */ /** Called when content download is started. */
downloading: (product: IAPProduct, progress: any, time_remaining: any) => void; downloading: (product: IAPProduct, progress: any, time_remaining: any) => IAPProductEvents;
/** Called when content download has successfully completed. */ /** Called when content download has successfully completed. */
downloaded: (callback: IAPQueryCallback) => void; downloaded: (callback: IAPQueryCallback) => IAPProductEvents;
} }
/** /**
@ -731,6 +731,14 @@ export class InAppPurchase2 extends IonicNativePlugin {
@CordovaProperty() @CordovaProperty()
validator: string | ((url: string | IAPProduct, callback: Function) => void); validator: string | ((url: string | IAPProduct, callback: Function) => void);
@CordovaProperty()
applicationUsername: string | (() => string);
@Cordova({ sync: true })
getApplicationUsername(): string {
return;
}
@CordovaProperty() @CordovaProperty()
log: { log: {
error: (message: string) => void; error: (message: string) => void;