public transaction(int dT, paymentMethod pM)
 {
     this.dateTime  = dT;
     this.isAReturn = false;
     this.pM        = pM;
     this.transactionID++;
 }
 private static PaymentMethodViewModel ToModel(this paymentMethod row)
 {
     return(new PaymentMethodViewModel()
     {
         instructions = row.instructions,
         id = row.id.ToString(),
         name = row.method == PaymentMethod.Other.ToString()? row.name: row.method.ToEnum <PaymentMethod>().ToDescriptionString(),
         identifier = row.identifier
     });
 }
Beispiel #3
0
        private void CreateDataStructures()
        {
            // CREATE DEFAULT STRUCTURES
            // add default inventory location
            var loc = new inventoryLocation
            {
                name       = GeneralConstants.INVENTORY_LOCATION_DEFAULT,
                subdomain  = mastersubdomain.id,
                lastUpdate = DateTime.UtcNow
            };

            repository.AddInventoryLocation(loc, mastersubdomain.id);

            // add default shipping profile
            var shippingProfile = new shippingProfile()
            {
                title       = "Default",
                type        = ShippingProfileType.FLATRATE.ToString(),
                subdomainid = mastersubdomain.id,
                permanent   = true
            };

            repository.AddShippingProfile(shippingProfile);

            // add default payment methods
            var method_bank = new paymentMethod
            {
                method       = PaymentMethod.BankTransfer.ToString(),
                name         = "Bank Deposit",
                instructions = "Please contact me for payment details"
            };

            mastersubdomain.paymentMethods.Add(method_bank);

            var method_cod = new paymentMethod
            {
                method       = PaymentMethod.COD.ToString(),
                name         = "Cash On Delivery",
                instructions = ""
            };

            mastersubdomain.paymentMethods.Add(method_cod);

            usr.passwordHash = Utility.ComputePasswordHash(email + password);

            // if user exist then we still need to verify email
            Random rnd = RandomNumberGenerator.Instance;

            usr.confirmationCode = rnd.Next();

            repository.Save();

            // generate liquid stuff
            new Thread(() => ThemeHandler.GenerateDefaultStructures(mastersubdomain.id)).Start();
        }
 public static PaymentMethodViewModel ToFullModel(this paymentMethod row)
 {
     return(new PaymentMethodViewModel
     {
         id = row.id.ToString(),
         instructions = row.instructions,
         identifier = row.identifier,
         name = row.name,
         methodList = typeof(PaymentMethod).ToSelectList(true, null, null, false, row.method)
     });
 }
Beispiel #5
0
        private void testUpdatePaymentMethod()
        {
            CustomerSalesServicesClient client = new CustomerSalesServicesClient();

            cardPaymentDTO card = new cardPaymentDTO();

            card.cardDisplayName       = "MARIA L B SANTOS";
            card.cardFlag              = "LUIZA";
            card.cardNumber            = "5307804589564512";
            card.cardValidity          = new DateTime(2017, 4, 1);
            card.cardValiditySpecified = true;

            paymentMethod paymentMethod = new paymentMethod();

            paymentMethod.cardPayment = card;

            identityDTO idensales = new identityDTO();

            idensales.documentType          = document.CPF;
            idensales.documentTypeSpecified = true;
            idensales.documentValue         = "44795714851";

            salesman salesman1 = new salesman();

            salesman1.identity = idensales;


            updatePaymentMethodRequest request      = new updatePaymentMethodRequest();
            insuranceCertificate       certificate1 = new insuranceCertificate();

            certificate1.paymentMethod  = paymentMethod;
            certificate1.salesman       = salesman1;
            certificate1.contractNumber = "1095828040419";

            updatePaymentMethodResponse response = null;

            request.certificate = certificate1;

            try {
                response = client.updatePaymentMethod(request);

                Console.WriteLine("Response = " + response);
                Console.WriteLine("Updated = " + response.updated);
                Console.WriteLine("Message = " + response.message);
            } catch (Exception ex) {
                Console.WriteLine("Exception to call service : " + ex);
            }
        }
Beispiel #6
0
        public ActionResult method_save(long?id, string name, string instructions, string method, string identifier)
        {
            var pmethod = new paymentMethod();

            if (id.HasValue)
            {
                pmethod = MASTERdomain.paymentMethods.SingleOrDefault(x => x.id == id);
                if (pmethod == null)
                {
                    return(SendJsonErrorResponse("Could not find method"));
                }
            }
            else
            {
                MASTERdomain.paymentMethods.Add(pmethod);
            }

            // sanity checks
            if (method == PaymentMethod.Paypal.ToString())
            {
                if (!MASTERdomain.currency.ToCurrencyCode().IsCurrencySupportedByPaypal())
                {
                    var errorMessage = string.Concat("<strong>", MASTERdomain.currency.ToCurrencyName(),
                                                     "</strong> is not supported by Paypal. Please change your currency if you want to accept payments via Paypal.");
                    return(Json(errorMessage.ToJsonFail()));
                }
            }

            pmethod.method       = method;
            pmethod.identifier   = identifier;
            pmethod.name         = name;
            pmethod.instructions = instructions;

            try
            {
                repository.Save();
            }
            catch (Exception ex)
            {
                return(SendJsonErrorResponse(ex));
            }
            return(View("method_list", MASTERdomain.paymentMethods.OrderBy(x => x.name).ToModel()));
        }
Beispiel #7
0
        public bool AddPaymentMethod(PaymentMethodDTO PaymentMethod)
        {
            try
            {
                var p = new paymentMethod
                {
                    PMID = PaymentMethod.PMID,
                    name = PaymentMethod.name
                };

                db.paymentMethod.Add(p);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #8
0
        private void testDoSale()
        {
            CustomerSalesServicesClient client = new CustomerSalesServicesClient();

            doSaleRequest request = new doSaleRequest();

            customer c = new customer();

            c.birthDate          = new DateTime(1984, 3, 3);
            c.birthDateSpecified = true;

            addressDTO add = new addressDTO();

            add.addressDetail     = "Rua 1";
            add.type              = addressType.RESIDENTIAL;
            add.typeSpecified     = true;
            add.addressNumber     = "123";
            add.addressPostalCode = "06871120";
            add.city              = "Embu";
            add.neighborhood      = "Marilú";
            add.state             = "SP";

            phoneDTO phone = new phoneDTO();

            phone.phoneNumber   = "1143216363";
            phone.type          = phoneType.RESIDENTIAL;
            phone.typeSpecified = true;

            c.fullName        = "Teste Abobrinha";
            c.gender          = gender.MALE;
            c.genderSpecified = true;

            identityDTO iden = new identityDTO();

            iden.documentType          = document.CPF;
            iden.documentTypeSpecified = true;
            iden.documentValue         = "40614102022";


            c.maritalStatus          = maritalStatus.SINGLE;
            c.maritalStatusSpecified = true;
            //criar novo contato para celular e repetir
            //cus.contacts[1].phone.phoneNumber = segurosuppro.Celular;
            //cus.contacts[1].phone.type = phoneType.MOBILE;

            cardPaymentDTO card = new cardPaymentDTO();

            card.cardDisplayName       = "THIAGO SANTANA";
            card.cardFlag              = "luiza";
            card.cardNumber            = "5307804589564512";
            card.cardSecurityCode      = "456";
            card.cardValidity          = new DateTime(1985, 1, 26);
            card.cardValiditySpecified = true;
            card.cardValue             = Convert.ToDecimal("19,90");
            card.cardValueSpecified    = true;

            productDTO prod = new productDTO();

            prod.descripton  = "CARTÃO PROTEGIDO";
            prod.ID          = 25;
            prod.IDSpecified = true;

            contactDTO cc = new contactDTO();

            cc.address = add;
            cc.phone   = phone;

            contactDTO[] contatos = new contactDTO[] { cc };
            c.contacts = contatos;
            c.identity = iden;

            paymentMethod payM = new paymentMethod();

            payM.cardPayment = card;

            identityDTO idensales = new identityDTO();

            idensales.documentType          = document.CPF;
            idensales.documentTypeSpecified = true;
            idensales.documentValue         = "10752104969";

            loginDTO log = new loginDTO();

            log.username = "******";
            log.password = "******";

            partner part = new partner();

            part.ID          = 001;
            part.IDSpecified = true;

            salesman salman = new salesman();

            salman.identity     = idensales;
            salman.login        = log;
            salman.partner      = part;
            salman.operatorName = "Saulo Mezencio";

            sale sa = new sale();

            sa.customer      = c;
            sa.paymentMethod = payM;
            sa.product       = prod;
            sa.salesman      = salman;

            request.sale = sa;

            doSaleResponse response = null;

            try {
                response = client.doSale(request);

                Console.WriteLine("Response = " + response);
                Console.WriteLine("PARANDO PARA VISUALIZAR JANELA");
            } catch (Microsoft.Web.Services3.ResponseProcessingException exR) {
                Console.WriteLine("Exception to call service FAULT: " + exR.Response.OuterXml);
                Console.WriteLine("PARANDO PARA VISUALIZAR JANELA ANTERIOR");
            }/* catch (Exception ex) {
              * Console.WriteLine("Exception : " + ex);
              * Console.WriteLine("PARANDO PARA VISUALIZAR JANELA");
              * }*/
        }