Exemplo n.º 1
0
 def submit_order(self):
     headers = {
         "accept": "application/json, text/javascript, */*; q=0.01",
         "accept-encoding": "gzip, deflate, br",
         "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7",
         "content-type": "application/json",
         "inkiru_precedence": "false",
         "origin": "https://www.walmart.com",
         "referer": "https://www.walmart.com/checkout/",
         "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.69 Safari/537.36",
         "wm_vertical_id": "0"
     }
     while True:
         self.status_signal.emit({"msg":"Submitting Order","status":"alt"})
         try:
             r = self.session.put("https://www.walmart.com/api/checkout/v3/contract/:PCID/order",json={},headers=headers)
             try:
                 json.loads(r.text)["order"]
                 self.status_signal.emit({"msg":"Order Placed","status":"success"})
                 send_webhook("OP","Walmart",self.profile["profile_name"],self.task_id,self.product_image)
                 return
             except:
                 self.status_signal.emit({"msg":"Payment Failed","status":"error"})
                 if self.check_browser():
                     return
                 send_webhook("PF","Walmart",self.profile["profile_name"],self.task_id,self.product_image)
                 return
         except Exception as e:
             self.status_signal.emit({"msg":"Error Submitting Order (line {} {} {})".format(sys.exc_info()[-1].tb_lineno, type(e).__name__, e),"status":"error"})
             time.sleep(self.error_delay)
Exemplo n.º 2
0
    def __init__(self, task_id, status_signal, image_signal, product, profile,
                 proxy, monitor_delay, error_delay):
        self.task_id, self.status_signal, self.image_signal, self.product, self.profile, self.monitor_delay, self.error_delay = task_id, status_signal, image_signal, product, profile, float(
            monitor_delay), float(error_delay)

        starting_msg = "Starting Target"
        self.browser = self.init_driver()
        self.product_image = None

        if settings.dont_buy:
            starting_msg = "Starting Target in dev mode; will not actually checkout"

        self.status_signal.emit(create_msg(starting_msg, "normal"))
        self.status_signal.emit(create_msg("Logging In..", "normal"))
        self.login()
        self.monitor()
        self.atc()
        self.checkout()
        self.submit_billing()

        if not settings.dont_buy:
            self.submit_order()
        else:
            self.status_signal.emit(create_msg("Mock Order Placed", "success"))
            send_webhook("OP", "Target", self.profile["profile_name"],
                         self.task_id, self.product_image)
Exemplo n.º 3
0
 def check_browser(self):
     if settings.browser_on_failed:
         self.status_signal.emit(
             {"msg": "Browser Ready", "status": "alt", "url": "https://www.walmart.com/checkout/#/payment",
              "cookies": [{"name": cookie.name, "value": cookie.value, "domain": cookie.domain} for cookie in
                          self.session.cookies]})
         send_webhook("B", "Walmart", self.profile["profile_name"], self.task_id, self.product_image)
         return True
     return False
Exemplo n.º 4
0
    def submit_order(self):
        did_submit = False

        self.status_signal.emit(create_msg("Submitting Order", "normal"))
        while not did_submit:
            try:
                self.browser.find_element_by_xpath('//button[@data-test= "placeOrderButton"]').click()
                self.status_signal.emit(create_msg("Order Placed", "success"))
                send_webhook("OP", "Target", self.profile["profile_name"], self.task_id, self.product_image)
                did_submit = True
            except:
                continue
Exemplo n.º 5
0
    def submit_order(self):
        wait(self.browser, self.LONG_TIMEOUT).until(lambda _: self.browser.current_url == "https://www.gamestop.com/checkout/?stage=placeOrder#placeOrder")

        self.status_signal.emit(create_msg("Submitting Order..", "normal"))

        wait(self.browser, self.LONG_TIMEOUT).until(EC.element_to_be_clickable((By.CLASS_NAME, 'btn.btn-primary.btn-block.place-order')))

        if not settings.dont_buy:
            order_review_btn = self.browser.find_element_by_class_name("btn.btn-primary.btn-block.place-order")
            order_review_btn.click()
            self.status_signal.emit(create_msg("Order Placed", "success"))
            send_webhook("OP", "GameStop", self.profile["profile_name"], self.task_id, self.product_image)
        else:
            self.status_signal.emit(create_msg("Mock Order Placed", "success"))
            send_webhook("OP", "GameStop", self.profile["profile_name"], self.task_id, self.product_image)
