def decrypt_visa_checkout_data():
	merchantAuth = apicontractsv1.merchantAuthenticationType()
	merchantAuth.name = constants.apiLoginId
	merchantAuth.transactionKey = constants.transactionKey
	# Populate the payment data
	opaqueData = apicontractsv1.opaqueDataType()
	opaqueData.dataDescriptor = "COMMON.VCO.ONLINE.PAYMENT"
	opaqueData.dataValue = "q1rx4GVCh0dqjZGgSBI8RB/VlI/1lwzTxDnrW/L1D4f/lfKZeQPo34eTB59akZXdRlRBW/dHVWgc2eVebvWpkAKmDrc+7Zr7lGXvHbLG78e0ZgfEReQNS4es6K7DxsDXp0UZSdnxw6g3stQhW2TqR6fcwLj7gWpZvAL3GAftP6QNCJfv6ohFPN9L/t84A1h8M0jClNq7DtDsUhuy35dEBdP8/MKOb7hSRkMqb/8qh7XUR+84FOoAKHAcG6KoRRdogTrYmPBuyDoaWUmDFgRFSSXN7Wj7evVsliis5H9y+tub/f5mAiZtl+fyFC7uIEZOLUcSWHfeX1lWxyWTEYxRq5TwnzewPNn0VbmqPh+/uaHooDQT891nUeZfm79Bunj+NfWtr06YIxW2LW3P6IWuyAhquAseL1hOv7vHT5QGogPuUJlv/+jY52tSsXrVccWu4rTjHShwvFmvxl82VZx55zcIrYFROiFVw+3sN88BL4hNnh3RCYrotWDiAwdJmJLdYhAzO2xiWLRRBgiGn27hi+G381EwLUy/6K1rx6iAN+x2bWWHgyKddSYLo0U7g+UfHBrvNSHZQcQM5LzjiZP86bx2SqQoLrqgSZQcChSy/T6C4vIvlFyomx9+7Soht6J61KoRvhM1yzlvwwjyF0ouamCRUBzrKR6j366TbdrAhAVLfuVc2XbE57Wc9bF0w4+K5I4kfA47XfRHlkA+6S4dpgp+fV+bC/jzrqIQwrs+wehzEaiR43lBQpyfPElX2SGfGk0WH4c4SbIhUY0KtyLmfgCbcAHyCAXN1ZNQvNb8Axw2j/C2B77cE81Dsi9DyGdGclM2u14UqxkXEINS2FoYQI4mZj04TR4oDG6axkp52d+ndagOS0kIH8SM71fPPiXSGw/zbm+JRdr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VghQfx9PD/T+XZTA3yzBwHHZNiNJK2mhheEubgNYcnw1t9Lf9cx174OEayQrU+AORjPnEPGWYx+bYtK6XuQ9bt9gAo4HzaGRF1WB6Dr0p8gfqrxHe9HhjrbeHILmVtIJnv2jDds20pR/VRYs1IFJNWyDjgCe2uWBM+oC22YdSYyn3f2swouqqXz6yl9UTImzCM8KAzLpPGZVFlafJka8soKSxr9KBvAsBnfb34RPB7OMgSo+uqgvB3YGvOu5LpLoaVNxQ1d6GLeeQ9u9olb12Y2kPzGni99f04lI77qoleqzCcCFZC9Q"
	opaqueData.dataKey = "KCSJeIab7wwH7mFcPM/YL+V9xBCDe4CmSjJ0MPHEodpWz4rmz78U8bR4Qqs1ipLBqH9mrfvLF4pytIcLOjKUtXvAII/xCze84INFMdtsVBgtEp5bZ4leehRQhNM+3/NH"
	# Initialize decrypt request
	request = apicontractsv1.decryptPaymentDataRequest()
	request.merchantAuthentication = merchantAuth
	request.opaqueData = opaqueData
	request.callId = "1238408836021304101"
	# Execute API request
	controller = decryptPaymentDataController(request)
	controller.execute()
	response = controller.getresponse()

	if (response.messages.resultCode=="Ok"):
		print "SUCCESS"
		print "Message Code : %s" % response.messages.message[0].code
		print "Message text : %s" % response.messages.message[0].text
		print "Card number : %s" % response.cardInfo.cardNumber
		print "Amount : %s" % response.paymentDetails.amount
	else:
		print "ERROR"
		print "Message Code : %s" % response.messages.message[0].code
		print "Message text : %s" % response.messages.message[0].text

	return response
示例#2
0
def _getPayment(opaque_data):
    # Create the payment object for a payment nonce
    opaqueData = apicontractsv1.opaqueDataType()
    opaqueData.dataDescriptor = opaque_data['dataDescriptor']
    opaqueData.dataValue = opaque_data['dataValue']

    # Add the payment data to a paymentType object
    payment = apicontractsv1.paymentType()
    payment.opaqueData = opaqueData
    return payment
示例#3
0
def _getPayment(opaque_data):
    # Create the payment object for a payment nonce
    opaqueData = apicontractsv1.opaqueDataType()
    opaqueData.dataDescriptor = opaque_data['dataDescriptor']
    opaqueData.dataValue = opaque_data['dataValue']

    # Add the payment data to a paymentType object
    payment = apicontractsv1.paymentType()
    payment.opaqueData = opaqueData
    return payment
