コード例 #1
0
        //Get Customer
        public async Task <dynamic> GetCustomerDetails(CustomerDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();
            var data   = await client.GetCustomerAsync(token, model.customerId, model.customerInternalId);

            return(data);
        }
コード例 #2
0
        public async Task <dynamic> SearchRecurringPayments(RecurringDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var      client   = new PaymentGateway.IeBizServiceClient();
            Customer customer = await client.GetCustomerAsync(token, "409", "");

            dynamic response = await client.SearchRecurringPaymentsAsync(token, model.scheduledPaymentInternalId, model.customerId, model.customerInternalId, model.fromDateTime, model.toDateTime, model.start, model.limit, model.sort);

            return(response);
        }
コード例 #3
0
        public async Task <dynamic> DeleteRecurringPayments(RecurringDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var      client   = new PaymentGateway.IeBizServiceClient();
            Customer customer = await client.GetCustomerAsync(token, "409", "");

            dynamic response = await client.ModifyScheduledRecurringPaymentStatusAsync(token, model.scheduledPaymentInternalId, model.statusId);

            return(response);
        }
コード例 #4
0
ファイル: SyncManager.cs プロジェクト: Tekhqs-Net/EbizWebApi
        public async Task <dynamic> SyncCustomers(SyncDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();
            List <SyncCustomerReponse> customerReponses = new List <SyncCustomerReponse>();
            SyncResponseModel          response         = new SyncResponseModel();

            foreach (var item in model.customers)
            {
                SyncCustomerReponse custresponse = new SyncCustomerReponse();
                try
                {
                    var customer = await client.GetCustomerAsync(token, item.CustomerId, "");

                    item.CustomerId         = customer.CustomerId;
                    item.CustomerInternalId = customer.CustomerInternalId;
                    var updatecust = await new CustomerManager().UpdateCustomer(item, model.securityToken);
                    custresponse.Status             = updatecust.Status;
                    custresponse.Message            = "Succesfuly Updated";
                    custresponse.CustomerId         = updatecust.CustomerId;
                    custresponse.CustomerInternalId = updatecust.CustomerInternalId;
                    customerReponses.Add(custresponse);
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString() == "Not Found" && item != null)
                    {
                        var newcust = await new CustomerManager().AddNewCustomer(item, model.securityToken);
                        custresponse.Status             = newcust.Status;
                        custresponse.Message            = "Succesfuly Created";
                        custresponse.CustomerId         = newcust.CustomerId;
                        custresponse.CustomerInternalId = newcust.CustomerInternalId;
                        customerReponses.Add(custresponse);
                    }
                }
            }
            response.customerReponses = customerReponses;
            return(response.customerReponses);
        }
コード例 #5
0
ファイル: EmailManager.cs プロジェクト: Tekhqs-Net/EbizWebApi
        public async Task <EmailResponse> AddPaymentMethodTemplate(EmailDetailModel model)
        {
            SecurityToken token = await GetSecurityToken();

            var           client   = new PaymentGateway.IeBizServiceClient();
            EmailResponse response = new EmailResponse();

            if (!string.IsNullOrEmpty(model.ebizWebForm?.CustomerId))
            {
                try
                {
                    Customer customer = await client.GetCustomerAsync(token, model.ebizWebForm.CustomerId, "");

                    model.ebizWebForm.CustFullName = customer.FirstName + " " + customer.LastName;
                    model.customer = customer;
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString() == "Not Found" && model.customer != null)
                    {
                        Customer customer = new Customer();
                        customer.CustomerId  = model.ebizWebForm.CustomerId;
                        customer.CompanyName = model.ebizWebForm.CustFullName;
                        //model.customer
                        response.Customer                 = await new CustomerManager().AddNewCustomer(customer, token);
                        model.ebizWebForm.CustomerId      = response.Customer.CustomerId;
                        model.ebizWebForm.CustFullName    = model.customer.FirstName + " " + model.customer.LastName;
                        model.customer.CustomerInternalId = response.Customer.CustomerInternalId;
                    }
                }
            }
            model.ebizWebForm.EmailAddress        = "*****@*****.**";
            model.ebizWebForm.SendEmailToCustomer = true;
            var data = await client.GetEbizWebFormURLAsync(token, model.ebizWebForm);

            response.EbizWebFormLink = data;
            return(response);
        }
