public IActionResult Post([FromBody] Payments paymentParam) { var request = new RestRequest("api/Bank/", Method.POST) { RequestFormat = DataFormat.Json }; paymentParam.AccountNumber = 3; // merchant account num request.AddJsonBody(paymentParam); var response = _client.Execute <Payments>(request); dynamic responseObj = JsonConvert.DeserializeObject(response.Content.ToString()); if ((bool)responseObj.isSuccess) { var transact = new GatewayTransaction() { AccountNumber = paymentParam.AccountNumber, Amount = paymentParam.Amount, CardNumber = CardMasker.Mask(paymentParam.CardNumber.ToString()), Status = "success", TransactionDate = DateTime.Now, MerchantId = 2, }; _transactService.CreateTransaction(transact); } return(Ok((bool)responseObj.isSuccess)); }
public PaymentResponse CreateTransaction(GatewayTransaction transaction) { var response = new PaymentResponse(); try { var paymentTransaction = new PaymentTransaction() { Id = Guid.NewGuid(), AccountNumber = transaction.AccountNumber, Amount = transaction.Amount, CardNumber = transaction.CardNumber, MerchantId = transaction.MerchantId, TransactionDate = transaction.TransactionDate, Status = "success" }; _repository.Insert(paymentTransaction); _repository.Save(); response.Id = Guid.NewGuid(); response.IsSuccess = true; } catch (Exception ex) { _logger.Error(this.GetType().Name + ex.Message); } return(response); }
async Task DataReceivedOnChannel(DataReceivedOnChannelArgs e) { using (e.Data) { var callInfo = ChannelReceiverHeaderReader.GetCallInfo(e); Logger.DebugFormat("Received message of type {0} for client id: {1}", callInfo.Type, callInfo.ClientId); using (var scope = GatewayTransaction.Scope()) { switch (callInfo.Type) { case CallType.SingleCallDatabusProperty: await HandleDatabusProperty(callInfo).ConfigureAwait(false); break; case CallType.SingleCallSubmit: await HandleSubmit(callInfo).ConfigureAwait(false); break; default: throw new Exception("Unknown call type: " + callInfo.Type); } scope.Complete(); } } }
void DataReceivedOnChannel(object sender, DataReceivedOnChannelArgs e) { using (e.Data) { var callInfo = ChannelReceiverHeaderReader.GetCallInfo(e); Logger.DebugFormat("Received message of type {0} for client id: {1}", callInfo.Type, callInfo.ClientId); using (var scope = GatewayTransaction.Scope()) { switch (callInfo.Type) { case CallType.SingleCallDatabusProperty: HandleDatabusProperty(callInfo); break; case CallType.SingleCallSubmit: HandleSubmit(callInfo); break; default: receiver.DispatchReceivedCallInfo(callInfo); break; } scope.Complete(); } } }
public SingleCallChannelReceiver(IChannelFactory channelFactory, IDeduplicateMessages deduplicator, DataBusHeaderManager headerManager, GatewayTransaction transaction) { this.channelFactory = channelFactory; this.deduplicator = deduplicator; this.headerManager = headerManager; this.transaction = transaction; }
public Action <TransportReceiver> GetReceiverCustomization() { return(transport => { transport.TransactionSettings.TransactionTimeout = GatewayTransaction.Timeout(transport.TransactionSettings.TransactionTimeout); }); }
void DataReceivedOnChannel(object sender, DataReceivedOnChannelArgs e) { using (e.Data) { var callInfo = ChannelReceiverHeaderReader.GetCallInfo(e); Hasher.Verify(callInfo.Data, callInfo.Md5); Logger.DebugFormat("Received message of type {0} for client id: {1}", callInfo.Type, callInfo.ClientId); using (var scope = GatewayTransaction.Scope()) { DispatchReceivedCallInfo(callInfo); scope.Complete(); } } }
async Task DataReceivedOnChannel(DataReceivedOnChannelArgs e, CancellationToken cancellationToken) { using (e.Data) { var callInfo = ChannelReceiverHeaderReader.GetCallInfo(e); Logger.DebugFormat("Received message of type {0} for client id: {1}", callInfo.Type, callInfo.ClientId); if (useTransactionScope) { using (var scope = GatewayTransaction.Scope()) { await Receive(callInfo).ConfigureAwait(false); scope.Complete(); } } else { // create no transaction scope to avoid that only the persistence or the transport enlist with a transaction. // this would cause issues when commiting the transaction fails after the persistence or transport operation has succeeded. await Receive(callInfo).ConfigureAwait(false); } } async Task Receive(CallInfo callInfo) { switch (callInfo.Type) { case CallType.SingleCallDatabusProperty: await HandleDatabusProperty(callInfo, cancellationToken).ConfigureAwait(false); break; case CallType.SingleCallSubmit: await HandleSubmit(callInfo, cancellationToken).ConfigureAwait(false); break; default: throw new Exception("Unknown call type: " + callInfo.Type); } } }