Exemplo n.º 6
0
    def submit_order(self):
        headers = {
            "accept": "application/json, text/javascript, */*; q=0.01",
            "accept-encoding": "gzip, deflate, br",
            "accept-language": "en-US,en;q=0.9",
            "content-type": "application/json",
            "origin": "https://www.walmart.com",
            "referer": "https://www.walmart.com/checkout/",
            "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36",
            "wm_vertical_id": "0"
        }
        
        if DONT_BUY is True:
            # TODO: this used to open the page up with everything filled out but walmart may have changed how that works...
            self.handle_captcha("https://www.walmart.com/checkout/#/payment") # OPEN BROWSER TO SEE IF SHIT WORKED
            self.check_browser()  
            return               # TODO: HARD STOP TO STOP BUYING SHIT

        while True:
            self.status_signal.emit({"msg":"Submitting Order","status":"alt"})
            try:
                r = self.session.put("https://www.walmart.com/api/checkout/v3/contract/:PCID/order",json={},headers=headers)
                print('-------')
                print(r.status_code)
                print(r.text)
                try:
                    json.loads(r.text)["order"]
                    self.status_signal.emit({"msg":"Order Placed","status":"success"})
                    send_webhook("OP","Walmart",self.profile["profile_name"],self.task_id,self.product_image)
                    return
                except:
                    self.status_signal.emit({"msg":"Payment Failed","status":"error"})
                    
                    # open the page for checkout if failed to auto submit
                    self.handle_captcha("https://www.walmart.com/checkout/#/payment")
                    if self.check_browser():
                        return

                    send_webhook("PF","Walmart",self.profile["profile_name"],self.task_id,self.product_image)
                    return
            except Exception as e:
                self.status_signal.emit({"msg":"Error Submitting Order (line {} {} {})".format(sys.exc_info()[-1].tb_lineno, type(e).__name__, e),"status":"error"})
                time.sleep(self.error_delay)
Exemplo n.º 7
0
    def submit_order(self):
        headers = {
            "accept": "application/json, text/javascript, */*; q=0.01",
            "accept-encoding": "gzip, deflate, br",
            "accept-language": "en-US,en;q=0.9",
            "content-type": "application/json",
            "origin": "https://www.walmart.com",
            "referer": "https://www.walmart.com/checkout/",
            "user-agent": settings.userAgent,
            "wm_vertical_id": "0"
        }

        if settings.dont_buy is True:
            # TODO: this used to open the page up with everything filled out but only works for some users
            self.status_signal.emit({"msg":"Opening Checkout Page","status":"alt"})
            self.handle_captcha("https://www.walmart.com/checkout/#/payment", close_window_after=False,redirect=True) # OPEN BROWSER TO SEE IF SHIT WORKED
            self.check_browser()  
            return              

        while True:
            self.status_signal.emit({"msg": "Submitting Order", "status": "alt"})
            try:
                r = self.session.put("https://www.walmart.com/api/checkout/v3/contract/:PCID/order", json={},
                                     headers=headers)
                try:
                    json.loads(r.text)["order"]
                    self.status_signal.emit({"msg": "Order Placed", "status": "success"})
                    send_webhook("OP", "Walmart", self.profile["profile_name"], self.task_id, self.product_image)
                    return
                except:
                    self.status_signal.emit({"msg": "Payment Failed", "status": "error"})

                    # open the page for checkout if failed to auto submit
                    self.handle_captcha("https://www.walmart.com/checkout/#/payment")
                    if self.check_browser():
                        return

                    send_webhook("PF", "Walmart", self.profile["profile_name"], self.task_id, self.product_image)
                    return
            except Exception as e:
                self.status_signal.emit({"msg": "Error Submitting Order (line {} {} {})".format(
                    sys.exc_info()[-1].tb_lineno, type(e).__name__, e), "status": "error"})
                time.sleep(self.error_delay)
