protected void Page_Load(object sender, EventArgs e) { string words = ""; if (!Page.IsPostBack) { Doku_Initiate.sharedKey = "k8UhY5t4RF4e"; //local //Doku_Initiate.sharedKey = "aKh4dSX72d6C";//luna Doku_Initiate.mallId = Request.Form["doku-mall-id"]; #region PREDATA Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("amount", Request.Form["doku-amount"]); param.Add("invoice", Request.Form["doku-invoice-no"]); param.Add("currency", Request.Form["doku-currency"]); param.Add("pairing_code", Request.Form["doku-pairing-code"]); param.Add("token", Request.Form["doku-token"]); words = Library.doCreateWords(param); List <string> basket = new List <string>(); basket.Add("sayur"); basket.Add("10000.00"); basket.Add("1"); basket.Add("10000.00"); basket.Add(";"); basket.Add("buah"); basket.Add("10000.00"); basket.Add("1"); basket.Add("10000.00"); basket.Add(";"); string JSONBasket = Library.formatBasket(Helper.ListToJson(basket)); Dictionary <string, string> customer = new Dictionary <string, string>(); customer.Add("name", "TEST NAME"); customer.Add("data_phone", "08121111111"); customer.Add("data_email", "*****@*****.**"); customer.Add("data_address", "bojong gede #1 08/01"); string JSONCustomer = Helper.DictionaryToJson(customer); Dictionary <string, object> dataPrePayment = new Dictionary <string, object>(); dataPrePayment.Add("req_mall_id", Request.Form["doku-mall-id"]); dataPrePayment.Add("req_chain_merchant", Request.Form["doku-chain-merchant"]); dataPrePayment.Add("req_amount", Request.Form["doku-amount"]); dataPrePayment.Add("req_words", words); dataPrePayment.Add("req_purchase_amount", Request.Form["doku-amount"]); dataPrePayment.Add("req_trans_id_merchant", Request.Form["doku-invoice-no"]); dataPrePayment.Add("req_request_date_time", Helper.getDate()); dataPrePayment.Add("req_currency", Request.Form["doku-currency"]); dataPrePayment.Add("req_purchase_currency", Request.Form["doku-currency"]); dataPrePayment.Add("req_session_id", Helper.GetSHA1HashData(Helper.getDate())); dataPrePayment.Add("req_name", customer["name"]); dataPrePayment.Add("req_payment_channel", "04"); dataPrePayment.Add("req_basket", JSONBasket); dataPrePayment.Add("req_email", customer["data_email"]); dataPrePayment.Add("req_token_id", Request.Form["doku-token"]); dataPrePayment.Add("req_mobile_phone", customer["data_phone"]); dataPrePayment.Add("req_address", customer["data_address"]); #endregion string JSONDataPayment = Helper.DictionaryToJson(dataPrePayment); Debug.Write(JSONDataPayment); Dictionary <string, object> dict_dataPayment = new Dictionary <string, object>(); dict_dataPayment.Add("data", JSONDataPayment); string responsePayment = Doku_Api.doPayment(dict_dataPayment); dynamic results = Newtonsoft.Json.JsonConvert.DeserializeObject(responsePayment); if (results != null) { var code = results.res_response_code; if (code != null && code.Value == "0000") { Literal1.Text = "PAYMENT SUCCESS -- "; } else { Literal1.Text = "PAYMENT FAILED -- "; } } else { Literal1.Text = "NO SERVER RESPONSE -- "; } Literal1.Text = results; } }
protected void Page_Load(object sender, EventArgs e) { string words = ""; if (!Page.IsPostBack) { Doku_Initiate.sharedKey = "k8UhY5t4RF4e"; //local //Doku_Initiate.sharedKey = "aKh4dSX72d6C";//luna Doku_Initiate.mallId = "2074"; #region PREDATA Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("amount", "100000.00"); param.Add("invoice", Request.Form["invoice_no"]); param.Add("currency", "360"); string cc = null; if (Request.Form["cc_number"] != null) { cc = Request.Form["cc_number"].ToString().Replace(" - ", ""); } words = Library.doCreateWords(param); List <string> basket = new List <string>(); basket.Add("sayur"); basket.Add("10000.00"); basket.Add("1"); basket.Add("10000.00"); basket.Add(";"); basket.Add("buah"); basket.Add("10000.00"); basket.Add("1"); basket.Add("10000.00"); basket.Add(";"); string JSONBasket = Library.formatBasket(Helper.ListToJson(basket)); Dictionary <string, string> customer = new Dictionary <string, string>(); customer.Add("name", "TEST NAME"); customer.Add("data_phone", "08121111111"); customer.Add("data_email", "*****@*****.**"); customer.Add("data_address", "bojong gede #1 08/01"); string JSONCustomer = Helper.DictionaryToJson(customer); Dictionary <string, object> data = new Dictionary <string, object>(); data.Add("req_mall_id", "2074"); data.Add("req_chain_merchant", "NA"); data.Add("req_amount", param["amount"]); data.Add("req_words", words); data.Add("req_purchase_amount", param["amount"]); data.Add("req_trans_id_merchant", Request.Form["invoice_no"]); data.Add("req_request_date_time", Helper.getDate()); data.Add("req_currency", "360"); data.Add("req_purchase_currency", "360"); data.Add("req_session_id", Helper.GetSHA1HashData(Helper.getDate())); data.Add("req_name", customer["name"]); data.Add("req_payment_channel", "02"); data.Add("req_email", customer["data_email"]); data.Add("req_card_number", cc); data.Add("req_basket", Helper.ListToJson(basket)); data.Add("req_challenge_code_1", Request.Form["CHALLENGE_CODE_1"]); data.Add("req_challenge_code_2", Request.Form["CHALLENGE_CODE_2"]); data.Add("req_challenge_code_3", Request.Form["CHALLENGE_CODE_3"]); data.Add("req_response_token", Request.Form["response_token"]); data.Add("req_mobile_phone", customer["data_phone"]); data.Add("req_address", customer["data_address"]); #endregion string JSONData = Helper.DictionaryToJson(data); Debug.Write(JSONData); Dictionary <string, object> datas = new Dictionary <string, object>(); datas.Add("data", JSONData); string responsePayment = Doku_Api.doDirectPayment(datas); dynamic results = Newtonsoft.Json.JsonConvert.DeserializeObject(responsePayment); if (results != null) { var code = results.res_response_code; if (code != null && code.Value == "0000") { Literal1.Text = "PAYMENT SUCCESS -- "; } else { Literal1.Text = "PAYMENT FAILED -- "; } Literal1.Text += results; } else { Literal1.Text = "NO SERVER RESPONSE -- "; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Doku_Initiate.sharedKey = "k8UhY5t4RF4e"; //local //Doku_Initiate.sharedKey = "aKh4dSX72d6C";//luna Doku_Initiate.mallId = "2074"; dynamic postData = Newtonsoft.Json.JsonConvert.DeserializeObject(Request.Form["data"]); if (postData != null) { #region PREDATA string token = postData.res_token_id.Value; string pairing_code = postData.res_pairing_code.Value; string invoice_no = postData.res_transaction_id.Value; string amount = postData.res_amount.Value; string device_id = postData.res_device_id.Value; string mobile_number = postData.res_data_mobile_phone.Value; string name = postData.res_data_name.Value; string email = postData.res_data_email.Value; string payment_channel = postData.res_payment_channel.Value; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("amount", amount); param.Add("invoice", invoice_no); param.Add("currency", "360"); param.Add("pairing_code", pairing_code); param.Add("token", token); param.Add("device_id", device_id); string words = Library.doCreateWords(param); List <string> basket = new List <string>(); basket.Add("sayur"); basket.Add(amount); basket.Add("1"); basket.Add(amount); basket.Add(";"); string JSONBasket = Library.formatBasket(Helper.ListToJson(basket)); #endregion #region PAYMENT Dictionary <string, object> dataPayment = new Dictionary <string, object>(); dataPayment.Add("req_mall_id", "2074"); dataPayment.Add("req_chain_merchant", "NA"); dataPayment.Add("req_amount", amount); dataPayment.Add("req_words", words); dataPayment.Add("req_purchase_amount", amount); dataPayment.Add("req_trans_id_merchant", invoice_no); dataPayment.Add("req_request_date_time", Helper.getDate()); dataPayment.Add("req_currency", "360"); dataPayment.Add("req_purchase_currency", "360"); dataPayment.Add("req_session_id", Helper.GetSHA1HashData(Helper.getDate())); dataPayment.Add("req_name", name); dataPayment.Add("req_payment_channel", payment_channel); dataPayment.Add("req_basket", JSONBasket); dataPayment.Add("req_email", email); dataPayment.Add("req_token_id", token); dataPayment.Add("req_mobile_phone", mobile_number); dataPayment.Add("req_address", "bojong gede #1 08/01"); #endregion string JSONDataPayment = Helper.DictionaryToJson(dataPayment); Debug.Write(JSONDataPayment); Dictionary <string, object> dict_dataPayment = new Dictionary <string, object>(); dict_dataPayment.Add("data", JSONDataPayment); string responsePayment = Doku_Api.doPayment(dict_dataPayment); dynamic results = Newtonsoft.Json.JsonConvert.DeserializeObject(responsePayment); if (results != null) { Literal1.Text = results; } else { Literal1.Text = "NO SERVER RESPONSE -- "; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Doku_Initiate.sharedKey = "k8UhY5t4RF4e"; //local //Doku_Initiate.sharedKey = "aKh4dSX72d6C";//luna Doku_Initiate.mallId = "2074"; dynamic postData = Newtonsoft.Json.JsonConvert.DeserializeObject(Request.Form["data"]); if (postData != null) { #region PREDATA string invoice_no = "invoice_" + Helper.getTime(); string amount = "10000.00"; string device_id = postData.req_device_id.Value; string payment_channel = postData.req_payment_channel.Value; string challenge_1 = postData.req_challenge_code_1; string challenge_2 = postData.req_challenge_code_2; string challenge_3 = postData.req_challenge_code_3; string card_number = postData.req_card_number; string response_token = postData.req_response_token; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("amount", amount); param.Add("invoice", invoice_no); param.Add("currency", "360"); param.Add("device_id", device_id); string words = Library.doCreateWords(param); Dictionary <string, string> customer = new Dictionary <string, string>(); customer.Add("name", "TEST NAME"); customer.Add("data_phone", "08121111111"); customer.Add("data_email", "*****@*****.**"); customer.Add("data_address", "bojong gede #1 08/01"); string JSONCustomer = Helper.DictionaryToJson(customer); List <string> basket = new List <string>(); basket.Add("sayur"); basket.Add(amount); basket.Add("1"); basket.Add(amount); basket.Add(";"); string JSONBasket = Library.formatBasket(Helper.ListToJson(basket)); #endregion #region PAYMENT Dictionary <string, object> dataPayment = new Dictionary <string, object>(); dataPayment.Add("req_mall_id", "2074"); dataPayment.Add("req_chain_merchant", "NA"); dataPayment.Add("req_amount", amount); dataPayment.Add("req_words", words); dataPayment.Add("req_words_raw", Library.doCreateWordsRaw(param)); dataPayment.Add("req_purchase_amount", amount); dataPayment.Add("req_trans_id_merchant", invoice_no); dataPayment.Add("req_request_date_time", Helper.getDate()); dataPayment.Add("req_currency", "360"); dataPayment.Add("req_purchase_currency", "360"); dataPayment.Add("req_session_id", Helper.GetSHA1HashData(Helper.getDate())); dataPayment.Add("req_name", customer["name"]); dataPayment.Add("req_payment_channel", payment_channel); dataPayment.Add("req_basket", JSONBasket); dataPayment.Add("req_email", customer["data_email"]); dataPayment.Add("req_card_number", card_number); dataPayment.Add("req_challenge_code_1", challenge_1); dataPayment.Add("req_challenge_code_2", challenge_2); dataPayment.Add("req_challenge_code_3", challenge_3); dataPayment.Add("req_mobile_phone", customer["data_phone"]); dataPayment.Add("req_address", customer["data_address"]); dataPayment.Add("req_device_id", device_id); #endregion string JSONDataPayment = Helper.DictionaryToJson(dataPayment); Debug.Write(JSONDataPayment); Dictionary <string, object> dict_dataPayment = new Dictionary <string, object>(); dict_dataPayment.Add("data", JSONDataPayment); string responsePayment = Doku_Api.doDirectPayment(dict_dataPayment); dynamic results = Newtonsoft.Json.JsonConvert.DeserializeObject(responsePayment); if (results != null) { Literal1.Text = results; } else { Literal1.Text = "NO SERVER RESPONSE -- "; } } } }
protected void Page_Load(object sender, EventArgs e) { string words = ""; if (!Page.IsPostBack) { Doku_Initiate.sharedKey = "k8UhY5t4RF4e"; //local //Doku_Initiate.sharedKey = "aKh4dSX72d6C";//luna Doku_Initiate.mallId = Request.Form["doku_mall_id"]; #region PREDATA Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("amount", Request.Form["doku_amount"]); param.Add("invoice", Request.Form["doku_invoice_no"]); param.Add("currency", Request.Form["doku_currency"]); param.Add("pairing_code", Request.Form["doku_pairing_code"]); param.Add("token", Request.Form["doku_token"]); words = Library.doCreateWords(param); List <string> basket = new List <string>(); basket.Add("sayur"); basket.Add("10000.00"); basket.Add("1"); basket.Add("10000.00"); basket.Add(";"); basket.Add("buah"); basket.Add("10000.00"); basket.Add("1"); basket.Add("10000.00"); basket.Add(";"); string JSONBasket = Library.formatBasket(Helper.ListToJson(basket)); Dictionary <string, string> customer = new Dictionary <string, string>(); customer.Add("name", "TEST NAME"); customer.Add("data_phone", "08121111111"); customer.Add("data_email", "*****@*****.**"); customer.Add("data_address", "bojong gede #1 08/01"); string JSONCustomer = Helper.DictionaryToJson(customer); string[] binFilter = { "411111", "548117", "433???6", "41*3" }; Dictionary <string, object> data = new Dictionary <string, object>(); data.Add("req_token_id", Request.Form["doku_token"]); data.Add("req_pairing_code", Request.Form["doku_pairing_code"]); data.Add("req_bin_filter", binFilter); data.Add("req_customer", JSONCustomer); data.Add("req_basket", JSONBasket); data.Add("req_words", words); #endregion string JSONData = Helper.DictionaryToJson(data); Debug.Write(JSONData); Dictionary <string, object> predata = new Dictionary <string, object>(); predata.Add("data", JSONData); string responsePrePayment = Doku_Api.doPrePayment(predata); dynamic results = Newtonsoft.Json.JsonConvert.DeserializeObject(responsePrePayment); if (results != null) { var msg = results.res_response_msg; var code = results.res_response_code; if (msg != null && code != null) { if (code.Value == "0000" && msg.Value == "SUCCESS") //Prepayment Success { #region data post Dictionary <string, object> dataPayment = new Dictionary <string, object>(); dataPayment.Add("req_mall_id", Request.Form["doku_mall_id"]); dataPayment.Add("req_chain_merchant", Request.Form["doku_chain_merchant"]); dataPayment.Add("req_amount", Request.Form["doku_amount"]); dataPayment.Add("req_words", words); dataPayment.Add("req_words_raw", Library.doCreateWordsRaw(param)); dataPayment.Add("req_purchase_amount", Request.Form["doku_amount"]); dataPayment.Add("req_trans_id_merchant", Request.Form["doku_invoice_no"]); dataPayment.Add("req_request_date_time", Helper.getDate()); dataPayment.Add("req_currency", Request.Form["doku_currency"]); dataPayment.Add("req_purchase_currency", Request.Form["doku_currency"]); dataPayment.Add("req_session_id", Helper.GetSHA1HashData(Helper.getDate())); dataPayment.Add("req_name", customer["name"]); dataPayment.Add("req_payment_channel", 15); dataPayment.Add("req_basket", JSONBasket); dataPayment.Add("req_email", customer["data_email"]); dataPayment.Add("req_token_id", Request.Form["doku_token"]); dataPayment.Add("req_mobile_phone", customer["data_phone"]); dataPayment.Add("req_address", customer["data_address"]); #endregion string JSONDataPayment = Helper.DictionaryToJson(dataPayment); Debug.Write(JSONDataPayment); Dictionary <string, object> dict_dataPayment = new Dictionary <string, object>(); dict_dataPayment.Add("data", JSONDataPayment); string responsePayment = Doku_Api.doPayment(dict_dataPayment); results = Newtonsoft.Json.JsonConvert.DeserializeObject(responsePayment); if (results != null) { msg = results.res_response_msg; code = results.res_response_code; if (msg != null && code != null && code.Value == "0000" && msg.Value == "SUCCESS") { #region MERCHANT PROCESS //merchant process //do what you want to do #endregion #region token //process tokenization if (results.res_bundle_token != null) { dynamic tokenPayment = Newtonsoft.Json.JsonConvert.DeserializeObject(results.res_bundle_token.Value); if (tokenPayment != null) { if (tokenPayment.res_token_code == "0000") { //save token string getTokenPayment = tokenPayment.res_token_payment.Value; } } else { Literal1.Text = "Response Null"; } } #endregion //redirect process to doku string urlBased = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.IndexOf("/example/")); results.res_redirect_url = urlBased + "/example-payment/merchant-redirect-example.aspx"; results.res_show_doku_page = true; //true if you want to show doku page first before redirecting to redirect url Literal1.Text = Newtonsoft.Json.JsonConvert.SerializeObject(results); } else { Literal1.Text = Newtonsoft.Json.JsonConvert.SerializeObject(results); } } else { Literal1.Text = "Response Null"; } } else { Literal1.Text = Newtonsoft.Json.JsonConvert.SerializeObject(results); } } else { Literal1.Text = "Response Null"; } } else { Literal1.Text = "Response Null"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Doku_Initiate.sharedKey = "k8UhY5t4RF4e"; //local //Doku_Initiate.sharedKey = "aKh4dSX72d6C";//luna Doku_Initiate.mallId = Request.Form["mall_id"]; #region PREDATA Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("amount", Request.Form["amount"]); param.Add("invoice", Request.Form["trans_id"]); param.Add("currency", Request.Form["currency"]); string words = Library.doCreateWords(param); Dictionary <string, string> customer = new Dictionary <string, string>(); customer.Add("name", "TEST NAME"); customer.Add("data_phone", "08121111111"); customer.Add("data_email", "*****@*****.**"); customer.Add("data_address", "bojong gede #1 08/01"); string JSONCustomer = Helper.DictionaryToJson(customer); Dictionary <string, object> dataPayment = new Dictionary <string, object>(); dataPayment.Add("req_mall_id", Request.Form["mall_id"]); dataPayment.Add("req_chain_merchant", Request.Form["chain_merchant"]); dataPayment.Add("req_amount", param["amount"]); dataPayment.Add("req_words", words); dataPayment.Add("req_trans_id_merchant", Request.Form["trans_id"]); dataPayment.Add("req_purchase_amount", param["amount"]); dataPayment.Add("req_request_date_time", Helper.getDate()); dataPayment.Add("req_session_id", Helper.GetSHA1HashData(Helper.getDate())); dataPayment.Add("req_email", customer["data_email"]); dataPayment.Add("req_name", customer["name"]); #endregion string JSONData = Helper.DictionaryToJson(dataPayment); Debug.Write(JSONData); Dictionary <string, object> data = new Dictionary <string, object>(); data.Add("data", JSONData); string response = Doku_Api.doGeneratePaycode(data); dynamic results = Newtonsoft.Json.JsonConvert.DeserializeObject(response); if (results != null) { var code = results.res_response_code; if (code != null && code.Value == "0000") { Literal1.Text = "GENERATE SUCCESS -- "; } else { Literal1.Text = "GENERATE FAILED -- "; } Literal1.Text += results; } else { Literal1.Text = "NO SERVER RESPONSE -- "; } } }