def create_an_apple_pay_transaction():

	merchantAuth = apicontractsv1.merchantAuthenticationType()
	merchantAuth.name = constants.apiLoginId
	merchantAuth.transactionKey = constants.transactionKey

	opaquedata = apicontractsv1.opaqueDataType()
	opaquedata.dataDescriptor = "COMMON.APPLE.INAPP.PAYMENT"
	opaquedata.dataValue = "eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzltWHpcL29iSHBvZnVJRVM4cjljcUdHc1VBUERwdzdnNjQybTRQendLRitIQnVZVW5lV0RCTlNEMnU2amJBRzMiLCJ2ZXJzaW9uIjoiRUNfdjEiLCJoZWFkZXIiOnsiYXBwbGljYXRpb25EYXRhIjoiOTRlZTA1OTMzNWU1ODdlNTAxY2M0YmY5MDYxM2UwODE0ZjAwYTdiMDhiYzdjNjQ4ZmQ4NjVhMmFmNmEyMmNjMiIsInRyYW5zYWN0aW9uSWQiOiJjMWNhZjVhZTcyZjAwMzlhODJiYWQ5Mm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FFZSktvWklodmNOQVFFQkJRQUVnWUJhSzNFbE9zdGJIOFdvb3NlREFCZitKZ1wvMTI5SmNJYXdtN2M2VnhuN1phc05iQXEzdEF0OFB0eSt1UUNnc3NYcVprTEE3a3oyR3pNb2xOdHY5d1ltdTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0="

	paymentOne = apicontractsv1.paymentType()
	paymentOne.opaqueData = opaquedata

	transactionrequest = apicontractsv1.transactionRequestType()
	transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
	transactionrequest.amount = Decimal('151')
	transactionrequest.payment = paymentOne

	request = apicontractsv1.createTransactionRequest()
	request.merchantAuthentication = merchantAuth
	request.refId = "Sample"
	request.transactionRequest = transactionrequest

	controller = createTransactionController(request)
	controller.execute()

	response = controller.getresponse()

	if response is not None:
		if response.messages.resultCode == "Ok":
			if hasattr(response.transactionResponse, 'messages') == True:
				print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId);
				print ('Transaction Response Code: %s' % response.transactionResponse.responseCode);
				print ('Message Code: %s' % response.transactionResponse.messages.message[0].code);
				print ('Description: %s' % response.transactionResponse.messages.message[0].description);
				print ('AUTH Code : %s' % response.authCode)
			else:
				print ('Failed Transaction.');
				if hasattr(response.transactionResponse, 'errors') == True:
					print ('Error Code:  %s' % str(response.transactionResponse.errors.error[0].errorCode));
					print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText);
		else:
			print ('Failed Transaction.');
			if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True:
				print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode));
				print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText);
			else:
				print ('Error Code: %s' % response.messages.message[0]['code'].text);
				print ('Error message: %s' % response.messages.message[0]['text'].text);
	else:
		print ('Null Response.');

	return response
def create_an_accept_transaction():

	merchantAuth = apicontractsv1.merchantAuthenticationType()
	merchantAuth.name = constants.apiLoginId
	merchantAuth.transactionKey = constants.transactionKey

	opaquedata = apicontractsv1.opaqueDataType()
	opaquedata.dataDescriptor = "COMMON.ACCEPT.INAPP.PAYMENT"
	opaquedata.dataValue = "9471471570959063005001"

	paymentOne = apicontractsv1.paymentType()
	paymentOne.opaqueData = opaquedata

	transactionrequest = apicontractsv1.transactionRequestType()
	transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
	transactionrequest.amount = Decimal('151')
	transactionrequest.payment = paymentOne

	request = apicontractsv1.createTransactionRequest()
	request.merchantAuthentication = merchantAuth
	request.refId = "Sample"
	request.transactionRequest = transactionrequest

	controller = createTransactionController(request)
	controller.execute()

	response = controller.getresponse()

	if response is not None:
		if response.messages.resultCode == "Ok":
			if hasattr(response.transactionResponse, 'messages') == True:
				print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId);
				print ('Transaction Response Code: %s' % response.transactionResponse.responseCode);
				print ('Message Code: %s' % response.transactionResponse.messages.message[0].code);
				print ('Description: %s' % response.transactionResponse.messages.message[0].description);
				print ('AUTH Code : %s' % response.authCode)
			else:
				print ('Failed Transaction.');
				if hasattr(response.transactionResponse, 'errors') == True:
					print ('Error Code:  %s' % str(response.transactionResponse.errors.error[0].errorCode));
					print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText);
		else:
			print ('Failed Transaction.');
			if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True:
				print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode));
				print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText);
			else:
				print ('Error Code: %s' % response.messages.message[0]['code'].text);
				print ('Error message: %s' % response.messages.message[0]['text'].text);
	else:
		print ('Null Response.');

	return response
