Пример #1
0
 def billingDetails(self, billing_details):
     if isinstance(billing_details, BillingDetails):
         p = BillingDetails(billing_details.__dict__)
         self.__dict__['billingDetails'] = p
     else:
         p = BillingDetails(billing_details)
         self.__dict__['billingDetails'] = p
Пример #2
0
 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)
Пример #3
0
    def partial_authorization_reversal(self):
        '''
        Partial authorization reversal
        '''
        auth_obj = Authorization(None)
        auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
        auth_obj.amount(555)
        auth_obj.settleWithAuth("false")

        card_obj = Card(None)
        card_obj.cardNum("4530910000012345")
        card_obj.cvv("123")
        auth_obj.card(card_obj)

        cardExpiry_obj = CardExpiry(None)
        cardExpiry_obj.month("1")
        cardExpiry_obj.year("2017")
        card_obj.cardExpiry(cardExpiry_obj)

        billing_obj = BillingDetails(None)
        billing_obj.zip("M5H 2 N2")
        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 ("Authorization Response : ", response_object.__dict__)
        auth_id = response_object.id
        print ("Authorization Id : ", auth_id)
        # dea6fd3a-3e47-4b44-a303-c5c38f7104f6
        auth_rev =  AuthorizationReversal(None)
        auth_rev.merchantRefNum(RandomTokenGenerator().generateToken())
        auth_rev.amount(222)

        auth_obj2 = Authorization(None)
        auth_obj2.id(auth_id)
        auth_rev.authorization(auth_obj2)

        self._optimal_obj = OptimalApiClient(self._api_key,
                                             self._api_password, 
                                             "TEST", 
                                             self._account_number)
        response_object = self._optimal_obj.card_payments_service_handler(
                                            ).reverse_authorization_using_merchant_no(auth_rev)

        print ("Complete Response : ")
        print (response_object.__dict__)
Пример #4
0
    def verify_card_billing_details(self):
        '''
        Sample of verifying a card and billing details
        '''
        verify_obj = Verification(None)
        card_obj = Card(None)
        card_exp_obj = CardExpiry(None)
        billing_obj = BillingDetails(None)
        profile_obj = Profile(None)

        verify_obj.merchantRefNum("4lnvozq01d1pbkr0")
        #verify_obj.customerIp("204.91.0.12")
        #verify_obj.description("This is  a test transaction")

        #profile_obj.firstName("John")
        #profile_obj.lastName("Smith")
        #profile_obj.email("*****@*****.**")
        #verify_obj.profile(profile_obj)

        card_obj.cardNum("4530910000012345")
        card_obj.cvv("123")
        verify_obj.card(card_obj)

        card_exp_obj.month("02")
        card_exp_obj.year("2017")
        card_obj.cardExpiry(card_exp_obj)

        #billing_obj.street("100 Queen Street West")
        #billing_obj.city("Toronto")
        #billing_obj.state("ON")
        #billing_obj.country("CA")
        billing_obj.zip("M5H 2N2")
        verify_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(
                                            ).verify_card(verify_obj)

        print ("Complete Response : ")
        print (response_object.__dict__)
Пример #5
0
    def create_authorization_with_card(self):
        '''
        Create Authorization with payment token
        '''     

        auth_obj = Authorization(None)
        card_obj = Card(None)
        cardExpiry_obj = CardExpiry(None)
        billing_obj = BillingDetails(None)
        profile_obj = Profile(None)

        auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
        auth_obj.amount("1400")
        auth_obj.settleWithAuth("false")
		
        card_obj.cardNum("4530910000012345")
        card_obj.cvv("123")
        auth_obj.card(card_obj)
		
        cardExpiry_obj.month("2")
        cardExpiry_obj.year("2017")
        card_obj.cardExpiry(cardExpiry_obj)
		
        billing_obj.zip("M5H 2N2")
        auth_obj.billingDetails(billing_obj)

        profile_obj.firstName("John")
        profile_obj.lastName("Smith")
        auth_obj.profile(profile_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 ("Profile: ", response_object.profile.__dict__)
        print ("Card ID: ", response_object.card.__dict__)
Пример #6
0
    def payment_process_with_card_settle_with_auth_true(self):
        '''
        Process a card purchase (settleWithAuth=true)
        '''     

        auth_obj = Authorization(None)
        card_obj = Card(None)
        cardExpiry_obj = CardExpiry(None)
        billing_obj = BillingDetails(None)

        auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
        auth_obj.amount("4")
        auth_obj.settleWithAuth("true")

        card_obj.cardNum("4530910000012345")
        card_obj.cvv("123")
        auth_obj.card(card_obj)

        cardExpiry_obj.month("2")
        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__)
        print ("Card ID: ", response_object.card.__dict__)
        print("error code: ", response_object.error.code)
        print("error message: ", response_object.error.message)
Пример #7
0
 def billingDetails(self, billing_details):
     if isinstance(billing_details, BillingDetails):
         self.__dict__['billingDetails'] = billing_details
     else:
         bd = BillingDetails(billing_details)
         self.__dict__['billingDetails'] = bd
Пример #8
0
from PythonNetBanxSDK.CardPayments.Card import Card
from PythonNetBanxSDK.CardPayments.CardExpiry import CardExpiry
from PythonNetBanxSDK.CardPayments.BillingDetails import BillingDetails
from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient
from RandomTokenGenerator import RandomTokenGenerator
from Config import Config

form = cgi.FieldStorage()
card_num = form.getvalue('cardNumber')

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

auth_obj = Authorization(None)
card_obj = Card(None)
cardExpiry_obj = CardExpiry(None)
billing_obj = BillingDetails(None)
		
auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
auth_obj.amount("100")
auth_obj.settleWithAuth("false")

#card_obj.cardNum("4530910000012345")		
card_obj.cardNum(card_num)
card_obj.cvv("123")
auth_obj.card(card_obj)
		
cardExpiry_obj.month("2")
cardExpiry_obj.year("2017")
card_obj.cardExpiry(cardExpiry_obj)

billing_obj.street("Carlos Pellegrini 551")
standalone_Obj.merchantRefNum(RandomTokenGenerator().generateToken())
standalone_Obj.amount("10098")
standalone_Obj.customerIp("192.0.126.111")

eftbank_Obj = EFTBankAccount(None)
eftbank_Obj.accountHolderName("XYZ Company")
eftbank_Obj.accountNumber("335892")
eftbank_Obj.transitNumber("22446")
eftbank_Obj.institutionId("001")

profile_Obj = Profile(None)
profile_Obj.firstName("Joe")
profile_Obj.lastName("Smith")
profile_Obj.email("*****@*****.**")

billingdetails_Obj = BillingDetails(None)
billingdetails_Obj.street("100 Queen Street West")
billingdetails_Obj.city("Ottawa")
billingdetails_Obj.state("ON")
billingdetails_Obj.country("CA")
billingdetails_Obj.zip("90210")
billingdetails_Obj.phone("6139991100")

standalone_Obj.profile(profile_Obj)
standalone_Obj.billingDetails(billingdetails_Obj)
standalone_Obj.eft(eftbank_Obj)

response_object = optimal_obj.direct_debit_service_handler().submit_standalone(standalone_Obj)

print ("\nResponse Values ==========> ")
Utils.print_response(response_object)
purchase_obj.merchantRefNum(RandomTokenGenerator().generateToken())
purchase_obj.amount("10098")
purchase_obj.customerIp("192.0.126.111")

eftbank_obj = EFTBankAccount(None)
eftbank_obj.accountHolderName("XYZ Company")
eftbank_obj.accountNumber("336657")
eftbank_obj.transitNumber("22446")
eftbank_obj.institutionId("001")

profile_obj = Profile(None)
profile_obj.firstName("Joe")
profile_obj.lastName("Smith")
profile_obj.email("*****@*****.**")

billingdetails_obj = BillingDetails(None)
billingdetails_obj.street("100 Queen Street West")
billingdetails_obj.city("Ottawa")
billingdetails_obj.state("ON")
billingdetails_obj.country("CA")
billingdetails_obj.zip("M1M1M1")
billingdetails_obj.phone("6139991100")

purchase_obj.profile(profile_obj)
purchase_obj.billingDetails(billingdetails_obj)
purchase_obj.eft(eftbank_obj)

response_object = optimal_obj.direct_debit_service_handler().submit_purchase(purchase_obj)

print ("\nResponse Values ==========> ")
Utils.print_response(response_object)
Пример #11
0
standalone_Obj.amount("10098")
standalone_Obj.customerIp("192.0.126.111")

achbank_Obj = ACHBankAccount(None)
achbank_Obj.accountHolderName("XYZ Company")
achbank_Obj.accountType("CHECKING")
achbank_Obj.accountNumber("988758392")
achbank_Obj.routingNumber("211589828")
achbank_Obj.payMethod("PPD")

profile_Obj = Profile(None)
profile_Obj.firstName("Joe")
profile_Obj.lastName("Smith")
profile_Obj.email("*****@*****.**")

billingdetails_Obj = BillingDetails(None)
billingdetails_Obj.street("100 Queen Street West")
billingdetails_Obj.city("Los Angeles")
billingdetails_Obj.state("CA")
billingdetails_Obj.country("US")
billingdetails_Obj.zip("90210")
billingdetails_Obj.phone("3102649010")

standalone_Obj.profile(profile_Obj)
standalone_Obj.billingDetails(billingdetails_Obj)
standalone_Obj.ach(achbank_Obj)

response_object = optimal_obj.direct_debit_service_handler().submit_standalone(
    standalone_Obj)

print("\nResponse Values ==========> ")
Пример #12
0
 def create_transaction_test(self):
     '''
     Sample of complete transaction request
     '''
     billing_obj = BillingDetails(None)
     shipping_obj = ShippingDetails(None)
     auth_obj = Authorization(None)
     card_obj = Card(None)
     card_exp_obj = CardExpiry(None)
     
     billing_obj.street("Carlos Pellegrini 551")
     billing_obj.city("Buenos Aires")
     billing_obj.state("CA")
     billing_obj.country("US")
     billing_obj.zip("M5H 2N2")
     
     shipping_obj.carrier("CAD")
     shipping_obj.city("Buenos Aires")
     shipping_obj.state("ON")
     shipping_obj.country("CA")
     shipping_obj.zip("M5H 2N2")
     
     card_obj.cardNum("5191330000004415")
     card_exp_obj.month("09")
     card_exp_obj.year("2019")
     card_obj.cardExpiry(card_exp_obj)
     
     auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
     auth_obj.amount("1200")
     auth_obj.settleWithAuth(True)
     auth_obj.dupCheck(True)
     auth_obj.card(card_obj)
     auth_obj.billingDetails(billing_obj)
     auth_obj.shippingDetails(shipping_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__)        
Пример #13
0
    def create_complex_authorization(self):
        '''
        Create Complex Authorization
        '''
        auth_obj = Authorization(None)
        authentication_obj = Authentication(None)
        card_obj = Card(None)
        cardExpiry_obj = CardExpiry(None)
        billing_obj = BillingDetails(None)
        shipping_obj = ShippingDetails(None)

        auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
        auth_obj.amount("5")
        auth_obj.settleWithAuth("false")
        auth_obj.customerIp("204.91.0.12")

        card_obj.cardNum("5036150000001115")
        card_obj.cvv("123")
        auth_obj.card(card_obj)

        cardExpiry_obj.month("4")
        cardExpiry_obj.year("2017")
        card_obj.cardExpiry(cardExpiry_obj)

        authentication_obj.eci("5")
        authentication_obj.cavv("AAABCIEjYgAAAAAAlCNiENiWiV+=")
        authentication_obj.xid("OU9rcTRCY1VJTFlDWTFESXFtTHU=")
        authentication_obj.threeDEnrollment("Y")
        authentication_obj.threeDResult("Y")
        authentication_obj.signatureStatus("Y")
        auth_obj.authentication(authentication_obj)

        billing_obj.street("100 Queen Street West")
        billing_obj.city("Toronto")
        billing_obj.state("ON")
        billing_obj.country("CA")
        billing_obj.zip("M5H 2N2")
        auth_obj.billingDetails(billing_obj)

        shipping_obj.carrier("FEX")
        shipping_obj.shipMethod("C")
        shipping_obj.street("100 Queen Street West")
        shipping_obj.city("Toronto")
        shipping_obj.state("ON")
        shipping_obj.country("CA")
        shipping_obj.zip("M5H 2N2")
        auth_obj.shippingDetails(shipping_obj)
        
        #self.optimal_obj.card_payments_service_handler().lookup_authorization_with_id(auth_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__)
Пример #14
0
from RandomTokenGenerator import RandomTokenGenerator

cgitb.enable()
#from sample_application.RandomTokenGenerator import RandomTokenGenerator
#from sample_application.Config import Config

form = cgi.FieldStorage()
card_num = form.getvalue('cardNumber')

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

auth_obj = Authorization(None)
card_obj = Card(None)
cardExpiry_obj = CardExpiry(None)
billing_obj = BillingDetails(None)

auth_obj.merchantRefNum(RandomTokenGenerator().generateToken())
auth_obj.amount("100")
auth_obj.settleWithAuth("false")

#card_obj.cardNum("4530910000012345")
card_obj.cardNum(card_num)
card_obj.cvv("123")
auth_obj.card(card_obj)

cardExpiry_obj.month("2")
cardExpiry_obj.year("2017")
card_obj.cardExpiry(cardExpiry_obj)

billing_obj.street("Carlos Pellegrini 551")
purchase_obj.customerIp("192.0.126.111")

achbank_obj = ACHBankAccount (None)
achbank_obj.accountHolderName("XYZ Company")
achbank_obj.accountType("CHECKING")
#achbank_obj.accountNumber(RandomTokenGenerator().generateNumber())
achbank_obj.accountNumber("988948193")
achbank_obj.routingNumber("211589828")
achbank_obj.payMethod("WEB")

profile_obj = Profile(None)
profile_obj.firstName("Joe")
profile_obj.lastName("Smith")
profile_obj.email("*****@*****.**")

billingdetails_obj = BillingDetails(None)
billingdetails_obj.street("100 Queen Street West")
billingdetails_obj.city("Los Angeles")
billingdetails_obj.state("CA")
billingdetails_obj.country("US")
billingdetails_obj.zip("90210")
billingdetails_obj.phone("3102649010")

purchase_obj.profile(profile_obj)
purchase_obj.billingDetails(billingdetails_obj)
purchase_obj.ach(achbank_obj)

response_object = optimal_obj.direct_debit_service_handler().submit_purchase(purchase_obj)

print ("\nResponse Values ==========> ")
Utils.print_response(response_object)