示例#1
0
    def get_product_name(self, response_data):
        search_query = self.prompt(self.PROMPTS["search_query"])
        print "\nProcessing request...\n"
        product_name_response = ZincRequestProcessor.process("search_products", {
                "client_token": self.client_token,
                "retailer": self.retailer,
                "search_query": search_query
            })

        response_data["product_name_response"] = product_name_response
        self.product_url = self.select_product_name(product_name_response)
示例#2
0
    def get_shipping_methods(self, response_data):
        self.shipping_address = self.retrieve_data("shipping_address")
        print "\nProcessing request...\n"
        shipping_response = ZincRequestProcessor.process_async("shipping_methods", {
                    "client_token": self.client_token,
                    "retailer": self.retailer,
                    "products": response_data["products"],
                    "shipping_address": self.shipping_address,
                    "retailer_credentials": response_data["retailer_credentials"]
                })

        self.async_responses["shipping_response"] = shipping_response
示例#3
0
    def get_place_order(self, response_data):
        self.write_to_zincrc()
        self.print_price_components(response_data)
        if self.prompt_boolean(self.PROMPTS["place_order"]):
            print "\nProcessing request...\n"
            place_order_response = ZincRequestProcessor.process("place_order", {
                        "client_token": self.client_token,
                        "place_order_key": response_data["review_order_response"]["place_order_key"]
                    })

            response_data["place_order_response"] = place_order_response
            print "HOORAY! You've successfully placed an order. Here are the details:\n"
            print "Amazon Order Id: %s" % place_order_response["merchant_order"]["merchant_order_id"]
            print "Total Price: %s" % format_price(place_order_response["price_components"]["total"])
            print place_order_response["shipping_method"]["name"] + ": " + place_order_response["shipping_method"]["description"]
示例#4
0
 def get_product_variants(self, response_data):
     print "\nProcessing request...\n"
     async_response = ZincRequestProcessor.process_async("variant_options", {
                 "client_token": self.client_token,
                 "retailer": self.retailer,
                 "product_url": self.product_url
                 })
     asin = self.get_asin(self.product_url)
     product_info = None
     if asin != None:
         InterfaceHelpers.print_ihmage_image(asin)
         print "\nLoading product information...\n"
         product_info = AmazonDataFinder.get_amazon_data(asin)
     variants_response = async_response.get_response()
     response_data["variant_options_response"] = variants_response
     response_data["products"] = self.select_product_variants(variants_response, product_info)
示例#5
0
    def get_store_card(self, response_data):
        cc_token = self.retrieve_data("cc_token")
        if cc_token == None:
            cc_data = self.retrieve_data("credit_card")
            self.billing_address = self.retrieve_data("billing_address")
            print "\nProcessing request...\n"
            store_card_response = ZincRequestProcessor.process("store_card", {
                        "client_token": self.client_token,
                        "retailer": self.retailer,
                        "billing_address": self.billing_address,
                        "number": cc_data["number"],
                        "expiration_month": cc_data["expiration_month"],
                        "expiration_year": cc_data["expiration_year"]
                    })

            response_data["store_card_response"] = store_card_response
            self.stored_data["cc_token"] = store_card_response["cc_token"]
示例#6
0
    def get_review_order(self, response_data):
        shipping_method_id = self.select_shipping_methods(
                self.async_responses["shipping_response"].get_response())
        payment_method = {
                "prefer_use_gift_balance": True,
                "cc_token": self.retrieve_data("cc_token"),
                "security_code": self.get_security_code()
                }
        is_gift = self.get_is_gift()
        print "\nProcessing request...\n"
        review_order_response = ZincRequestProcessor.process("review_order", {
                    "client_token": self.client_token,
                    "retailer": self.retailer,
                    "products": response_data["products"],
                    "shipping_address": self.shipping_address,
                    "is_gift": is_gift,
                    "shipping_method_id": shipping_method_id,
                    "payment_method": payment_method,
                    "customer_email": "*****@*****.**",
                    "retailer_credentials": response_data["retailer_credentials"]
                })

        response_data["review_order_response"] = review_order_response