Esempio n. 1
0
    def test_get_user(self):
        

        

        id = ""
        map = RequestMap()
        
        map.set("id", BaseTest.resolveResponseValue("create_user.id"));
        
        response = User.read(id,map)

        ignoreAsserts = []
        ignoreAsserts.append("address.city")
        
        self.customAssertEqual(ignoreAsserts, "website", response.get("website"),"hildegard.org")
        self.customAssertEqual(ignoreAsserts, "address.instructions.doorman", response.get("address.instructions.doorman"),"true")
        self.customAssertEqual(ignoreAsserts, "address.instructions.text", response.get("address.instructions.text"),"some delivery instructions text")
        self.customAssertEqual(ignoreAsserts, "address.city", response.get("address.city"),"New York")
        self.customAssertEqual(ignoreAsserts, "address.postalCode", response.get("address.postalCode"),"10577")
        self.customAssertEqual(ignoreAsserts, "address.id", response.get("address.id"),"1")
        self.customAssertEqual(ignoreAsserts, "address.state", response.get("address.state"),"NY")
        self.customAssertEqual(ignoreAsserts, "address.line1", response.get("address.line1"),"2000 Purchase Street")
        self.customAssertEqual(ignoreAsserts, "phone", response.get("phone"),"1-770-736-8031")
        self.customAssertEqual(ignoreAsserts, "name", response.get("name"),"Joe Bloggs")
        self.customAssertEqual(ignoreAsserts, "id", response.get("id"),"1")
        self.customAssertEqual(ignoreAsserts, "email", response.get("email"),"*****@*****.**")
        self.customAssertEqual(ignoreAsserts, "username", response.get("username"),"jbloggs")
        

        BaseTest.putResponse("get_user", response)
Esempio n. 2
0
    def get_transaction(self, hash):
        """
        Returns full detail of the value of the blockchain entry referenced by the specified hashkey, if it has been
         previously recorded by your node's key-value store (database).

        :param hash
            The hash of the entry to retrieve
            Example: 1e6fc898c0f0853ca504a29951665811315145415fa5bdfa90253efe1e2977b1
            Required

        :return response
            Parameter	Example
            hash
            Hash of the value written onto the chain. Can be used to lookup the entry.
            50cbc906b2d5e4e795b9aa79ad35e7b9989839a0a0fc95b2ecd063529db365fd
            slot
            Slot the entry is written to
            1502899441
            status
            Status of the entry on the chain.
            confirmed
            value
            Hex representation of the value written onto the chain.
            0a0d5465737420446f63756d656e74
         """
        id = CREDS['app_identifier']
        map = RequestMap()
        map.set("hash", hash)
        response = TransactionEntry.read(id, map)
        return {
            'hash': response.get('hash'),
            'slot': response.get('slot'),
            'status': response.get('status'),
            'value': response.get('value')
        }
Esempio n. 3
0
    def test_list_users_query(self):
        

        
    
        map = RequestMap()
        map.set("max", "10")
        
        
        response = User.listByCriteria(map)

        ignoreAsserts = []
        
        self.customAssertEqual(ignoreAsserts, "website", response.get("list[0].website"),"hildegard.org")
        self.customAssertEqual(ignoreAsserts, "address.instructions.doorman", response.get("list[0].address.instructions.doorman"),"true")
        self.customAssertEqual(ignoreAsserts, "address.instructions.text", response.get("list[0].address.instructions.text"),"some delivery instructions text")
        self.customAssertEqual(ignoreAsserts, "address.city", response.get("list[0].address.city"),"New York")
        self.customAssertEqual(ignoreAsserts, "address.postalCode", response.get("list[0].address.postalCode"),"10577")
        self.customAssertEqual(ignoreAsserts, "address.id", response.get("list[0].address.id"),"1")
        self.customAssertEqual(ignoreAsserts, "address.state", response.get("list[0].address.state"),"NY")
        self.customAssertEqual(ignoreAsserts, "address.line1", response.get("list[0].address.line1"),"2000 Purchase Street")
        self.customAssertEqual(ignoreAsserts, "phone", response.get("list[0].phone"),"1-770-736-8031")
        self.customAssertEqual(ignoreAsserts, "name", response.get("list[0].name"),"Joe Bloggs")
        self.customAssertEqual(ignoreAsserts, "id", response.get("list[0].id"),"1")
        self.customAssertEqual(ignoreAsserts, "email", response.get("list[0].email"),"*****@*****.**")
        self.customAssertEqual(ignoreAsserts, "username", response.get("list[0].username"),"jbloggs")
        

        BaseTest.putResponse("list_users_query", response.get("list[0]"))
