public int CreateTransaction(IDbConnection db, Transaction trans) { string sql = @"INSERT INTO transaction( gtoken_transaction_id, price, status, description, payment_method, ip_address, country_code, partner_identifier, customer_username, discount_percentage, final_amount, currency, original_price, original_final_amount, original_currency, partner_order_id, exchange_rate, is_venvici_applicable, original_tax, original_service_charge, tax, service_charge, revenue_percentage) VALUES (@gtoken_transaction_id, @price, @status, @description, @payment_method, @ip_address, @country_code, @partner_identifier, @customer_username, @discount_percentage, @final_amount, @currency, @original_price, @original_final_amount, @original_currency, @partner_order_id, @exchange_rate, @is_venvici_applicable, @original_tax, @original_service_charge, @tax, @service_charge, @revenue_percentage) RETURNING id"; return db.Query<int>(sql, trans).FirstOrDefault(); }
public void UpdateVenviciBalance(Partner partner, Transaction transaction) { if (!CheckValidVenviciUser(transaction.customer_username)) return; //decimal gtoken = 0; //var inviter = Api.Instance.GetInviterByCustomerUserName(transaction.customer_username).Data; //if (inviter != null && !string.IsNullOrEmpty(inviter.username)) // gtoken = transaction.revenue; //if (CheckGToken(transaction.customer_username, gtoken)) //{ // deductGToken(transaction.customer_username, transaction); // commissionCredit(transaction.customer_username, transaction); //} //else if (CheckGToken(inviter.username, gtoken)) //{ // deductGToken(inviter.username, transaction); // commissionCredit(inviter.username, transaction); //} //else // PushBv(transaction.customer_username, transaction); string remark = string.Format("Add GToken for transaction: {0}, originator: {1}", transaction.gtoken_transaction_id, transaction.customer_username); AddGToken(transaction.customer_username, remark, transaction.revenue, transaction.gtoken_transaction_id); PushBv(transaction.customer_username, transaction); }
public bool PushBv(string username, Transaction transaction) { decimal pushbv = Math.Round(transaction.revenue * 0.1m, 2); var venvici = new VenviciModel() { enumAction = VenviciAction.PushBV, username = username, bv = pushbv }; var result = SendAPIRequest(venvici); bool success = result.Contains(Helper.GetDescription(VenviciReult.success)); Api.Instance.LogApi("1", "web/pushBv.jsp", success, HttpContext.Current.Request.UserAgent, "venvici", transaction.customer_username, HttpContext.Current.Request.UserHostAddress, string.Empty, JsonConvert.SerializeObject(venvici) + " ---- Result: " + result); if (success) { string remark = string.Format("BV for transaction: {0}, originator: {1}", transaction.gtoken_transaction_id, transaction.customer_username); recordTransaction(username, transaction.gtoken_transaction_id, remark, pushBv: pushbv); } return success; }
public bool deductGToken(string username, Transaction transaction) { string remark = string.Format("Deduct GToken for transaction: {0}, originator: {1}", transaction.gtoken_transaction_id, transaction.customer_username); var venvici = new VenviciModel() { enumAction = VenviciAction.deductGToken, username = username, amount = transaction.revenue, refNo = transaction.gtoken_transaction_id, remark = remark }; var result = SendAPIRequest(venvici); bool suscess = result.Contains(Helper.GetDescription(VenviciReult.success)); Api.Instance.LogApi("1", "web/deductGToken.jsp", suscess, HttpContext.Current.Request.UserAgent, "venvici", transaction.customer_username, HttpContext.Current.Request.UserHostAddress, string.Empty, JsonConvert.SerializeObject(venvici) + " ---- Result: " + result); if (suscess) recordTransaction(username, transaction.gtoken_transaction_id, remark, gtokenAmount: transaction.revenue); return suscess; }