def __get_shopping_cart_extension(self, properties, prefix):
     try:
         creator = properties.get("ConnectSDK",
                                  prefix + ".shoppingCartExtension.creator")
     except NoOptionError:
         creator = None
     try:
         name = properties.get("ConnectSDK",
                               prefix + ".shoppingCartExtension.name")
     except NoOptionError:
         name = None
     try:
         version = properties.get("ConnectSDK",
                                  prefix + ".shoppingCartExtension.version")
     except NoOptionError:
         version = None
     try:
         extension_id = properties.get(
             "ConnectSDK", prefix + ".shoppingCartExtension.extensionId")
     except NoOptionError:
         extension_id = None
     if creator is None and name is None and version is None and extension_id is None:
         return None
     else:
         return ShoppingCartExtension(creator, name, version, extension_id)
    def test_server_meta_data_headers_full_no_shopping_cart_extension_id(self):
        """Tests that the MetaDataProvider can construct meta_data_headers when supplied with a full shopping cart"""
        shopping_cart_extension = ShoppingCartExtension(
            "Ingenico.creator", "Extension", "1.0")
        meta_data_provider = MetaDataProvider("Ingenico",
                                              shopping_cart_extension)

        request_headers = meta_data_provider.meta_data_headers
        self.assertEqual(1, len(request_headers))
        self.assertServerMetaInfo(meta_data_provider, "Ingenico",
                                  shopping_cart_extension, request_headers[0])
 def from_dictionary(self, dictionary):
     super(MetaDataProvider.ServerMetaInfo, self).from_dictionary(dictionary)
     if 'platformIdentifier' in dictionary:
         self.platform_identifier = dictionary['platformIdentifier']
     if 'sdkIdentifier' in dictionary:
         self.sdk_identifier = dictionary['sdkIdentifier']
     if 'sdkCreator' in dictionary:
         self.sdk_creator = dictionary['sdkCreator']
     if 'integrator' in dictionary:
         self.integrator = dictionary['integrator']
     if 'shoppingCartExtension' in dictionary:
         if not isinstance(dictionary['shoppingCartExtension'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['shoppingCartExtension']))
         self.shopping_cart_extension = ShoppingCartExtension.create_from_dictionary(dictionary['shoppingCartExtension'])
     return self