/// <summary> /// 对账单数据名称检测 /// </summary> /// <param name="names"></param> /// <param name="type"></param> /// <returns></returns> internal static bool CheckName(subString names, billType type) { switch (type) { case billType.ALL: return(names.Equals("交易时间,公众账号ID,商户号,子商户号,设备号,微信订单号,商户订单号,用户标识,交易类型,交易状态,付款银行,货币种类,总金额,代金券或立减优惠金额,微信退款单号,商户退款单号,退款金额,代金券或立减优惠退款金额,退款类型,退款状态,商品名称,商户数据包,手续费,费率")); case billType.SUCCESS: return(names.Equals("交易时间,公众账号ID,商户号,子商户号,设备号,微信订单号,商户订单号,用户标识,交易类型,交易状态,付款银行,货币种类,总金额,代金券或立减优惠金额,商品名称,商户数据包,手续费,费率")); case billType.REFUND: return(names.Equals("交易时间,公众账号ID,商户号,子商户号,设备号,微信订单号,商户订单号,用户标识,交易类型,交易状态,付款银行,货币种类,总金额,代金券或立减优惠金额,退款申请时间,退款成功时间,微信退款单号,商户退款单号,退款金额,代金券或立减优惠退款金额,退款类型,退款状态,商品名称,商户数据包,手续费,费率")); } return(false); }
/// <summary> /// 对账单数据 /// </summary> /// <param name="values"></param> /// <param name="type"></param> internal bill(subArray <subString> values, billType type) { switch (type) { case billType.ALL: if (values.Count != 24) { log.Default.Throw(log.exceptionType.IndexOutOfRange); } break; case billType.SUCCESS: if (values.Count != 18) { log.Default.Throw(log.exceptionType.IndexOutOfRange); } break; case billType.REFUND: if (values.Count != 26) { log.Default.Throw(log.exceptionType.IndexOutOfRange); } break; default: log.Default.Throw(log.exceptionType.IndexOutOfRange); break; } subString[] valueArray = values.UnsafeArray; time = valueArray[0]; appid = valueArray[1]; mch_id = valueArray[2]; //子商户号[3] device_info = valueArray[4]; transaction_id = valueArray[5]; out_trade_no = valueArray[6]; openid = valueArray[7]; trade_type = valueArray[8]; trade_state = valueArray[9]; bank_type = valueArray[10]; fee_type = valueArray[11]; total_fee = (uint)(decimal.Parse(valueArray[12]) * 100); coupon_fee = (uint)(decimal.Parse(valueArray[13]) * 100); int index = 14; if (type == billType.REFUND) { refund_apply_time = valueArray[index++]; refund_time = valueArray[index++]; } if (type != billType.SUCCESS) { refund_id = valueArray[index++]; out_refund_no = valueArray[index++]; refund_fee = (uint)(decimal.Parse(valueArray[index++]) * 100); coupon_refund_fee = (uint)(decimal.Parse(valueArray[index++]) * 100); refund_type = valueArray[index++]; refund_status = valueArray[index++]; } product_name = valueArray[index++]; packet = valueArray[index++]; fee = (uint)(decimal.Parse(valueArray[index++]) * 100); rates = valueArray[index++]; }