使用MockIAPLib对IAP消耗品进行测试 [英] IAP testing of consumables using the MockIAPLib

查看:77
本文介绍了使用MockIAPLib对IAP消耗品进行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试包括耗材购买在内的WP8应用程序,并且正在使用MockIAPLib来协助我的测试.尝试使用MockIAPLib重新购买易耗品时遇到一个问题.我原以为会调用CurrentApp.ReportProductFulfillment  将产品许可证上的IsActive属性重置为false,但不是.

I'm testing a WP8 app which includes consumable purchases, and I'm using the MockIAPLib to assist my testing.  I'm having one issue when trying to re-purchase a consumable item using the MockIAPLib.   I was expecting that a call to CurrentApp.ReportProductFulfillment would reset the IsActive property on the product license to false, but it's not.

这是我的代码:

purchaseResult = await CurrentApp.RequestProductPurchaseAsync(iapCode, true);

if (licenseInformation.ProductLicenses[iapCode].IsActive && licenseInformation.ProductLicenses[iapCode].IsConsumable)
{
// the in-app purchase was successful
//Do internal stuff to fulfill consumable...

//Then let the store know the consumable is fulfilled
CurrentApp.ReportProductFulfillment(licenseInformation.ProductLicenses[iapCode].ProductId);
}

当我使用新加载的MockIAPLib缓存运行此代码块时,它第一次起作用.在第二次运行中,结果 调用CurrentApp.RequestProductPurchaseAsync的返回错误,表明我已经购买了,但耗材尚未兑现,并且该产品的IsActive属性仍列为"IsActive"

When I run this code block with a newly loaded MockIAPLib cache, it works the first time.  The consumable is fulfilled on my side and the CurrentApp.ReportProductFulfillment runs without an exception.  During the second run, the result of the call CurrentApp.RequestProductPurchaseAsync returns an error saying I have already purchased, but the consumable has not yet been fulfilled, and the IsActive property for that product is still listed as "IsActive"

我是否误解了IAP应该如何工作,或者MockIAPLib没有正确地将耗材标记为已完成?

Am I misunderstanding how consumable IAP should work, or does the MockIAPLib not correctly mark consumables as fulfilled?

推荐答案

乔,

对于直到现在还没有注意到这一点,我感到非常抱歉:(我是MockIAP库的作者,并且刚刚意识到我在这个特定领域中有一个bug.

I am so sorry for not noticing this until now :( I am the author of the MockIAP Library and just realized that I have a bug in this particular area.

我将致力于更新库,但这是您需要解决的问题:

I will work on updating the library but here's what you need to fix:

在MockIAP.cs中,您需要编辑"ReportFulfillment"方法,然后在"case ProductType.Consumable:"案例中,再增加一行(在下面加下划线):

In MockIAP.cs, you need to edit the "ReportFulfillment" method and in the "case ProductType.Consumable:", add one more line (underlined below):

StateInformation.SetState(selectedProductId,true);
var rs = new MockReceiptStore();
rs.DeleteReceipt(selectedProductId);
_ appLicenseInformation.ProductLicenses [listing.ProductId] .IsActive = false;
休息;

StateInformation.SetState(selectedProductId, true);
var rs = new MockReceiptStore();
rs.DeleteReceipt(selectedProductId);
_appLicenseInformation.ProductLicenses[listing.ProductId].IsActive = false;
break;

对于深(迟到)的回复非常抱歉:(

Very sorry for the late (extremely late) reply :(


这篇关于使用MockIAPLib对IAP消耗品进行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