Example #1
0
        public void doVerify()
        {
            string url = "https://staging-api.payhub.com/api/v2/";
            string oauth = "107d74ab-4a18-4713-88ff-69bd05710086";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10127;
            merchant.terminal_id = 215;
            CardData card_data = new CardData();
            card_data.card_number = "4055011111111111";
            card_data.card_expiry_date = "202012"; //September 2018
            card_data.billing_address_1 = "123 Happy St";
            card_data.billing_address_2 = "On the corner";
            card_data.billing_city = "San Rafael";
            card_data.billing_state = "CA";
            card_data.billing_zip = "94901";
            card_data.cvv_data = "999";
            Customer customer = new Customer();
            customer.first_name = "Joe";
            customer.last_name = "Tester";
            customer.company_name = "Payhub Inc";
            customer.job_title = "Software Engineer";
            customer.email_address = "*****@*****.**";
            customer.web_address = "http://payhub.com";
            customer.phone_number = "844-217-1631";
            customer.phone_ext = "123";
            customer.phone_type = "W";
            Verify verify = new Verify(merchant, card_data, customer);
            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            VerifyResponseInformation response = transaction.doVerify(verify);
            Console.Write(response.rowData);
        }
        public void findReports()
        {
            string url = "https://staging-api.payhub.com/api/v2/";
            string oauth = "107d74ab-4a18-4713-88ff-69bd05710086";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10127;
            merchant.terminal_id = 215;
            TransactionSearchParameters tsp = new TransactionSearchParameters();
            tsp.AmountFrom = "1";
            tsp.AmountTo = "1002";
            tsp.CardLast4Digits = "4507";
            tsp.BatchIdFrom = "1300";
            tsp.BatchIdTo = "1320";
            tsp.Email = "marrighi";
            tsp.TransactionType = "Sale";
            tsp.ResponseCode = "00";
            tsp.FirstName = "First";
            tsp.LastName = "Cont";
            tsp.PhoneNumber = "(415) 479 1349";
            tsp.TrnDateFrom = "2015-04-01 00:00:00";
            tsp.TrnDateTo = "2015-04-30 00:00:00";
            tsp.CardType = "MasterCard";
            tsp.CardToken = "9999000000001853";
            tsp.Swiped = "true";
            tsp.Source = "3rd Party API";

            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            List<TransactionReportInformation> tri = transaction.findTransactions(tsp);

            Console.Write(tri.ElementAt(0).CustomerName);
        }
        public void doAuthorization()
        {
            /* The current url, oauth_token, orgId and Terminal Id provided in this example, are only for testing purposes
            *  For development purposes you need to contact the Payhub Integration Support team. They will provide you with  *  all you need.
            *  Thanks.
            */
            //Defining the Web Service URL
            string url = "https://sandbox-api.payhub.com/api/v2/";
            string oauth = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10074;
            merchant.terminal_id = 134;

            Bill bill = new Bill();
            bill.Base_amount = (decimal)7.00m;
            bill.Shipping_amount = (decimal)2.00m;
            bill.Tax_amount = (decimal)1.00m;
            bill.note = "";
            bill.invoice_number = "";
            bill.po_number = "";
            CardData card_data = new CardData();
            card_data.card_number = "4055011111111111";
            card_data.card_expiry_date = "202012"; //September 2018
            card_data.billing_address_1 = "123 Happy St";
            card_data.billing_address_2 = "On the corner";
            card_data.billing_city = "San Rafael";
            card_data.billing_state = "CA";
            card_data.billing_zip = "12345";
            card_data.cvv_data = "999";
            Customer customer = new Customer();
            customer.first_name = "Joe";
            customer.last_name = "Tester";
            customer.company_name = "Payhub Inc";
            customer.job_title = "Software Engineer";
            customer.email_address = "*****@*****.**";
            customer.web_address = "http://payhub.com";
            customer.phone_number = "844-217-1631";
            customer.phone_ext = "123";
            customer.phone_type = "W";
            AuthOnly authorization = new AuthOnly(merchant,bill,card_data,customer);

            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            AuthorizationResponseInformation response = transaction.doAuthonly(authorization);
            Console.Write(response.rowData);
            if (response.errors == null)
            {
                var transactionId = response.AuthOnlyResponse.TransactionId;
                Capture capture = new Capture(merchant, transactionId, bill);
                CaptureResponseInfromation responseCapture = transaction.doCapture(capture);
                Console.Write(responseCapture.rowData);
            }
            else
            {
                Console.Write(response.errors);
            }
        }
Example #4
0
        public void getInformation()
        {
            string url = "https://staging-api.payhub.com/api/v2/";
            string oauth = "107d74ab-4a18-4713-88ff-69bd05710086";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10127;
            merchant.terminal_id = 215;

            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            SaleResponseInformation response = transaction.getSaleInformation("18243011");
            Console.Write(response.rowData);
        }