コード例 #6
0
        //Save Transaction without saving payment details
        public async Task <dynamic> SaveCustTransaction(CustomerTransactionModel model)
        {
            Response response = new Response();
            // if paymentmethod is empty then first add payment method also check customer token as well.
            //if customer token available then search on cstmr token otherwise on id.
            //if paymentmethodid = "" then add and save card details
            // paymentmethodid from model
            string        custIntlId    = "";
            string        invoiceIntlId = "";
            string        orderIntlId   = "";
            SecurityToken token         = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();

            if (!string.IsNullOrEmpty(model.customer?.CustomerId))
            {
                try
                {
                    model.customer = await client.GetCustomerAsync(token, model.customer.CustomerId, "");

                    //getCustomer( by id customer?.CustomerId
                    //assigne to custIntlId = customerInternalID
                    custIntlId = model.customer.CustomerInternalId;
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString() == "Not Found")
                    {
                        custIntlId = "";
                    }
                }
            }
            if (string.IsNullOrEmpty(custIntlId.ToString()) && model.customer != null)
            {
                //Add customer
                response.CustomerResponse = await new CustomerManager().AddNewCustomer(model.customer, token);
                //get customertoken
                model.customer.CustomerToken = await client.GetCustomerTokenAsync(token, model.customer.CustomerId, model.customer.CustomerInternalId);

                custIntlId = response.CustomerResponse.CustomerInternalId;
            }
            if (string.IsNullOrEmpty(model.paymentMethod) && model.paymentMethodProfile != null)
            {
                //Add Payment method (use custIntlId
                //if secondrySort == 0 then call SetAsDefault
                // values must come from controller.
                response.PaymentMethodProfileResponse = await new PaymentManager().AddNewPaymentDetails(model.customer.CustomerInternalId, model.paymentMethodProfile);
                model.paymentMethod = response.PaymentMethodProfileResponse;
                // this logic also implemented in controller.
                if (model.paymentMethodProfile.SecondarySort == "0")
                {
                    PaymentProfile obj = new PaymentProfile();
                    obj.customerToken = model.customer.CustomerToken;
                    obj.paymentMethod = response.PaymentMethodProfileResponse;
                    obj.securityToken = token;
                    var status = await new PaymentManager().SetDefaultPaymentMethodProfile(obj);
                }
            }
            if (!string.IsNullOrEmpty(model.customerTransaction?.Details?.Invoice) && model.isOrder == false)
            {
                try
                {
                    model.invoice = await client.GetInvoiceAsync(token, model.customer.CustomerId, "", model.customerTransaction.Details.Invoice, "");

                    invoiceIntlId = model.invoice.InvoiceInternalId;
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString() == "Not Found")
                    {
                        invoiceIntlId = "";
                    }
                }
            }
            if (string.IsNullOrEmpty(invoiceIntlId.ToString()) && model.invoice != null && model.isOrder == false)
            {
                //Add new Invoice
                response.Invoice = await new InvoiceManager().AddInvoices(model.invoice, token);
                invoiceIntlId    = response.Invoice.InvoiceInternalId;
            }
            if (!string.IsNullOrEmpty(model.customerTransaction?.Details?.OrderID) && model.isOrder == true)
            {
                try
                {
                    model.salesOrder = await client.GetSalesOrderAsync(token, model.customer.CustomerId, model.customer.CustomerInternalId, model.customerTransaction.Details.OrderID, "");

                    orderIntlId = model.salesOrder.SalesOrderInternalId;
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString() == "Not Found")
                    {
                        orderIntlId = "";
                    }
                }
            }
            if (string.IsNullOrEmpty(orderIntlId.ToString()) && model.salesOrder != null && model.isOrder == true)
            {
                //Add new Invoice
                response.SalesOrder = await new OrderManager().AddSalesOrder(token, model.salesOrder);
                orderIntlId         = response.SalesOrder.SalesOrderInternalId;
            }

            //Call Run Customer transaction
            ///
            //end
            var result = await client.runCustomerTransactionAsync(token, model.customer.CustomerToken, model.paymentMethod, model.customerTransaction);

            if (model.isOrder == true)
            {
                if (!string.IsNullOrEmpty(model.customerTransaction.Details.OrderID))
                {
                    ApplicationTransactionRequest obj = new ApplicationTransactionRequest();
                    {
                        obj.CustomerInternalId = custIntlId;
                        obj.LinkedToInternalId = orderIntlId;                               //sales order internal id or invoice internal id
                        obj.LinkedToTypeId     = model.customerTransaction.Details.OrderID; //sales order number or invoice number
                        obj.TransactionId      = result.RefNum;
                        obj.TransactionDate    = DateTime.Now.ToString();
                        obj.TransactionTypeId  = "AuthOnly";
                        obj.SoftwareId         = ".NetApi";
                    }
                    response.AppTransResponse = await client.AddApplicationTransactionAsync(token, obj);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(model.customerTransaction.Details.Invoice))
                {
                    ApplicationTransactionRequest obj = new ApplicationTransactionRequest();
                    {
                        obj.CustomerInternalId = custIntlId;
                        obj.LinkedToInternalId = invoiceIntlId;                             //sales order internal id or invoice internal id
                        obj.LinkedToTypeId     = model.customerTransaction.Details.Invoice; //sales order number or invoice number
                        obj.TransactionId      = result.RefNum;
                        obj.TransactionDate    = DateTime.Now.ToString();
                        obj.TransactionTypeId  = "AuthOnly";
                        obj.SoftwareId         = ".NetApi";
                    }
                    response.AppTransResponse = await client.AddApplicationTransactionAsync(token, obj);
                }
            }


            if (result.ResultCode == "A")
            {
                response.TransResponse = result;
            }
            else
            {
                response.TransResponse = result;
            }
            return(response);
        }
