public void HostNode() { using (var client = ScsServiceClientBuilder.CreateClient <IHostNodeRequestService>(new ScsTcpEndPoint(Ip, Port))) { client.Connect(); string nameLocation = "800 LANGDON ST, MADISON AU"; string posEntryMode = "021"; string posCondCode = "41"; // Cash Dispenser Machine (ATM) TranHostNodeRequestDto hostReq = new TranHostNodeRequestDto { P3ProcessingCode = "11", // from triton P4AmountTran = 12000, // from triton P7TransmitDt = DateTime.Now, //P11Stan = 1, P12TimeLocalTran = DateTime.Now, P13DateLocalTran = DateTime.Now, P15DateSettlement = DateTime.Now.AddDays(+1), P18MerchantType = "5811", P25PosConditionCode = posCondCode, P28AmtTranFee = 200, // from triton P35Track2 = "5188680100002932=15122015076719950000", // from triton v P41TerminalId = "S9218163", // from triton P43NameLocation = nameLocation, P52PinBlock = "A8FB4E47EACB0FA1", // from triton P57AmountCash = 0 // from triton }; TranHostNodeResponseDto hostRes = client.ServiceProxy.RequestTransaction(hostReq); // Send to HostNode } }
public TranCoreNodeResponseDto RequestTransaction(TranTritonNodeRequestDto req) { using (var client = ScsServiceClientBuilder.CreateClient <IHostNodeRequestService>(new ScsTcpEndPoint(Config.HostIpAddress, Config.HostPort))) { client.Connect(); TranCoreNodeResponseDto autResponseDto; IAuthorizationService svr = new AuthorizationService(); TranHostNodeRequestDto autReq = svr.AuthorizationRequest(req); if (autReq != null) { _log.Debug("Sending Core Request Object"); TranHostNodeResponseDto res = client.ServiceProxy.RequestTransaction(autReq); // Send to HostNode _log.Debug("Getting Host Response Object"); autResponseDto = new TranCoreNodeResponseDto { Stan = res.Stan, ResponseCode = res.ResponseCode, ResponseDescription = res.ResponseDescription, ResponseAction = res.ResponseAction, AmountTran = res.AmountTran, AmtTranFee = res.AmtTranFee, AmountCash = res.AmountCash, TranSeqNo = res.TranSeqNo }; } else { _log.Debug("Pin Translation failed, sending response."); //send response back to terminal for decline autResponseDto = new TranCoreNodeResponseDto { ResponseCode = "99", ResponseDescription = "Pin Translation Error", ResponseAction = "Decline transaction", TranSeqNo = req.TranSeqNo, AmountTran = req.Amount1, AmtTranFee = req.Amount2 }; } return(autResponseDto); } }
public TranHostNodeRequestDto AuthorizationRequest(TranTritonNodeRequestDto req) { TranHostNodeRequestDto requestDto; ICryptographyService svr = new CryptographyService(req.TerminalId); var translateResult = svr.TranslatePin(req.PinBlock, req.Track2); //string nameLocation = "800 LANGDON ST, MADISON AU"; string nameLocation = svr.GetTerminalLocation(); string merchantType = "5811"; if (translateResult != null && translateResult.ErrorCode == "00") //if (translateResult != null) { _log.Debug("Constructing Core Request Object"); requestDto = new TranHostNodeRequestDto { P3ProcessingCode = req.TransactionCode, // from triton P4AmountTran = req.Amount1, // from triton P7TransmitDt = DateTime.Now, P12TimeLocalTran = DateTime.Now, P13DateLocalTran = DateTime.Now, P15DateSettlement = DateTime.Now.AddDays(+1), P18MerchantType = merchantType, P25PosConditionCode = req.PosCondCode, // from triton P28AmtTranFee = req.Amount2, // from triton P35Track2 = req.Track2, // from triton P41TerminalId = req.TerminalId, // from triton P43NameLocation = nameLocation, P52PinBlock = translateResult.PinBlock, // translated pin P57AmountCash = req.TransactionCode == "11" || req.TransactionCode == "12" || req.TransactionCode == "15" ? req.Amount1 : 0, // from triton TranSeqNo = req.TranSeqNo, // from triton MiscellaneousX = req.MiscellaneousX, // 55 }; } else { requestDto = null; } return(requestDto); }
public TranHostNodeResponseDto RequestTransaction(TranHostNodeRequestDto req) { ITransactionService svc = new TransactionService(); _log.Debug("Creating Transaction Request"); AuthorizationRequestModel model = svc.RequestTranAuthorization(req); byte[] rawBytes = _responseBuilder.RequestTranAuthorization(model); _log.Debug("Get Transaction Response"); try { BaseModel res = _bank.Send(rawBytes, model.Stan); if (res is TransactionModel) { TransactionModel tran = res as TransactionModel; TranHostNodeResponseDto responseDto = new TranHostNodeResponseDto { Stan = tran.Stan, ResponseCode = tran.RespCode, ResponseDescription = tran.RespDescription, ResponseAction = tran.RespAction, AmountTran = tran.AmountTran, AmtTranFee = tran.AmtTranFee, AmountCash = tran.AmountCash, TranSeqNo = model.TranSeqNo// set from request model }; return(responseDto); } else { throw new InvalidOperationException("incorrect responsed from Bank"); } } catch (Exception) { throw; } }
public AuthorizationRequestModel RequestTranAuthorization(TranHostNodeRequestDto dto) { _log.Debug("Creating TransactionModel Request"); string cardAcceptorId = "437586000 "; // p42_card_acceptor_id string nationalData = @"TCC01\EFC00000000\CCI0\FBKV\"; // p47_additional_response_national int securityBlock = 2; // 53 string destKeyRow = "29365A0400000000"; // 64 int acq_inst_id = 560258; // 32 string mti = "0200"; AuthorizationRequestModel trn = new AuthorizationRequestModel ( mti: mti, processingCode: dto.P3ProcessingCode, transactionAmount: dto.P4AmountTran, transactionDate: dto.P7TransmitDt, stan: _rrnSequence.GetStan, timeLocal: dto.P12TimeLocalTran, dateLocation: dto.P13DateLocalTran, dateSettlement: dto.P15DateSettlement, merchantType: dto.P18MerchantType, posConditionCode: dto.P25PosConditionCode, transactionFee: dto.P28AmtTranFee, acqInstIdCode: acq_inst_id, track2: dto.P35Track2, retRefNo: dto.TranSeqNo, terminalId: dto.P41TerminalId, cardAcptIdCode: cardAcceptorId, nameLocation: dto.P43NameLocation, addtlDataNat: nationalData, pinBlock: dto.P52PinBlock, secControlInfo: securityBlock, amountCash: dto.P57AmountCash, mac64: destKeyRow, miscellaneousX: dto.MiscellaneousX ); return(trn); }