Exemplo n.º 8
0
    def submit_order(self):
        did_submit = False

        self.status_signal.emit(create_msg("Submitting Order", "normal"))
        url = self.browser.current_url
        while not did_submit:
            try:
                cvv_field = self.browser.find_elements_by_id('creditCardInput-cvv')
                if cvv_field:
                    if len(cvv_field[0].get_attribute('value')) == 0:
                        cvv_field[0].send_keys(self.profile["card_cvv"])
                self.browser.find_element_by_xpath('//button[@data-test="placeOrderButton"]').click()
                time.sleep(5)
                if url != self.browser.current_url:
                    self.status_signal.emit(create_msg("Order Placed", "success"))
                    send_webhook("OP", "Target", self.profile["profile_name"], self.task_id, self.product_image)
                    did_submit = True               
            except:
                continue
Exemplo n.º 9
0
 def __init__(self,task_id,status_signal,image_signal,product,profile,proxy,monitor_delay,error_delay):
     self.status_signal,self.image_signal,self.product,self.profile,self.monitor_delay,self.error_delay = status_signal,image_signal,product,profile,float(monitor_delay),float(error_delay)
     self.session = requests.Session()
     if proxy != False:
         self.session.proxies.update(proxy)
     self.status_signal.emit({"msg":"Starting","status":"normal"})
     tas_data = self.get_tas_data()
     product_image = self.monitor()
     self.atc()
     self.start_checkout()
     self.submit_shipping()
     self.submit_payment(tas_data)
     while True:
         success,jwt = self.submit_order()
         if not success and jwt != None:
             transaction_id = self.handle_3dsecure(jwt)
             self.submit_card(transaction_id)
         else:
             if success:
                 send_webhook("OP","Bestbuy",self.profile["profile_name"],task_id,product_image)
             else:
                 if settings.browser_on_failed:
                     self.status_signal.emit({"msg":"Browser Ready","status":"alt","url":"https://www.bestbuy.com/checkout/r/fulfillment","cookies":[{"name":cookie.name,"value":cookie.value,"domain":cookie.domain} for cookie in self.session.cookies]})
                     send_webhook("B","Bestbuy",self.profile["profile_name"],task_id,product_image)
                 else:
                     send_webhook("PF","Bestbuy",self.profile["profile_name"],task_id,product_image)
             break
Exemplo n.º 10
0
 def submit_order(self):
     self.did_submit = False
     url = self.browser.current_url
     while not self.did_submit:
         try:
             self.process_interruptions(silent=True)
             if not settings.dont_buy:
                 self.browser.find_element_by_xpath(
                     '//button[@data-test="placeOrderButton"]').click()
                 time.sleep(5)
             if 'https://www.target.com/co-thankyou' in self.browser.current_url or settings.dont_buy:
                 if settings.dont_buy:
                     self.status_signal.emit(
                         create_msg("Mock Order Placed", "success"))
                 else:
                     self.status_signal.emit(
                         create_msg("Order Placed", "success"))
                 send_webhook("OP", "Target", self.profile["profile_name"],
                              self.task_id, self.product_image)
                 self.did_submit = True
         except:
             self.status_signal.emit(
                 create_msg('Retrying submit order until success',
                            'normal'))
Exemplo n.º 11
0
 def add_to_cart(self):
     webbrowser.open_new(BEST_BUY_CART_URL.format(sku=self.sku_id))
     send_webhook("B", "Bestbuy", self.profile["profile_name"],
                  self.task_id, self.product_image)
     return BEST_BUY_CART_URL.format(sku=self.sku_id)
Exemplo n.º 12
0
 async def handle_crash(self, request):
     send_webhook(str(await request.content.read(), encoding="utf-8"))
     return web.Response()
