public bool CreditAccount(string PaydunyaAccount, double Amount) { string jsonData = JsonConvert.SerializeObject( new JObject { { "account_alias", PaydunyaAccount }, { "amount", Amount } }); JObject JsonResult = utility.HttpPostJson(PayDunyaHelper.GetDirectPayCreditUrl(setup.Mode), jsonData); ResponseCode = JsonResult["response_code"].ToString(); if (ResponseCode == "00") { Status = SUCCESS; ResponseText = JsonResult["response_text"].ToString(); Description = JsonResult["description"].ToString(); TransactionId = JsonResult["transaction_id"].ToString(); return(true); } else { ResponseText = JsonResult["response_text"].ToString(); Status = FAIL; } return(false); }
public bool Charge(string OPRToken, string ConfirmToken) { string jsonData = JsonConvert.SerializeObject( new JObject { { "token", OPRToken }, { "confirm_token", ConfirmToken } }); JObject JsonResult = utility.HttpPostJson(PayDunyaHelper.GetOPRChargeUrl(setup.Mode), jsonData); if (JsonResult.Count > 0) { if (JsonResult["response_code"].ToString() == "00") { Status = JsonResult["invoice_data"]["status"].ToString(); invoice = utility.ParseJSON(JsonResult["invoice_data"]["invoice"]); taxes = utility.ParseJSON(JsonResult["invoice_data"]["taxes"]); customData = utility.ParseJSON(JsonResult["invoice_data"]["custom_data"]); storeData = utility.ParseJSON(JsonResult["invoice_data"]["store"]); customer = utility.ParseJSON(JsonResult["invoice_data"]["customer"]); receiptUrl = JsonResult["invoice_data"]["receipt_url"].ToString(); ResponseText = JsonResult["response_text"].ToString(); ResponseCode = "00"; return(true); } else { Status = PaydunyaCheckout.FAIL; ResponseText = JsonResult["response_text"].ToString(); ResponseCode = JsonResult["response_code"].ToString(); } } else { Status = PaydunyaCheckout.FAIL; ResponseCode = "1002"; ResponseText = "Invoice Not Found"; } return(false); }
public bool Create(string AccountAlias) { invoice.Add("items", items); invoice.Add("taxes", taxes); JObject payload = new JObject { { "invoice_data", new JObject { { "invoice", invoice }, { "store", storeData }, { "actions", actions }, { "custom_data", customData } } }, { "opr_data", new JObject { { "account_alias", AccountAlias } } } }; string jsonData = JsonConvert.SerializeObject(payload); JObject JsonResult = utility.HttpPostJson(PayDunyaHelper.GetOPRInvoiceUrl(setup.Mode), jsonData); ResponseCode = JsonResult["response_code"].ToString(); if (ResponseCode == "00") { Status = PaydunyaCheckout.SUCCESS; ResponseText = JsonResult["description"].ToString(); Token = JsonResult["token"].ToString(); InvoiceToken = JsonResult["invoice_token"].ToString(); return(true); } else { ResponseText = JsonResult["response_text"].ToString(); Status = PaydunyaCheckout.FAIL; } return(false); }
public PaydunyaCheckoutInvoice(PaydunyaSetup setup, PaydunyaStore store) { this.setup = setup; this.store = store; this.utility = new PaydunyaUtility(setup); storeData = PayDunyaHelper.SetPaydunyaStore(store); if (!string.IsNullOrEmpty(this.store.CancelUrl)) { actions.Add("cancel_url", this.store.CancelUrl); } if (!string.IsNullOrEmpty(this.store.ReturnUrl)) { actions.Add("return_url", this.store.ReturnUrl); } if (!string.IsNullOrEmpty(this.store.ReturnUrl)) { actions.Add("callback_url", this.store.CallbackUrl); } }
public bool Confirm(string token) { JObject jsonData = utility.HttpGetRequest(PayDunyaHelper.GetConfirmUrl(setup.Mode) + token); bool result = false; if (jsonData.Count > 0 && jsonData["status"] != null) { Status = jsonData["status"].ToString(); invoice = utility.ParseJSON(jsonData["invoice"]); taxes = utility.ParseJSON(jsonData["taxes"]); customData = utility.ParseJSON(jsonData["custom_data"]); storeData = utility.ParseJSON(jsonData["store"]); if (jsonData["status"].ToString() == "completed") { ResponseText = "Checkout Invoice has been paid"; ResponseCode = "00"; result = true; customer = utility.ParseJSON(jsonData["customer"]); receiptUrl = (string)jsonData["receipt_url"]; } else { ResponseText = "Checkout Invoice has not been paid"; ResponseCode = "1003"; } } else { Status = PaydunyaCheckout.FAIL; ResponseCode = "1002"; ResponseText = "Invoice Not Found"; } return(result); }
public bool Create() { invoice.Add("items", items); invoice.Add("taxes", taxes); invoice.Add("channels", channels); string jsonData = JsonConvert.SerializeObject( new JObject { { "invoice", invoice }, { "store", storeData }, { "actions", actions }, { "custom_data", customData } } ); JObject jsonResult = utility.HttpPostJson(PayDunyaHelper.GetInvoiceUrl(setup.Mode), jsonData); ResponseCode = jsonResult["response_code"].ToString(); if (ResponseCode == "00") { Status = PaydunyaCheckout.SUCCESS; SetInvoiceUrl(jsonResult["response_text"].ToString()); ResponseText = jsonResult["description"].ToString(); Token = jsonResult["token"].ToString(); return(true); } else { ResponseText = jsonResult["response_text"].ToString(); Status = PaydunyaCheckout.FAIL; return(false); } }