def testTokenWithApplepay(self): token = litleXmlFields.registerTokenRequest() token.orderId = "12344" applepay = litleXmlFields.applepayType() applepay.data = "4100000000000000" applepay.signature = "yoyo" applepay.version = '8.29' header=litleXmlFields.applepayHeaderType() header.applicationData='applicationData' header.ephemeralPublicKey ='UWIRNRSKSXMXEYEINR' header.publicKeyHash='UYTGHJKMNBVFYWUWI' header.transactionId='1024' applepay.header=header token.applepay = applepay comm = Communications(config) comm.http_post = MagicMock() litle = litleOnlineRequest(config) litle.setCommunications(comm) litle._processResponse = MagicMock(return_value=None) litle.sendRequest(token) comm.http_post.assert_called_once() match_re = RegexMatcher(".*?<litleOnlineRequest.*?<registerTokenRequest.*?<applepay>.*?<data>4100000000000000</data>.*?</applepay>.*?</registerTokenRequest>.*?") comm.http_post.assert_called_with(match_re, url=ANY, proxy=ANY, timeout=ANY)
def testTokenWithApplepay(self): token = litleXmlFields.registerTokenRequest() token.orderId = "12344" token.id="id" applepay = litleXmlFields.applepayType() applepay.data = "4100000000000000" applepay.signature = "yoyo" applepay.version = '8.29' header=litleXmlFields.applepayHeaderType() header.applicationData='applicationData' header.ephemeralPublicKey ='UWIRNRSKSXMXEYEINR' header.publicKeyHash='UYTGHJKMNBVFYWUWI' header.transactionId='1024' applepay.header=header token.applepay = applepay comm = Communications(config) comm.http_post = MagicMock() litle = litleOnlineRequest(config) litle.setCommunications(comm) litle._processResponse = MagicMock(return_value=None) litle.sendRequest(token) comm.http_post.assert_called_once() match_re = RegexMatcher(".*?<litleOnlineRequest.*?<registerTokenRequest.*?<applepay>.*?<data>4100000000000000</data>.*?</applepay>.*?</registerTokenRequest>.*?") comm.http_post.assert_called_with(match_re, url=ANY, proxy=ANY, timeout=ANY)
def applepay_fixture(): applepay = litleXmlFields.applepayType() applepay.data = "4100000000000000" applepay.signature = "sign" applepay.version = '1' return applepay
def testSaleWithSecondaryAmountAndApplepayAndWallet(self): sale = litleXmlFields.sale() sale.amount = 106 sale.litleTxnId = 123456 sale.orderId = "12344" sale.orderSource = 'ecommerce' sale.secondaryAmount = 100 wallet = litleXmlFields.wallet() wallet.walletSourceType = 'MasterPass' wallet.walletSourceTypeId = '12345' applepay = litleXmlFields.applepayType() applepay.data = "4100000000000000" applepay.signature = "yoyo" applepay.version = '9.3' header = litleXmlFields.applepayHeaderType() header.applicationData = 'applicationData' header.ephemeralPublicKey = 'UWIRNRSKSXMXEYEINR' header.publicKeyHash = 'UYTGHJKMNBVFYWUWI' header.transactionId = '1024' applepay.header = header sale.applepay = applepay sale.wallet = wallet comm = Communications(config) comm.http_post = MagicMock() litle = litleOnlineRequest(config) litle.setCommunications(comm) litle._processResponse = MagicMock(return_value=None) litle.sendRequest(sale) comm.http_post.assert_called_once() match_re = RegexMatcher( ".*?<litleOnlineRequest.*?<sale.*?<applepay>.*?<data>4100000000000000</data>.*?</applepay>.*?<wallet.*?</wallet>.*?</sale>.*?" ) comm.http_post.assert_called_with(match_re, url=ANY, proxy=ANY, timeout=ANY)
def testSaleWithSecondaryAmountAndApplepayAndWallet(self): sale = litleXmlFields.sale() sale.amount = 106 sale.litleTxnId = 123456 sale.orderId = "12344" sale.orderSource = 'ecommerce' sale.secondaryAmount=100 sale.id="id" wallet=litleXmlFields.wallet() wallet.walletSourceType='MasterPass' wallet.walletSourceTypeId='12345' applepay = litleXmlFields.applepayType() applepay.data = "4100000000000000" applepay.signature = "yoyo" applepay.version = '9.3' header=litleXmlFields.applepayHeaderType() header.applicationData='applicationData' header.ephemeralPublicKey ='UWIRNRSKSXMXEYEINR' header.publicKeyHash='UYTGHJKMNBVFYWUWI' header.transactionId='1024' applepay.header=header sale.applepay = applepay sale.wallet=wallet comm = Communications(config) comm.http_post = MagicMock() litle = litleOnlineRequest(config) litle.setCommunications(comm) litle._processResponse = MagicMock(return_value=None) litle.sendRequest(sale) comm.http_post.assert_called_once() match_re = RegexMatcher(".*?<litleOnlineRequest.*?<sale.*?<applepay>.*?<data>4100000000000000</data>.*?</applepay>.*?<wallet.*?</wallet>.*?</sale>.*?") comm.http_post.assert_called_with(match_re, url=ANY, proxy=ANY, timeout=ANY)