public void returnSuccess(string result) { JSONNode jSONNode = JSON.Parse(result); string text = jSONNode[NIAPConstant.invokeMethod]; Debug.Log("success! invokeMethod : " + text + " result : " + result); if (string.Equals(text, NIAPConstant.InvokeMethod.getProductDetails)) { if (this.getProductDetailsSuccessEvent != null) { this.getProductDetailsSuccessEvent(NIAPResult.Build(result)); } this.getProductDetailsSuccessEvent = null; } else if (string.Equals(text, NIAPConstant.InvokeMethod.requestPayment)) { if (this.requestPaymentSuccessEvent != null) { this.requestPaymentSuccessEvent(NIAPPurchase.Build(result)); } this.requestPaymentSuccessEvent = null; this.requestPaymentCanceledEvent = null; } else if (string.Equals(text, NIAPConstant.InvokeMethod.requestConsume)) { if (this.consumeSuccessEvent != null) { this.consumeSuccessEvent(NIAPResult.Build(result)); } this.consumeSuccessEvent = null; } else if (string.Equals(text, NIAPConstant.InvokeMethod.getPurchases)) { if (this.getPurchasesSuccessEvent != null) { this.getPurchasesSuccessEvent(NIAPResult.Build(result)); } this.getPurchasesSuccessEvent = null; } else if (string.Equals(text, NIAPConstant.InvokeMethod.getSinglePurchase)) { if (this.getSinglePurchaseSuccessEvent != null) { this.getSinglePurchaseSuccessEvent(NIAPPurchase.Build(result)); } this.getSinglePurchaseSuccessEvent = null; } }
public void returnCancel(string result) { Debug.Log("fail! returnCancel result : " + result); JSONNode jSONNode = JSON.Parse(result); string text = jSONNode[NIAPConstant.invokeMethod]; Debug.Log("canceled! invokeMethod : " + text + " result : " + result); if (string.Equals(text, NIAPConstant.InvokeMethod.requestPayment)) { if (this.requestPaymentCanceledEvent != null) { this.requestPaymentCanceledEvent(NIAPResult.Build(result)); } this.requestPaymentSuccessEvent = null; this.requestPaymentCanceledEvent = null; } }