def create_an_apple_pay_transaction():

    merchantAuth = apicontractsv1.merchantAuthenticationType()
    merchantAuth.name = constants.apiLoginId
    merchantAuth.transactionKey = constants.transactionKey

    opaquedata = apicontractsv1.opaqueDataType()
    opaquedata.dataDescriptor = "COMMON.APPLE.INAPP.PAYMENT"
    opaquedata.dataValue = "eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzltWHpcL29iSHBvZnVJRVM4cjljcUdHc1VBUERwdzdnNjQybTRQendLRitIQnVZVW5lV0RCTlNEMnU2amJBRzMiLCJ2ZXJzaW9uIjoiRUNfdjEiLCJoZWFkZXIiOnsiYXBwbGljYXRpb25EYXRhIjoiOTRlZTA1OTMzNWU1ODdlNTAxY2M0YmY5MDYxM2UwODE0ZjAwYTdiMDhiYzdjNjQ4ZmQ4NjVhMmFmNmEyMmNjMiIsInRyYW5zYWN0aW9uSWQiOiJjMWNhZjVhZTcyZjAwMzlhODJiYWQ5MmI4MjgzNjM3MzRmODViZjJmOWNhZGYxOTNkMWJhZDlkZGNiNjBhNzk1IiwiZXBoZW1lcmFsUHVibGljS2V5IjoiTUlJQlN6Q0NBUU1HQnlxR1NNNDlBZ0V3Z2ZjQ0FRRXdMQVlIS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dTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0="

    paymentOne = apicontractsv1.paymentType()
    paymentOne.opaqueData = opaquedata

    transactionrequest = apicontractsv1.transactionRequestType()
    transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
    transactionrequest.amount = Decimal('151')
    transactionrequest.payment = paymentOne

    request = apicontractsv1.createTransactionRequest()
    request.merchantAuthentication = merchantAuth
    request.refId = "Sample"
    request.transactionRequest = transactionrequest

    controller = createTransactionController(request)
    controller.execute()

    response = controller.getresponse()

    if response is not None:
        if response.messages.resultCode == "Ok":
            if hasattr(response.transactionResponse, 'messages') == True:
                print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId)
                print ('Transaction Response Code: %s' % response.transactionResponse.responseCode)
                print ('Message Code: %s' % response.transactionResponse.messages.message[0].code)
                print ('Description: %s' % response.transactionResponse.messages.message[0].description)
                print ('AUTH Code : %s' % response.authCode)
            else:
                print ('Failed Transaction.')
                if hasattr(response.transactionResponse, 'errors') == True:
                    print ('Error Code:  %s' % str(response.transactionResponse.errors.error[0].errorCode))
                    print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText)
        else:
            print ('Failed Transaction.')
            if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True:
                print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode))
                print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText)
            else:
                print ('Error Code: %s' % response.messages.message[0]['code'].text)
                print ('Error message: %s' % response.messages.message[0]['text'].text)
    else:
        print ('Null Response.')

    return response
def create_visa_checkout_transaction():

	merchantAuth = apicontractsv1.merchantAuthenticationType()
	merchantAuth.name = constants.apiLoginId
	merchantAuth.transactionKey = constants.transactionKey
	# Populate the payment data
	opaqueData = apicontractsv1.opaqueDataType()
	opaqueData.dataD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ehsmVYBle+1uEocHAHv1Kc1BtXP+WT/wyWKMGnPJoPovglIhowODb2wU8ltnbRRhP14W6jwPCqtPWV4LXN0+7VKfyqBRUGkITjQWqsntlf3/egfG4uS3faPU4M"
	opaqueData.dataKey = "ZW6TOD05lWOtUYVunXhYmXRBA6d7UTVezRCwUYLrK/xHPK5LDuZe5Rk/sT223vO0NdD7iQXMPqnQrCS1myW+CFceOKiUuoA0zKJ6TZ84q/+msPG66DDdzDxeKKdE5Qjt"
	paymentType = apicontractsv1.paymentType()
	paymentType.opaqueData = opaqueData
	# Create the payment transaction request
	transactionRequest = apicontractsv1.transactionRequestType()
	transactionRequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
	transactionRequest.callId = "1238408836021304101"
	transactionRequest.amount = Decimal('14.00')
	transactionRequest.payment = paymentType
	# Make the API Request
	request = apicontractsv1.createTransactionRequest()
	request.merchantAuthentication = merchantAuth
	request.transactionRequest = transactionRequest
	# Execute the API request
	controller = createTransactionController(request)
	controller.execute()
	# Get the response
	response = controller.getresponse()
	
	if response is not None:
		if response.messages.resultCode == "Ok":
			if hasattr(response.transactionResponse, 'messages') == True:
				print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId);
				print ('Transaction Response Code: %s' % response.transactionResponse.responseCode);
				print ('Message Code: %s' % response.transactionResponse.messages.message[0].code);
				print ('Description: %s' % response.transactionResponse.messages.message[0].description);
			else:
				print ('Failed Transaction.');
				if hasattr(response.transactionResponse, 'errors') == True:
					print ('Error Code:  %s' % str(response.transactionResponse.errors.error[0].errorCode));
					print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText);
		else:
			print ('Failed Transaction.');
			if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True:
				print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode));
				print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText);
			else:
				print ('Error Code: %s' % response.messages.message[0]['code'].text);
				print ('Error message: %s' % response.messages.message[0]['text'].text);
	else:
		print ('Null Response.');

	return response