Esempio n. 4
0
    def test_account_inquiry(self):

        mapObj = RequestMap()
        mapObj.set("AccountInquiry.AccountNumber","5343434343434343")

        response = AccountInquiry.update(mapObj)
        
        ignoreAsserts = []
        
        self.customAssertEqual(ignoreAsserts, "Listed", response.get("Account.Listed"),"True")
        self.customAssertEqual(ignoreAsserts, "Listed", response.get("Account.ReasonCode"),"S")
        self.customAssertEqual(ignoreAsserts, "Listed", response.get("Account.Reason"),"STOLEN")
    def test_delete_user_posts_with_mutplie_path(self):

        map = RequestMap()
        map.set("user_id", "1")
        map.set("post_id", "2")

        response = MultiplePathUserPost.deleteById("", map)
        self.assertNotEqual(response, None)

        ignoreAsserts = []

        BaseTest.putResponse("delete_user_posts_with_mutplie_path", response)
Esempio n. 6
0
    def test_delete_user_204(self):
        

        

        map = RequestMap()
        
        map.set("id", BaseTest.resolveResponseValue("create_user.id"));
        
        response = User.delete204ById("ssss",map)
        self.assertNotEqual(response,None)

        ignoreAsserts = []
        
        

        BaseTest.putResponse("delete_user_204", response)
Esempio n. 7
0
    def test_setInvalidAction(self):

        requestMapObj = RequestMap()

        requestMapObj.set("user.name[0]", "Naman")
        requestMapObj.set("user.name[1]", "Kumar")
        requestMapObj.set("user.name[2]", "Aggarwal")

        with self.assertRaises(TypeError):
            requestMapObj.set("user.name.class.id", 1233)

        self.assertEqual(requestMapObj.getObject(),
                         {'user': {
                             'name': ['Naman', 'Kumar', 'Aggarwal']
                         }})
    def test_get_user_posts_with_path(self):

        map = RequestMap()
        map.set("user_id", "1")

        response = UserPostPath.listByCriteria(map)

        ignoreAsserts = []

        self.customAssertEqual(ignoreAsserts, "id", response.get("list[0].id"),
                               "1")
        self.customAssertEqual(ignoreAsserts, "title",
                               response.get("list[0].title"), "My Title")
        self.customAssertEqual(ignoreAsserts, "body",
                               response.get("list[0].body"), "some body text")
        self.customAssertEqual(ignoreAsserts, "userId",
                               response.get("list[0].userId"), "1")

        BaseTest.putResponse("get_user_posts_with_path",
                             response.get("list[0]"))
Esempio n. 9
0
    def read(cls, id, criteria=None):
        """
        Returns objects of type User by id and optional criteria
        @param str id
        @param dict criteria
        @return instance of User
        """
        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if criteria:
            if (isinstance(criteria, RequestMap)):
                mapObj.setAll(criteria.getObject())
            else:
                mapObj.setAll(criteria)

        return BaseObject.execute("7bd54cb3-740a-46a8-ba73-a7116d7fbfa5",
                                  User(mapObj))
Esempio n. 10
0
    def read(cls, id, criteria=None):
        """
        Returns objects of type App by id and optional criteria
        @param str id
        @param dict criteria
        @return instance of App
        @raise ApiException: raised an exception from the response status
        """
        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if criteria:
            if (isinstance(criteria, RequestMap)):
                mapObj.setAll(criteria.getObject())
            else:
                mapObj.setAll(criteria)

        return BaseObject.execute("3de9977e-ee9d-4239-a27d-8d37e79accd9", App(mapObj))
