Exemplo n.º 1
0
 public object Put(PreAuth request)
 {
     // Submit and return the transaction hash of the broadcasted transaction
     return(AppServices.createSignPublishTransaction(
                AppModelConfig.EXTACCESSI.abi,
                request.ContractAdr,
                request.SigningPrivateKey,
                "preAuth",
                null
                ));
 }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            string host = "esqa.moneris.com";
            string order_id = "Need_Unique_Order_ID_12345";
            string store_id = "store5";
            string api_token = "yesguy";
            string amount = "304.00";
            string pan = "5454545454545454";
            string expdate = "0812";
            string crypt = "7";

            PreAuth preauth = new PreAuth(order_id, amount, pan, expdate, crypt);

            //preauth.SetDynamicDescriptor("123456");

            HttpsPostRequest mpgReq = new HttpsPostRequest(host, store_id, api_token, preauth);

            /**********************   REQUEST  ************************/

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 3
0
        public ProcessPaymentResult ProcessPayment(ProcessPaymentRequest processPaymentRequest)
        {
            var resp = new ProcessPaymentResult
            {
                OrderId      = processPaymentRequest.OrderId,
                CurrencyCode = processPaymentRequest.CurrencyCode,
                AuthorizationTransactionUrl = Settings.NotificationUrl + "/" + processPaymentRequest.OrderId,
                UseAuthUrlToRedirect        = true
            };
            var req = new PreAuth
            {
                id           = GetGivexIdentification(),
                givexNumber  = processPaymentRequest.CardNo,
                reference    = processPaymentRequest.OrderNo + "." + processPaymentRequest.PaymentId,
                amount       = processPaymentRequest.OrderTotal,
                securityCode = processPaymentRequest.Cvv
            };

            try
            {
                var givResp = _givexClient.PreAuth(req);
                if ((givResp != null))
                {
                    resp.AuthorizationTransactionCode = givResp.authCode.ToString();
                    resp.AuthorizedAmount             = givResp.amount;
                    // resp.BalanceAmount = givResp.certBalance;
                }
                else
                {
                    resp.AddError(ErrorCodesPayment.InvalidResponseFromPSP.ToString());
                }
            }
            catch (EndpointNotFoundException endPointExc)
            {
                resp.AddError(ErrorCodesPayment.EndPointNotFound.ToString() + " " + endPointExc.Message);
            }
            catch (FaultException ex)
            {
                resp.AddError(ErrorCodesPayment.RejectedByPSP.ToString() + " " + ex.Message);
            }
            catch (Exception genEx)
            {
                resp.AddError(ErrorCodesPayment.ExceptionInServiceCall.ToString() + " " + genEx.Message);
            }
            return(resp);
        }
        private PreAuth CreateAuth(string cardNumber, string expireDate, string customerId, string orderId, string amount, string cvd)
        {
            // Create purchase
            var auth = new PreAuth();

            auth.SetPan(cardNumber);
            // Expire date "YYMM" format
            auth.SetExpDate(expireDate);
            auth.SetOrderId(orderId);
            auth.SetCustId(customerId);
            auth.SetAmount(amount);
            auth.SetCryptType(_monerisPaymentSettings.Crypt);
            auth.SetDynamicDescriptor(_monerisPaymentSettings.DynamicDescriptor);
            // CVD check
            auth.SetCvdInfo(CreateCvdInfo(cvd));

            return(auth);
        }
