Ejemplo n.º 1
0
        /// <summary>
        /// Send Money from Business to Customer
        /// </summary>
        /// <param name="phone">Phone to Send money</param>
        /// <param name="amount">Amonunt</param>
        /// <param name="commandId">The type of transaction being perfomed</param>
        /// <param name="comment">Comments that are sent along with the transaction.</param>
        /// <param name="occasion">Occasion</param>
        public async Task <ApiResponse <Response> > SendMoney(string phone, string amount, B2CCommandIdEnum commandId = B2CCommandIdEnum.SalaryPayment, string comment = "B2C Payment", string occasion = "B2C Payment")
        {
            var requestId = ShortId.Generate(32);
            var response  = await PostHttp <Response>("/b2c/v1/paymentrequest", new Dictionary <string, string>
            {
                { "InitiatorName", Options.Initiator },
                { "SecurityCredential", Options.SecurityCredential },
                { "CommandID", commandId.ToString() },
                { "Amount", amount },
                { "PartyA", Options.ShortCode },
                { "PartyB", phone },
                { "Remarks", comment },
                { "Occassion", occasion },
                { "QueueTimeOutURL", $"{Options.GetQueueTimeoutURL(requestId)}/b2c" },
                { "ResultURL", $"{Options.GetResultRL(requestId)}/b2c" },
            });

            var res = response.ToApiResponse();

            if (res.Success)
            {
                res.Data.RequestId = requestId;
            }
            return(res);
        }
Ejemplo n.º 2
0
 public Task<ApiResponse<Response>> SendMoney(string phone, string amount, B2CCommandIdEnum commandId = B2CCommandIdEnum.SalaryPayment, string remarks = "B2C Payment") =>
     api.B2CClient.SendMoney(phone, amount, commandId, remarks);