cordova-plugin-purchase
Advanced tools
Comparing version 13.1.6 to 13.2.0
@@ -15,2 +15,3 @@ # Interface: When | ||
- [receiptUpdated](CdvPurchase.When.md#receiptupdated) | ||
- [unverified](CdvPurchase.When.md#unverified) | ||
- [updated](CdvPurchase.When.md#updated) | ||
@@ -93,2 +94,20 @@ - [verified](CdvPurchase.When.md#verified) | ||
### unverified | ||
▸ **unverified**(`cb`): [`When`](CdvPurchase.When.md) | ||
Register a function called when a receipt failed validation. | ||
#### Parameters | ||
| Name | Type | | ||
| :------ | :------ | | ||
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`UnverifiedReceipt`](CdvPurchase.UnverifiedReceipt.md)\> | | ||
#### Returns | ||
[`When`](CdvPurchase.When.md) | ||
___ | ||
### updated | ||
@@ -95,0 +114,0 @@ |
@@ -69,2 +69,3 @@ # Namespace: CdvPurchase | ||
- [TransactionMonitor](../interfaces/CdvPurchase.TransactionMonitor.md) | ||
- [UnverifiedReceipt](../interfaces/CdvPurchase.UnverifiedReceipt.md) | ||
- [VerifiedPurchase](../interfaces/CdvPurchase.VerifiedPurchase.md) | ||
@@ -156,3 +157,3 @@ - [When](../interfaces/CdvPurchase.When.md) | ||
• `Const` **PLUGIN\_VERSION**: ``"13.1.6"`` | ||
• `Const` **PLUGIN\_VERSION**: ``"13.2.0"`` | ||
@@ -159,0 +160,0 @@ Current release number of the plugin. |
{ | ||
"name": "cordova-plugin-purchase", | ||
"version": "13.1.6", | ||
"version": "13.2.0", | ||
"description": "Cordova Purchase plugin for iOS, Android, Windows (AppStore, Play, UWP)", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -61,3 +61,6 @@ namespace CdvPurchase { | ||
*/ | ||
get pricing(): PricingPhase | undefined { return this.offers[0]?.pricingPhases[0]; } | ||
get pricing(): PricingPhase | undefined { | ||
// see Object.defineProperty in the constructor for the actual implementation. | ||
return this.offers[0]?.pricingPhases[0]; | ||
} | ||
@@ -89,3 +92,3 @@ /** | ||
this.offers = []; | ||
Object.defineProperty(this, 'pricing', { enumerable: false }); | ||
Object.defineProperty(this, 'pricing', { enumerable: false, get: () => this.offers[0]?.pricingPhases[0] }); | ||
Object.defineProperty(this, 'canPurchase', { enumerable: false, get: () => decorator.canPurchase(this) }); | ||
@@ -92,0 +95,0 @@ Object.defineProperty(this, 'owned', { enumerable: false, get: () => decorator.owned(this) }); |
@@ -27,3 +27,3 @@ /// <reference path="validator/validator.ts" /> | ||
*/ | ||
export const PLUGIN_VERSION = '13.1.6'; | ||
export const PLUGIN_VERSION = '13.2.0'; | ||
@@ -154,2 +154,5 @@ /** | ||
/** Callbacks when a receipt has been validated */ | ||
private unverifiedCallbacks = new Internal.Callbacks<UnverifiedReceipt>(this.log, 'unverified()'); | ||
/** Callbacks for errors */ | ||
@@ -181,2 +184,3 @@ private errorCallbacks = new Internal.Callbacks<IError>(this.log, 'error()'); | ||
verifiedCallbacks: this.verifiedCallbacks, | ||
unverifiedCallbacks: this.unverifiedCallbacks, | ||
finish: (receipt: VerifiedReceipt) => this.finish(receipt), | ||
@@ -277,2 +281,3 @@ }, this.log); | ||
verified: (cb: Callback<VerifiedReceipt>) => (this.verifiedCallbacks.push(cb), ret), | ||
unverified: (cb: Callback<UnverifiedReceipt>) => (this.unverifiedCallbacks.push(cb), ret), | ||
}; | ||
@@ -279,0 +284,0 @@ return ret; |
@@ -285,2 +285,5 @@ /// <reference path="store.ts" /> | ||
verified(cb: Callback<VerifiedReceipt>): When; | ||
/** Register a function called when a receipt failed validation. */ | ||
unverified(cb: Callback<UnverifiedReceipt>): When; | ||
} | ||
@@ -287,0 +290,0 @@ |
@@ -44,2 +44,3 @@ namespace CdvPurchase { | ||
get verifiedCallbacks(): Callbacks<VerifiedReceipt>; | ||
get unverifiedCallbacks(): Callbacks<UnverifiedReceipt>; | ||
finish(receipt:VerifiedReceipt): Promise<void>; | ||
@@ -106,5 +107,5 @@ } | ||
} | ||
// else { | ||
// } | ||
// TODO: update transactions | ||
else { | ||
this.controller.unverifiedCallbacks.trigger({receipt, payload}); | ||
} | ||
}; | ||
@@ -111,0 +112,0 @@ receipts.forEach(receipt => this.runOnReceipt(receipt, onResponse)); |
@@ -13,2 +13,7 @@ namespace CdvPurchase { | ||
export interface UnverifiedReceipt { | ||
receipt: Receipt; | ||
payload: Validator.Response.ErrorPayload; | ||
} | ||
/** Receipt data as validated by the receipt validation server */ | ||
@@ -15,0 +20,0 @@ export class VerifiedReceipt { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1872360
303
24105