示例#8
0
def create_visa_checkout_transaction():

	merchantAuth = apicontractsv1.merchantAuthenticationType()
	merchantAuth.name = constants.apiLoginId
	merchantAuth.transactionKey = constants.transactionKey
	# Populate the payment data
	opaqueData = apicontractsv1.opaqueDataType()
	opaqueData.dataDescriptor = "COMMON.VCO.ONLINE.PAYMENT"
	opaqueData.dataValue = "vJhm2AREOockvIeUeJXkzSzcSwQtnz6pTbkjuXsGRMoG/4CYVZhUaNxwA2AbPr/wWOr3GPBlIv/5sH31wQotfjCHyq+rP1X+9myn3MueaOYxhpfpfkfAZcm8upaUVl20McTiuhmhHulNNTRd5AFnq3qUS55TRkAODqwMrSL+gLab8fw4V5L355Ufu7+qjUpMFi71hQ92L7u0DjuGSDmXZzPvH3p21LphdixDLNJWvA0YQ5/jIH7WbrNkSw9O//Zsf5p256WAjdsCcvLjPCYDB2mMAs4E8ZpOpQ39GATRSscPP5550RpHeYrTDLzlLZB/P5989mcz6ReH6sIbqn9Z0W0j+aIpZ7HsSRx74ps8kYt1SZ/NTph5+rT1JhmLR+QQAYI5EeXH4amYyOxt9klHb9erkLNwDPhBNkRh08kVlxPFHK4AHj1nXnaKjSs4yQ8JighJyD5rc1ekvX/n/Ng+TFbdpEUxsCAyNeClclxytaU0g6jJuxcsyq3cotzCgbBQKNd3B03eayqOUaeIXFN+7hNqAHIcm5BP16xG4Dh4HS5d+9e+mWZ4OVJz+UzBThSoPJ5uckpLIRNn9Fs1NKxSVrtSMjqdktOyge17z46IB9G+ISbcQJH+wqEDhwLyP8YhQUueALhldS95pWuH3oC07w6avVoTJGQAJrTLVzwX/VV/0fkhcHHFJEv19SSFuKqhohLiVGSw63mOyj14BCZhQIz3B9k5sYFYT8iMwcqAWQTgrJYsfck5/pxlnAwfPHips5YsKwQuS6Jg5Kf9FfI92zCW+141x8U0E9kQDkVsmyV4fRCEG0QXLMRKA2bDwE7faliUoSWYgEkdyTqdO5T1A6E9Grfn7v+Fa3Axlx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3E1exkVYV0FTtljhruYQ9TF2pg7T950RkGwlj3cWPjSqKqKyp8yu4w8xoS9Rel/LD0sABzE16d4tVRdNeJPCmOIzYhrDddfo4xW736BzgjYGKcdSUrl9YMeyVcYhvoGGM1YzkL+PTt3RO+moo9PYGQnY+7GkOpJoBwb5COQVvcCrkwcehsmVYBle+1uEocHAHv1Kc1BtXP+WT/wyWKMGnPJoPovglIhowODb2wU8ltnbRRhP14W6jwPCqtPWV4LXN0+7VKfyqBRUGkITjQWqsntlf3/egfG4uS3faPU4M"
	opaqueData.dataKey = "ZW6TOD05lWOtUYVunXhYmXRBA6d7UTVezRCwUYLrK/xHPK5LDuZe5Rk/sT223vO0NdD7iQXMPqnQrCS1myW+CFceOKiUuoA0zKJ6TZ84q/+msPG66DDdzDxeKKdE5Qjt"
	paymentType = apicontractsv1.paymentType()
	paymentType.opaqueData = opaqueData
	# Create the payment transaction request
	transactionRequest = apicontractsv1.transactionRequestType()
	transactionRequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
	transactionRequest.callId = "1238408836021304101"
	transactionRequest.amount = Decimal('14.00')
	transactionRequest.payment = paymentType
	# Make the API Request
	request = apicontractsv1.createTransactionRequest()
	request.merchantAuthentication = merchantAuth
	request.transactionRequest = transactionRequest
	# Execute the API request
	controller = createTransactionController(request)
	controller.execute()
	# Get the response
	response = controller.getresponse()
	if (response.messages.resultCode == "Ok"):
	    print "SUCCESS"
	    print "Transaction ID : %s" % response.transId
	    print "Auth code : %s " % response.authCode
	else:
	    print "ERROR"
	    print "Message Code : %s" % response.messages.message[0].code
	    print "Message text : %s" % response.messages.message[0].text

	return response
示例#9
0
文件: __init__.py 项目: vonq/saleor
def authorize(
    payment_information: PaymentData,
    config: GatewayConfig,
    user_id: Optional[int] = None,
) -> GatewayResponse:
    """Based on AcceptSuite create-an-accept-payment-transaction example.

    https://github.com/AuthorizeNet/sample-code-python/blob/master/AcceptSuite/create-an-accept-payment-transaction.py
    """
    kind = TransactionKind.CAPTURE if config.auto_capture else TransactionKind.AUTH
    merchant_auth = _get_merchant_auth(config.connection_params)

    # The Saleor token is the authorize.net "opaque data"
    opaque_data = apicontractsv1.opaqueDataType()
    opaque_data.dataDescriptor = "COMMON.ACCEPT.INAPP.PAYMENT"
    opaque_data.dataValue = payment_information.token

    payment_one = apicontractsv1.paymentType()
    payment_one.opaqueData = opaque_data

    order = apicontractsv1.orderType()
    order.invoiceNumber = payment_information.order_id
    order.description = payment_information.graphql_payment_id

    # An auth.net "profile" id is the id generated by auth.net.
    # It is not the Saleor user id.
    customer_id = (payment_information.customer_id
                   if payment_information.reuse_source else None)

    customer_data = apicontractsv1.customerDataType()
    customer_data.type = "individual"
    if user_id:
        customer_data.id = str(user_id)
    customer_data.email = payment_information.customer_email

    transaction_request = apicontractsv1.transactionRequestType()
    transaction_request.transactionType = ("authCaptureTransaction"
                                           if config.auto_capture else
                                           "authOnlyTransaction")
    transaction_request.amount = payment_information.amount
    transaction_request.currencyCode = payment_information.currency
    transaction_request.order = order
    transaction_request.payment = payment_one
    transaction_request.customer = customer_data

    if payment_information.reuse_source and customer_id is None:
        profile = apicontractsv1.customerProfilePaymentType()
        profile.createProfile = True
        transaction_request.profile = profile

    if payment_information.billing:
        customer_address = apicontractsv1.customerAddressType()
        customer_address.firstName = payment_information.billing.first_name
        customer_address.lastName = payment_information.billing.last_name
        customer_address.company = payment_information.billing.company_name
        # authorize.net support says we should not attempt submitting street_address_2
        customer_address.address = payment_information.billing.street_address_1
        customer_address.city = payment_information.billing.city
        customer_address.state = payment_information.billing.country_area
        customer_address.zip = payment_information.billing.postal_code
        customer_address.country = payment_information.billing.country
        transaction_request.billTo = customer_address

    create_transaction_request = apicontractsv1.createTransactionRequest()
    create_transaction_request.merchantAuthentication = merchant_auth
    create_transaction_request.refId = str(payment_information.payment_id)
    create_transaction_request.transactionRequest = transaction_request

    response = _make_request(create_transaction_request,
                             config.connection_params)

    (
        success,
        error,
        transaction_id,
        transaction_response,
        raw_response,
    ) = _handle_authorize_net_response(response)
    psp_reference = None
    if transaction_id:
        psp_reference = transaction_id
    elif payment_information.token:
        transaction_id = payment_information.token

    if hasattr(response, "profileResponse") and hasattr(
            response.profileResponse, "customerProfileId"):
        customer_id = response.profileResponse.customerProfileId

    payment_method_info = _authorize_net_account_to_payment_method_info(
        transaction_response)

    return GatewayResponse(
        is_success=success,
        action_required=False,
        transaction_id=transaction_id,
        amount=payment_information.amount,
        currency=payment_information.currency,
        error=error,
        payment_method_info=payment_method_info,
        kind=kind,
        raw_response=raw_response,
        customer_id=customer_id,
        psp_reference=str(psp_reference) if psp_reference else None,
    )