Example #5
0
        public void doSale()
        {
            string url = "https://staging-api.payhub.com/api/v2/";
            string oauth = "107d74ab-4a18-4713-88ff-69bd05710086";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10127;
            merchant.terminal_id = 215;

            Bill bill = new Bill();
            bill.Base_amount = (decimal)7.00m;
            bill.Shipping_amount = (decimal)2.00m;
            bill.Tax_amount = (decimal)1.00m;
            bill.note = "";
            bill.invoice_number = "";
            bill.po_number = "";
            CardData card_data = new CardData();
            card_data.card_number = "4055011111111111";
            card_data.card_expiry_date = "202012";
            card_data.billing_address_1 = "123 Happy St";
            card_data.billing_address_2 = "On the corner";
            card_data.billing_city = "San Rafael";
            card_data.billing_state = "CA";
            card_data.billing_zip = "12345";
            card_data.cvv_data = "999";
            Customer customer = new Customer();
            customer.first_name = "Joe";
            customer.last_name = "Tester";
            customer.company_name = "Payhub Inc";
            customer.job_title = "Software Engineer";
            customer.email_address = "*****@*****.**";
            customer.web_address = "http://payhub.com";
            customer.phone_number = "844-217-1631";
            customer.phone_ext = "123";
            customer.phone_type = "W";
            Sale sale = new Sale(merchant, bill, card_data, customer);

            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            SaleResponseInformation response = transaction.doSale(sale);
            Console.Write(response.rowData);
            if (response.errors == null)
            {
                var saleId = response.SaleResponse.SaleId;
                VoidTransaction voidTransaction = new VoidTransaction(merchant, saleId);
                VoidResponseInformation voidInfo = transaction.doVoid(voidTransaction);
                Console.Write(voidInfo.rowData);
            }
            else {
                Console.Write(response.errors);
            }
        }
        public void addMetadata()
        {
            /* The current url, oauth_token, orgId and Terminal Id provided in this example, are only for testing purposes
            *  For development purposes you need to contact the Payhub Integration Support team. They will provide you with  *  all you need.
            *  Thanks.
            */
            //Defining the Web Service URL
            string url = "https://sandbox-api.payhub.com/api/v2/";
            string oauth = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10074;
            merchant.terminal_id = 134;

            Bill bill = new Bill();
            bill.Base_amount = (decimal)7.00m;
            bill.Shipping_amount = (decimal)2.00m;
            bill.Tax_amount = (decimal)1.00m;
            bill.note = "";
            bill.invoice_number = "";
            bill.po_number = "";
            CardData card_data = new CardData();
            card_data.card_number = "4055011111111111";
            card_data.card_expiry_date = "202012";
            card_data.billing_address_1 = "123 Happy St";
            card_data.billing_address_2 = "On the corner";
            card_data.billing_city = "San Rafael";
            card_data.billing_state = "CA";
            card_data.billing_zip = "12345";
            card_data.cvv_data = "999";
            Customer customer = new Customer();
            customer.first_name = "Joe";
            customer.last_name = "Tester";
            customer.company_name = "Payhub Inc";
            customer.job_title = "Software Engineer";
            customer.email_address = "*****@*****.**";
            customer.web_address = "http://payhub.com";
            customer.phone_number = "844-217-1631";
            customer.phone_ext = "123";
            customer.phone_type = "W";
            Sale sale = new Sale(merchant, bill, card_data, customer);

            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            SaleResponseInformation saleResponse = transaction.doSale(sale);
            if (saleResponse.errors == null) {
                string datos = "{\"order\": {\"id\": 465, \"invoice\":\"MyIncoice\", \"lines\": [{\"City\": \"Cordoba\"}, {\"Neighborhood\": \"Nueva Cordoba\"}]}}";
                transaction.addMetaData(datos, TransactionType.Sale, saleResponse.SaleResponse.SaleId);
                SaleResponseInformation saleResponseMetadata = transaction.getSaleInformation(saleResponse.SaleResponse.SaleId);
                Console.Write(saleResponseMetadata.metaData);
            }
        }
        public void doRecurringBilling()
        {
            /* The current url, oauth_token, orgId and Terminal Id provided in this example, are only for testing purposes
            *  For development purposes you need to contact the Payhub Integration Support team. They will provide you with  *  all you need.
            *  Thanks.
            */
            //Defining the Web Service URL
            string url = "https://sandbox-api.payhub.com/api/v2/";
            string oauth = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10074;
            merchant.terminal_id = 134;

            ScheduleSartAndEnd scheduleSartAndEnd = new ScheduleSartAndEnd();
            scheduleSartAndEnd.Start_date = Convert.ToDateTime("2016-07-08");
            scheduleSartAndEnd.End_date = Convert.ToDateTime("2017-07-08");
            scheduleSartAndEnd.end_date_type = "O";
            MontlySchedule montlySchedule = new MontlySchedule();
            montlySchedule.Monthly_type = "E";
            List<int> m = new List<int>();
            m.Add(15);
            montlySchedule.Monthly_each_days = m;
            Schedule schedule = new Schedule("M");
            schedule.Schedule_type = "M";
            schedule.Bill_generation_interval = 1;

            Bill bill = new Bill();
            bill.Base_amount = (decimal)19.99m;
            CardData card_data = new CardData();
            card_data.card_number = "4012881888818888";
            card_data.card_expiry_date = "202012"; //September 2018
            card_data.billing_zip = "60527";
            Customer customer = new Customer();
            customer.first_name = "Joe";
            customer.last_name = "Tester";
            customer.phone_number = "844-217-1631";
            customer.phone_type = "W";
            RecurringBill recurringBill = new RecurringBill(merchant,card_data,customer,schedule,bill);
            recurringBill.Merchant = merchant;
            recurringBill.Card_data = card_data;
            recurringBill.Customer = customer;
            recurringBill.Schedule = schedule;
            recurringBill.Bill = bill;
            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            RecurringBillInformation response = transaction.doRecurringBill(recurringBill);
            Console.Write(response.rowData);
        }
        public void getLists()
        {
            string url = "https://staging-api.payhub.com/api/v2/";
            string oauth = "107d74ab-4a18-4713-88ff-69bd05710086";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10127;
            merchant.terminal_id = 215;

            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            // debug and see the result list for each transaction
            var a = transaction.getAllBillForSaleInformation();
            var b = transaction.getAllBillForRecurringBillInformation();
            var c = transaction.getAllCardDataInformation();
            var d = transaction.getAllCustomerForRecurringBillInformation();
            var e = transaction.getAllCustomerForSalesInformation();
            var f = transaction.getAllMerchantInformation();
        }
        public void findAll()
        {
            /* The current url, oauth_token, orgId and Terminal Id provided in this example, are only for testing purposes
            *  For development purposes you need to contact the Payhub Integration Support team. They will provide you with  *  all you need.
            *  Thanks.
            */
            //Defining the Web Service URL
            string url = "https://sandbox-api.payhub.com/api/v2/";
            string oauth = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10074;
            merchant.terminal_id = 134;

            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            List<RecurringBillInformation> response = transaction.getAllRecurringBillInformation(0,100);
            if (response != null) Console.Write(response[0].rowData);
        }
