public void Consume() { NIAPPurchase pItem = null; if (this.m_bRecovery) { pItem = this.m_RecoveryItem; } else { pItem = this.m_pResult; } if (pItem != null) { if (pItem.getOriginalPurchaseAsJsonText() != null && pItem.getSignature() != null) { NIAPNativeExtension.Instance.requestConsume(pItem.getOriginalPurchaseAsJsonText(), pItem.getSignature(), delegate(NIAPResult niapResult) { this.RemoveRcoveryItemData(pItem); }, delegate(NIAPResultError error) { Debug.Log("consumePurchaseFailedEvent: " + error); BillingManager_NStore component = BillingManager_NStore.Instance.GetComponent <BillingManager_NStore>(); if (component != null && component.m_RecoveryItem != null) { GS_BILLING_ITEM_RECODE_REQ gS_BILLING_ITEM_RECODE_REQ = new GS_BILLING_ITEM_RECODE_REQ(); gS_BILLING_ITEM_RECODE_REQ.i8Type = 2; gS_BILLING_ITEM_RECODE_REQ.i8Result = 1; gS_BILLING_ITEM_RECODE_REQ.i64ItemMallIndex = NrTSingleton <ItemMallItemManager> .Instance.GetItemIndex(pItem.getProductCode()); NrTSingleton <ItemMallItemManager> .Instance.RecodeErrorMessage(ref gS_BILLING_ITEM_RECODE_REQ, string.Format("requestConsume error code : {0} , error message : {1}", error.getCode(), error.getMessage())); SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_BILLING_ITEM_RECODE_REQ, gS_BILLING_ITEM_RECODE_REQ); } this.RemoveRcoveryItemData(pItem); if (!this.m_ConsumeFailedList.Contains(pItem)) { this.m_ConsumeFailedList.Add(pItem); } }); } } else if (pItem == null) { TsLog.LogError("pItem == NULL", new object[0]); } }
public void onPaymentCompleted(NIAPPurchase result) { string arg = string.Empty; this.m_pResult = result; this.NStorePurchase(result.getOriginalPurchaseAsJsonText().dictionaryFromJson(), ref this.strProductID); arg = result.getSignature(); if (TsPlatform.IsBand) { this.Receipt.Append(string.Format("MarketType={0}&Signature={1}&SignedData={2}", "bandnaver", arg, result.getOriginalPurchaseAsJsonText())); } else { this.Receipt.Append(string.Format("MarketType={0}&Signature={1}&SignedData={2}", "naver", arg, result.getOriginalPurchaseAsJsonText())); } NrMyCharInfo myCharInfo = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo(); if (myCharInfo != null) { GS_BILLINGCHECK_REQ gS_BILLINGCHECK_REQ = new GS_BILLINGCHECK_REQ(); gS_BILLINGCHECK_REQ.i64ItemMallIndex = NrTSingleton <ItemMallItemManager> .Instance.GetItemIndex(this.strProductID); TKString.StringChar(this.Receipt.ToString(), ref gS_BILLINGCHECK_REQ.Receipt); SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_BILLINGCHECK_REQ, gS_BILLINGCHECK_REQ); PlayerPrefs.SetString(NrPrefsKey.SHOP_PRODUCT_ID, gS_BILLINGCHECK_REQ.i64ItemMallIndex.ToString()); PlayerPrefs.SetString(NrPrefsKey.SHOP_RECEIPT, this.Receipt.ToString()); if (TsPlatform.IsBand) { PlayerPrefs.SetString(NrPrefsKey.BAND_RECEIPT, result.getOriginalPurchaseAsJsonText()); } TsPlatform.FileLog(string.Format("TStorePurchaseComplete\nReceipt ={0} ProductID = {1} ItemMallIdex = {2}", this.Receipt, this.strProductID, gS_BILLINGCHECK_REQ.i64ItemMallIndex)); this.Receipt.Remove(0, this.Receipt.Length); } GS_BILLING_ITEM_RECODE_REQ gS_BILLING_ITEM_RECODE_REQ = new GS_BILLING_ITEM_RECODE_REQ(); gS_BILLING_ITEM_RECODE_REQ.i8Type = 1; gS_BILLING_ITEM_RECODE_REQ.i8Result = 0; gS_BILLING_ITEM_RECODE_REQ.i64ItemMallIndex = NrTSingleton <ItemMallItemManager> .Instance.GetItemIndex(this.strProductID); SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_BILLING_ITEM_RECODE_REQ, gS_BILLING_ITEM_RECODE_REQ); NrTSingleton <NrMainSystem> .Instance.m_bIsBilling = false; }