protected override Task RunAsync(UdpResult result, UdpShared udpshared) { return(Task.Factory.StartNew(() => { uint eid; if (udpshared.entities.TryGetValue(result.endPoint, out eid)) { ushort func = result.byteStream.GetUShort(); //DebugUtility.Log($"DealMsg::func::{func}"); using (IPay paylodable = udpshared.msgMaper.TakeMsgClone(func)) { if (paylodable == null) { return; } //DebugUtility.Log($"DealMsg::func::{func}"); paylodable.GetFrom(result.byteStream); ADealer dealer = udpshared.msgMaper.TakeDealer(func); Entity entity; if (udpshared.world.TryGetEntity(eid, out entity)) { dealer?.Run(entity, paylodable); } } //DebugUtility.Log($"DealMsg:: id::{entity.Id}"); } })); }
public PayResponseModel Pay(byte[] preMsg, string mac) { try { IPay PayObj = PaymentPlatFormFactory.GetPayFactory().GetPayObj(new ICCard()); return(PayObj.Pay(preMsg, mac)); } catch (System.Exception ex) { //针对农行卡 62 开头的卡假如输入简单密码是 //调用接口出现超时的情况。 //进行特殊的处理 返回代码 68 :交易超时,请重试 var w32ex = ex as Win32Exception; if (w32ex == null) { w32ex = ex.InnerException as Win32Exception; } if (w32ex != null && w32ex.ErrorCode.Equals(10060)) { return(new PayResponseModel() { ResponseCode = "68" }); } else { throw ex; } } }
/// <summary> /// 初始化支付 /// </summary> /// <param name="pay"></param> public void initSdkPay(IPay pay) { if (pay.isSupportInit) { pay.init(); } registerMessageReceiver(pay); }
public PayWrapper(IPay wrapped) { if (wrapped == null) { throw new ArgumentNullException(nameof(wrapped)); } _wrapped = wrapped; }
public void AddEmployee(IPay employee) { lista.Add(employee); if (EmployeeAdded != null) { EmployeeAdded(this, new EventArgs()); } }
internal void GetRent(IPay player) { player.Pay(this.Rent); this.Owner.TakePayment(this.Rent); string message = string.Format("{0} pay ${1} to {2} from {3} street.", player.Name, this.Rent, this.Owner.Name, this.Name); GameMessages.Instance.LastMessage = message; }
/// <summary> /// 支付 /// </summary> /// <param name="pay"></param> public void sdkPay(IPay pay, SinglePaySuccessCallback msinglePaySuccess = null) { this.mSinglePaySuccessCallback = msinglePaySuccess; #if UNITY_IPHONE pay.registerMessageReceiver(this.gameObject.name); #endif pay.pay(); }
public void Verify(IPay pay) { if (pay.IsPayed() == 1) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Allowed"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Forbidden"); } Console.ForegroundColor = ConsoleColor.White; }
private static IPay CreatePay(string payOption) { IPay pay = null; if (payOption == PayOption.ALIPAY.Id) { pay = new Alipay(); } else if (payOption == PayOption.WEIXIN.Id) { pay = new WeixinPay(); } return(pay); }
/// <summary> /// 获取支付对象 /// </summary> /// <param name="creditCard">银行卡</param> /// <param name="creditCard">加密设备</param> /// <returns></returns> public IPay GetPayObj(CreditCard creditCard) { Type type = creditCard.GetType(); IPay payObj = null; if (type.Name == "ICCard") { payObj = new ICCardPay(); } else if (type.Name == "MagCard") { payObj = new MagCardPay(); } return(payObj); }
public static PaidHandleResult PayReturn <T>(PayMethods pm, PayApiType pt, PayMointor <T> proc) where T : class { IPay _pay = null; if (pm == PayMethods.Alipay) { if (pt == PayApiType.Direct) { _pay = new AlipayRedirect(); } else if (pt == PayApiType.Normal) { _pay = new AlipayNormal(); } else if (pt == PayApiType.Mobile) { _pay = new AlipayMobile(); } else { _pay = new AlipayComfireApi(); } } else if (pm == PayMethods.Tenpay) { //财付通默认支持所有 _pay = new Tenpay.Tenpay(); } else if (pm == PayMethods.ChinaPay) { _pay = new ChinaPayApi(); } if (_pay == null) { SetLogMessage("不支持的支付方式"); return(PaidHandleResult.Fail); } else { return(_pay.Return(proc)); } }
private async void receve(Entity entity) { var websocket = entity.Get <NetworkData>().webSocket; while (true) { if (!world.HasEntity(entity.Id)) { return; } ByteStream stream = null; try { byte[] rec = await websocket.ReceiveAsync().ConfigureAwait(false); stream = ByteStream.Take(); stream.Set(rec); ushort func = stream.GetUShort(); using (IPay paylodable = maper.TakeMsgClone(func)) { if (paylodable == null) { return; } paylodable.GetFrom(stream); ADealer dealer = maper.TakeDealer(func); dealer?.Run(entity, paylodable); } } catch (Exception e) { DebugUtility.Error($"Error::{e}"); } finally { if (stream != null) { ByteStream.Return(stream); } } } }
/// <summary> /// 获取网关地址 /// </summary> /// <param name="pm"></param> /// <param name="pt"></param> /// <param name="ht"></param> /// <returns></returns> public static string GetGatewayStr(PayMethods pm, PayApiType pt, Hashtable ht) { IPay _pay = null; if (pm == PayMethods.Alipay) { if (ht.Contains("bank")) { pt = PayApiType.Direct; } if (pt == PayApiType.Direct) { _pay = new AlipayRedirect(); } else if (pt == PayApiType.Normal) { _pay = new AlipayNormal(); } else if (pt == PayApiType.Mobile) { _pay = new AlipayMobile(); } else { _pay = new AlipayComfireApi(); } } else if (pm == PayMethods.Tenpay) { //财付通默认支持所有 _pay = new Tenpay.Tenpay(); } else if (pm == PayMethods.ChinaPay) { _pay = new ChinaPayApi(); } return(_pay == null ? String.Empty : _pay.GetPayRequest(ht)); }
//------------------------------------------------------------------------- public Pay() { // Listen to all events for illustration purposes OpenIABEventManager.billingSupportedEvent += billingSupportedEvent; OpenIABEventManager.billingNotSupportedEvent += billingNotSupportedEvent; OpenIABEventManager.queryInventorySucceededEvent += queryInventorySucceededEvent; OpenIABEventManager.queryInventoryFailedEvent += queryInventoryFailedEvent; OpenIABEventManager.purchaseSucceededEvent += purchaseSucceededEvent; OpenIABEventManager.purchaseFailedEvent += purchaseFailedEvent; OpenIABEventManager.consumePurchaseSucceededEvent += consumePurchaseSucceededEvent; OpenIABEventManager.consumePurchaseFailedEvent += consumePurchaseFailedEvent; #if UNITY_ANDROID mIPay = new AndroidPay(); Debug.Log("AndroidPay::"); #elif UNITY_IOS mIPay = new IOSPay(); Debug.Log("IOSPay::"); #else Debug.LogError("Do not supported on this platform. "); #endif }
public void Load_Pay_Attr(string pPayType) { switch (pPayType) { case "zfb": //支付宝 iPay = new Pay_Attr_zfb(); break; case "gs": //工 case "ny": //农 case "zg": //中 case "js": //建 iPay = new Pay_Attr_yh(); break; //case "cft"://财 // iPay = new Pay_Attr_cft(); // break; default: break; } }
/// <summary> /// 获取支付字符串 /// </summary> /// <param name="request"></param> /// <returns></returns> public Response Execute(string request) { var req = JsonConvert.DeserializeObject <Request <PayInfo> >(request); var info = req.FirstEntity(); if (info.PayOption.IsNullOrEmpty()) { return(ResultHelper.Fail("没有设置支付方式。")); } IPay pay = CreatePay(info.PayOption); pay.SetPayId(info); if (info.AlipayId.IsNullOrEmpty()) { return(ResultHelper.Fail("没有设置支付宝帐号。")); } var result = ResultHelper.Success(); result.Tag = pay.GetPayString(info); return(result); }
public static string PayNotify <T>(PayMethods pm, PayApiType pt, PayMointor <T> proc) where T : class { IPay _pay = null; if (pm == PayMethods.Alipay) { if (pt == PayApiType.Direct) { _pay = new AlipayRedirect(); } else if (pt == PayApiType.Normal) { _pay = new AlipayNormal(); } else if (pt == PayApiType.Mobile) { _pay = new AlipayMobile(); } else { _pay = new AlipayComfireApi(); } } else if (pm == PayMethods.Tenpay) { //财付通默认支持所有 _pay = new Tenpay.Tenpay(); } else if (pm == PayMethods.ChinaPay) { _pay = new ChinaPayApi(); } return(_pay == null ? "不支持的支付方式" : _pay.Notify(proc)); }
public override void Run(Entity client, IPay patload) { Handle(client, (patload as PayloadPakcet <T>).value); }
public CIB(IPay pay) { this.pay = pay; }
public void ProcessPayment(IPay processor) { processor.ProcessPayment(); _logger.Log(_log); }
private void registerMessageReceiver(IPay pay) { mJavaObjectName = pay.getsinglepayClassPath(); registerMessageReceiver(this, mJavaObjectName); }
public static DateTime RefundAll(string storeId, string machineSn, int companyId, int reason, string paySn, decimal amount, string deviceSn, IPay pay, DateTime createdt) { var customOrderSn = new Pharos.Infrastructure.Data.Normalize.PaySn(companyId, storeId, machineSn); var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn); var shoppingcart = ShoppingCartFactory.Factory(storeId, machineSn, companyId, deviceSn); var uid = shoppingcart.MachineInformation.CashierUid; var datetime = dataAdapter.RefundAll(reason, paySn, amount, uid, pay.ApiCodes, pay.PayDetails.PaySn, customOrderSn.ToString(), createdt); customOrderSn.NextSerialNumber(); return(datetime); }
public DateTime SaveRecord(string storeId, string machineSn, int companyId, int reason, decimal amount, decimal receive, IPay pay, string deviceSn) { var dataAdapter = DataAdapterFactory.Factory(MachinesSettings.Mode, storeId, machineSn, companyId, deviceSn); var shoppingcart = ShoppingCartFactory.Factory(storeId, machineSn, companyId, deviceSn); var uid = shoppingcart.MachineInformation.CashierUid; string apiCodes = pay != null ? pay.ApiCodes : "-1"; DateTime saveTime = pay != null ? pay.PayDetails.CreateDt : DateTime.Now; var orderTime = dataAdapter.ChangeOrRefund(this, reason, shoppingcart.MachineInformation, this.CustomOrderSn, amount, receive, uid, apiCodes, saveTime, this.SaleMan, this.OldOrderSn); new Pharos.Infrastructure.Data.Normalize.PaySn(companyId, storeId, machineSn).NextSerialNumber(); return(orderTime); }
public PayResponseModel Query(byte[] preMsg, string mac) { IPay PayObj = PaymentPlatFormFactory.GetPayFactory().GetPayObj(new ICCard()); return(PayObj.Query(preMsg, mac)); }
public override void Run(Entity client, IPay patload) { client.Set((patload as PayloadPakcet <T>).value); }
public CIB(IPay a)//Ipay a=new Azer(); { gg = a; }
public abstract void Run(Entity client, IPay patload);
public CheckoutTime(IProduct product, IPay paymentMethod) { _product = product; _paymentMethod = paymentMethod; }
public void sendMessageToSDK(IPay pay) { pay.sendMessageToSDK(); }
public User(IPay purse) { _purse = purse; }