Esempio n. 1
0
        public ResponseToTransfer ToTransfer(RequestTransfer requestTransfer)
        {
            ResponseToTransfer objToTransfer = new ResponseToTransfer();
            decimal            transfer_amount;
            //1: ORIGEN (AL QUE SE LE RESTA) 2: DESTINO(EL QUE RECIBE)
            string identification1, name1, identification2, name2, description;

            identification1 = requestTransfer.Identifier_Root;
            identification2 = requestTransfer.Identifier_To_Affect;
            name1           = requestTransfer.Account_Root;
            name2           = requestTransfer.Account_To_Affect;
            description     = "";
            transfer_amount = requestTransfer.Balance_To_Transfer;
            try
            {
                entities.bankTransfer(transfer_amount, identification1, name1, identification2, name2, description);
                objToTransfer.Success = true;
                objToTransfer.Message = "La transferencia se hizo con exito!";
            }
            catch
            {
                objToTransfer.Success = false;
                objToTransfer.Message = "La transferencia no se hizo con exito, intentelo mas tarde";
            }

            return(objToTransfer);
        }
Esempio n. 2
0
        public ResponseToTransfer TransferToProperBankAccount(string identifier1, string identifier2, string account1, string account2, decimal balance, string pin)
        {
            RequestTransfer    v = new RequestTransfer(identifier1, identifier2, account1, account2, balance, pin);
            ResponseToTransfer y = ResponseToTransfer.ResponseToATransfer(v);

            return(y);
        }
Esempio n. 3
0
        public RequestTransfer[] GetTransferRequests(string docNum)
        {
            Recordset recordset = null;

            RequestTransfer[]           requestTransfers = null;
            Dictionary <string, string> paramaters       = new Dictionary <string, string>();

            try {
                paramaters.Add("DocNum", docNum);
                string query = this.GetSQL("GetTransferRequest").Inject(paramaters);
                recordset = (Recordset)DIApplication.Company.GetBusinessObject(BoObjectTypes.BoRecordset);
                recordset.DoQuery(query);

                if (recordset.RecordCount > 0)
                {
                    requestTransfers = new RequestTransfer[recordset.RecordCount];
                    for (int i = 0; i < recordset.RecordCount; i++)
                    {
                        var transferRequest = new RequestTransfer();
                        Parallel.ForEach(recordset.Fields.OfType <Field>(), field => {
                            transferRequest.GetType().GetProperty(field.Name).SetValue(transferRequest, field.Value);
                        });
                        requestTransfers[i] = transferRequest;
                        recordset.MoveNext();
                    }
                }
            }
            catch (Exception ex) {
                HandleException(ex, "GetTransferItems");
            }
            return(requestTransfers);
        }
Esempio n. 4
0
        public ResponseToTransfer Transfer(string identifier1, string identifier2, string account1, string account2, decimal balance, string pin)
        {
            RequestTransfer    transfer1 = new RequestTransfer(identifier1, identifier2, account1, account2, balance, pin);
            ResponseToTransfer transfer2 = ResponseToTransfer.ResponseToATransfer(transfer1);

            return(transfer2);
        }
Esempio n. 5
0
        public ResponseToTransfer TransferenciaCuentaPropia(string identifier_Root, string identifier_To_Affect, string account_Root, string account_To_Affect,
                                                            decimal balance, string pin)
        {
            RequestTransfer request = new RequestTransfer(identifier_Root, identifier_To_Affect, account_Root, account_To_Affect,
                                                          balance, pin);
            ResponseToTransfer response = ResponseToTransfer.ResponseToATransfer(request);

            return(response);
        }
 private RequestTransfer SetRequestTransferStartedTime(RequestTransfer payload)
 {
     payload.TransferStarted = DateTime.Now;
     return(payload);
 }
 public async Task <IActionResult> RequestTransfer([FromBody] RequestTransfer payload) =>
 Ok(await ExecuteTransaction(CreateSignedToken(SetRequestTransferStartedTime(payload)).ToTokenString()));
Esempio n. 8
0
        public OutputValues TransferInteractiontoAgent(int proxyClientId, string interactionID, string agentID)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestTransfer requestTransfer = RequestTransfer.Create();
                requestTransfer.ProxyClientId = proxyClientId;
                requestTransfer.InteractionId = interactionID;
                requestTransfer.AgentId       = agentID;
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestTransfer);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------Transfer Interaction to agent-------------");
                            logger.Info("AgentID  :" + requestTransfer.AgentId);
                            logger.Info("ProxyClientId  :" + requestTransfer.ProxyClientId);
                            logger.Info("InteractionId  :" + requestTransfer.InteractionId);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Transfer interaction Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Transferring Interaction to Agent-------------");
                            logger.Info("AgentID  :" + requestTransfer.AgentId);
                            logger.Info("ProxyClientId  :" + requestTransfer.ProxyClientId);
                            logger.Info("InteractionId  :" + requestTransfer.InteractionId);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Error("Error occurred while transferring  interaction : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Transfer Interaction UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("TransferInteraction() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while transfer the interaction" + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }