Giter Site home page Giter Site logo

Comments (7)

karakasli avatar karakasli commented on June 16, 2024

I faced a similar issue;

I can retrieve all products there is no issue. But when I triggered BuyProduct function like below;

public void Buy(ProductLineComp productLineComp)
        {
            var product = productLineComp.GetProduct();
            
            PurchaseIntentReq purchaseIntentReq = new PurchaseIntentReq
            {
                PriceType = 0,
                ProductId = product.id,
                DeveloperPayload = "dev"
            };
            
            ITask<PurchaseIntentResult> task = _iapClient.CreatePurchaseIntent(purchaseIntentReq);
                
            task.AddOnSuccessListener((intentResult)=>
            {
                if (intentResult != null)
                {
                    Debug.Log("[HMSPlugin]:" + intentResult.ErrMsg + intentResult.ReturnCode.ToString());
                    Debug.Log("[HMSPlugin]: Bought " + purchaseIntentReq.ProductId);
                    Status status = intentResult.Status;
                    status.StartResolutionForResult((androidIntent) =>
                    {
                        PurchaseResultInfo purchaseResultInfo = _iapClient.ParsePurchaseResultInfoFromIntent(androidIntent);

                        Debug.Log("HMSPluginResult: " + purchaseResultInfo.ReturnCode);
                        Debug.Log("HMErrorMssg: " + purchaseResultInfo.ErrMsg);
                        Debug.Log("HMS: HMSInAppPurchaseData" + purchaseResultInfo.InAppPurchaseData);
                        Debug.Log("HMS: HMSInAppDataSignature" + purchaseResultInfo.InAppDataSignature);

                        switch (purchaseResultInfo.ReturnCode)
                        {
                            case OrderStatusCode.ORDER_STATE_SUCCESS:
                                _listener.OnPurchaseSuccess(product.id);
                                break;
                            default:
                                Debug.Log("[HMSPlugin]:startIntent ERROR");
                                break;
                        }

                    }, (exception) =>
                    {
                        Debug.Log("[HMSPlugin]:startIntent ERROR");
                    });

                }
            });
                
            task.AddOnFailureListener((exception) =>
            {
                Debug.Log("[HMSPlugin]:startIntent ERROR: " + exception.Message);
            });
        }

It throws an exception;

07-06 20:13:44.753: E/Unity(27131): MissingMethodException: Constructor on type 'HuaweiMobileServices.IAP.PurchaseIntentResult' not found.
07-06 20:13:44.753: E/Unity(27131): at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0
07-06 20:13:44.753: E/Unity(27131): at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <00000000000000000000000000000000>:0
07-06 20:13:44.753: E/Unity(27131): at HuaweiMobileServices.Utils.AndroidJavaObjectExtensions.AsWrapper[T] (UnityEngine.AndroidJavaObject javaObject) [0x00000] in <00000000000000000000000000000000>:0
07-06 20:13:44.753: E/Unity(27131): at System.Func`2[T,TResult].Invoke (T arg) [0x00000] in <00000000000000000000000000000000>:0
07-06 20:13:44.753: E/Unity(27131): at HuaweiMobileServices.Base.OnSuccessListenerConve
07-06 20:13:45.270: E/hms_pay(8474): StateCoupon coupons parseJsonObject jsonObject returnCode is not success.

My Unity Version is: 2019.3.6f1
HMS Unity Plugin Version is v1.1.2

from hms-unity-plugin.

jmercado86 avatar jmercado86 commented on June 16, 2024

After using the latest version. I managed to make it work, I get all the respective events I needed while doing a purchase and after a purchase.

from hms-unity-plugin.

CavinChang avatar CavinChang commented on June 16, 2024

HMS version 1.1.2
Unity 2019.3.15f1
Having same issue when buyProduct MissingMethodException:Constructor on type 'HuaweiMobileServices.IAP.PurchaseIntentResult' not found

2020/07/23 11:04:45.727 9463 9463 Error Unity MissingMethodException: Constructor on type 'HuaweiMobileServices.IAP.PurchaseIntentResult' not found as above

from hms-unity-plugin.

EwgenijGolowko avatar EwgenijGolowko commented on June 16, 2024

tempsnip
all purchases from the developer console are initialized, but when you click on the buy button, the purchase window does not appear, iapClient.CreatePurchaseIntent (purchaseIntentReq) -> does not work
HMS версия 1.1.2
Unity 2019.2.14f1

from hms-unity-plugin.

robroy07 avatar robroy07 commented on June 16, 2024

We are having the same issue. Inside IapManager.cs, when we call:
ITask<PurchaseIntentResult> task = iapClient.CreatePurchaseIntent(purchaseIntentReq);

we get the following error in logcat:
07-24 11:30:06.332 16567 16567 E Unity : MissingMethodException: Constructor on type 'HuaweiMobileServices.IAP.PurchaseIntentResult' not found. 07-24 11:30:06.332 16567 16567 E Unity : at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0 07-24 11:30:06.332 16567 16567 E Unity : at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <00000000000000000000000000000000>:0 07-24 11:30:06.332 16567 16567 E Unity : at HuaweiMobileServices.Utils.AndroidJavaObjectExtensions.AsWrapper[T] (UnityEngine.AndroidJavaObject javaObject) [0x00000] in <00000000000000000000000000000000>:0 07-24 11:30:06.332 16567 16567 E Unity : at System.Func2[T,TResult].Invoke (T arg) [0x00000] in <00000000000000000000000000000000>:0
07-24 11:30:06.332 16567 16567 E Unity : at HuaweiMobileServices.Base.OnSuccessListenerConve`

HMS version 1.1.2
Unity 2019.3.14f1

Edit: We have downloaded the dll project from https://github.com/m0skit0/hms-sdk-unity/tree/master/hms-sdk-unity to generate the release version of the HuaweiMobileServices.dll and we have replaced the one that comes with the plugin. Now the error is gone

from hms-unity-plugin.

m0skit0 avatar m0skit0 commented on June 16, 2024

Thanks @robroy07 , we will update the plugin with the correct DLL asap.

from hms-unity-plugin.

m0skit0 avatar m0skit0 commented on June 16, 2024

Updated with latest SDK DLL in commit aea9a72

from hms-unity-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.