def test_0020_gb_gb(self):
        "GB to GB UPS Standard with 2 packages"
        ship_confirm_request = ShipmentConfirm.shipment_confirm_request_type(
            Helper.get_shipper(self.shipper_number, "GB"),
            Helper.get_ship_to("GB"),
            Helper.get_ship_from("GB"),

            # Package 1
            Helper.get_package(
                "GB", weight='15.0', package_type_code='02'
            ),  # Customer Supplied Package

            # Package 2
            Helper.get_package(
                "GB", weight='15.0', package_type_code='02'
            ),  # Customer Supplied Package

            Helper.get_payment_info(AccountNumber=self.shipper_number),
            ShipmentConfirm.service_type(Code='11'),    # UPS Standard
            Description=__doc__[:50]
        )
        response = self.shipment_confirm_api.request(ship_confirm_request)
        digest = self.shipment_confirm_api.extract_digest(response)

        # now accept the package
        accept_request = ShipmentAccept.shipment_accept_request_type(digest)
        self.shipment_accept_api.request(accept_request)
Example #2
0
    def test_0020_gb_gb(self):
        "GB to GB UPS Standard with 2 packages"
        ship_confirm_request = ShipmentConfirm.shipment_confirm_request_type(
            Helper.get_shipper(self.shipper_number, "GB"),
            Helper.get_ship_to("GB"),
            Helper.get_ship_from("GB"),

            # Package 1
            Helper.get_package(
                "GB", weight='15.0',
                package_type_code='02'),  # Customer Supplied Package

            # Package 2
            Helper.get_package(
                "GB", weight='15.0',
                package_type_code='02'),  # Customer Supplied Package
            Helper.get_payment_info(AccountNumber=self.shipper_number),
            ShipmentConfirm.service_type(Code='11'),  # UPS Standard
            Description=__doc__[:50])
        response = self.shipment_confirm_api.request(ship_confirm_request)
        digest = self.shipment_confirm_api.extract_digest(response)

        # now accept the package
        accept_request = ShipmentAccept.shipment_accept_request_type(digest)
        result = self.shipment_accept_api.request(accept_request)
Example #3
0
    def test_negotiated_rate_fetching(self):
        """
        Test the rate fetching with negotiated rates.
        This will fail if your shipper number is not eligible for negotaited
        rates
        """
        rating_request = RatingService.rating_request_type(
            E.Shipment(
                Helper.get_shipper(self.shipper_number, "US"),
                Helper.get_ship_to("US"),
                Helper.get_ship_from("US"),
                RatingService.service_type(Code='03'),    # UPS Ground
                Helper.get_package("US", package_type_code="00"),
                RatingService.rate_information_type(negotiated=True)
            ),
        )
        response = self.rating_api.request(rating_request)

        self.assertTrue(
            hasattr(response.RatedShipment, 'NegotiatedRates')
        )
        self.assertTrue(
            response.RatedShipment.RatedPackage.TotalCharges.MonetaryValue
        )
        print etree.tostring(response, pretty_print=True)
    def test_0030_gb_gb_saturday(self):
        "GB to GB UPS Standard with 2 packages and Saturday delivery"
        ship_confirm_request = ShipmentConfirm.shipment_confirm_request_type(
            Helper.get_shipper(self.shipper_number, "GB"),
            Helper.get_ship_to("GB"),
            Helper.get_ship_from("GB"),
            # Package 1
            Helper.get_package("GB", weight="15.0", package_type_code="02"),  # Customer Supplied Package
            # Package 2
            Helper.get_package("GB", weight="15.0", package_type_code="02"),  # Customer Supplied Package
            ShipmentConfirm.shipment_service_option_type(SaturdayDelivery="1"),
            Helper.get_payment_info(AccountNumber=self.shipper_number),
            ShipmentConfirm.service_type(Code="11"),  # UPS Standard
            Description=__doc__[:50],
        )
        response = self.shipment_confirm_api.request(ship_confirm_request)
        digest = self.shipment_confirm_api.extract_digest(response)

        # now accept the package
        accept_request = ShipmentAccept.shipment_accept_request_type(digest)
        self.shipment_accept_api.request(accept_request)
Example #5
0
    def test_rate_fetching(self):
        "Test the rate fetching"
        rating_request = RatingService.rating_request_type(
            E.Shipment(
                Helper.get_shipper(self.shipper_number, "US"),
                Helper.get_ship_to("US"),
                Helper.get_ship_from("US"),
                RatingService.service_type(Code='03'),    # UPS Ground
                Helper.get_package("US", package_type_code="00")
            ),
        )
        response = self.rating_api.request(rating_request)

        self.assertTrue(
            response.RatedShipment.RatedPackage.TotalCharges.MonetaryValue
        )
        print etree.tostring(response, pretty_print=True)
Example #6
0
    def test_rate_chart_fetching(self):
        "Test the rate fetching"
        rating_request = RatingService.rating_request_type(
            E.Shipment(
                Helper.get_shipper(self.shipper_number, "US"),
                Helper.get_ship_to("US"),
                Helper.get_ship_from("US"),
                Helper.get_package("US", package_type_code="00"),
            ),
        )
        response = self.rating_api.request(rating_request)

        self.assertTrue(
            len([s for s in response.iterchildren(tag='RatedShipment')]) > 1
        )

        self.assertTrue(
            response.RatedShipment.RatedPackage.TotalCharges.MonetaryValue
        )
        print etree.tostring(response, pretty_print=True)