Esempio n. 11
0
    def read(cls, id, criteria=None):
        """
        Returns objects of type Block by id and optional criteria
        @param str id
        @param dict criteria
        @return instance of Block
        @raise ApiException: raised an exception from the response status
        """
        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if criteria:
            if (isinstance(criteria, RequestMap)):
                mapObj.setAll(criteria.getObject())
            else:
                mapObj.setAll(criteria)

        return BaseObject.execute("e2929737-7620-429a-bf0d-bd3a6483a4a5",
                                  Block(mapObj))
Esempio n. 12
0
    def delete204ById(cls, id, map=None):
        """
        Delete object of type User by id

        @param str id
        @return User of the response of the deleted instance.
        """

        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if map:
            if (isinstance(map, RequestMap)):
                mapObj.setAll(map.getObject())
            else:
                mapObj.setAll(map)

        return BaseObject.execute("7223cecd-203a-47b7-85cb-3ddbf9027f33",
                                  User(mapObj))
Esempio n. 13
0
    def read(cls, id, criteria=None):
        """
		Returns objects of type Node by id and optional criteria
		@param str id
		@param dict criteria
		@return instance of Node
		@raise ApiException: raised an exception from the response status
		"""
        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if criteria:
            if (isinstance(criteria, RequestMap)):
                mapObj.setAll(criteria.getObject())
            else:
                mapObj.setAll(criteria)

        return BaseObject.execute("7257dc46-3f6c-4ff3-a119-da1135d4bc96",
                                  Node(mapObj))
    def read(cls, id, criteria=None):
        """
		Returns objects of type TerminationInquiryHistoryRequest by id and optional criteria
		@param str id
		@param dict criteria
		@return instance of TerminationInquiryHistoryRequest
		@raise ApiException: raised an exception from the response status
		"""
        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if criteria:
            if (isinstance(criteria, RequestMap)):
                mapObj.setAll(criteria.getObject())
            else:
                mapObj.setAll(criteria)

        return BaseObject.execute("fcae4efd-1761-4c7a-8058-a4cf809e12c2",
                                  TerminationInquiryHistoryRequest(mapObj))
Esempio n. 15
0
    def delete200ById(cls, id, map=None):
        """
        Delete object of type User by id

        @param str id
        @return User of the response of the deleted instance.
        """

        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if map:
            if (isinstance(map, RequestMap)):
                mapObj.setAll(map.getObject())
            else:
                mapObj.setAll(map)

        return BaseObject.execute("ff6f7de7-08fe-4dc2-8185-1f838dc96197",
                                  User(mapObj))
Esempio n. 16
0
    def deleteById(cls, id, map=None):
        """
        Delete object of type MultiplePathUserPost by id

        @param str id
        @return MultiplePathUserPost of the response of the deleted instance.
        """

        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if map:
            if (isinstance(map, RequestMap)):
                mapObj.setAll(map.getObject())
            else:
                mapObj.setAll(map)

        return BaseObject.execute("7d0317ff-5d7d-427b-abd2-9df62d5becb7",
                                  MultiplePathUserPost(mapObj))
Esempio n. 17
0
    def deleteById(cls, id, map=None):
        """
        Delete object of type User by id

        @param str id
        @return User of the response of the deleted instance.
        """

        mapObj = RequestMap()
        if id:
            mapObj.set("id", id)

        if map:
            if (isinstance(map, RequestMap)):
                mapObj.setAll(map.getObject())
            else:
                mapObj.setAll(map)

        return BaseObject.execute("32f3baaa-9757-4f56-9ed1-241756206274",
                                  User(mapObj))
