Skip to content

Instantly share code, notes, and snippets.

@RoyiNamir
Last active June 16, 2018 13:25
Show Gist options
  • Save RoyiNamir/a0033d1438fb306b10956eeae502b36a to your computer and use it in GitHub Desktop.
Save RoyiNamir/a0033d1438fb306b10956eeae502b36a to your computer and use it in GitHub Desktop.
async onRemoveAddsTap(e)
{
try
{
await this._purchaseService.init0();
await this._purchaseService.getProduct1();
this._purchaseService.registerAndHandleTransactions2()
.then(() => this._fancyService.showSuccess("Thanks!", "Ads will be removed . Please restart the app.", "Ok"),
(e) => this._fancyService.showFail("Oooops!", "Error:Purchase failed.(code:88).Please contact us via the 'Contact Pinky Softs' link",
"Close"
)
);
let isCanMake = this._purchaseService.buy9();
if (isCanMake === false)
{
this._fancyService.showFail("Oooops!", ("Sorry, your account is not eligible to make payments!"), "Close");
}
}
catch (e)
{
if ((e + "").toLowerCase().indexOf("already purchased") > -1)
{
this._fancyService.showFail("Error", "Already Purchased. You can't purchase twice.", "close");
}
else
{
this._fancyService.showFail("Error", "Purchase failed.(code:99).Please contact us via the 'Contact Pinky Softs' link", "close");
}
}
}
async onResorePerchuses(e)
{
try
{
await this._purchaseService.init0();
await this._purchaseService.getProduct1();
this._purchaseService.registerAndHandleTransactions2()
.then(() => this._fancyService.showSuccess("Thanks!", "Purchase restored :) . Please restart the app.", "Ok"),
(e) => this._fancyService.showFail("Oooops!", "Error:Restore failed.(code:87).Please contact us via the 'Contact Pinky Softs' link",
"Close"
)
);
this._purchaseService.restorePurchases10()
.then(() =>
{
}, () => this._fancyService.showFail("Oooops!", "No Purchase found", "Close"));
}
catch (e)
{
console.log(e);
this._fancyService.showFail("Error", "Error:Restore failed.(code:86).Please contact us via the 'Contact Pinky Softs' link", "close");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment