Beispiel #1
0
        /// <summary>
        /// Método para realizar o cadastro (com o mínimo possível de dados) no programa de pontos tudo azul
        /// TODO: Renato;
        /// </summary>
        static async Task CadastrarNoTudoAzul()
        {
            extWSAddressView customerAdress = new extWSAddressView();

            customerAdress.additionalInfo  = null;
            customerAdress.apartmentNumber = null;
            customerAdress.city            = "Jaboatao dos Guararapes";
            customerAdress.country         = "BR";
            customerAdress.email           = "*****@*****.**";
            customerAdress.fax             = null;
            customerAdress.house           = "3256";
            customerAdress.mobile          = "81998906521";
            customerAdress.name            = "H";
            customerAdress.neighbourhood   = "Piedade";
            customerAdress.phone           = null;
            customerAdress.postalCode      = "54410010";
            customerAdress.region          = "PE";
            customerAdress.street          = "Bernardo Vieira de Melo";
            customerAdress.streetPrefix    = null;

            extWSRegistrationFormView customer = new extWSRegistrationFormView();

            customer.accountId                = 0;
            customer.accountIdSpecified       = false;
            customer.address                  = customerAdress;
            customer.applicationDateSpecified = false;
            customer.birthDate                = DateTime.Parse("01/12/1987 00:00:00");
            customer.birthDateSpecified       = true;
            customer.enrollmentCode           = "QSAPPADR";
            customer.firstName                = "JONH";
            customer.gender = "M";
            customer.identifierIdSpecified = false;
            customer.identifierNo          = "59662838260"; //CHANGE IT BY GENERATING A RANDOM CPF
            customer.identifierType        = "FFP";
            customer.lastName           = "JOHN";
            customer.nationality        = "BR";
            customer.omitValidation     = true;
            customer.ownCpf             = true;
            customer.ownCpfSpecified    = true;
            customer.title              = "MR";
            customer.travelDocumentID   = "59662838260"; //SAME AS identifierNo
            customer.travelDocumentType = "1";

            customer.password = "******"; //NOT MANDATORY, CAN BE COMMENTED

            var response = await new ComarchService().EnrollCustomerExtAsync(customer);

            Console.WriteLine("New Customer ID: " + response.@return);
        }
        public async Task <enrollCustomerExtResponse1> EnrollCustomerExtAsync(extWSRegistrationFormView customer)
        {
            var userContext = new extUserContextView {
                clientLogin = _clientUsername, clientPass = _clientPassword, channel = "U", langCode = "pt"
            };

            enrollCustomerExtResponse1 response = null;

            await Resilience.HandleAsync(async() =>
            {
                response = await _comarchService.enrollCustomerExtAsync(userContext, customer);
            }, "ComarchEnrollCustomerExtAsync");

            if (response?.@return == null)
            {
                throw new Exception();
            }

            return(response);
        }