using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using LitJson;
using MySystem;
using MySystem.Models.Main;

namespace MySystem
{
    /// <summary>
    /// 订单申请分账参数赋值
    /// </summary>
    public class OrderDivideAccountsUtil
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="applyNo">批次号</param>
        /// <param name="mchtNo">慧掌柜商户号</param>
        /// <param name="orderNo">交易订单号（好哒平台订单号，G开头）</param>
        /// <param name="acctNo">账户号，账户类型为商户收款账户时填收款商户号, 账户类型为分账接收方时填分账接收方账户号</param>
        /// <param name="acctType">账户类型（0：商户收款账户（大B），1：分账接收方账户（小B））</param>
        /// <param name="amount">金额（分）</param>
        /// <returns></returns>
        public static OrderDivideAccounts AddValue(string applyNo, string mchtNo, string orderNo, string acctNo, string sacctNo, string acctType, string amount, string seviceAmount)
        {
            OrderDivideAccounts orderDivideAccounts = new OrderDivideAccounts();
            orderDivideAccounts.applyNo = applyNo;
            orderDivideAccounts.mchtNo = mchtNo;
            orderDivideAccounts.orderNo = orderNo;
            List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
            Dictionary<string, object> obj = new Dictionary<string, object>();
            //分账接收方账户
            obj = new Dictionary<string, object>();
            obj.Add("acctNo", "230817000000000278");
            obj.Add("acctType", "1");
            obj.Add("amount", seviceAmount);
            list.Add(obj);

            //商户收款账户
            obj = new Dictionary<string, object>();
            obj.Add("acctNo", sacctNo);
            obj.Add("acctType", "0");
            obj.Add("amount", amount);

            list.Add(obj);
            orderDivideAccounts.detail = list;
            return orderDivideAccounts;
        }
    }
}