def create_an_accept_transaction():

    merchantAuth = apicontractsv1.merchantAuthenticationType()
    merchantAuth.name = constants.apiLoginId
    merchantAuth.transactionKey = constants.transactionKey

    opaquedata = apicontractsv1.opaqueDataType()
    opaquedata.dataDescriptor = "COMMON.ACCEPT.INAPP.PAYMENT"
    opaquedata.dataValue = "9471471570959063005001"

    paymentOne = apicontractsv1.paymentType()
    paymentOne.opaqueData = opaquedata

    transactionrequest = apicontractsv1.transactionRequestType()
    transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
    transactionrequest.amount = Decimal('151')
    transactionrequest.payment = paymentOne

    request = apicontractsv1.createTransactionRequest()
    request.merchantAuthentication = merchantAuth
    request.refId = "Sample"
    request.transactionRequest = transactionrequest

    controller = createTransactionController(request)
    controller.execute()

    response = controller.getresponse()

    if response is not None:
        if response.messages.resultCode == "Ok":
            if hasattr(response.transactionResponse, 'messages') == True:
                print(
                    'Successfully created transaction with Transaction ID: %s'
                    % response.transactionResponse.transId)
                print('Transaction Response Code: %s' %
                      response.transactionResponse.responseCode)
                print('Message Code: %s' %
                      response.transactionResponse.messages.message[0].code)
                print('Description: %s' % response.transactionResponse.
                      messages.message[0].description)
                print('AUTH Code : %s' % response.authCode)
            else:
                print('Failed Transaction.')
                if hasattr(response.transactionResponse, 'errors') == True:
                    print('Error Code:  %s' % str(response.transactionResponse.
                                                  errors.error[0].errorCode))
                    print(
                        'Error message: %s' %
                        response.transactionResponse.errors.error[0].errorText)
        else:
            print('Failed Transaction.')
            if hasattr(response, 'transactionResponse') == True and hasattr(
                    response.transactionResponse, 'errors') == True:
                print('Error Code: %s' % str(
                    response.transactionResponse.errors.error[0].errorCode))
                print('Error message: %s' %
                      response.transactionResponse.errors.error[0].errorText)
            else:
                print('Error Code: %s' %
                      response.messages.message[0]['code'].text)
                print('Error message: %s' %
                      response.messages.message[0]['text'].text)
    else:
        print('Null Response.')

    return response
