Ejemplo n.º 1
0
        public IActionResult InitiateTransfer(SendMoneyViewModel sendMoneyViewModel)
        {
            var initiatetransfer = new InitiateTransferRequestModel
            {
                reason    = sendMoneyViewModel.reason,
                source    = "balance",
                amount    = sendMoneyViewModel.amount,
                recipient = sendMoneyViewModel.recipientcode,
                currency  = "NGN"
            };

            var result1 = _transfer.InitiateTransfer(initiatetransfer);
            var message = result1.Result.Result.message;

            if (result1.Result.Result.status == "true")
            {
                TempData["notification"] = "Transfer Initiated Successfully";
                TempData["notifytype"]   = NotificationType.success;
            }
            else
            {
                TempData["notification"] = message;
                TempData["notifytype"]   = NotificationType.error;
            }


            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        //This method is used to initiate transfer from paystack endpoint
        public async Task <InitiateTransferResponseModel> InitiateTransfer(InitiateTransferRequestModel initiateTransferRequest)
        {
            string url    = $"{_configuration["PaystackEndPoints:baseUrl"]}" + $"{_configuration["PaystackEndPoints:InitiateTransfer"]}";
            var    result = await _requestClient.PostRequestAsync <InitiateTransferRequestModel, InitiateTransferResponseModel>(url, initiateTransferRequest);

            return(result);
        }
Ejemplo n.º 3
0
        public async Task <ServiceResponse <InitiateTransferResponseModel> > InitiateTransfer(InitiateTransferRequestModel initiateTransferRequest)
        {
            ServiceResponse <InitiateTransferResponseModel> serviceResponse = new ServiceResponse <InitiateTransferResponseModel>();

            try
            {
                var result = await _transferClient.InitiateTransfer(initiateTransferRequest);

                serviceResponse.Result = result;
                return(serviceResponse);
            }
            catch (Exception ex)
            {
                return(serviceResponse);
            }
        }