Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var realmail = 'emailsin@';
- function telepizza(email, callback) {
- var data = {
- email: email
- }
- var url = 'https://d6ow8diqzony0.cloudfront.net/check-prize';
- $.ajax({
- type: "POST",
- url: url,
- dataType: 'json',
- contentType: "application/json",
- crossDomain: true,
- data: JSON.stringify(data),
- success: function (result) {
- console.log(result);
- var body = JSON.stringify(JSON.parse(result['body']));
- var response = JSON.parse(body);
- switch (response.responseMessage) {
- case 'USER_IS_WINNER':
- callback(true);
- break;
- case 'USER_NOT_WIN':
- callback(false);
- break;
- default:
- console.log("¡UpsLoimos este email no es valido, está repetido o ha sido mal introducido.¡INTENTALO DE NUEVO!");
- callback(false)
- break;
- }
- },
- error: function (e) {
- console.log("ERRORssage");
- }
- });
- }
- function validateMail(email, callback) {
- console.log('######################');
- var data = {
- email: email,
- receive_offert: true
- }
- console.log(data);
- var url = 'https://d6ow8diqzony0.cloudfront.net/check-mail';
- $.ajax({
- type: "POST",
- url: url,
- dataType: 'json',
- contentType: "application/json",
- crossDomain: true,
- data: JSON.stringify(data),
- success: function (result) {
- var body = JSON.stringify(JSON.parse(result['body']));
- var response = JSON.parse(body);
- switch (response.responseMessage) {
- case 'EMAIL_SAVED':
- break;
- case 'DYNAMO_ERR':
- console.log("¡UpsHaridorror interno, por favor, vuelve a intentarlo.");
- break;
- case 'USER_HAS_PARTICIPED':
- console.log("¡UpsElrioa participado en el concurso.");
- break;
- case 'FORBIDDEN':
- console.log("¡UpsEstaanzado el número máximo de peticiones. Por favor, vuelve a intentarlo transcurridos 30 minutos.");
- break;
- default:
- console.log("¡UpsLoimos este email no es valido, está vacío, está repetido o ha sido mal introducido.¡INTENTALO DE NUEVO!");
- break;
- }
- callback(response.responseMessage)
- },
- error: function (e) {
- console.log("ERRORssage");
- }
- });
- }
- var nombremail = realmail;
- var intents_tramp = 0;
- function execute() {
- var mail = nombremail + intents_tramp + '@gmail.com';
- validateMail(mail, function (response) {
- console.log(intents_tramp++);
- if (response == 'EMAIL_SAVED') {
- telepizza(mail, function(winner) {
- if(winner) {
- alert('GANADOR !!! PIZZA GRATIS');
- } else {
- repeat();
- }
- });
- } else {
- repeat();
- }
- });
- }
- function repeat() {
- mail = nombremail + intents_tramp + '@gmail.com';
- setTimeout(function () {
- execute();
- }, 4000);
- }
- execute();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement