当前位置: 首页>>代码示例>>Python>>正文


Python OptimalApiClient.card_payments_service_handler方法代码示例

本文整理汇总了Python中PythonNetBanxSDK.OptimalApiClient.OptimalApiClient.card_payments_service_handler方法的典型用法代码示例。如果您正苦于以下问题:Python OptimalApiClient.card_payments_service_handler方法的具体用法?Python OptimalApiClient.card_payments_service_handler怎么用?Python OptimalApiClient.card_payments_service_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PythonNetBanxSDK.OptimalApiClient.OptimalApiClient的用法示例。


在下文中一共展示了OptimalApiClient.card_payments_service_handler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OptimalApiClient

# 需要导入模块: from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient [as 别名]
# 或者: from PythonNetBanxSDK.OptimalApiClient.OptimalApiClient import card_payments_service_handler [as 别名]
import cgi
from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient
from PythonNetBanxSDK.CardPayments.Authorization import Authorization
from PythonNetBanxSDK.CardPayments.Card import Card
from PythonNetBanxSDK.CardPayments.CardExpiry import CardExpiry
from RandomTokenGenerator import RandomTokenGenerator
from Config import Config

form = cgi.FieldStorage()
payment_token = form.getvalue('paymentToken')

optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number)

auth_obj = Authorization(None)
card_obj = Card(None)
auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
auth_obj.amount("2006")
card_obj.paymentToken(payment_token)
auth_obj.card(card_obj)


response_object = optimal_obj.card_payments_service_handler().create_authorization(auth_obj)    

print ('Content-Type: text/html')
print ()
print ('<html>')
print ('<head><title>Card Payments - Create  Authorization with Payment Token</title></head>')
print ('<body>')
print (response_object.__dict__)
print ('</body></html>')
开发者ID:EDUlib,项目名称:Python_SDK-1,代码行数:32,代码来源:CardCustomer.py

示例2: SampleTest_Card

# 需要导入模块: from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient [as 别名]
# 或者: from PythonNetBanxSDK.OptimalApiClient.OptimalApiClient import card_payments_service_handler [as 别名]
class SampleTest_Card(object):
    '''
    classdocs
    '''

    # Static data
    _api_key = 'devcentre4628'
    _api_password = 'B-qa2-0-548ef25d-302b0213119f70d83213f828bc442dfd0af3280a7b48b1021400972746f9abe438554699c8fa3617063ca4c69a'
    _account_number = '89983472'


    def __init__(self):
        '''
        Constructor
        '''


    def card_payments_monitor(self):
        '''
        Card Payments Monitor
        '''
        self._optimal_obj = OptimalApiClient(self._api_key,
                                             self._api_password, 
                                             "TEST", 
                                             self._account_number)
        #self._optimal_obj._update_env('www.google.co.in',10,30,30)
        response_object = self._optimal_obj.card_payments_service_handler().monitor()

        print ("response object : ")
        print (response_object.__dict__)  

    def request_conflict_example_for_auth(self):
        '''
        Request Conflict Exception
        '''		
        auth_obj = Authorization(None)
        card_obj = Card(None)
        cardExpiry_obj = CardExpiry(None)
        billing_obj = BillingDetails(None)
        auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
        auth_obj.amount("1")
        auth_obj.settleWithAuth("false")
        card_obj.cardNum("4917480000000008")
        card_obj.cvv("123")
        auth_obj.card(card_obj)
        cardExpiry_obj.month("12")
        cardExpiry_obj.year("2017")
        card_obj.cardExpiry(cardExpiry_obj)
        billing_obj.zip("M5H 2N2")
        auth_obj.billingDetails(billing_obj)
        self._optimal_obj = OptimalApiClient(self._api_key,
                                             self._api_password, 
                                             "TEST", 
                                             self._account_number)
        response_object = self._optimal_obj.card_payments_service_handler().create_authorization(auth_obj)
        print ("Complete Response : ")
        print (response_object.__dict__)
        response_object = self._optimal_obj.card_payments_service_handler().create_authorization(auth_obj)
        print ("Complete Response : ")
        print (response_object.error.code)
        print (response_object.error.message)

	
    def create_authorization_with_payment_token(self):
        '''
        Create Authorization with payment token
        '''     
        auth_obj = Authorization(None)
        auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
        auth_obj.amount("1200")
          
        card_obj = Card(None)
        #C7dEdq9Mcz4nwyy old
        #Cejmh5QvaUyLGwA
        card_obj.paymentToken("Cejmh5QvaUyLGwA")
        auth_obj.card(card_obj)
        
        #billing_obj = BillingDetails(None)
        #billing_obj.zip("M5H 2N2")
        #auth_obj.billingDetails(billing_obj)
        
        self._optimal_obj = OptimalApiClient(self._api_key,
                                             self._api_password, 
                                             "TEST", 
                                             self._account_number)
        response_object = self._optimal_obj.card_payments_service_handler(
                                            ).create_authorization(auth_obj)
                                            
        print ("Complete Response : ")
        print (response_object.__dict__)
        print ("Card ID: ", response_object.card.__dict__)


    def create_complex_authorization(self):
        '''
        Create Complex Authorization
        '''
        auth_obj = Authorization(None)
        authentication_obj = Authentication(None)
        card_obj = Card(None)
#.........这里部分代码省略.........
开发者ID:EDUlib,项目名称:Python_SDK-1,代码行数:103,代码来源:SampleTest_Card.py


注:本文中的PythonNetBanxSDK.OptimalApiClient.OptimalApiClient.card_payments_service_handler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。