Esempio n. 18
0
    def status(self):
        """
        Gets general metadata about the current state of the blockchain network. Useful for building dashboards.

        :return: Response Reference
            Parameter	Example
            network
            For the main chain, this id should always be the integer 1513115205.
            1513115205
            version
            Note that this is returned as a semantically versioned string. Versions of messages should be able to be transmitted on the binary protocol as 32-bit integers. e.g. The version "1.0.0" represents the actual big-endian byte array [1,0,0,0] which is equivalent to a uint32 value of
            0.5.0
            witnesses[]
            The blockchain addresses of the audit nodes currently engaged in processing block confirmations
            applications[]
            The application identifiers available at this node
            ['MA99']
            genesis
            Basic information about first block in the chain on this network
            See child attributes
            genesis​.slot
            The slot number of the first block in the chain on this network
            1502882325
            genesis​.ref
            Hash of the first block in the chain on this network
            671d13640e28b3befe225a48a9b919a3ba424db0b8807ee57661b61a7555f763
            current
            Basic information about the current block which is last confirmed block in the chain on this network
            See child attributes
            current​.slot
            The slot number of the last confirmed block
            1502893442
            current​.ref
            Hash of the last confirmed block
            747443ae8d73dbb381770cea820ec6a0e9548b299c8d2aadb12f113e949158e7
            alerts[]
            Informational alerts such as upcoming version or network configuration changes
        """
        map_obj = RequestMap()
        response = Status.query(map_obj)
        return response
Esempio n. 19
0
    def transact(self, name, amount):
        """
        Saves this item transaction to the blockchain

        :param item: Item model
        :return:
        """
        # item_block = self.get_block(item.uuid)
        item_msg = Item()
        item_msg.name = name
        transaction = item_msg.transactions.add()
        transaction.amount = amount

        mapObj = RequestMap()
        mapObj.set("app", self.app_id)
        mapObj.set("encoding", "base64")
        mapObj.set("value", b64encode(item_msg.SerializeToString()).decode())

        response = TransactionEntry.create(mapObj)
        return {
            'hash': response.get('hash'),
            'slot': response.get('slot'),
            'status': response.get('status')
        }
Esempio n. 20
0
    def list_blocks(self, start=None, end=None):
        """

        :param start:
        :param end:
        :return:
        """
        if start or end:
            mapObj = RequestMap()
            if start:
                mapObj.set('from', start)
                if end:
                    mapObj.set('to', end)
            if end and not start:
                raise ValueError(
                    'end can only be defined when you define start')
            responseList = Block.listByCriteria(mapObj)
        else:
            responseList = Block.listByCriteria()
        return responseList.get('list')
Esempio n. 21
0
    def app_update(self,
                   message_definition_filename='item.proto',
                   message_version=1.0,
                   app_identifier=None):
        """
        When you are permissioned onto the network, you will be issued one or more `id`s to use. You may then send
        or update configurations of the transaction message types you wish to use. These are specified using Protocol
        Buffer version 3 files as specified [here](https://developers.google.com/protocol-buffers/docs/proto3) This
        specification may be sent either as the canonical JSON transform or the native `.proto` file encoded as hex,
        base58 or base64.

        Parameter	Required	Example
        id
        This is the application id. You can get a list of applications your Blockchain node is part of by using the Status/query API
        Required	MA99
        name
        This is your application identifier and will be used to partition your Blockchain instance. This value MUST match the package name in your protocol buffer definition.
        Required	MA99
        description
        Description of your Blockchain application
        Optional	My Blockchain Application
        version
        Version of your Blockchain application
        Optional	1
        definition
        Required	See child attributes
        definition​.format
        Format of your message defintion. Must be "proto3"
        Required	proto3
        definition​.encoding
        Encoding scheme used to encode your protocol buffer message definition
        Required	base64
        definition​.messages
        Your protocol buffer message definition
        Required	Ly8gU2ltcGxlIG5vdGFyeSBhcHBsaWNhdGlvbg0KDQpzeW50YXggPSAicHJvdG8zIjsNCg0KcGFja2FnZSBFMTAwOw0KDQptZXNzYWdlIE1lc3NhZ2Ugew0KCWJ5dGVzIGFydGlmYWN0UmVmZXJlbmNlID0gMTsNCn0=
        """
        with open(PROTOBUFS['item'], 'rb') as f:
            msg_def = b64encode(f.read()).decode()

        mapObj = RequestMap()
        mapObj.set("id", app_identifier)
        mapObj.set("name", app_identifier)
        mapObj.set("description", "")
        mapObj.set("version", message_version)
        mapObj.set("definition.format", "proto3")
        mapObj.set("definition.encoding", "base64")
        mapObj.set("definition.messages", msg_def)
        request = App(mapObj)
        response = request.update()
        return response
