protected void load()
    {
        string str = "";
        string str1 = "";
        AccountInfoRequest accountinforequest = new AccountInfoRequest();
        accountinforequest.api_password = SessionKey.apipass;
        accountinforequest.api_username = SessionKey.apiuser;
        accountinforequest.merchant_id = SessionKey.merchantid;
        AccountInfoResponse accountinforespone = new AccountInfoResponse();
        BKPaymentProService2 bk=new BKPaymentProService2();
        accountinforespone=bk.GetAccountInfo(accountinforequest);
        if (accountinforespone.error_code == "0")
        {
            PaymentMethod[] paymnet_id = accountinforespone.account_info.payment_methods;

            foreach (var item in paymnet_id)
            {
                string url = item.logo_url;
                string id = item.id;
                string name = item.name;
                /*1 =>"Các loại thẻ ATM trong nước",
                2 =>"Các loại thẻ Tín dụng quốc tế",
                3 =>"Chuyển khoản bằng Internet Banking",
                4 =>"Chuyển khoản bằng máy ATM",
                5 =>"Chuyển khoản tiền mặt tại quầy giao dịch"
                 * */
                if (item.payment_method_type == "1")//so sanh xem nó là hình thức nào có 5 hình thức là atm, interbanking
                {

                    str = str + " <div class='bank'><a title='"+name+"' href='Pay.aspx?payment_method_id=" + id + "' style='padding-left:5px; padding-bottom:5px;'><img class='img-v' src='" + url + "' /></a></div>";
                    Literal2.Text = str;
                    //... anh lấy nó ra
                }
                else if (item.payment_method_type == "2")
                {
                    str1 = str1 + " <div class='bank'><a title='"+name+"' href='Pay.aspx?payment_method_id=" + id + "' style='padding-left:5px; padding-bottom:5px;'><img class='img-v' src='" + url + "' /></a></div>";
                    Literal3.Text = str1;
                }

            }
        }
        else
            Literal2.Text = accountinforespone.error_message;
    }
Exemple #2
0
 protected void callDoPaymentPro(int pmi)
 {
     pmi = int.Parse(this.Request.QueryString["payment_method_id"]);
         string tm = DateTime.Now.ToString();
         PaymentInfoRequest url = new PaymentInfoRequest();
         url.api_username = SessionKey.apiuser;
         url.api_password = SessionKey.apipass;
         url.bank_payment_method_id =  pmi.ToString();
         url.bk_seller_email = SessionKey.Business;
         url.currency_code = "VND";
         url.escrow_timeout = "";
         url.extra_fields_value = "";
         url.merchant_id = SessionKey.merchantid;
         url.order_description = "";
         url.order_id = tm;
         url.payer_email = Session["email_payer"].ToString();
         url.payer_message = "";
         url.payer_name = "test";
         url.payer_phone_no = Session["phone"].ToString();
         url.payment_mode = "1";
         url.shipping_address = "";
         url.shipping_fee = "";
         url.tax_fee = "";
         url.total_amount = Session["price_bk"].ToString();
         url.url_return = "";
         //url.url_return = "http://localhost:52996/WebSite3/Baokim.aspx";
         BKPaymentProService2 bk=new BKPaymentProService2();
         PaymentInfoResponse baokim = new PaymentInfoResponse();
          baokim=bk.DoPaymentPro(url);
          string link = baokim.url_redirect;
          if (baokim.error_code != "0") { throw new Exception(baokim.error_message); }
          else
          {
              Response.Redirect(baokim.url_redirect);
          }
 }