static void Main(string[] args) { MRWPurchase purch = new MRWPurchase(); RequestModel model=new RequestModel(); model.Amount =Convert.ToDecimal("100.00"); model.PAN = "4242424242424242"; model.ExpDate = Convert.ToInt32("1612"); model.Crypt = "7"; string pan = model.PAN;// "4242424242424242"; string expdate = model.ExpDate.ToString();//"0812"; string crypt = model.Crypt;// "7"; var receipt= purch.BasicPurchase(model); Console.WriteLine("CardType = " + receipt.CardType); Console.WriteLine("TransAmount = " + receipt.TransAmount); Console.WriteLine("TxnNumber = " + receipt.TxnNumber); Console.WriteLine("ReceiptId = " + receipt.ReceiptId); Console.WriteLine("TransType = " + receipt.TransType); Console.WriteLine("ReferenceNum = " + receipt.ReferenceNum); Console.WriteLine("ResponseCode = " + receipt.ResponseCode); Console.WriteLine("ISO = " + receipt.ISO); Console.WriteLine("BankTotals = " + receipt.BankTotals); Console.WriteLine("Message = " + receipt.Message); Console.WriteLine("AuthCode = " + receipt.AuthCode); Console.WriteLine("Complete = " + receipt.Complete); Console.WriteLine("TransDate = " + receipt.TransDate); Console.WriteLine("TransTime = " + receipt.TransTime); Console.WriteLine("Ticket = " + receipt.Ticket); Console.WriteLine("TimedOut = " + receipt.TimedOut); Console.WriteLine("IsVisaDebit = " + receipt.IsVisaDebit); Console.ReadKey(); }
public ReceiptModel BasicPurchase(RequestModel model) { OrderInfo oinfo = new OrderInfo(); string host = AuthInfo.Host; string store_id = AuthInfo.StoreID; string api_token = AuthInfo.APIToken; string order_id = oinfo.GenerateOrderID();// "Test_P_0333"; string amount = model.Amount.Value.ToString(); string pan = model.PAN;// "4242424242424242"; string expdate = model.ExpDate.ToString();//"0812"; string crypt = model.Crypt;// "7"; //string status = "true"; /* Status Check Example */ // HttpsPostRequest mpgReq = // new HttpsPostRequest(host, store_id, api_token, status, // new Purchase(order_id, amount, pan, expdate, crypt)); Purchase purchase = new Purchase(order_id, amount, pan, expdate, crypt); //purchase.SetDynamicDescriptor("2134565"); HttpsPostRequest mpgReq = new HttpsPostRequest(host, store_id, api_token, purchase); ReceiptModel rcptModel = new ReceiptModel(); try { Receipt receipt = mpgReq.GetReceipt(); rcptModel.CardType = receipt.GetCardType(); rcptModel.TransAmount =receipt.GetTransAmount(); rcptModel.TxnNumber = receipt.GetTxnNumber(); rcptModel.ReceiptId = receipt.GetReceiptId(); rcptModel.TransType = receipt.GetTransType(); rcptModel.ReferenceNum = receipt.GetReferenceNum(); rcptModel.ResponseCode = receipt.GetResponseCode(); rcptModel.ISO = receipt.GetISO(); rcptModel.BankTotals = receipt.GetBankTotals(); rcptModel.Message = receipt.GetMessage(); rcptModel.AuthCode = receipt.GetAuthCode(); rcptModel.Complete = receipt.GetComplete(); rcptModel.TransDate = receipt.GetTransDate(); rcptModel.TransTime = receipt.GetTransTime(); rcptModel.Ticket = receipt.GetTicket(); rcptModel.TimedOut = receipt.GetTimedOut(); rcptModel.IsVisaDebit = receipt.GetIsVisaDebit(); //Console.WriteLine("StatusCode = " + receipt.GetStatusCode()); //Console.WriteLine("StatusMessage = " + receipt.GetStatusMessage()); return rcptModel; } catch (Exception e) { Console.WriteLine(e); return null; } }
public string SaveAmount(RequestModel Pay) { MRWPurchase purch = new MRWPurchase(); RequestModel model = new RequestModel(); model.Amount = Convert.ToDecimal("100.00"); model.PAN = "4242424242424242"; model.ExpDate = Convert.ToInt32("1612"); model.Crypt = "7"; string pan = model.PAN;// "4242424242424242"; string expdate = model.ExpDate.ToString();//"0812"; string crypt = model.Crypt;// "7"; var receipt = purch.BasicPurchase(model); if (receipt.ResponseCode == null || receipt.ResponseCode=="null") return "0"; // Transaction not sent for authorization. else if (Convert.ToInt32(receipt.ResponseCode) < 50) return "1"; // Transaction approved. else return "0"; // >=50 Transaction declined. }