Esempio n. 22
0
 def query_node(self):
     """This call gets information about your local blockchain node, the applications that it understands,
     and its connections to other peers in the network. """
     mapObj = RequestMap()
     response = Node.query(mapObj)
     return response
Esempio n. 23
0
def test_login(consumerKey, keyPassword):
    auth = OAuthAuthentication(consumerKey, keyStorePath, keyAlias,
                               keyPassword)
    Config.setAuthentication(auth)
    Config.setDebug(True)  # Enable http wire logging
    Config.setSandbox(True)

    try:
        mapObj = RequestMap()
        mapObj.set("AccountHolderMessagingRequest.TokenUniqueReference",
                   "DWSPMC00000000010906a349d9ca4eb1a4d53e3c90a11d9c")
        mapObj.set("AccountHolderMessagingRequest.MessageText",
                   " You have earned a statement credit ")
        mapObj.set("AccountHolderMessagingRequest.MessageExpiration",
                   "2020-09-18T18:04:35-06:00")
        mapObj.set("AccountHolderMessagingRequest.MessageLanguageCode", "en")
        mapObj.set("AccountHolderMessagingRequest.MessageIdentifier",
                   "6598123486451346764616431064")
        mapObj.set(
            "AccountHolderMessagingRequest.IssuerApplicationMessageDisplay",
            "FALSE")
        mapObj.set("AccountHolderMessagingRequest.AuditInfo.UserId",
                   "A1435477")
        mapObj.set("AccountHolderMessagingRequest.AuditInfo.UserName",
                   "John Smith")
        mapObj.set("AccountHolderMessagingRequest.AuditInfo.Organization",
                   "Any Bank")
        mapObj.set("AccountHolderMessagingRequest.AuditInfo.Phone",
                   "5555551234")

        response = AccountHolderMessaging.create(mapObj)
        out(response,
            "AccountHolderMessagingResponse.Token.TokenUniqueReference")
        #-->DWSPMC00000000010906a349d9ca4eb1a4d53e3c90a11d9c

    except APIException as e:
        err("HttpStatus: %s", e.getHttpStatus())
        err("Message: %s", e.getMessage())
        err("ReasonCode: %s", e.getReasonCode())
        err("Source: %s", e.getSource())
Esempio n. 24
0
    def provision_node(self, app_id="MA99"):
        """
        Provisions a Blockchain node for your application.
        """
        mapObj = RequestMap()
        mapObj.set("network", "Z0NE")
        mapObj.set("application.name", app_id)
        mapObj.set("application.description", "")
        mapObj.set("application.version", 0)
        mapObj.set("application.definition.format", "proto3")
        mapObj.set("application.definition.encoding", "base64")
        mapObj.set(
            "application.definition.messages",
            "Ly8gU2ltcGxlIG5vdGFyeSBhcHBsaWNhdGlvbg0KDQpzeW50YXggPSAicHJvdG8zIjsNCg0KcGFja2FnZSBFMTAyOw0KDQptZXNzYWdlIE1lc3NhZ2Ugew0KCWJ5dGVzIGFydGlmYWN0UmVmZXJlbmNlID0gMTsNCn0="
        )
        mapObj.set("invitations[0]", "*****@*****.**")
        mapObj.set("invitations[1]", "*****@*****.**")

        response = Node.provision(mapObj)
        print("address--> %s") % response.get(
            "address")  # address-->CNkNVuVnQ4WigadrQKcNuTa1JkAJFWF9S8
        print("authority--> %s") % response.get(
            "authority")  # authority-->ShgddyMCV6oBL7putekmJkYzXbGuoyggA8
        print("type--> %s") % response.get("type")  # type-->customer
        return response
