public void StartOrder() { //this.itemName = itemName; ShopWindow.SetActive(false); LoadWindow.SetActive(true); SetStatus(CurrentStatus.STARTING_ORDER); PreparePayment existingCreatePaymentAPIcall = ShopSettings.inst.gameObject.GetComponent <PreparePayment>(); if (existingCreatePaymentAPIcall != null) { Destroy(existingCreatePaymentAPIcall); } /* * PreparePayment createPaymentAPICall = ShopSettings.inst.gameObject.AddComponent<PreparePayment>(); * createPaymentAPICall.accessToken = ShopSettings.inst.GetComponent<GetAuthorization>().API_Success.access_token; * createPaymentAPICall.transactionDescription = "Food Purchase"; * createPaymentAPICall.itemCurrency = ShopSettings.inst.currencyCode; * createPaymentAPICall.itemDescription = itemToPurchase.itemDesc; * createPaymentAPICall.itemName = itemToPurchase.itemName; * createPaymentAPICall.itemPrice = itemToPurchase.itemPrice.ToString(); * createPaymentAPICall.JSONrequest = Resources.Load("JSON/PaymentRequest") as TextAsset; */ PreparePayment createPaymentAPICall = ShopSettings.inst.gameObject.AddComponent <PreparePayment>(); createPaymentAPICall.accessToken = ShopSettings.inst.GetComponent <GetAuthorization>().API_Success.access_token; /*createPaymentAPICall.transactionDescription = "Consegna a Domicilio"; * createPaymentAPICall.itemCurrency = ShopSettings.inst.currencyCode; * createPaymentAPICall.itemDescription = "orecchiette alla capuana"; * createPaymentAPICall.itemName = "pasta"; * createPaymentAPICall.itemPrice = itemToPurchase.itemPrice.ToString();*/ createPaymentAPICall.JSONrequest = Orderstring; //createPaymentAPICall.JSONrequest = Application.persistentDataPath("PaymentRequest") as TextAsset; //var sr = new StreamReader(Application.dataPath + "/" + "PaymentRequest") as TextAsset; InvokeRepeating("CheckOrderStatus", 1f, 1f); }
public void OpenPayPal() { string url = ShopSettings.inst.GetComponent <PreparePayment>().API_Success.links[1].href; if (Application.platform == RuntimePlatform.WebGLPlayer) { #if UNITY_WEBGL openWindow(url); #endif } else { Application.OpenURL(url); } OrderChecker newPaymentListener = ShopSettings.inst.gameObject.AddComponent <OrderChecker>(); PreparePayment createPaymentAPI_Call = ShopSettings.inst.GetComponent <PreparePayment>(); PreparePaymentResponse createPaymentResponse = createPaymentAPI_Call.API_Success; newPaymentListener.accessToken = createPaymentAPI_Call.accessToken; newPaymentListener.checkInterval = 10f; newPaymentListener.payID = createPaymentResponse.id; InvokeRepeating("CheckOrderStatus", 1f, 1f); SetStatus(CurrentStatus.WAITING); }