@nativescript/payments
Version:
In-App Purchase and Subscriptions for NativeScript
32 lines • 1.25 kB
JavaScript
import { BaseItem } from './common';
export { RecurrenceMode } from './common';
export class Item extends BaseItem {
constructor(nativeValue) {
super(nativeValue);
const formatter = NSNumberFormatter.alloc().init();
formatter.numberStyle = 2 /* NSNumberFormatterStyle.CurrencyStyle */;
formatter.locale = nativeValue.priceLocale;
this.itemId = nativeValue.productIdentifier;
this.localizedDescription = nativeValue.localizedDescription;
this.localizedTitle = nativeValue.localizedTitle;
this.priceAmount = nativeValue.price.doubleValue;
this.priceFormatted = formatter.stringFromNumber(nativeValue.price);
this.priceCurrencyCode = nativeValue.priceLocale.objectForKey(NSLocaleCurrencyCode);
this.isFamilyShareable = nativeValue.isFamilyShareable;
}
get debug() {
if (this.nativeValue) {
const temp = {};
for (const i in this.nativeValue) {
if (this.nativeValue[i] != null) {
temp[i] = this.nativeValue[i];
}
}
return JSON.stringify(temp);
}
else {
return null;
}
}
}
//# sourceMappingURL=index.ios.js.map