示例#11
0
    def create_an_accept_payment_transaction(self, order_number, dataValue,
                                             dataDescriptor, total):
        # Create a merchantAuthenticationType object with authentication details
        # retrieved from the constants file
        merchantAuth = apicontractsv1.merchantAuthenticationType()
        merchantAuth.name = constants.apiLoginId
        merchantAuth.transactionKey = constants.transactionKey

        # Create the payment object for a payment nonce
        opaqueData = apicontractsv1.opaqueDataType()
        opaqueData.dataDescriptor = dataDescriptor
        opaqueData.dataValue = dataValue

        # Add the payment data to a paymentType object
        paymentOne = apicontractsv1.paymentType()
        paymentOne.opaqueData = opaqueData

        # Create order information
        #order = apicontractsv1.orderType()
        #order.invoiceNumber = "10101"
        #order.description = "Golf Shirts"

        # Add values for transaction settings
        duplicateWindowSetting = apicontractsv1.settingType()
        duplicateWindowSetting.settingName = "duplicateWindow"
        duplicateWindowSetting.settingValue = "600"
        settings = apicontractsv1.ArrayOfSetting()
        settings.setting.append(duplicateWindowSetting)

        # Create a transactionRequestType object and add the previous objects to it
        transactionrequest = apicontractsv1.transactionRequestType()
        transactionrequest.transactionType = "authCaptureTransaction"
        transactionrequest.amount = total.incl_tax
        #transactionrequest.order = order
        transactionrequest.payment = paymentOne

        # Assemble the complete transaction request
        createtransactionrequest = apicontractsv1.createTransactionRequest()
        createtransactionrequest.merchantAuthentication = merchantAuth
        # Set the transaction's refId
        createtransactionrequest.refId = str(order_number)
        createtransactionrequest.transactionRequest = transactionrequest

        # Create the controller and get response
        createtransactioncontroller = createTransactionController(
            createtransactionrequest)
        createtransactioncontroller.execute()

        response = createtransactioncontroller.getresponse()

        if response is not None:
            # Check to see if the API request was successfully received and acted upon
            if response.messages.resultCode == "Ok":
                # Since the API request was successful, look for a transaction response
                # and parse it to display the results of authorizing the card
                if hasattr(response.transactionResponse, 'messages'):
                    reference = "Transaction ID: %s\nAuth Code: %s\nTransaction Response Code: %s" \
                                % (response.transactionResponse.transId, response.transactionResponse.authCode,
                                   response.transactionResponse.responseCode)
                    # Record payment source and event
                    self.recordPayment('Authorize.net', total, reference)
                else:
                    # print('Failed Transaction.')
                    # if hasattr(response.transactionResponse, 'errors') == True:
                    #     print('Error Code:  %s' % str(response.transactionResponse.errors.error[0].errorCode))
                    #     print('Error message: %s' % response.transactionResponse.errors.error[0].errorText)
                    raise exceptions.UnableToTakePayment
            else:
                # print('Failed Transaction.')
                # if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse,
                #                                                                 'errors') == True:
                #     print('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode))
                #     print('Error message: %s' % response.transactionResponse.errors.error[0].errorText)
                # else:
                #     print('Error Code: %s' % response.messages.message[0]['code'].text)
                #     print('Error message: %s' % response.messages.message[0]['text'].text)
                raise exceptions.PaymentError
        else:
            raise exceptions.PaymentError
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from decimal import *

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = "5KP3u95bQpv"
merchantAuth.transactionKey = "4Ktq966gC55GAX7S"
# Populate the payment data
opaqueData = apicontractsv1.opaqueDataType()
opaqueData.dataDescriptor = "COMMON.VCO.ONLINE.PAYMENT"
opaqueData.dataValue = "vJhm2AREOockvIeUeJXkzSzcSwQtnz6pTbkjuXsGRMoG/4CYVZhUaNxwA2AbPr/wWOr3GPBlIv/5sH31wQotfjCHyq+rP1X+9myn3MueaOYxhpfpfkfAZcm8upaUVl20McTiuhmhHulNNTRd5AFnq3qUS55TRkAODqwMrSL+gLab8fw4V5L355Ufu7+qjUp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J6TZ84q/+msPG66DDdzDxeKKdE5Qjt"
paymentType = apicontractsv1.paymentType()
paymentType.opaqueData = opaqueData
# Create the payment transaction request
transactionRequest = apicontractsv1.transactionRequestType()
transactionRequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
transactionRequest.callId = "1238408836021304101"
transactionRequest.amount = Decimal("14.00")
transactionRequest.payment = paymentType
# Make the API Request
request = apicontractsv1.createTransactionRequest()
request.merchantAuthentication = merchantAuth
request.transactionRequest = transactionRequest
# Execute the API request
controller = createTransactionController(request)
controller.execute()
# Get the response
response = controller.getresponse()
if response.messages.resultCode == "Ok":
    print "SUCCESS"
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from decimal import *

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
# Populate the payment data
opaqueData = apicontractsv1.opaqueDataType()
opaqueData.dataDescriptor = "COMMON.VCO.ONLINE.PAYMENT"
opaqueData.dataValue = "vJhm2AREOockvIeUeJXkzSzcSwQtnz6pTbkjuXsGRMoG/4CYVZhUaNxwA2AbPr/wWOr3GPBlIv/5sH31wQotfjCHyq+rP1X+9myn3MueaOYxhpfpfkfAZcm8upaUVl20McTiuhmhHulNNTRd5AFnq3qUS55TRkAODqwMrSL+gLab8fw4V5L355Ufu7+qjUpMFi71hQ92L7u0DjuGSDmXZzPvH3p21LphdixDLNJWvA0YQ5/jIH7WbrNkSw9O//Zsf5p256WAjdsCcvLjPCYDB2mMAs4E8ZpOpQ39GATRSscPP5550RpHeYrTDLzlLZB/P5989mcz6ReH6sIbqn9Z0W0j+aIpZ7HsSRx74ps8kYt1SZ/NTph5+rT1JhmLR+QQAYI5EeXH4amYyOxt9klHb9erkLNwDPhBNkRh08kVlxPFHK4AHj1nXnaKjSs4yQ8JighJyD5rc1ekvX/n/Ng+TFbdpEUxsCAyNeClclxytaU0g6jJuxcsyq3cotzCgbBQKNd3B03eayqOUa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AF68kzSWvuA1ZQ0HJWTemGOu0rY/jzoicCHv0cC/MJaZ+nCqYfyhWUWgdTqPg+HOw1n1tZ7/geQTgHS2ZQlP5KYrKNDBNs9lRSKLjCE4vs+ZhA6YTMn/aPQKRyrkzQE/IQb2C4+ablq0RiVKdKegoiOHeQi9WlJIpu/SSn34pedLYfHXCLDkRoHyRy+0DhXWB7CYKC6AU0ZcaWzulSHhS6c1Sm0ZiET9CW63lZNsWS5y5s7hCIEYqWm7v+4nv2gERHxXWeX/+ZWvO8DRqfX5BVbUUKXSKpgddtdTn6VKyCs4/qnU4uP1qcqbStfZX33vzJPH8RGgL/T3E1exkVYV0FTtljhruYQ9TF2pg7T950RkGwlj3cWPjSqKqKyp8yu4w8xoS9Rel/LD0sABzE16d4tVRdNeJPCmOIzYhrDddfo4xW736BzgjYGKcdSUrl9YMeyVcYhvoGGM1YzkL+PTt3RO+moo9PYGQnY+7GkOpJoBwb5COQVvcCrkwcehsmVYBle+1uEocHAHv1Kc1BtXP+WT/wyWKMGnPJoPovglIhowODb2wU8ltnbRRhP14W6jwPCqtPWV4LXN0+7VKfyqBRUGkITjQWqsntlf3/egfG4uS3faPU4M"
opaqueData.dataKey = "ZW6TOD05lWOtUYVunXhYmXRBA6d7UTVezRCwUYLrK/xHPK5LDuZe5Rk/sT223vO0NdD7iQXMPqnQrCS1myW+CFceOKiUuoA0zKJ6TZ84q/+msPG66DDdzDxeKKdE5Qjt"
paymentType = apicontractsv1.paymentType()
paymentType.opaqueData = opaqueData
# Create the payment transaction request
transactionRequest = apicontractsv1.transactionRequestType()
transactionRequest.transactionType = apicontractsv1.transactionTypeEnum.authCaptureTransaction
transactionRequest.callId = "1238408836021304101"
transactionRequest.amount = Decimal('14.00')
transactionRequest.payment = paymentType
# Make the API Request
request = apicontractsv1.createTransactionRequest()
request.merchantAuthentication = merchantAuth
request.transactionRequest = transactionRequest
# Execute the API request
controller = createTransactionController(request)
controller.execute()
# Get the response
response = controller.getresponse()
if (response.messages.resultCode == "Ok"):
    print "SUCCESS"