Esempio n. 25
0
    def test_simpleSet(self):

        requestMapObj = RequestMap()
        requestMapObj.set("user", 122132)

        self.assertEqual(requestMapObj.getObject(), {'user': 122132})

        requestMapObj.set("name", "naman")
        self.assertEqual(requestMapObj.getObject(), {
            'user': 122132,
            'name': 'naman'
        })

        #Override the value
        requestMapObj.set("name", "atul")
        self.assertEqual(requestMapObj.getObject(), {
            'user': 122132,
            'name': 'atul'
        })
Esempio n. 26
0
    def test_nestedSet(self):

        requestMapObj = RequestMap()

        requestMapObj.set("user.name.first", "Naman")
        self.assertEqual(requestMapObj.getObject(),
                         {'user': {
                             'name': {
                                 'first': 'Naman'
                             }
                         }})

        requestMapObj.set("user.name.last.middle", "Kumar")
        self.assertEqual(requestMapObj.getObject(), {
            'user': {
                'name': {
                    'first': 'Naman',
                    'last': {
                        'middle': 'Kumar'
                    }
                }
            }
        })

        requestMapObj.set("user.name.last.last", "Aggarwal")
        self.assertEqual(
            requestMapObj.getObject(), {
                'user': {
                    'name': {
                        'first': 'Naman',
                        'last': {
                            'middle': 'Kumar',
                            'last': 'Aggarwal'
                        }
                    }
                }
            })
Esempio n. 27
0
    def test_nestedSetWithList(self):

        requestMapObj = RequestMap()

        requestMapObj.set("user.name[0]", "Naman")
        self.assertEqual(requestMapObj.getObject(),
                         {'user': {
                             'name': ['Naman']
                         }})

        requestMapObj.set("user.name[1]", "Kumar")
        self.assertEqual(requestMapObj.getObject(),
                         {'user': {
                             'name': ['Naman', 'Kumar']
                         }})

        requestMapObj.set("user.name[2]", "Aggarwal")
        self.assertEqual(requestMapObj.getObject(),
                         {'user': {
                             'name': ['Naman', 'Kumar', 'Aggarwal']
                         }})

        requestMapObj.set("user.name[3].class.id", 1233)
        self.assertEqual(
            requestMapObj.getObject(), {
                'user': {
                    'name':
                    ['Naman', 'Kumar', 'Aggarwal', {
                        'class': {
                            'id': 1233
                        }
                    }]
                }
            })
Esempio n. 28
0
def main():
    consumerKey = "YT8iexhqzg5vWetxDvntC5f13J6JFEnwlL8FTKtm7837dcf6!66f2fd60279d4e649c9343a6d0964d410000000000000000"
    # You should copy this from "My Keys" on your project page e.g. UTfbhDCSeNYvJpLL5l028sWL9it739PYh6LU5lZja15xcRpY!fd209e6c579dc9d7be52da93d35ae6b6c167c174690b72fa
    keyStorePath = "D:\keyalias-sandbox.p12"
    # e.g. /Users/yourname/project/sandbox.p12 | C:\Users\yourname\project\sandbox.p12
    keyAlias = "keyalias"  # For production: change this to the key alias you chose when you created your production key
    keyPassword = "******"  # For production: change this to the key alias you chose when you created your production key

    auth = OAuthAuthentication(consumerKey, keyStorePath, keyAlias, keyPassword)
    Config.setAuthentication(auth)
    Config.setDebug(True)  # Enable http wire logging
    Config.setSandbox(True)

    try:
        mapObj = RequestMap()
        mapObj.set("SearchRequest.AccountPan", "5412345678901234")
        mapObj.set("SearchRequest.ExcludeDeletedIndicator", "false")
        mapObj.set("SearchRequest.AuditInfo.UserId", "A1435477")
        mapObj.set("SearchRequest.AuditInfo.UserName", "John Smith")
        mapObj.set("SearchRequest.AuditInfo.Organization", "Any Bank")
        mapObj.set("SearchRequest.AuditInfo.Phone", "5555551234")

        response = Search.create(mapObj)

    except APIException as e:
        print("HttpStatus: %s") % e.getHttpStatus()
        print("Message: %s") % e.getMessage()
        print("ReasonCode: %s") % e.getReasonCode()
        print("Source: %s") % e.getSource()
