自动续订订阅错误的时间响应沙盒模式 [英] Auto-Renewable Subscription Wrong Time Response Sandbox Mode

查看:225
本文介绍了自动续订订阅错误的时间响应沙盒模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试进行本地收据验证和测试. 但是从苹果收货响应中,我得到了与时间相关的错误响应,因此目前很难测试应用程序.

I was trying to do local receipt validation and doing testing at present. But from apple receipt response, I was getting wrong time related response so it become difficult for me to test application at present.

以下是日志信息:

这是我用于收据验证的源代码:

Here is source code that I used for receipt validation:

 public void CheckIfSubscriptionIsActive(bool validateReceipt)
{
    ConfigurationBuilder builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());

    IAppleConfiguration appleConfig = builder.Configure<IAppleConfiguration>();
    bool isSubscriptionRunning = false;

    if (!string.IsNullOrEmpty(appleConfig.appReceipt))
    {
        if (validateReceipt)
        {
            // local receipt verification
            var receiptData = System.Convert.FromBase64String(appleConfig.appReceipt);
            AppleReceipt receipt = new AppleValidator(AppleTangle.Data()).Validate(receiptData);
            foreach (AppleInAppPurchaseReceipt productReceipt in receipt.inAppPurchaseReceipts)
            {

                Debug.Log("# server date: " + GameManager.Instance.ServerDate + " expire date: " + productReceipt.subscriptionExpirationDate);
                int result = DateTime.Compare(GameManager.Instance.ServerDate, productReceipt.subscriptionExpirationDate);
                if (result <= 0)
                {
                    isSubscriptionRunning = true;
                    Debug.Log(" === ==== === Subscription Running: curr date: " + GameManager.Instance.ServerDate + " expire date: " + productReceipt.subscriptionExpirationDate);
                }

                //Debug.Log("PRODUCTID: " + productReceipt.productID);
                //Debug.Log("PURCHASE DATE: " + productReceipt.purchaseDate);
                //Debug.Log("EXPIRATION DATE: " + productReceipt.subscriptionExpirationDate);
                //Debug.Log("CANCELDATE DATE: " + productReceipt.cancellationDate);
            }

            if (isSubscriptionRunning)
                SubscriptionActivated();

            // hide loading...
            showLoader = false;
            Camera.main.SendMessage("ActivateLoadingDialog", false, SendMessageOptions.DontRequireReceiver);

        }
        else
        {
            // server side receipt vecification
            appReceipt = appleConfig.appReceipt;
            StartCoroutine(CheckSubscriptionStatusServerSideVerification());
        }
    }
}

通常每周订阅有3分钟的持续时间,所以如果我没有得到准确的时间,那么我该如何进行正确的测试!

Usually Weekly subscription has 3 mins time duration so if I am not getting exact time then how can I do proper testing!!

在上图中,我提到了两次,我的本地时间 15:01:04 苹果收据响应时间 09:37:18 . 目前,使用本地设备收据验证无法测试工作.那么我可以通过什么方式进行测试?

In above image, I have mention both times, my local time is 15:01:04 and apple receipt response time is 09:37:18. Using local device receipt validation at present I can't able to test the work. so what way exist for me for testing??

推荐答案

基本上在上述问题中,我在Apple收据响应中遇到了主要的时差,但现在我已经解决了这一问题的解决方案. 本地时间是15:01:04 苹果收据回复时间为09:37:18

Basically in above problem, I was getting major time difference in Apple receipt response but now I have concluded the solution for this. local time is 15:01:04 apple receipt response time is 09:37:18

主要原因是格林尼治标准时间(GMT)时差. 我住在印度,所以我们有5:30的时差运行.

Main reason for this is GMT time difference. I am living in India so we have 5:30 time difference running.

因此,在Apple接收时间中,我需要添加此GMT时间差以获取准确的时间值,然后我们就可以完成剩余的编码.

So in Apple receipt time, I require to add this GMT time difference to get exact time values and after this we can complete our rest coding.

如果有人需要,我将在此处发布我的Unity支持讨论的链接.

I will post link here with my Unity Support discussion if anybody required that.

这篇关于自动续订订阅错误的时间响应沙盒模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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