コード例 #7
0
ファイル: EmailManager.cs プロジェクト: Tekhqs-Net/EbizWebApi
        public async Task <EmailResponse> GetEmailPaymentTemplate(EmailDetailModel model)
        {
            EmailResponse response = new EmailResponse();
            SecurityToken token    = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();

            if (!string.IsNullOrEmpty(model.ebizWebForm?.CustomerId))
            {
                try
                {
                    Customer customer = await client.GetCustomerAsync(token, model.ebizWebForm.CustomerId, "");

                    model.ebizWebForm.CustFullName = customer.FirstName + " " + customer.LastName;
                    model.customer = customer;
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString() == "Not Found" && model.customer != null)
                    {
                        Customer customer = new Customer();
                        customer.CustomerId  = model.ebizWebForm.CustomerId;
                        customer.CompanyName = model.ebizWebForm.CustFullName;
                        //model.customer
                        response.Customer                 = await new CustomerManager().AddNewCustomer(customer, token);
                        model.ebizWebForm.CustomerId      = response.Customer.CustomerId;
                        model.ebizWebForm.CustFullName    = model.customer.FirstName + " " + model.customer.LastName;
                        model.customer.CustomerInternalId = response.Customer.CustomerInternalId;
                    }
                }
            }
            //ShowViewSalesOrderLink
            //ShowViewInvoiceLink
            if (!string.IsNullOrEmpty(model.ebizWebForm?.InvoiceNumber))
            {
                try
                {
                    var invoice = await client.GetInvoiceAsync(token, model.ebizWebForm.CustomerId, "", model.ebizWebForm.InvoiceNumber, model.ebizWebForm.InvoiceInternalId);

                    model.ebizWebForm.InvoiceNumber     = invoice.InvoiceNumber;
                    model.ebizWebForm.InvoiceInternalId = invoice.InvoiceInternalId;
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString() == "Not Found" && model.invoice != null)
                    {
                        //model.invoice
                        Invoice invoice = new Invoice();
                        invoice.CustomerId     = model.ebizWebForm.CustomerId;
                        invoice.AmountDue      = model.ebizWebForm.AmountDue;
                        invoice.InvoiceNumber  = model.ebizWebForm?.InvoiceNumber;
                        invoice.InvoiceDueDate = model.ebizWebForm.DueDate?.ToString();
                        var addinvoice = await client.AddInvoiceAsync(token, invoice);

                        response.Invoice = addinvoice;
                        model.ebizWebForm.InvoiceNumber     = invoice.InvoiceNumber;
                        model.ebizWebForm.InvoiceInternalId = addinvoice.InvoiceInternalId;
                    }
                }
            }
            if (!string.IsNullOrEmpty(model.ebizWebForm?.OrderId))
            {
                try
                {
                    var salesOrder = await client.GetSalesOrderAsync(token, model.ebizWebForm?.CustomerId, model.customer?.CustomerInternalId, model.ebizWebForm?.OrderId, model.salesOrder?.SalesOrderInternalId);

                    model.ebizWebForm.SalesOrderInternalId = salesOrder.SalesOrderInternalId;
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString() == "Not Found" && model.salesOrder != null)
                    {
                        //model.salesOrder
                        //SalesOrder salesOrder = new SalesOrder();
                        var addOrder = await client.AddSalesOrderAsync(token, model.salesOrder);

                        response.SalesOrder = addOrder;
                        model.ebizWebForm.SalesOrderInternalId = addOrder.SalesOrderInternalId;
                    }
                }
            }
            var data = await client.GetEbizWebFormURLAsync(token, model.ebizWebForm);

            response.EbizWebFormLink = data;
            return(response);
        }