Esempio n. 29
0
    def test_constructor(self):

        requestMapObj = RequestMap()
        self.assertEqual(requestMapObj.getObject(), {})
def main():
    consumerKey = "YT8iexhqzg5vWetxDvntC5f13J6JFEnwlL8FTKtm7837dcf6!17c438eb264f403f80d8fada38b34e1b0000000000000000"
    # You should copy this from "My Keys" on your project page e.g. UTfbhDCSeNYvJpLL5l028sWL9it739PYh6LU5lZja15xcRpY!fd209e6c579dc9d7be52da93d35ae6b6c167c174690b72fa
    keyStorePath = "D:\ub-mdescs-1499832439-sandbox.p12"
    # e.g. /Users/yourname/project/sandbox.p12 | C:\Users\yourname\project\sandbox.p12
    keyAlias = "keyalias"  # For production: change this to the key alias you chose when you created your production key
    keyPassword = "******"  # For production: change this to the key alias you chose when you created your production key

    auth = OAuthAuthentication(consumerKey, keyStorePath, keyAlias, keyPassword)
    Config.setAuthentication(auth)
    Config.setDebug(True)  # Enable http wire logging
    Config.setSandbox(True)

    try:
        mapObj = RequestMap()
        mapObj.set("SearchRequest.TokenUniqueReference", "DWSPMC00000000010906a349d9ca4eb1a4d53e3c90a11d9c")
        mapObj.set("SearchRequest.AuditInfo.UserId", "A1435477")
        mapObj.set("SearchRequest.AuditInfo.UserName", "John Smith")
        mapObj.set("SearchRequest.AuditInfo.Organization", "Any Bank")
        mapObj.set("SearchRequest.AuditInfo.Phone", "5555551234")

        response = Search.create(mapObj)
        print("SearchResponse.Accounts.Account[0].AccountPanSuffix--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].AccountPanSuffix")  # SearchResponse.Accounts.Account[0].AccountPanSuffix-->1234
        print("SearchResponse.Accounts.Account[0].ExpirationDate--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].ExpirationDate")  # SearchResponse.Accounts.Account[0].ExpirationDate-->1215
        print("SearchResponse.Accounts.Account[0].AlternateAccountIdentifierSuffix--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].AlternateAccountIdentifierSuffix")  # SearchResponse.Accounts.Account[0].AlternateAccountIdentifierSuffix-->4300
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenUniqueReference--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenUniqueReference")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenUniqueReference-->DWSPMC00000000010906a349d9ca4eb1a4d53e3c90a11d9c
        print(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].PrimaryAccountNumberUniqueReference--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].PrimaryAccountNumberUniqueReference")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].PrimaryAccountNumberUniqueReference-->FWSPMC0000000004793dac803f190a4dca4bad33c90a11d3
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenSuffix--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenSuffix")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenSuffix-->7639
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].ExpirationDate--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].ExpirationDate")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].ExpirationDate-->0216
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].AccountPanSequenceNumber--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].AccountPanSequenceNumber")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].AccountPanSequenceNumber-->002
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].DigitizationRequestDateTime--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].DigitizationRequestDateTime")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].DigitizationRequestDateTime-->2015-01-20T18:04:35-06:00
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenActivatedDateTime--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenActivatedDateTime")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenActivatedDateTime-->2015-01-20T18:04:35-06:00
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].FinalTokenizationDecision--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].FinalTokenizationDecision")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].FinalTokenizationDecision-->A
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].CorrelationId--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].CorrelationId")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].CorrelationId-->101234
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].CurrentStatusCode--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].CurrentStatusCode")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].CurrentStatusCode-->A
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].CurrentStatusDescription--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].CurrentStatusDescription")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].CurrentStatusDescription-->Active
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].ProvisioningStatusCode--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].ProvisioningStatusCode")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].ProvisioningStatusCode-->S
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].ProvisioningStatusDescription--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].ProvisioningStatusDescription")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].ProvisioningStatusDescription-->Provisioning successful
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenRequestorId--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenRequestorId")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenRequestorId-->00212345678
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].WalletId--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].WalletId")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].WalletId-->103
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].PaymentAppInstanceId--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].PaymentAppInstanceId")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].PaymentAppInstanceId-->92de9357a535b2c21a3566e446f43c532a46b54c46
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenType--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenType")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenType-->S
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].LastCommentId--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].LastCommentId")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].LastCommentId-->2376
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceId--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceId")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceId-->3e5edf24a24ba98e27d43e345b532a245e4723d7a9c4f624e93452c92de9357a535b2c21a3566e446f43c532d34s6
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceName--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceName")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceName-->John Phone
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceType--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceType")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.DeviceType-->09
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.SecureElementId--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.SecureElementId")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].Device.SecureElementId-->92de9357a535b2c21a3566e446f43c532a46b54c46
        print("SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenDeletedFromConsumerApp--> %s") % response.get(
            "SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenDeletedFromConsumerApp")  # SearchResponse.Accounts.Account[0].Tokens.Token[0].TokenDeletedFromConsumerApp-->false

    except APIException as e:
        print("HttpStatus: %s") % e.getHttpStatus()
        print("Message: %s") % e.getMessage()
        print("ReasonCode: %s") % e.getReasonCode()
        print("Source: %s") % e.getSource()
