public int CreateTokenTransaction(IDbConnection db, TokenTransaction tokenTran)
        {
            string sql = @"INSERT INTO token_transaction(
            customer_username, partner_identifier, gtoken_transaction_id, 
            partner_order_id, token_type, transaction_type, amount, description, 
            ip_address, country_code, created_at, updated_at, tax, service_charge)
            VALUES (
            @customer_username, @partner_identifier, @gtoken_transaction_id, 
            @partner_order_id, @token_type, @transaction_type, @amount, @description, 
            @ip_address, @country_code, @created_at, @updated_at, @tax, @service_charge)
            RETURNING id";

            return db.Query<int>(sql, tokenTran).FirstOrDefault();
        }
Beispiel #2
0
 public bool deductGToken(string username, TokenTransaction transaction, string campTitle)
 {
     string remark = string.Format("Deduct GToken for transaction: {0} {1}, originator: {2}", transaction.gtoken_transaction_id, campTitle, transaction.customer_username);
     decimal amount = transaction.amount;
     var venvici = new VenviciModel()
     {
         enumAction = VenviciAction.deductGToken,
         username = username,
         amount = amount,
         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: amount);
     return suscess;
 }
Beispiel #3
0
        public bool UpdateCashBack(string username, TokenTransaction transaction, string campTitle)
        {
            if (!deductGToken(username, transaction, campTitle))
                return false;

            return commissionCredit(username, transaction, campTitle);
        }
Beispiel #4
0
 public bool PushBv(string username, TokenTransaction transaction)
 {
     decimal pushbv = transaction.amount;
     var venvici = new VenviciModel()
     {
         enumAction = VenviciAction.PushBV,
         username = username,
         bv = pushbv
     };
     var result = SendAPIRequest(venvici);
     bool suscess = result.Contains(Helper.GetDescription(VenviciReult.success));
     Api.Instance.LogApi("1", "web/pushBv.jsp", suscess, HttpContext.Current.Request.UserAgent,
        "venvici", transaction.customer_username, HttpContext.Current.Request.UserHostAddress, string.Empty, JsonConvert.SerializeObject(venvici) + " ---- Result: " + result);
     if (suscess)
     {
         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 suscess;
 }