示例#14
0
def create_an_accept_payment_transaction(amount):

    # Create a merchantAuthenticationType object with authentication details
    # retrieved from the constants file
    merchantAuth = apicontractsv1.merchantAuthenticationType()
    merchantAuth.name = constants.apiLoginId
    merchantAuth.transactionKey = constants.transactionKey

    # Set the transaction's refId
    refId = "ref {}".format(time.time())

    # Create the payment object for a payment nonce
    opaqueData = apicontractsv1.opaqueDataType()
    opaqueData.dataDescriptor = "COMMON.ACCEPT.INAPP.PAYMENT"
    opaqueData.dataValue = "119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9"

    # Add the payment data to a paymentType object
    paymentOne = apicontractsv1.paymentType()
    paymentOne.opaqueData = opaqueData

    # Create order information
    order = apicontractsv1.orderType()
    order.invoiceNumber = "10101"
    order.description = "Golf Shirts"

    # Set the customer's Bill To address
    customerAddress = apicontractsv1.customerAddressType()
    customerAddress.firstName = "Ellen"
    customerAddress.lastName = "Johnson"
    customerAddress.company = "Souveniropolis"
    customerAddress.address = "14 Main Street"
    customerAddress.city = "Pecan Springs"
    customerAddress.state = "TX"
    customerAddress.zip = "44628"
    customerAddress.country = "USA"

    # Set the customer's identifying information
    customerData = apicontractsv1.customerDataType()
    customerData.type = "individual"
    customerData.id = "99999456654"
    customerData.email = "*****@*****.**"

    # Add values for transaction settings
    duplicateWindowSetting = apicontractsv1.settingType()
    duplicateWindowSetting.settingName = "duplicateWindow"
    duplicateWindowSetting.settingValue = "600"
    settings = apicontractsv1.ArrayOfSetting()
    settings.setting.append(duplicateWindowSetting)

    # Create a transactionRequestType object and add the previous objects to it
    transactionrequest = apicontractsv1.transactionRequestType()
    transactionrequest.transactionType = "authCaptureTransaction"
    transactionrequest.amount = amount
    transactionrequest.order = order
    transactionrequest.payment = paymentOne
    transactionrequest.billTo = customerAddress
    transactionrequest.customer = customerData
    transactionrequest.transactionSettings = settings

    # Assemble the complete transaction request
    createtransactionrequest = apicontractsv1.createTransactionRequest()
    createtransactionrequest.merchantAuthentication = merchantAuth
    createtransactionrequest.refId = refId
    createtransactionrequest.transactionRequest = transactionrequest

    # Create the controller and get response
    createtransactioncontroller = createTransactionController(
        createtransactionrequest)
    createtransactioncontroller.execute()

    response = createtransactioncontroller.getresponse()

    if response is not None:
        # Check to see if the API request was successfully received and acted upon
        if response.messages.resultCode == "Ok":
            # Since the API request was successful, look for a transaction response
            # and parse it to display the results of authorizing the card
            if hasattr(response.transactionResponse, 'messages') == True:
                print(
                    'Successfully created transaction with Transaction ID: %s'
                    % response.transactionResponse.transId)
                print('Transaction Response Code: %s' %
                      response.transactionResponse.responseCode)
                print('Message Code: %s' %
                      response.transactionResponse.messages.message[0].code)
                print('Auth Code: %s' % response.transactionResponse.authCode)
                print('Description: %s' % response.transactionResponse.
                      messages.message[0].description)
            else:
                print('Failed Transaction.')
                if hasattr(response.transactionResponse, 'errors') == True:
                    print('Error Code:  %s' % str(response.transactionResponse.
                                                  errors.error[0].errorCode))
                    print(
                        'Error Message: %s' %
                        response.transactionResponse.errors.error[0].errorText)
        # Or, print errors if the API request wasn't successful
        else:
            print('Failed Transaction.')
            if hasattr(response, 'transactionResponse') == True and hasattr(
                    response.transactionResponse, 'errors') == True:
                print('Error Code: %s' % str(
                    response.transactionResponse.errors.error[0].errorCode))
                print('Error Message: %s' %
                      response.transactionResponse.errors.error[0].errorText)
            else:
                print('Error Code: %s' %
                      response.messages.message[0]['code'].text)
                print('Error Message: %s' %
                      response.messages.message[0]['text'].text)
    else:
        print('Null Response.')

    return response
