Пример #1
0
    def test_centinel_01(self):
        """ Pass Merchant and Transaction information """

        order_number = 1
        order_amount = 500
        currency_code = "826"
        card_number = "4000000000000002"
        card_expiry_month = "01"
        card_expiry_year = "2012"
        order_description = ""
        trans_password = "******"

        cent = Centinel(None)

        data_dict = {}
        data_dict["TransactionPwd"] = trans_password
        data_dict["Amount"] = order_amount
        data_dict["CurrencyCode"] = currency_code
        data_dict["CardNumber"] = card_number
        data_dict["CardExpMonth"] = card_expiry_month
        data_dict["CardExpYear"] = card_expiry_year
        data_dict["OrderNumber"] = order_number

        cent.client.add("MsgType", "cmpi_lookup")

        cent.create_centinel_request(data_dict)
        result = cent.client.send_request(cent.url)
        self.assertTrue(result)
        response = cent.client.response

        self.assertEqual(response['ErrorNo'], '0')
        self.assertEqual(response['ErrorDesc'], None)
Пример #2
0
def centinel_cardholder_auth_result(request, template="centinel_error.html"):
    """ Result of auth check called by centinel """
    from centinel import Centinel
    logger.debug(request.POST)
    cent = Centinel(request)
    if request.POST.get('payres') and request.POST.get('transaction_id'):
        return cent.centinel_authenticate(request.POST['payres'], request.POST['transaction_id'])
    else:
        logger.debug("returning error")
        return cent.error_view(request, "Could not authenticate")