Example #10
0
        public void doRefund()
        {
            string url = "https://staging-api.payhub.com/api/v2/";
            string oauth = "107d74ab-4a18-4713-88ff-69bd05710086";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10127;
            merchant.terminal_id = 215;

            //'{someSaleId}' is the Id for the sale that is going to be refunded, each refund transaction will be valid only if the batch has been settled
            //'{someRecordFormat}' like CREDIT_CARD
            var someSaleId = "someSaleId";
            var someRecordFormat = "CREDIT_CARD";
            Refund refund = new Refund(merchant, someSaleId, someRecordFormat);
            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            RefundInformation response = transaction.doRefund(refund);
            Console.Write(response.rowData);
        }
 public void doRecurringBilling()
 {
     string url = "https://staging-api.payhub.com/api/v2/";
     string oauth = "107d74ab-4a18-4713-88ff-69bd05710086";
     ScheduleSartAndEnd scheduleSartAndEnd = new ScheduleSartAndEnd();
     scheduleSartAndEnd.Start_date = Convert.ToDateTime("2015-07-08");
     scheduleSartAndEnd.End_date = Convert.ToDateTime("2016-07-08");
     scheduleSartAndEnd.end_date_type = "O";
     MontlySchedule montlySchedule = new MontlySchedule();
     montlySchedule.Monthly_type = "E";
     List<int> m = new List<int>();
     m.Add(15);
     montlySchedule.Monthly_each_days = m;
     Schedule schedule = new Schedule(scheduleSartAndEnd, montlySchedule);
     schedule.Schedule_type = "M";
     schedule.Bill_generation_interval = 1;
     Merchant merchant = new Merchant();
     merchant.organization_id = 10127;
     merchant.terminal_id = 215;
     Bill bill = new Bill();
     bill.Base_amount = (decimal)19.99m;
     CardData card_data = new CardData();
     card_data.card_number = "4012881888818888";
     card_data.card_expiry_date = "202012"; //September 2018
     card_data.billing_zip = "60527";
     Customer customer = new Customer();
     customer.first_name = "Joe";
     customer.last_name = "Tester";
     customer.phone_number = "844-217-1631";
     customer.phone_type = "W";
     RecurringBill recurringBill = new RecurringBill(merchant,card_data,customer,schedule,bill);
     recurringBill.Merchant = merchant;
     recurringBill.Card_data = card_data;
     recurringBill.Customer = customer;
     recurringBill.Schedule = schedule;
     recurringBill.Bill = bill;
     TransactionManager transaction = new TransactionManager(url, oauth, merchant);
     RecurringBillInformation response = transaction.doRecurringBill(recurringBill);
     Console.Write(response.rowData);
 }
        public void doVerify()
        {
            /* The current url, oauth_token, orgId and Terminal Id provided in this example, are only for testing purposes
            *  For development purposes you need to contact the Payhub Integration Support team. They will provide you with  *  all you need.
            *  Thanks.
            */
            //Defining the Web Service URL
            string url = "https://sandbox-api.payhub.com/api/v2/";
            string oauth = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10074;
            merchant.terminal_id = 134;

            CardData card_data = new CardData();
            card_data.card_number = "4055011111111111";
            card_data.card_expiry_date = "202012"; //September 2018
            card_data.billing_address_1 = "123 Happy St";
            card_data.billing_address_2 = "On the corner";
            card_data.billing_city = "San Rafael";
            card_data.billing_state = "CA";
            card_data.billing_zip = "94901";
            card_data.cvv_data = "999";
            Customer customer = new Customer();
            customer.first_name = "Joe";
            customer.last_name = "Tester";
            customer.company_name = "Payhub Inc";
            customer.job_title = "Software Engineer";
            customer.email_address = "*****@*****.**";
            customer.web_address = "http://payhub.com";
            customer.phone_number = "844-217-1631";
            customer.phone_ext = "123";
            customer.phone_type = "W";
            Verify verify = new Verify(merchant, card_data, customer);
            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            VerifyResponseInformation response = transaction.doVerify(verify);
            Console.Write(response.rowData);
        }
        public void doRefund()
        {
            /* The current url, oauth_token, orgId and Terminal Id provided in this example, are only for testing purposes
            *  For development purposes you need to contact the Payhub Integration Support team. They will provide you with  *  all you need.
            *  Thanks.
            */
            //Defining the Web Service URL
            string url = "https://sandbox-api.payhub.com/api/v2/";
            string oauth = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10074;
            merchant.terminal_id = 134;

            //'{someSaleId}' is the Id for the sale that is going to be refunded, each refund transaction will be valid only if the batch has been settled
            //'{someRecordFormat}' like CREDIT_CARD
            var someSaleId = "someSaleId";
            var someRecordFormat = "CREDIT_CARD";
            Refund refund = new Refund(merchant, someSaleId, someRecordFormat);
            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            RefundInformation response = transaction.doRefund(refund);
            Console.Write(response.rowData);
        }
        public void getLists()
        {
            string url = "https://sandbox-api.payhub.com/api/v2/";
            string oauth = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";

            Merchant merchant = new Merchant();
            merchant.organization_id = 10074;
            merchant.terminal_id = 134;

            TransactionManager transaction = new TransactionManager(url, oauth, merchant);
            // debug and see the result list for each transaction
            var sales = transaction.getAllSalesInformation();
            var auths = transaction.getAllAuthOnlyInformation();
            var caps = transaction.getAllCaptureInformation(0,100);
            var voids = transaction.getAllVoidResponseInformation(0,100);
            var refunds = transaction.getAllRefundInformation(0,100);

            var a = transaction.getAllBillForSaleInformation(0,100);
            var b = transaction.getAllBillForRecurringBillInformation(0,100);
            var c = transaction.getAllCardDataInformation(0,100);
            var d = transaction.getAllCustomerForRecurringBillInformation(0,100);
            var e = transaction.getAllCustomerForSalesInformation(0,100);
            var f = transaction.getAllMerchantInformation(0,100);
        }
 public ScheduleInformation(TransactionManager transactionManager)
     : base(transactionManager)
 {
     this.transactionType = TransactionType.CardData;
 }
 public MerchantInformation(TransactionManager transactionManager)
     : base(transactionManager)
 {
     this.transactionType = TransactionType.CardData;
 }
Example #17
0
 public AbstractInfo(TransactionManager transactionManager)
 {
     this.transactionManager = transactionManager;
 }
 public BillInformation(TransactionManager t)
 {
     this.transactionManager = t;
     transactionType = TransactionType.Bill;
 }
 public StatusInformation(TransactionManager transactionManager)
     : base(transactionManager)
 {
     this.transactionType = TransactionType.Status;
 }
 public CustomerInformation(TransactionManager transactionManager)
 {
     this.transactionManager=transactionManager;
     this.transactionType=TransactionType.Customer;
 }