public static TransactionResult Decode(IByteReader stream) { TransactionResult decodedTransactionResult = new TransactionResult(); decodedTransactionResult.FeeCharged = Int64.Decode(stream); decodedTransactionResult.Result = TransactionResultResult.Decode(stream); decodedTransactionResult.Ext = TransactionResultExt.Decode(stream); return decodedTransactionResult; }
public static TransactionResult<Task> Save(Task task) { TransactionResult<Task> result = new TransactionResult<Task>(); try { var db = Database.GetDataContext(); if (task.Id == 0) { db.Tasks.InsertOnSubmit(task); db.SubmitChanges(); } else { if (!db.Tasks.IsAttached(task)) { db.Tasks.Attach(task, true); } db.SubmitChanges(); } result.Data = task; result.NumEffected = 1; result.Success = true; } catch (Exception ex) { result.Success = false; result.Error = ex; } return result; }
public static TransactionResult<List<Task>> GetAll() { TransactionResult<List<Task>> result = new TransactionResult<List<Task>>(); var db = Database.GetDataContext(isReadOnly: true); var data = db.Tasks.ToList(); result.Data = data; result.Success = true; result.NumEffected = data.Count; return result; }
public TransactionResult CreatePaymentOrder(string customerId, PaymentOrder paymentOrder, string language) { var transactionResult = new TransactionResult(false, ""); paymentOrder.CustomerId = customerId; paymentOrder.PreviousExecutionDate = paymentOrder.ExpirationDate; try { orderManager.InsertPaymentOrder(paymentOrder); } catch (Exception) { transactionResult.HasError = true; transactionResult.Message = language == "greek" ? "Σφάλμα κατά την δημιουργία της πάγιας εντολής πληρωμής" : "There was an error while creating the order"; } return(transactionResult); }
public int ModificarCliente(Cliente item) { if (_listaclientes.Any(o => o.Dni == item.Dni && o.Id != item.Id)) { throw new ReservasException("El DNI se encuentra registrado"); } TransactionResult resultado = ClienteMapper.Update(item); if (resultado.IsOk) { ClienteCache(); return(resultado.Id); } else { throw new ReservasException(resultado.Error); } }
private PaymentRecord GetPaymentRecordFromBankTransaction(TransactionResult bankTransactionResult, BankTransaction bankTransaction) { return(new PaymentRecord() { Id = bankTransactionResult.TransactionId, CompanyId = bankTransaction.CompanyId, Amount = bankTransaction.Amount, CardExpirationMonth = bankTransaction.CardExpirationMonth, CardExpirationYear = bankTransaction.CardExpirationYear, CardName = bankTransaction.CardHolderName, CardNumber = bankTransaction.CardNumber, Currency = bankTransaction.Currency, Cvv = bankTransaction.Cvv, TransactionStatus = bankTransactionResult.TransactionStatus, TransactionDate = DateTime.UtcNow }); }
TransactionResult AddDataTransaction(MutableData mutableData) { List<object> datas = mutableData.Value as List<object>; if (datas == null) { datas = new List<object>(); } Dictionary<string, object> newData = new Dictionary<string, object>(); newData["Food"] = food; newData["Gold"] = gold; newData["Jewelry"] = jewelry; datas.Add(newData); mutableData.Value = datas; return TransactionResult.Success(mutableData); }
private TransactionResult SaveManyToManyRelations() { TransactionResult result = new TransactionResult(SQLiteErrorCode.Ok, null); foreach (var column in this.manyToManyRelations) { var genericArgs = column.PropertyType.GetGenericArguments(); var genericDict = column.GetGetMethod().Invoke(this, null); var concreteDict = genericDict.GetType().MakeGenericType(genericArgs) as IDictionary; foreach (var model in concreteDict.Values) { result = ((Model)model).Save(); } } return(result); }
public static TransactionResult ProcessRefund(TransactionRequest refundRequest, StripeSettings stripeSettings, ILogger logger) { InitStripe(stripeSettings, true); var refundService = new RefundService(); var order = refundRequest.Order; var address = order.BillingAddressSerialized.To <Address>(); GetFinalAmountDetails(refundRequest.Amount ?? refundRequest.Order.OrderTotal, refundRequest.Order.CurrencyCode, address, out _, out var amount); var refundOptions = new RefundCreateOptions { Charge = refundRequest.GetParameterAs <string>("chargeId"), Amount = 100 * (long)(amount), }; var refund = refundService.Create(refundOptions); var refundResult = new TransactionResult() { TransactionGuid = Guid.NewGuid().ToString(), ResponseParameters = new Dictionary <string, object>() { { "sourceTransferReversalId", refund.SourceTransferReversalId }, { "balanceTransactionId", refund.BalanceTransactionId }, { "chargeId", refund.ChargeId }, { "receiptNumber", refund.ReceiptNumber }, }, OrderGuid = refundRequest.Order.Guid, TransactionCurrencyCode = refund.Currency, TransactionAmount = (decimal)refund.Amount / 100 }; if (refund.Status == "failed") { logger.Log <TransactionResult>(LogLevel.Warning, "The refund for Order#" + refundRequest.Order.Id + " by stripe failed." + refund.FailureReason); refundResult.Success = false; refundResult.Exception = new Exception("An error occurred while processing refund"); return(refundResult); } if (refund.Status == "succeeded") { refundResult.NewStatus = refundRequest.IsPartialRefund ? PaymentStatus.RefundedPartially : PaymentStatus.Refunded; refundResult.Success = true; } return(refundResult); }
private async Task GetTransactionBaobeiInfosAsync(DateTime date, ResultViewModel result, List <Price> relatedPrices) { var ordersQuery = from o in _dbContext.Orders join b in _dbContext.Baobeis on o.OrderId equals b.OrderId where o.OriginSourceDate != null && o.OriginSourceDate.Value.Date == date.Date select new { OrderId = o.OrderId, OrderTotalAmout = o.Amount, BaobeiId = b.BaobeiExternalId, BaobeiTitle = b.BaobeiTitle, BaobeiQuantity = b.Quantity }; var orderBaobeis = await ordersQuery.ToListAsync(); var orderGroups = orderBaobeis.GroupBy(p => p.OrderId); foreach (var group in orderGroups) { var transaction = new TransactionResult { OrderId = group.Key, BaobeiResults = new List <BaobeiResultViewModel>(), FeeResults = new List <FeeResultPerTransaction>() }; result.Transactions.Add(transaction); foreach (var item in group) { var price = relatedPrices.FirstOrDefault(p => p.BaobeiId == item.BaobeiId); if (price == null) { price = relatedPrices.FirstOrDefault(p => p.BaobeiId == item.BaobeiTitle); } transaction.BaobeiResults.Add(new BaobeiResultViewModel { BaobeiId = (item.BaobeiId ?? "").ToUpper() == "NULL" ? item.BaobeiTitle : item.BaobeiId, BaobeiTitle = item.BaobeiTitle, Quantity = item.BaobeiQuantity, Amount = (price == null ? 0 : ((price.UnitPriceInEuro ?? 0) * item.BaobeiQuantity)) }); } } }
TransactionResult AddScoreTransaction(MutableData mutableData) { List <object> leaders = mutableData.Value as List <object>; if (leaders == null) { leaders = new List <object>(); } else if (mutableData.ChildrenCount >= MaxScores) { long maxTime = 0; object maxVal = null; foreach (var child in leaders) { if (!(child is Dictionary <string, object>)) { continue; } long childTime = (long)((Dictionary <string, object>)child)["time"]; if (childTime > maxTime) { maxTime = childTime; maxVal = child; } } // Not fast enough if (maxTime < finishTime) { return(TransactionResult.Abort()); } // Kick lowest score leaders.Remove(maxVal); } // Insert new player record time Dictionary <string, object> newScoreMap = new Dictionary <string, object>(); newScoreMap["time"] = finishTime; newScoreMap["playerName"] = playerName; leaders.Add(newScoreMap); mutableData.Value = leaders; return(TransactionResult.Success(mutableData)); }
private void SilentPostCharge(TransactionsData data) { string sendStr = BuildUrlStringToSend(data); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(sendStr); webReq.Method = "GET"; try { HttpWebResponse webRes = (HttpWebResponse)webReq.GetResponse(); StreamReader sr = new StreamReader(webRes.GetResponseStream()); string resStr = sr.ReadToEnd(); if (!string.IsNullOrEmpty(resStr)) { TransactionResult transResult = new TransactionResult(); string[] resParts = resStr.Split('&'); if (resParts != null && resParts.Length > 0) { string reply = resParts.ToList().Where(l => l.StartsWith("Reply")).Select(l => l).FirstOrDefault(); string[] replyParts = reply.Split('='); if (replyParts?.Length > 1) { transResult.Code = replyParts[1]; } string replyDesc = resParts.ToList().Where(l => l.StartsWith("ReplyDesc")).Select(l => l).FirstOrDefault(); string[] descParts = replyDesc.Split('='); if (descParts?.Length > 1) { transResult.Description = descParts[1]; } } Session["TransactionResult"] = transResult; } Response.Redirect("TransResult.aspx"); } catch (Exception ex) { Response.Write(ex.Message); } }
public static TransactionResult<Task> Get(int id) { TransactionResult<Task> result = new TransactionResult<Task>(); try { var db = Database.GetDataContext(isReadOnly: true); var data = db.Tasks.SingleOrDefault(c => c.Id.Equals(id)); result.Data = data; result.Success = true; result.NumEffected = 1; } catch (Exception ex) { result.Success = false; result.Error = ex; } return result; }
public ITransactionVoidResult Void(ITransactionVoidRequest request) { //to void a transaction, we'll need capture id or authorization id previously obtained from paypal var transactionId = request.GetParameterAs <string>(PaymentParameterNames.AuthorizationId); if (string.IsNullOrEmpty(transactionId)) { transactionId = request.GetParameterAs <string>(PaymentParameterNames.CaptureId); } //create a capture request for paypal var doVoidRequest = new DoVoidReq() { DoVoidRequest = new DoVoidRequestType() { Version = ApiVersion, AuthorizationID = transactionId } }; //get the service for paypal api var service = GetPayPalApiInterfaceServiceService(); var paypalResponse = service.DoVoid(doVoidRequest); var result = new TransactionResult(); string error; var success = PayPalHelper.ParseResponseSuccess(paypalResponse, out error); if (success) { result.Success = true; result.SetParameter(PaymentParameterNames.RefundId, paypalResponse.AuthorizationID); result.SetParameter(PaymentParameterNames.RefundResult, paypalResponse.Ack); } else { result.SetParameter(PaymentParameterNames.ErrorMessage, error); } return(result); }
public static void InsertarCliente(Cliente cliente) { if (ExisteCliente(cliente)) { throw new ClienteExistenteException(cliente.Id); } else { TransactionResult result = ClienteMapper.Insert(cliente); if (!result.IsOk) { throw new ErrorServidorException(result.Error); } else { RefrescarCache(); } } }
public TransactionResult Trade(Signal s) { var result = new TransactionResult() { Signal = s }; var history_transaction = repo.GetStockTransactionWithRedis(s.Code, s.StartTradingTime, s.StartTradingTime); double total_amount = 0; double total_volume = 0; foreach (var tr in history_transaction) { var average = tr.Amount / tr.Volume; switch (s.Type) { case TradingType.Ask: if (average >= s.Price) { total_volume += simu_trading_ratio * tr.Volume; total_amount += simu_trading_ratio * tr.Amount; } break; case TradingType.Bid: if (average <= s.Price) { total_volume += simu_trading_ratio * tr.Volume; total_amount += simu_trading_ratio * tr.Amount; } break; default: break; } if (total_volume >= tr.Volume) { break; } } result.TradedAmount = total_amount; result.TradedVolume = total_volume; return(result); }
public TransactionResult CreateEmptyBebillitem(string orderId) { if (string.IsNullOrEmpty(orderId)) throw new ArgumentException("The value cannot be empty", "orderId"); using (var session = this.store.Write()) { if (session.Data.BebillTransactions.ContainsKey(orderId)) return session.Data.BebillTransactions[orderId]; var item = new TransactionResult { OrderId = orderId, }; session.Data.BebillTransactions.Add(orderId, item); session.Save(); return item; } }
public TransactionResult GetTransactionDetails(int transactionNumber) { Log.InfoFormat("Calling GetTransactionDetails for TransactionNumber:{0}.", transactionNumber); string hash = _hasher.Create(_payExSettings.AccountNumber, transactionNumber, _payExSettings.EncryptionKey); string xmlResult = _orderFacade.GetTransactionDetails(_payExSettings.AccountNumber, transactionNumber, hash); TransactionResult result = _resultParser.Deserialize <TransactionResult>(xmlResult); if (result.Status.Success) { Log.InfoFormat("Successfully called GetTransactionDetails for TransactionNumber:{0}. Result:{1}", transactionNumber, xmlResult); } else { Log.ErrorFormat("Error when calling GetTransactionDetails for TransactionNumber:{0}. Result:{1}", transactionNumber, xmlResult); } return(result); }
static async Task MakeTransaction(TransactionType transactionType) { Console.WriteLine(); Console.Write("Enter the Amount: "); var transactionAmount = Console.ReadLine(); Console.WriteLine(); Console.WriteLine(transactionType.ToString()); Console.WriteLine(); var transactionInput = new TransactionInput() { TransactionType = transactionType, Amount = Math.Round(Convert.ToDecimal(transactionAmount), 2) }; var transactionResult = new TransactionResult(); if (transactionType == TransactionType.Deposit) { transactionResult = await DepositAsync(transactionInput); } else if (transactionType == TransactionType.Withdrawal) { transactionResult = await WithdrawAsync(transactionInput); } if (transactionResult.IsSuccessful) { Console.WriteLine($"Status: {transactionResult.Message}"); Console.WriteLine($"Account No: {transactionResult.AccountNumber}"); Console.WriteLine($"Current Balance: {transactionResult.Balance}"); Console.WriteLine($"Currency: {transactionResult.Currency}"); } else { Console.WriteLine($"Status: Transaction failed"); Console.WriteLine($"Message: {transactionResult.Message}"); } Console.WriteLine(); }
public async Task <IHttpActionResult> CheckoutToViva(VivaWalletTokenModel vivaWalletModel, int fundingPackageId) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } using (var s = new UserFundingRepository()) { TransactionResult task = await s.ChargeAsync(vivaWalletModel.vivaWalletToken); if (task == null) { return(BadRequest()); } return(Ok(task)); } }
public TransactionResult <GridPager <Component> > GetComponentPager(int page, int size) { TransactionResult <GridPager <Component> > result = new TransactionResult <GridPager <Component> >(); var serviceResult = componentService.GetPager(new BaseModel.GridPagerPamater <RemoteConfig.Service.ComponentSearchPamater>() { Current = page, PageSize = size, SearchPamater = new RemoteConfig.Service.ComponentSearchPamater() }); if (serviceResult.ActionResult & serviceResult.HavingData) { result.Data = serviceResult; } else { result.Code = 103; result.Message = "暂无数据"; } return(result); }
static async Task MakeTransaction(EnumTransactionType transactionType) { Console.WriteLine(); Console.Write("Informe a quantidade: "); var transactionAmount = Console.ReadLine(); Console.WriteLine(); Console.WriteLine(transactionType.ToString()); Console.WriteLine(); var transactionInput = new TransactionInput() { TransactionType = transactionType, Amount = Math.Round(Convert.ToDecimal(transactionAmount), 2) }; var transactionResult = new TransactionResult(); if (transactionType == EnumTransactionType.Deposit) { transactionResult = await DepositAsync(transactionInput); } else if (transactionType == EnumTransactionType.Withdrawal) { transactionResult = await WithdrawAsync(transactionInput); } if (transactionResult.IsSuccessful) { Console.WriteLine($"Status: {transactionResult.Message}"); Console.WriteLine($"Numero da conta: {transactionResult.AccountNumber}"); Console.WriteLine($"Saldo Atual: {transactionResult.Balance}"); Console.WriteLine($"Moeda: {transactionResult.Currency}"); } else { Console.WriteLine($"Status: Falha na transação"); Console.WriteLine($"Message: {transactionResult.Message}"); } Console.WriteLine(); }
public TransactionResult <Boolean> RemoveComponentConfig(int appConfigId, int componentConfigId) { TransactionResult <Boolean> result = new TransactionResult <Boolean>(); var serviceResult = appService.RemoveComponentConfigForApp(new List <int>() { componentConfigId }, appConfigId); if (serviceResult.ActionResult && serviceResult.Data) { result.Data = serviceResult.Data; } else { result.Code = 103; result.Message = serviceResult.ErrorMsg; } return(result); }
private async Task ProcessConflictingSetsAsync(List <ExecutionReturnSet> conflictionSets, List <ExecutionReturnSet> returnSets, BlockHeader blockHeader) { var transactionResults = new List <TransactionResult>(); foreach (var conflictionSet in conflictionSets) { var result = new TransactionResult { TransactionId = conflictionSet.TransactionId, Status = TransactionResultStatus.Unexecutable, Error = ExecutionStatus.Canceled.ToString() }; conflictionSet.Status = result.Status; transactionResults.Add(result); returnSets.Add(conflictionSet); } await _transactionResultService.AddTransactionResultsAsync(transactionResults, blockHeader); }
TransactionResult AddPlayerTransaction(MutableData mutableData) { Dictionary <string, object> leaders = mutableData.Value as Dictionary <string, object>; if (leaders == null) { leaders = new Dictionary <string, object>();; } // Now we add the new score as a new entry that contains the email address and score. Dictionary <string, object> newScoreMap = new Dictionary <string, object>(); newScoreMap["color"] = color; newScoreMap["NombreTablero"] = tableroNAme; leaders = newScoreMap; // You must set the Value to indicate data at that location has changed. mutableData.Value = leaders; return(TransactionResult.Success(mutableData)); }
public TransactionResult ThirdPartyPayment(string customerId, TransactionDTO transaction, string language) { var transactionResult = new TransactionResult(false, ""); IHasBalances debitProduct = helper.GetProduct(transaction.DebitProductType, transaction.DebitProductId, out transactionResult, language); transactionResult = transferServices.CheckDebitBalance(debitProduct, transaction.Amount, language); if (!transactionResult.HasError) { transferServices.DebitProduct(debitProduct, transaction.Amount, transaction.Expenses); transactionResult = helper.UpdateProduct(transaction.DebitProductType, debitProduct, language); if (!transactionResult.HasError) { transactionServices.LogTransaction(customerId, "ΗΛΕΚΤΡΟΝΙΚΗ ΠΛΗΡΩΜΗ", debitProduct.AvailableBalance, transaction); } } return(transactionResult); }
public int IngresarHotel(Hotel hotel) { if (_listahoteles.Any(o => o.Nombre == hotel.Nombre)) { throw new ReservasException("El hotel ya existe."); } TransactionResult resultado = HotelMapper.Insert(hotel); if (resultado.IsOk) { HotelesCache(); return(resultado.Id); } else { throw new ReservasException(resultado.Error); } }
//note - uses inv. gold pieces, account gold & loc private static TransactionResult RepayLoan(ref int amount, bool accountOnly, int regionIndex) { PlayerEntity playerEntity = GameManager.Instance.PlayerEntity; var availableGold = BankAccounts[regionIndex].accountGold; if (!accountOnly) { availableGold += playerEntity.GetGoldAmount(); } TransactionResult result = TransactionResult.NONE; if (!HasLoan(regionIndex)) { return(TransactionResult.NONE); } else if (amount > availableGold) { return(TransactionResult.NOT_ENOUGH_GOLD); } else if (amount > BankAccounts[regionIndex].loanTotal) { result = TransactionResult.OVERPAID_LOAN; amount = BankAccounts[regionIndex].loanTotal; } bankAccounts[regionIndex].loanTotal -= amount; if (!accountOnly) { amount = playerEntity.DeductGoldAmount(amount); } if (amount > 0) { bankAccounts[regionIndex].accountGold -= amount; } if (bankAccounts[regionIndex].loanTotal <= 0) { bankAccounts[regionIndex].loanDueDate = 0; } return(result); }
public int ActualizarPrestamo(Prestamo prestamo) { if (prestamo.FechaBaja < prestamo.FechaAlta) { throw new Exception("Fecha baja no puede ser menor a fecha alta..."); } TransactionResult result = prestamoMapper.Put(prestamo); if (result.IsOk) { _prestamos = GetPrestamos(); return(result.Id); } else { throw new Exception(string.Format("Ocurrió un error en el servidor. Detalle: \"{0}\"", result.Error)); } }
public TransactionResult <List <Security.Service.AppService> > GetAppServiceByAppId(int appId) { var r = new TransactionResult <List <Security.Service.AppService> >(); var serviceResult = appService.GetList(new AppServiceSearchPamater() { AppId = appId }); if (serviceResult.ActionResult) { r.Data = serviceResult.Data; } else { r.Code = 101; r.Message = "AppInstanceId不能为0"; } return(r); }
public int InsertarEmpresa(string razonSocial, long cuil, string domicilio) { Empresa empresa = new Empresa(razonSocial, cuil, domicilio); empresa.RazonSocial = razonSocial; empresa.Cuil = cuil; empresa.Domicilio = domicilio; TransactionResult resultante = mapper.Insert(empresa); if (resultante.IsOk) { return(resultante.Id); } else { throw new Exception("Hubo un error en la petición al servidor. Detalle: " + resultante.Error); } }
public static void InsertarHotel(Hotel hotel) { if (ExisteHotel(hotel)) { throw new Exception("no se encontró el hotel"); } else { TransactionResult result = HotelMapper.Insert(hotel); if (!result.IsOk) { throw new ErrorServidorException(result.Error); } else { RefrescarCache(); } } }
public int InsertarCliente(string nombre, string apellido, string direccion) { Cliente cliente = new Cliente(); cliente.Ape = apellido; cliente.Nombre = nombre; cliente.Direccion = direccion; TransactionResult resultante = mapper.Insert(cliente); if (resultante.IsOk) { return(resultante.Id); } else { throw new Exception("Hubo un error en la petición al servidor. Detalle: " + resultante.Error); } }
public TransactionResult <Boolean> Delete(int id) { TransactionResult <Boolean> result = new TransactionResult <Boolean>(); var serviceResult = AppConfigService.DeleteByID(new List <int>() { id }); if (serviceResult.ActionResult) { result.Data = serviceResult.Data; } else { result.Code = 103; result.Message = "暂无数据"; } return(result); }
private async Task ProcessConflictingSetsAsync(List <ExecutionReturnSet> conflictingSets, BlockHeader blockHeader) { var transactionResults = new List <TransactionResult>(); foreach (var conflictingSet in conflictingSets) { var result = new TransactionResult { TransactionId = conflictingSet.TransactionId, Status = TransactionResultStatus.Conflict, Error = "Parallel conflict", }; conflictingSet.Status = result.Status; transactionResults.Add(result); } await _transactionResultService.AddTransactionResultsAsync(transactionResults, blockHeader); }
//Execute DQ Order/Lmt Order private void ExecuteCallback(Transaction tran, TransactionResult transactionResult) { App.MainFrameWindow.Dispatcher.BeginInvoke((Action)delegate() { if (transactionResult == null) return; if (transactionResult.TransactionError == TransactionError.OK) { foreach (Order order in tran.Orders) { if (order.Status == OrderStatus.Deleting || order.Status == OrderStatus.Deleting) { order.ChangeStatus(OrderStatus.Deleted); } if (this.OnExecuteOrderNotifyEvent != null) { } } this.RemoveTransaction(tran); this.TranPhaseManager.UpdateTransaction(tran); } }); }
public static void Encode(IByteWriter stream, TransactionResult encodedTransactionResult) { Int64.Encode(stream, encodedTransactionResult.FeeCharged); TransactionResultResult.Encode(stream, encodedTransactionResult.Result); TransactionResultExt.Encode(stream, encodedTransactionResult.Ext); }
/// <summary> /// Assigns the fields and properties of aSource to this instance. /// </summary> /// <param name="aSource">A source TransactionStatus.</param> public void AssignFromSource(TransactionStatus aSource) { if (aSource == null) { return; } _transactionResult = aSource._transactionResult; _sourceAssembly = aSource._sourceAssembly; _targetUrl = aSource._targetUrl; _message = aSource._message; _innerMessage = aSource._innerMessage; aSource._messagePairList.ForEach(vSourceMessagePair => { var vTargetMessagePair = new MessagePair(vSourceMessagePair.Message, vSourceMessagePair.Subject); _messagePairList.Add(vTargetMessagePair); }); }
private void SendClick(object sender, EventArgs e) { try { _result = null; if (string.IsNullOrWhiteSpace(_editTextValue.Text)) { Toast.MakeText(this, "The field value is required.", ToastLength.Short).Show(); return; } decimal value = decimal.Parse(_editTextValue.Text); var mode = _spinnerTransactionType.SelectedItemPosition == 0 ? TransactionMode.Credit : TransactionMode.Debit; short parcel = short.Parse((_spinnerParcels.SelectedItemPosition + 1).ToString()); //Just send the transaction the same way you do on console var parameters = new TerminalTransactionParameters(); parameters.Mode = mode; parameters.Amount = value; parameters.CashbackValue = 0; parameters.Parcel = parcel; parameters.Type = TransactionType.Authorization; _transactionOrchestrator.ExecuteTransaction(parameters, _token); } catch (Exception ex) { _progressDialog.Dismiss(); Helpers.Alert(this, "PI - SendClick - Error", ex.Message, false); } }
// EndOfTransaction will be called at the end of a transaction public void EndOfTransaction(TransactionResult transactionResult, Device device) { Window.DisplayReceipts(transactionResult.MerchantReceipt, transactionResult.CustomerReceipt); }
private void SetTransactionResult(TransactionResult.Status status, string message = null) { PayuService.CompleteTransaction(new TransactionResult(status, message)); if(NavigationService.CanGoBack) NavigationService.GoBack(); }
public void SaveBebillTransaction(TransactionResult item) { using (var session = this.store.Write()) { var stored = session.Data.BebillTransactions.ContainsKey(item.OrderId) ? session.Data.BebillTransactions[item.OrderId] : null; if (stored == null) { stored = new TransactionResult() { OrderId = item.OrderId, }; session.Data.BebillTransactions.Add(item.OrderId, stored); } stored.UpdateFrom(item); session.Save(); } }
//This sample demonstrate how to use the TransactionResult object returned when a transaction is finished. //In a real application you may want to print the receipt for example. For the sake of this sample, we are going to print it on the console output. private static void TransactionOrchestratorOnTransactionFinished(TransactionResult obj) { Console.WriteLine("-------- Transaction Finished --------"); Console.WriteLine("-------- Transaction Status ----------"); Console.WriteLine(obj.Status); if (obj.Status == TransactionStatus.Authorized || obj.Status == TransactionStatus.PreAuthorized) { Console.WriteLine("-------- Client Receipt --------"); Console.WriteLine(obj.RAWClientReceipt); Console.WriteLine("-------- Merchant Receipt --------"); Console.WriteLine(obj.RAWMerchantReceipt); } Console.WriteLine("-------- Done --------"); }
internal static void CompleteTransaction(TransactionResult result) { _transactionResult = result; _transactionFinishedEvent.Set(); }
private void TransactionOrchestratorOnTransactionFinished(TransactionResult obj) { _result = obj; }
private void insertCoinB_Click(object sender, EventArgs e) { if (coinsCB.SelectedItem != null) { TransactionResult tr = new TransactionResult(); switch (coinsCB.SelectedItem.ToString()) { case "Ore50": tr = machine.InsertCoin(Coin.Ore50); break; case "Kr1": tr = machine.InsertCoin(Coin.Kr1); break; case "Kr2": tr = machine.InsertCoin(Coin.Kr2); break; case "Kr5": tr = machine.InsertCoin(Coin.Kr5); break; case "Kr10": tr = machine.InsertCoin(Coin.Kr10); break; case "Kr20": tr = machine.InsertCoin(Coin.Kr20); break; } if (machine.Finalize() == TransactionResult.Success) { MessageBox.Show("RELEASED PRODUCTS:\n" + machine.ReleasedProducts() + "\n\nCHANGE:\n" + machine.ReleasedCoins() ); // clicking on OK of MessageBox is treated as the product and change was taken off from case machine.EmptyCases(); insertCoinB.Enabled = false; purchaseB.Enabled = false; dispL.Text = "-----"; enableAllProd(); prepareOutOfStockLights(); } else // update display { decimal val = (machine.SelectedProduct.Price - machine.InsertedValue); dispL.Text = prepareDisp(val); } } // nothing entered }
public bool Add(TransactionResult tx) { return AddItem(tx.Hash(), tx); }
internal BasicResult AddPaymentToTransaction1(string transaction1Id, TransactionResult data) { if (string.IsNullOrEmpty(transaction1Id)) throw new ArgumentException("The value cannot be empty", "transaction1Id"); if (data == null) throw new ArgumentNullException("data"); using (var session = this.store.Write()) { var result = new BasicResult(); var tran = session.Data.Transactions1.SingleOrDefault(t => t.OrderId == transaction1Id); result.Data["Transaction"] = tran; if (tran == null) { result.Errors.Add(new BasicResultError("Cannot find transaction " + transaction1Id)); return result; } var paymentIds = tran.PaymentIds ?? new List<string>(); tran.PaymentIds = paymentIds; if (paymentIds.Contains(data.OrderId)) { result.Errors.Add(new BasicResultError("This payment is already associated with this item")); return result; } if (data.AmountCents != null) { paymentIds.Add(data.OrderId); tran.AmountPaid += (data.AmountCents.Value / 100M); } if (tran.AmountPaid >= tran.Amount) { tran.IsPaid = true; } session.Save(); result.Succeed = true; return result; } }