Esempio n. 31
0
    def test_example_Insights(self):

        mapObj = RequestMap()

        mapObj.set("Period", "")
        mapObj.set("CurrentRow", "1")
        mapObj.set("Sector", "")
        mapObj.set("Offset", "25")
        mapObj.set("Country", "US")
        mapObj.set("Ecomm", "")

        response = Insights.query(mapObj)
def test_mdes_customer_service(MessageExpiration):
    try:
        mapObj = RequestMap()
        mapObj.set("AccountHolderMessagingRequest.TokenUniqueReference",
                   "DWSPMC00000000010906a349d9ca4eb1a4d53e3c90a11d9c")
        mapObj.set("AccountHolderMessagingRequest.MessageText",
                   " You have earned a statement credit ")
        mapObj.set("AccountHolderMessagingRequest.MessageExpiration",
                   MessageExpiration)
        mapObj.set("AccountHolderMessagingRequest.MessageLanguageCode", "en")
        mapObj.set("AccountHolderMessagingRequest.MessageIdentifier",
                   "6598123486451346764616431064")
        mapObj.set(
            "AccountHolderMessagingRequest.IssuerApplicationMessageDisplay",
            "FALSE")
        mapObj.set("AccountHolderMessagingRequest.AuditInfo.UserId",
                   "A1435477")
        mapObj.set("AccountHolderMessagingRequest.AuditInfo.UserName",
                   "John Smith")
        mapObj.set("AccountHolderMessagingRequest.AuditInfo.Organization",
                   "Any Bank")
        mapObj.set("AccountHolderMessagingRequest.AuditInfo.Phone",
                   "5555551234")

        response = AccountHolderMessaging.create(mapObj)
        out(response,
            "AccountHolderMessagingResponse.Token.TokenUniqueReference")
        #-->DWSPMC00000000010906a349d9ca4eb1a4d53e3c90a11d9c

    except APIException as e:
        err("HttpStatus: %s", e.getHttpStatus())
        err("Message: %s", e.getMessage())
        err("ReasonCode: %s", e.getReasonCode())
        err("Source: %s", e.getSource())
        pytest.fail('MessageExpiration invalid')