@qonversion/capacitor-plugin
Version:
Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and co
40 lines • 1.25 kB
JavaScript
import { PurchaseResultStatus } from './enums';
/**
* Represents the result of a purchase operation.
* Contains the status of the purchase, entitlements, and store transaction details.
*/
export class PurchaseResult {
constructor(status, entitlements, error, isFallbackGenerated, source, storeTransaction) {
this.status = status;
this.entitlements = entitlements;
this.error = error;
this.isFallbackGenerated = isFallbackGenerated;
this.source = source;
this.storeTransaction = storeTransaction;
}
/**
* Returns true if the purchase was successful.
*/
get isSuccess() {
return this.status === PurchaseResultStatus.SUCCESS;
}
/**
* Returns true if the purchase was canceled by the user.
*/
get isCanceled() {
return this.status === PurchaseResultStatus.USER_CANCELED;
}
/**
* Returns true if the purchase is pending.
*/
get isPending() {
return this.status === PurchaseResultStatus.PENDING;
}
/**
* Returns true if an error occurred during the purchase.
*/
get isError() {
return this.status === PurchaseResultStatus.ERROR;
}
}
//# sourceMappingURL=PurchaseResult.js.map