当前位置: 首页>>代码示例>>Python>>正文


Python ShipmentConfirm.address_type方法代码示例

本文整理汇总了Python中ups.shipping_package.ShipmentConfirm.address_type方法的典型用法代码示例。如果您正苦于以下问题:Python ShipmentConfirm.address_type方法的具体用法?Python ShipmentConfirm.address_type怎么用?Python ShipmentConfirm.address_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ups.shipping_package.ShipmentConfirm的用法示例。


在下文中一共展示了ShipmentConfirm.address_type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_ship_to

# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import address_type [as 别名]
    def get_ship_to(country="GB"):
        """Returns a shipto to a known country"""
        if country == "GB":
            ship_to_address = ShipmentConfirm.address_type(
                AddressLine1="205, Copper Gate House",
                AddressLine2="16 Brune Street",
                City="London",
                # StateProvinceCode="E1 7NJ",
                CountryCode="GB",
                PostalCode="E1 7NJ"
            )
        elif country == "US":
            ship_to_address = ShipmentConfirm.address_type(
                AddressLine1="1 Infinite Loop",
                City="Cupertino",
                StateProvinceCode="CA",
                CountryCode="US",
                PostalCode="95014"
            )
        else:
            raise Exception("This country is not supported")

        return ShipmentConfirm.ship_to_type(
            ship_to_address,
            CompanyName="Apple",
            AttentionName="Someone other than Steve",
            TaxIdentificationNumber="123456",
            PhoneNumber='4089961010',
        )
开发者ID:openlabs,项目名称:PyUPS,代码行数:31,代码来源:helper.py

示例2: get_ship_from

# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import address_type [as 别名]
    def get_ship_from(country="GB"):
        """Returns a shipfrom from a known country"""
        if country == "GB":
            ship_from_address = ShipmentConfirm.address_type(
                AddressLine1="2,Hope Rd",
                AddressLine2="Anson Road",
                City="Manchester",
                CountryCode="GB",
                PostalCode="M145EU"
            )
        elif country == "US":
            ship_from_address = ShipmentConfirm.address_type(
                AddressLine1="245 NE 24th Street",
                AddressLine2="Suite 108",
                City="Miami",
                StateProvinceCode="FL",
                CountryCode="US",
                PostalCode="33137"
            )
        else:
            raise Exception("This country is not supported")

        return ShipmentConfirm.ship_from_type(
            ship_from_address,
            CompanyName="Openlabs",
            AttentionName="Someone other than Sharoon",
            TaxIdentificationNumber="33065",
            PhoneNumber='0987654321',
        )
开发者ID:openlabs,项目名称:PyUPS,代码行数:31,代码来源:helper.py

示例3: _get_ups_address_xml

# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import address_type [as 别名]
    def _get_ups_address_xml(self):
        """
        Return Address XML
        """
        if not all([self.street, self.city, self.country]):
            self.raise_user_error("Street, City and Country are required.")

        if self.country.code in ["US", "CA"] and not self.subdivision:
            self.raise_user_error("State is required for %s" % self.country.code)

        if self.country.code in ["US", "CA", "PR"] and not self.zip:
            # If Shipper country is US or Puerto Rico, 5 or 9 digits is
            # required. The character - may be used to separate the first five
            # digits and the last four digits. If the Shipper country is CA,
            # then the postal code is required and must be 6 alphanumeric
            # characters whose format is A#A#A# where A is an uppercase letter
            # and # is a digit. For all other countries the postal code is
            # optional and must be no more than 9 alphanumeric characters long.
            self.raise_user_error("ZIP is required for %s" % self.country.code)

        vals = {
            "AddressLine1": self.street[:35],  # Limit to 35 Char
            "City": self.city[:30],  # Limit 30 Char
            "CountryCode": self.country.code,
        }

        if self.streetbis:
            vals["AddressLine2"] = self.streetbis[:35]  # Limit to 35 char
        if self.subdivision:
            # TODO: Handle Ireland Case
            vals["StateProvinceCode"] = self.subdivision.code[3:]
        if self.zip:
            vals["PostalCode"] = self.zip

        return ShipmentConfirm.address_type(**vals)
开发者ID:fulfilio,项目名称:trytond-shipping-ups,代码行数:37,代码来源:party.py

示例4: get_address

# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import address_type [as 别名]
    def get_address(doc, is_ship_from= False):
        addr = ""
        if is_ship_from:
            address_line1 = doc.address_line_1 or ""
            address_line2 = doc.address_line_2 or ""
            city = doc.city or ""
            state = doc.state or ""
            country_code = doc.country or ""
            pincode = doc.pin_code or ""
            addr = "warehouse"
        else:
            address_line1 = doc.address_line1 or ""
            address_line2 = doc.address_line2 or ""
            city = doc.city or ""
            state = doc.state or ""
            country_code = frappe.db.get_value("Country",doc.country,"code") or ""
            pincode = str(doc.pincode) or ""
            addr = "shipping"

        if address_line1 and city and state and country_code and pincode:
            return ShipmentConfirm.address_type(
                AddressLine1= address_line1,
                AddressLine2= address_line2,
                City= city,
                StateProvinceCode= state,
                CountryCode= country_code,
                PostalCode= pincode,
            )
        else:
            frappe.throw("Invalid address details, Please check the %s address"%(addr))
开发者ID:aruizramon,项目名称:alec_frappe_subscription,代码行数:32,代码来源:ups_helper.py


注:本文中的ups.shipping_package.ShipmentConfirm.address_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。