Exemplo n.º 5
0
        public void preauthTest()
        {
            var raveConfig  = new RaveConfig(PbKey, ScKey, false);
            var preauthCard = new PreAuth(raveConfig);

            var card = new Card("5377283645077450", "09", "21", "789");

            var preauthResponse = preauthCard.Preauthorize(new PreAuthParams(raveConfig.PbfPubKey, raveConfig.SecretKey, "Olufumi", "Obafumiso", "*****@*****.**", 120, "USD", card)
            {
                TxRef = txRef
            }).Result;


            try
            {
                Assert.IsNotNull(preauthResponse.Data);
                Assert.AreEqual(preauthResponse.Status, "success");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        public static void Main(string[] args)
        {
            string store_id  = "store5";
            string api_token = "yesguy";
            string order_id  = "Test" + DateTime.Now.ToString("yyyyMMddhhmmss");
            string amount    = "5.00";
            string pan       = "4242424242424242";
            string expdate   = "0412";
            string crypt     = "7";
            string processing_country_code = "CA";
            bool   status_check            = false;

            CofInfo cof = new CofInfo();

            cof.SetPaymentIndicator("U");
            cof.SetPaymentInformation("2");
            cof.SetIssuerId("168451306048014");

            PreAuth preauth = new PreAuth();

            preauth.SetOrderId(order_id);
            preauth.SetAmount(amount);
            preauth.SetPan(pan);
            preauth.SetExpDate(expdate);
            preauth.SetCryptType(crypt);
            //preauth.SetWalletIndicator(""); //Refer to documentation for details
            preauth.SetCofInfo(cof);

            //preauth.SetCmId("8nAK8712sGaAkls56"); //set only for usage with Offlinx - Unique max 50 alphanumeric characters transaction id generated by merchant

            HttpsPostRequest mpgReq = new HttpsPostRequest();

            mpgReq.SetProcCountryCode(processing_country_code);
            mpgReq.SetTestMode(true); //false or comment out this line for production transactions
            mpgReq.SetStoreId(store_id);
            mpgReq.SetApiToken(api_token);
            mpgReq.SetTransaction(preauth);
            mpgReq.SetStatusCheck(status_check);
            mpgReq.Send();

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());
                //Console.WriteLine("StatusCode = " + receipt.GetStatusCode());
                //Console.WriteLine("StatusMessage = " + receipt.GetStatusMessage());
                Console.WriteLine("IssuerId = " + receipt.GetIssuerId());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 7
0
        public static void Main(string[] args)
        {
            string host = "esqa.moneris.com";
            string store_id = "store5";
            string api_token = "yesguy";
            string order_id = "Test_Preauth5";
            string amount = "10.01";
            string pan = "4242424242424242";
            string expdate = "0812";
            string crypt = "7";

            /*************** Address Verification Service **********************/

               	AvsInfo avsCheck = new AvsInfo();

               	avsCheck.SetAvsStreetNumber ("212");
               	avsCheck.SetAvsStreetName ("Payton Street");
               	avsCheck.SetAvsZipCode ("M1M1M1");
            avsCheck.SetAvsEmail ("*****@*****.**");
            avsCheck.SetAvsHostname ("hostname");
            avsCheck.SetAvsBrowser ("Mozilla");
            avsCheck.SetAvsShipToCountry("CAN");
            avsCheck.SetAvsShipMethod("G");
            avsCheck.SetAvsMerchProdSku ("123456");
            avsCheck.SetAvsCustIp ("192.168.0.1");
            avsCheck.SetAvsCustPhone ("5556667777");

               	PreAuth preauthTxn = new PreAuth(order_id, amount, pan, expdate, crypt);
               	preauthTxn.SetAvsInfo (avsCheck);

               	/****************** Card Validation Digits *************************/

               	CvdInfo cvdCheck = new CvdInfo();
               	cvdCheck.SetCvdIndicator ("1");
               	cvdCheck.SetCvdValue ("099");

               	preauthTxn.SetCvdInfo (cvdCheck);

               	/************************** Request *************************/

            HttpsPostRequest mpgReq =
                new HttpsPostRequest(host, store_id, api_token,preauthTxn);

            /************************** Receipt *************************/

            try
            {
               	Receipt receipt = mpgReq.GetReceipt();

                Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut ());
                Console.WriteLine("Avs Response = " + receipt.GetAvsResultCode());
                Console.WriteLine("Cvd Response = " + receipt.GetCvdResultCode());
                Console.WriteLine("ITD Response = " + receipt.GetITDResponse());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public static void Main(string[] args)
        {
            /************************* Post Request Variables *****************************/

            string host = "esqa.moneris.com";
            string store_id = "store5";
            string api_token = "yesguy";

            /************************* Transactional Variables ***************************/

            string order_id = "Need_Unique_Order_IDcc";
            string amount = "150.00";
            string pan = "4242424242424242";
            string expdate = "0812";
            string crypt = "7";

            /********************* Billing/Shipping Variables ****************************/

            string first_name = "Bob";
            string last_name = "Smith";
            string company_name = "ProLine Inc.";
            string address = "623 Bears Ave";
            string city = "Chicago";
            string province = "Illinois";
            string postal_code = "M1M2M1";
            string country = "Canada";
            string phone = "777-999-7777";
            string fax = "777-999-7778";
            string tax1 = "10.00";
            string tax2 = "5.78";
            string tax3 = "4.56";
            string shipping_cost = "10.00";

            /********************* Order Line Item Variables *****************************/

            string[] item_description = new string[]{"Chicago Bears Helmet", "Soldier Field Poster"};
            string[] item_quantity = new string[]{"1", "1"};
            string[] item_product_code = new string[]{"CB3450", "SF998S"};
            string[] item_extended_amount = new string[]{"150.00", "19.79"};

               	/*****************************************************************************/
               	/*								             */
               	/*			Customer Information Option 1			     */
               	/*									     */
               	/*****************************************************************************/

            /********************** Customer Information Object **************************/

            CustInfo customer = new CustInfo();

            /********************** Set Customer Billing Information **********************/

            customer.SetBilling (first_name, last_name, company_name, address, city,
                         province, postal_code, country, phone, fax, tax1, tax2,
                         tax3, shipping_cost);

            /******************** Set Customer Shipping Information ***********************/

            customer.SetShipping (first_name, last_name, company_name, address, city,
                         province, postal_code, country, phone, fax, tax1, tax2,
                         tax3, shipping_cost);

            /***************************** Order Line Items  ******************************/

            customer.SetItem (item_description[0], item_quantity[0],
                      item_product_code[0], item_extended_amount[0]);

            customer.SetItem (item_description[1], item_quantity[1],
                      item_product_code[1], item_extended_amount[1]);

               	/*****************************************************************************/
               	/*								             */
               	/*			Customer Information Option 2			     */
               	/*									     */
               	/*****************************************************************************/

               	/********************** Customer Information Object **************************/

            CustInfo customer2 = new CustInfo();

                /******************************* Billing Hashtable ***************************/

                Hashtable b = new Hashtable();	//billing hashtable

                b.Add("first_name",first_name);
                b.Add("last_name", last_name);
                b.Add("company_name",company_name);
                b.Add("address", address);
                b.Add("city", city);
                b.Add("province", province);
                b.Add("postal_code", postal_code);
                b.Add("country", country);
                b.Add("phone", phone);
                b.Add("fax", fax);
                b.Add("tax1",tax1);       //federal tax
                b.Add("tax2",tax2);        //prov tax
                b.Add("tax3",tax3);        //luxury tax
                b.Add("shipping_cost", shipping_cost);   //shipping cost

                customer2.SetBilling(b);

                /****************************** Shipping Hashtable ***************************/

                Hashtable s = new Hashtable();	//shipping hashtable

                s.Add("first_name",first_name);
                s.Add("last_name", last_name);
                s.Add("company_name", company_name);
                s.Add("address", address);
                s.Add("city", city);
                s.Add("province", province);
                s.Add("postal_code",postal_code);
                s.Add("country", country);
                s.Add("phone", phone);
                s.Add("fax", fax);
                s.Add("tax1", tax1);       //federal tax
                s.Add("tax2", tax2);        //prov tax
                s.Add("tax3", tax3);        //luxury tax
                s.Add("shipping_cost", shipping_cost);   //shipping cost

                customer2.SetShipping(s);

                /************************* Order Line Item1 Hashtable ************************/

                Hashtable i1 = new Hashtable();		//item hashtable #1

                i1.Add("name", item_description[0]);
                i1.Add("quantity", item_quantity[0]);
                i1.Add("product_code", item_product_code[0]);
                i1.Add("extended_amount", item_extended_amount[0]);

                customer2.SetItem(i1);

            /************************* Order Line Item2 Hashtable **************************/

                Hashtable i2 = new Hashtable();		//item hashtable #2

                i2.Add("name","item2's name");
                i2.Add("quantity","7");
                i2.Add("product_code","item2's product code");
                i2.Add("extended_amount","5.01");

                customer2.SetItem(i2);

                /*************** Miscellaneous Customer Information Methods *******************/

                customer.SetEmail("*****@*****.**");
                customer.SetInstructions("Make it fast!");

            /********************** Transactional Request Object **************************/

                PreAuth preauth = new PreAuth(order_id, amount, pan, expdate, crypt);

                /************************ Set Customer Information ***************************/

                preauth.SetCustInfo (customer);

            /**************************** Https Post Request ***************************/

            HttpsPostRequest mpgReq =
                new HttpsPostRequest(host, store_id, api_token, preauth);

            /******************************* Receipt ***********************************/

            try
            {
                Receipt receipt = mpgReq.GetReceipt();

             	Console.WriteLine("CardType = " + receipt.GetCardType());
                Console.WriteLine("TransAmount = " + receipt.GetTransAmount());
                Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber());
                Console.WriteLine("ReceiptId = " + receipt.GetReceiptId());
                Console.WriteLine("TransType = " + receipt.GetTransType());
                Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum());
                Console.WriteLine("ResponseCode = " + receipt.GetResponseCode());
                Console.WriteLine("ISO = " + receipt.GetISO());
                Console.WriteLine("BankTotals = " + receipt.GetBankTotals());
                Console.WriteLine("Message = " + receipt.GetMessage());
                Console.WriteLine("AuthCode = " + receipt.GetAuthCode());
                Console.WriteLine("Complete = " + receipt.GetComplete());
                Console.WriteLine("TransDate = " + receipt.GetTransDate());
                Console.WriteLine("TransTime = " + receipt.GetTransTime());
                Console.WriteLine("Ticket = " + receipt.GetTicket());
                Console.WriteLine("TimedOut = " + receipt.GetTimedOut());
                Console.WriteLine("IsVisaDebit = " + receipt.GetIsVisaDebit());

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }