def handle_noargs(self, **options):
        fulfilled_by = options.get('fulfilled_by')
        if not fulfilled_by:
            raise CommandError(
                "Fulfillment type is required but was not specified, please "
                "specify a fulfillment type (MFN or AFN)"
            )

        if fulfilled_by != AmazonProfile.FULFILLMENT_BY_AMAZON \
           and fulfilled_by != AmazonProfile.FULFILLMENT_BY_MERCHANT:
            raise CommandError(
                ("Invalid fulfillment type specified. Valid values are {0} "
                 " and {1}").format(
                    AmazonProfile.FULFILLMENT_BY_AMAZON,
                    AmazonProfile.FULFILLMENT_BY_MERCHANT,
                )
            )

        merchant_id = getattr(settings, 'MWS_SELLER_ID')

        submission = switch_product_fulfillment(
            products=Product.objects.all(),
            merchant_id=merchant_id,
            fulfillment_by=fulfilled_by,
            fulfillment_center_id="AMAZON_NA",
            dry_run=options.get('dry_run')
        )

        if not options.get('dry_run'):
            print "Feed submitted as ID #{0}".format(submission.submission_id)
Пример #2
0
    def test_is_processed(self):
        submissions = feeds_gw.submit_product_feed(
            products=[self.product], marketplaces=[self.marketplace])
        submission = self._check_submission(submissions[0])
        self.assertEquals(submission.processing_status, am.STATUS_DONE)

        # Switch the product to FBA
        submission = feeds_gw.switch_product_fulfillment(
            marketplace=self.marketplace,
            products=[self.product],
        )
        submission = self._check_submission(submission)
        self.assertEquals(submission.processing_status, am.STATUS_DONE)

        feeds_gw.update_product_identifiers(submission.merchant,
                                            products=[self.product])

        self.assertEquals(self.product.amazon_profile.fulfillment_by,
                          self.product.amazon_profile.FULFILLMENT_BY_AMAZON)

        # Delete product
        submissions = feeds_gw.submit_product_feed(
            products=[self.product],
            marketplaces=[self.marketplace],
            operation_type=feeds_gw.OP_TYPE_DELETE,
        )
        submission = self._check_submission(submissions[0])
        self.assertEquals(submission.processing_status, am.STATUS_DONE)
Пример #3
0
    def test_is_processed(self):
        submissions = feeds_gw.submit_product_feed(
            products=[self.product], marketplaces=[self.marketplace])

        submission = self._check_submission(submissions[0])
        self.assertEquals(submission.processing_status, am.STATUS_DONE)

        # Switch the product to FBA
        submission = feeds_gw.switch_product_fulfillment(
            marketplace=self.marketplace, products=[self.product])

        submission = self._check_submission(submission)
        self.assertEquals(submission.processing_status, am.STATUS_DONE)

        feeds_gw.update_product_identifiers(
            submission.merchant, products=[self.product])

        self.assertEquals(
            self.product.amazon_profile.fulfillment_by,
            AmazonProfile.FULFILLMENT_BY_AMAZON)

        # Delete product
        submissions = feeds_gw.submit_product_feed(
            products=[self.product],
            marketplaces=[self.marketplace],
            operation_type=feeds_gw.OP_TYPE_DELETE)

        submission = self._check_submission(submissions[0])
        self.assertEquals(submission.processing_status, am.STATUS_DONE)
Пример #4
0
    def test_can_be_created(self):
        submissions = feeds_gw.submit_product_feed(
            products=[self.product], marketplaces=[self.marketplace])
        self._wait_until_submission_processed(submissions[0])

        submission = feeds_gw.switch_product_fulfillment(
            marketplace=self.marketplace, products=[self.product])
        self._wait_until_submission_processed(submission)

        creator = FulfillmentOrderCreator()
        orders = creator.create_fulfillment_order(self.order)
    def test_can_be_created(self):
        submissions = feeds_gw.submit_product_feed(
            products=[self.product], marketplaces=[self.marketplace])
        self._wait_until_submission_processed(submissions[0])

        submission = feeds_gw.switch_product_fulfillment(
            marketplace=self.marketplace, products=[self.product])
        self._wait_until_submission_processed(submission)

        creator = FulfillmentOrderCreator()
        creator.create_fulfillment_order(self.order)