Exemplo n.º 13
0
 def __init__(self, task_id, status_signal, image_signal, product, profile,
              proxy, monitor_delay, error_delay):
     self.task_id, self.status_signal, self.image_signal, self.product, self.profile, self.monitor_delay, self.error_delay = task_id, status_signal, image_signal, product, profile, float(
         monitor_delay), float(error_delay)
     self.xpath_sequence = [{
         'type': 'method',
         'path':
         '//button[@data-test="orderPickupButton"] | //button[@data-test="shipItButton"]',
         'method': self.find_and_click_atc,
         'message': 'Added to cart',
         'message_type': 'normal',
         'optional': False
     }, {
         'type': 'button',
         'path':
         '//button[@data-test="espModalContent-declineCoverageButton"]',
         'message': 'Declining Coverage',
         'message_type': 'normal',
         'optional': True
     }, {
         'type': 'button',
         'path': '//button[@data-test="addToCartModalViewCartCheckout"]',
         'message': 'Viewing Cart before Checkout',
         'message_type': 'normal',
         'optional': False
     }, {
         'type': 'button',
         'path': '//button[@data-test="checkout-button"]',
         'message': 'Checking out',
         'message_type': 'normal',
         'optional': False
     }, {
         'type': 'method',
         'path': '//button[@data-test="placeOrderButton"]',
         'method': self.submit_order,
         'message': 'Submitting order',
         'message_type': 'normal',
         'optional': False
     }]
     self.possible_interruptions = [{
         'type': 'method',
         'path': '//input[@id="password"]',
         'method': self.fill_and_authenticate,
         'message': 'Authenticating',
         'message_type': 'normal'
     }, {
         'type': 'input',
         'path': '//input[@id="creditCardInput-cardNumber"]',
         'args': {
             'value': self.profile['card_number'],
             'confirm_button': '//button[@data-test="verify-card-button"]'
         },
         'message': 'Entering CC #',
         'message_type': 'normal'
     }, {
         'type': 'input',
         'path': '//input[@id="creditCardInput-cvv"]',
         'args': {
             'value': self.profile['card_cvv']
         },
         'message': 'Entering CC #',
         'message_type': 'normal'
     }]
     starting_msg = "Starting Target"
     self.browser = self.init_driver()
     self.product_image = None
     self.TIMEOUT_SHORT = 5
     self.TIMEOUT_LONG = 20
     self.did_submit = False
     self.failed = False
     self.retry_attempts = 10
     if settings.dont_buy:
         starting_msg = "Starting Target in dev mode; will not actually checkout"
     self.status_signal.emit(create_msg(starting_msg, "normal"))
     self.status_signal.emit(create_msg("Logging In..", "normal"))
     self.login()
     self.img_found = False
     self.product_loop()
     send_webhook("OP", "Target", self.profile["profile_name"],
                  self.task_id, self.product_image)
Exemplo n.º 14
0
    def __init__(self, task_id, status_signal, image_signal, product, profile,
                 proxy, monitor_delay, error_delay):
        self.status_signal, self.image_signal, self.product, self.profile, self.monitor_delay, self.error_delay = status_signal, image_signal, product, profile, float(
            monitor_delay), float(error_delay)
        self.sku_id = self.product.split('=')[1]
        self.session = requests.Session()
        self.cookies_from_browser = self.get_cookies_using_browser()
        
        self.kill_cookie_thread = False
        cookie_thread = threading.Thread(
            target=self.launch_cookie_thread,
            args=(),
        )
        cookie_thread.name = "cookieThread"
        cookie_thread.daemon = True
        cookie_thread.start()

        if proxy != False:
            self.session.proxies.update(proxy)
        self.status_signal.emit({"msg": "Starting", "status": "normal"})

        while True:
            self.status_signal.emit(
                {"msg": "Checking Stock", "status": "normal"})
            self.check_stock()
            tas_data = self.get_tas_data()
            # Get cookies using the browser
            self.set_cookies_using_browser()
            product_image = self.monitor()
            if not self.atc():
                continue
            self.start_checkout()
            self.submit_shipping()
            self.submit_payment(tas_data)
            self.refresh_payment()

            while True:
                success, jwt = self.submit_order()
                if not success and jwt != None:
                    transaction_id = self.handle_3dsecure(jwt)
                    self.submit_card(transaction_id)
                else:
                    if success:
                        send_webhook("OP", "Bestbuy", self.profile["profile_name"],
                                     task_id, product_image)
                    else:
                        if settings.browser_on_failed:
                            self.status_signal.emit(
                                {"msg": "Browser Ready", "status": "alt",
                                 "url": "https://www.bestbuy.com/checkout/r/fulfillment",
                                 "cookies": [
                                     {"name": cookie.name, "value": cookie.value,
                                      "domain": cookie.domain} for cookie in
                                     self.session.cookies]})
                            send_webhook("B", "Bestbuy",
                                         self.profile["profile_name"], task_id,
                                         product_image)
                        else:
                            send_webhook("PF", "Bestbuy",
                                         self.profile["profile_name"], task_id,
                                         product_image)
                    break
            if success:
                break

        self.kill_cookie_thread = True
        cookie_thread.join()