def create_an_accept_transaction(amount):

    # Create a merchantAuthenticationType object with authentication details
    # retrieved from the constants file
    merchantAuth = apicontractsv1.merchantAuthenticationType()
    merchantAuth.name = constants.apiLoginId
    merchantAuth.transactionKey = constants.transactionKey
    
    # Set the transaction's refId
    refId = "ref {}".format(time.time())

    # Create the payment object for a payment nonce
    opaqueData = apicontractsv1.opaqueDataType()
    opaqueData.dataDescriptor = "COMMON.ACCEPT.INAPP.PAYMENT"
    opaqueData.dataValue = "119eyJjb2RlIjoiNTBfMl8wNjAwMDUyN0JEODE4RjQxOUEyRjhGQkIxMkY0MzdGQjAxQUIwRTY2NjhFNEFCN0VENzE4NTUwMjlGRUU0M0JFMENERUIwQzM2M0ExOUEwMDAzNzlGRDNFMjBCODJEMDFCQjkyNEJDIiwidG9rZW4iOiI5NDkwMjMyMTAyOTQwOTk5NDA0NjAzIiwidiI6IjEuMSJ9"

    # Add the payment data to a paymentType object
    paymentOne = apicontractsv1.paymentType()
    paymentOne.opaqueData = opaqueData
    
    # Create order information
    order = apicontractsv1.orderType()
    order.invoiceNumber = "10101"
    order.description = "Golf Shirts"
    
    # Set the customer's Bill To address
    customerAddress = apicontractsv1.customerAddressType()
    customerAddress.firstName = "Ellen"
    customerAddress.lastName = "Johnson"
    customerAddress.company = "Souveniropolis"
    customerAddress.address = "14 Main Street"
    customerAddress.city = "Pecan Springs"
    customerAddress.state = "TX"
    customerAddress.zip = "44628"
    customerAddress.country = "USA"
    
    # Set the customer's identifying information
    customerData = apicontractsv1.customerDataType()
    customerData.type = "individual"
    customerData.id = "99999456654"
    customerData.email = "*****@*****.**"
    
    # Add values for transaction settings
    duplicateWindowSetting = apicontractsv1.settingType()
    duplicateWindowSetting.settingName = "duplicateWindow"
    duplicateWindowSetting.settingValue = "600"
    settings = apicontractsv1.ArrayOfSetting()
    settings.setting.append(duplicateWindowSetting)

    # Create a transactionRequestType object and add the previous objects to it
    transactionrequest = apicontractsv1.transactionRequestType()
    transactionrequest.transactionType = "authCaptureTransaction"
    transactionrequest.amount = amount
    transactionrequest.order = order
    transactionrequest.payment = paymentOne
    transactionrequest.billTo = customerAddress
    transactionrequest.customer = customerData
    transactionrequest.transactionSettings = settings

    # Assemble the complete transaction request
    createtransactionrequest = apicontractsv1.createTransactionRequest()
    createtransactionrequest.merchantAuthentication = merchantAuth
    createtransactionrequest.refId = refId
    createtransactionrequest.transactionRequest = transactionrequest
    
    # Create the controller and get response
    createtransactioncontroller = createTransactionController(createtransactionrequest)
    createtransactioncontroller.execute()

    response = createtransactioncontroller.getresponse()

    if response is not None:
        # Check to see if the API request was successfully received and acted upon
        if response.messages.resultCode == "Ok":
            # Since the API request was successful, look for a transaction response
            # and parse it to display the results of authorizing the card
            if hasattr(response.transactionResponse, 'messages') == True:
                print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId)
                print ('Transaction Response Code: %s' % response.transactionResponse.responseCode)
                print ('Message Code: %s' % response.transactionResponse.messages.message[0].code)
                print ('Auth Code: %s' % response.transactionResponse.authCode)
                print ('Description: %s' % response.transactionResponse.messages.message[0].description)
            else:
                print ('Failed Transaction.')
                if hasattr(response.transactionResponse, 'errors') == True:
                    print ('Error Code:  %s' % str(response.transactionResponse.errors.error[0].errorCode))
                    print ('Error Message: %s' % response.transactionResponse.errors.error[0].errorText)
        # Or, print errors if the API request wasn't successful
        else:
            print ('Failed Transaction.')
            if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True:
                print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode))
                print ('Error Message: %s' % response.transactionResponse.errors.error[0].errorText)
            else:
                print ('Error Code: %s' % response.messages.message[0]['code'].text)
                print ('Error Message: %s' % response.messages.message[0]['text'].text)
    else:
        print ('Null Response.')

    return response