def create_card(self): ''' Create Customer Card ''' card_obj = Card(None) card_obj.nickName("John's corporate Visa") card_obj.holderName("MR. JOHN SMITH") #6759950000000162 #4917480000000008 #4530910000012345 #375529360131002 card_obj.cardNum("375529360131002") card_obj.billingAddressId("0c84d4a4-97f2-4cbd-b92b-3a7c9403b69e") card_obj.defaultCardIndicator("true") card_exp_obj = CardExpiry(None) card_exp_obj.month("12") card_exp_obj.year("2019") profile_obj = Profile(None) #rofile_obj.id("f25a445d-395d-43dd-bd8d-f82cbe46dd40") profile_obj.id("34361085-c873-4b2f-a61e-18cfdc5bd02c") card_obj.profile(profile_obj) card_obj.cardExpiry(card_exp_obj) response_object = self.optimal_obj.customer_vault_service_handler( ).create_card(card_obj) print ("Response Values : ") print (response_object.__dict__)
def create_address(self): ''' Create Customer Address ''' address_obj = Address(None) # address_obj.country("AR") # address_obj.city("Buenos Aires") # address_obj.street("Carlos Pellegrini 551") # address_obj.street2("1009 Buenos Aires") # address_obj.zip("C1009ABK") address_obj.nickName("home") address_obj.street("100 Queen Street West") address_obj.street2("Unit 201") address_obj.city("Toronto") address_obj.country("CA") address_obj.state("ON") address_obj.zip("M5H 2N2") address_obj.phone("647-788-3901") address_obj.recipientName("Jane Doe") profile_obj = Profile(None) profile_obj.id("556ab258-cacc-406c-8cd8-412fde6b6e4f") address_obj.profile(profile_obj) response_object = self.optimal_obj.customer_vault_service_handler( ).create_address(address_obj) print ("Respone Object : ") print (response_object.__dict__)
def profile(self, profile): if isinstance(profile, Profile): p = Profile(profile.__dict__) self.__dict__['profile'] = p else: p = Profile(profile) self.__dict__['profile'] = p
def lookup_customer_profile_subcomponents(self): ''' lookup Customer Profile Subcomponents ''' is_addresses = True is_cards = True profile_obj = Profile(None) #dae5f3d7-aa7c-45c0-8d41-23fc82022f6a - singleusetoken #profile_obj.id("f920d2a3-6582-4cc2-acc6-bdf7cfa626a3") #d76208a7-cc28-4803-bbf3-e2091f124824 profile_obj.id("4818c6de-5687-4afb-930d-cbeb106bf757") response_object = self.optimal_obj1.customer_vault_service_handler( ).lookup_profile_subcomponents( profile_obj, is_addresses, is_cards) print ("Response : ") print (response_object.__dict__) #print ("Addresses:") #for c in range(0, response_object.addresses.__len__()): # print (response_object.addresses[c].id) print ("Cards:") for c in range(0, response_object.cards.__len__()): print (response_object.cards[c].__dict__) print (response_object.cards[c].id) print (response_object.cards[c].cardExpiry.month) print (response_object.cards[c].paymentToken)
def process_rebill_using_Profile(self): order_obj = Order(None) profile_obj = Profile(None) #order_obj.id("27CIQ2PTEWISYYP1L8") order_obj.dueDate("2018-09-24") order_obj.totalAmount("200") profile_obj.id("91b65e7f-c800-4f52-861a-6bd921ba3831") profile_obj.paymentToken("CT7uSUOJ550zMBW") order_obj.profile(profile_obj) order_obj.merchantRefNum(RandomTokenGenerator().generateToken()) order_obj.currencyCode("USD") eo_list = [] eo = ExtendedOptions(None) eo.key("recurringIndicator") eo.value(True) eo_list.append(eo) order_obj.extendedOptions(eo_list) self._optimal_obj = OptimalApiClient(api_key=self._api_key, api_password=self._api_password, env="TEST", account_number=self._account_number) response_object = self._optimal_obj.hosted_payment_service_handler( ).process_rebill_using_profile_id(order_obj) print ("Response: ") print (response_object)
def testCancelOrderWithoutTransaction(): # Get the profile profile_Obj = Profile(None) profile_Obj.id("93d2f486-a61b-43d3-b718-d974354f244d") prof_respo = optimalApiCli.customer_vault_service_handler().lookup_profile(profile_Obj) print("Profile available with id:" ,prof_respo.id) preetyPrint(prof_respo,"") order_obj = Order(None) order_obj.customerIp("14.140.42.67") order_obj.merchantRefNum(merchantRefNum) order_obj.currencyCode("USD") order_obj.totalAmount(totalAmount) order_obj.profile(profile_Obj) order_obj.customerNotificationEmail("*****@*****.**") response_object = optimalApiCli.hosted_payment_service_handler().create_order(order_obj) print("Order created with id: ", response_object.id) preetyPrint(response_object,"") order_obj2 = Order(None) order_obj2.id(response_object.id) response_object = optimalApiCli.hosted_payment_service_handler().cancel_order(order_obj2) print("Order canceled with id :", response_object.id) preetyPrint(response_object,"")
def createAddress(): profile_Obj = Profile(None) profile_Obj.id("ed853368-b876-4928-8312-69eb7739f3b9") prof_respo = optimalApiCli.customer_vault_service_handler().lookup_profile(profile_Obj) print("Profile available with id:" ,prof_respo.id) preetyPrint(prof_respo,"") if prof_respo.id is not None: address_Obj = Address(None) address_Obj.nickName("heldadd") address_Obj.street("100 Queen Street West") address_Obj.street2("Unit 201") address_Obj.city("Toronto") address_Obj.country("AR") address_Obj.state("ON") address_Obj.zip("C1009ABK") address_Obj.recipientName("suresh") address_Obj.phone("647-788-3901") address_Obj.profile(prof_respo) print("Profile id: " , address_Obj.profile.id) response_object = optimalApiCli.customer_vault_service_handler().create_address(address_Obj) print("Address created with id: ", response_object.id) preetyPrint(response_object,"") else: print("Without profile an address cann't be created")
def testGetProfile(): profile_Obj = Profile(None) profile_Obj.id("93d2f486-a61b-43d3-b718-d974354f244d") response_object = optimalApiCli.customer_vault_service_handler().lookup_profile(profile_Obj) print("Profile available with id: ", response_object.id) preetyPrint(response_object,"")
def testUpdateCard(): #get the profile profile_Obj = Profile(None) profile_Obj.id("93d2f486-a61b-43d3-b718-d974354f244d") prof_resp_object = optimalApiCli.customer_vault_service_handler().lookup_profile(profile_Obj) print("Profile available with id: ", prof_resp_object.id) preetyPrint(prof_resp_object,"") #get the card card_obj = Card(None) card_obj.id("7262db7c-7750-4a25-963f-a5fe11999713") card_obj.profile(prof_resp_object) card_resp_obj = optimalApiCli.customer_vault_service_handler().lookup_card(card_obj) print("Card availabe with following response: ") preetyPrint(card_resp_obj,"") #update the card for billing address card_obj2 = Card(None) card_obj2.id("7262db7c-7750-4a25-963f-a5fe11999713") card_obj2.profile(prof_resp_object) card_obj2.billingAddressId("f67a220a-bfec-4a5b-a7f0-4c15abfc62c8") cardExpiry_obj = CardExpiry(None) cardExpiry_obj.month(card_resp_obj.cardExpiry.month) cardExpiry_obj.year(card_resp_obj.cardExpiry.year) card_obj2.cardExpiry(cardExpiry_obj) card_resp_obj2 = optimalApiCli.customer_vault_service_handler().update_card(card_obj2) print("Card updated with following response: ") preetyPrint(card_resp_obj2,"")
def delete_customer_profile(self): ''' Delete Customer Profile ''' profile_obj = Profile(None) profile_obj.id("71e7f7a6-0849-40fc-989f-31ffe1460d89") response_object = self.optimal_obj.customer_vault_service_handler( ).delete_profile(profile_obj) print ("Respone Object : ") print (response_object)
def testLookupAddress(): profile_Obj = Profile(None) profile_Obj.id("93d2f486-a61b-43d3-b718-d974354f244d") prof_respo = optimalApiCli.customer_vault_service_handler().lookup_profile(profile_Obj) print("Profile available with id:" ,prof_respo.id) address_Obj = Address(None) address_Obj.id("8411776b-bc59-4a3b-97dc-b6a6b879bb76") address_Obj.profile(prof_respo) add_resp_obj = optimalApiCli.customer_vault_service_handler().lookup_address(address_Obj) print("Address availabe with following response: ") preetyPrint(add_resp_obj,"")
def delete_address(self): ''' Delete Customer Address ''' address_obj = Address(None) address_obj.id("0f668bb8-67c2-46a7-919b-e6de289b4a08") profile_obj = Profile(None) profile_obj.id("f920d2a3-6582-4cc2-acc6-bdf7cfa626a3") address_obj.profile(profile_obj) response_object = self.optimal_obj.customer_vault_service_handler( ).delete_address(address_obj) print ("Respone Object : ") print (response_object.__dict__)
def delete_card(self): ''' Delete Customer Card ''' card_obj = Card(None) card_obj.id("86824a20-4076-47f9-88fc-c24b0dc2bd51") profile_obj = Profile(None) profile_obj.id("f920d2a3-6582-4cc2-acc6-bdf7cfa626a3") card_obj.profile(profile_obj) response_object = self.optimal_obj.customer_vault_service_handler( ).delete_card(card_obj) print ("Respone Object : ") print (response_object.__dict__)
def lookup_card(self): ''' Lookup Customer Card ''' card_obj = Card(None) card_obj.id("492d583b-4360-4cae-affe-1d7fc8cb3a7b") profile_obj = Profile(None) profile_obj.id("f920d2a3-6582-4cc2-acc6-bdf7cfa626a3") card_obj.profile(profile_obj) response_object = self.optimal_obj.customer_vault_service_handler( ).lookup_card(card_obj) print ("Respone Object : ") print (response_object.__dict__)
def create_profile_single_use_token(self): ''' Create Profile using Single Use Token ''' profile_obj1 = Profile(None) profile_obj1.merchantCustomerId(RandomTokenGenerator().generateToken()) profile_obj1.locale("en_US") #profile_obj.firstName("John") #profile_obj.lastName("Smith") #profile_obj.email("*****@*****.**") #profile_obj.phone("713-444-5555") card_obj = Card(None) #card_obj.singleUseToken("SCO0Jpx9JUP9hESh") card_obj.singleUseToken(self.create_profile_single_use_token_2()) profile_obj1.card(card_obj) print ("api-key======", self.optimal_obj._api_key) print ("api-password======", self.optimal_obj._api_password) print ("api-account======", self.optimal_obj._account_number) #print ("api-key======", self.optimal_obj._api_key) response_object = self.optimal_obj.customer_vault_service_handler( ).create_profile(profile_obj1) print ("Respone Object : ") print (response_object.__dict__) print (response_object.error.code) print (response_object.error.message)
def create_order(self): ''' Create Order 27CIQ2AQY2G5JY31LQ 8d1457c5-d3be-4ebe-919c-accded13a568 ''' order_obj = Order(None) order_obj.customerIp("14.140.42.67") order_obj.merchantRefNum(str(RandomTokenGenerator().generateToken())) order_obj.currencyCode("USD") order_obj.totalAmount("1125") order_obj.customerNotificationEmail("*****@*****.**") profile_obj = Profile(None) profile_obj.merchantCustomerId(str(RandomTokenGenerator().generateToken())) profile_obj.firstName("Jane") profile_obj.lastName("Smythe") order_obj.profile(profile_obj) self._optimal_obj = OptimalApiClient(api_key=self._api_key, api_password=self._api_password, env="TEST", account_number=self._account_number) response_object = self._optimal_obj.hosted_payment_service_handler( ).create_order(order_obj) print ("Create Order Response: ") print (response_object.__dict__)
def lookup_customer_profile(self): profile_obj = Profile(None) #profile_obj.id("d1ecd379-58d3-4850-abce-744efb1eea91") #profile_obj.id("f7db7ffe-87ab-4df9-8f04-0d405128473f") #profile_obj.id("f920d2a3-6582-4cc2-acc6-bdf7cfa626a3") #f25a445d-395d-43dd-bd8d-f82cbe46dd40 - android #1df156a3-d977-409a-9a4a-3bfb405e88a7 profile_obj.id("1df156a3-d977-409a-9a4a-3bfb405e88a7") response_object = self.optimal_obj.customer_vault_service_handler().lookup_profile(profile_obj) print ("response object : ") print (response_object.__dict__) print (response_object) if isinstance(response_object.error, common.Error.Error): print (response_object.error.code) print (response_object.error.message) else: print (response_object.id)
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__)
def testCreateCardForRiskTrns(): profile_Obj = Profile(None) profile_Obj.id("93d2f486-a61b-43d3-b718-d974354f244d") prof_respo = optimalApiCli.customer_vault_service_handler().lookup_profile(profile_Obj) print("Profile available with id:" ,prof_respo.id) if prof_respo.id is not None: #create an address with risk teretories #address_Obj = Address(None) #address_Obj.nickName("heldAdd") #address_Obj.street("102 king Street east") #address_Obj.street2("Unit 401") #address_Obj.city("Buenos Aires") #address_Obj.country("AR") #address_Obj.state("BA") #address_Obj.zip("C1009ABK") #address_Obj.recipientName("heldAddpay") #address_Obj.phone("647-799-3901") #address_Obj.profile(prof_respo) #print("Profile id: " , address_Obj.profile.id) #hel_add_resp_obj = optimalApiCli.customer_vault_service_handler().create_address(address_Obj) #print("held Address created with id: ", hel_add_resp_obj.id) #preetyPrint(hel_add_resp_obj,"") #if(hel_add_resp_obj.error): # print("===========Error while address creation ================") #else: card_obj = Card(None) card_obj.cardNum("4510150000000321") cardExpiry_obj = CardExpiry(None) cardExpiry_obj.month("08") cardExpiry_obj.year("2020") card_obj.cardExpiry(cardExpiry_obj) card_obj.profile(prof_respo) card_obj.billingAddressId("8411776b-bc59-4a3b-97dc-b6a6b879bb76") #card_obj.billingAddressId(hel_add_resp_obj.id) held_card_cr_resp_obj = optimalApiCli.customer_vault_service_handler().create_card(card_obj) print("Created created with id: ", held_card_cr_resp_obj.id, "& Status", held_card_cr_resp_obj.status) preetyPrint(held_card_cr_resp_obj,"") else: print("Without profile a card cann't be created")
def lookup_address(self): ''' lookup Customer Address ''' address_obj = Address(None) address_obj.id("7fc8a442-88c9-45d1-a480-88d45a532816") profile_obj = Profile(None) profile_obj.id("f920d2a3-6582-4cc2-acc6-bdf7cfa626a3") address_obj.profile(profile_obj) response_object = self.optimal_obj.customer_vault_service_handler( ).lookup_address(address_obj) print ("Respone Object : ") print (response_object.__dict__) if isinstance(response_object.error, common.Error.Error): print (response_object.error.code) print (response_object.error.message) else: print (response_object.id)
def update_card(self): ''' Update Customer Card ''' card_obj = Card(None) card_obj.id("177fa616-0375-4b09-865b-a6d570eb415a") card_obj.holderName("MR. JOHN JAMES SMITH") card_obj.defaultCardIndicator("false") card_exp_obj = CardExpiry(None) card_exp_obj.month("12") card_exp_obj.year("2019") profile_obj = Profile(None) profile_obj.id("34361085-c873-4b2f-a61e-18cfdc5bd02c") card_obj.profile(profile_obj) card_obj.cardExpiry(card_exp_obj) response_object = self.optimal_obj.customer_vault_service_handler( ).update_card(card_obj) print ("Respone Object : ") print (response_object.__dict__)
def testCreateCards(): profile_Obj = Profile(None) profile_Obj.id("ed853368-b876-4928-8312-69eb7739f3b9") prof_respo = optimalApiCli.customer_vault_service_handler().lookup_profile(profile_Obj) print("Profile available with id:" ,prof_respo.id) if prof_respo.id is not None: card_obj = Card(None) card_obj.cardNum("3569990000000009") cardExpiry_obj = CardExpiry(None) cardExpiry_obj.month("06") cardExpiry_obj.year("2018") card_obj.cardExpiry(cardExpiry_obj) card_obj.profile(prof_respo) response_object = optimalApiCli.customer_vault_service_handler().create_card(card_obj) print("Created created with id: ", response_object.id, "& Status", response_object.status) preetyPrint(response_object,"") print("response_object.cardExpiry.month: " , response_object.cardExpiry.month) print("response_object.cardExpiry.year: " , response_object.cardExpiry.year) else: print("Without profile a card cann't be created")
def update_address(self): ''' Update Customer Address ''' address_obj = Address(None) address_obj.id("f6bb6f41-962b-4cb3-8011-53cc7be60d29") address_obj.country("CA") address_obj.city("Toronto") address_obj.nickName("home") address_obj.street("323 Queen Street West") address_obj.state("ON") address_obj.zip("M5H 2N2") address_obj.recipientName("Jane Doe") address_obj.phone("647-788-3901") profile_obj = Profile(None) profile_obj.id("f920d2a3-6582-4cc2-acc6-bdf7cfa626a3") address_obj.profile(profile_obj) response_object = self.optimal_obj.customer_vault_service_handler( ).update_address(address_obj) print ("Respone Object : ") print (response_object.__dict__)
def silent_post(self): ''' Create Order 27CIQ2AQY2G5JY31LQ 8d1457c5-d3be-4ebe-919c-accded13a568 ''' order_obj = Order(None) order_obj.customerIp("14.140.42.67") order_obj.merchantRefNum(str(RandomTokenGenerator().generateToken())) order_obj.currencyCode("USD") order_obj.totalAmount("1125") order_obj.customerNotificationEmail("*****@*****.**") profile_obj = Profile(None) profile_obj.merchantCustomerId(str(RandomTokenGenerator().generateToken())) profile_obj.firstName("Jane") profile_obj.lastName("Smythe") order_obj.profile(profile_obj) eo_list = [] eo = ExtendedOptions(None) eo.key("silentPost") eo.value("true") eo_list.append(eo.__dict__) order_obj.extendedOptions(eo_list) redirect_list = [] redirect1 = Redirect(None) redirect1.rel("on_success") redirect1.uri("https://api.netbanx.com/echo?payment=success") redirect2 = Redirect(None) redirect2.rel("on_error") redirect2.uri("https://api.netbanx.com/echo?payment=error") redirect3 = Redirect(None) redirect3.rel("on_decline") redirect3.uri("https://api.netbanx.com/echo?payment=failure") redirect_list.append(redirect1.__dict__) redirect_list.append(redirect2.__dict__) redirect_list.append(redirect3.__dict__) order_obj.redirect(redirect_list) self._optimal_obj = OptimalApiClient(api_key=self._api_key, api_password=self._api_password, env="TEST", account_number=self._account_number) response_object = self._optimal_obj.hosted_payment_service_handler( ).create_order(order_obj) print ("Create Order Response: ") print (response_object.__dict__)
def process_order_with_payment_token(self): ''' Process order with payment token ''' order_obj = Order(None) order_obj.customerIp("14.140.42.67") order_obj.merchantRefNum(RandomTokenGenerator().generateToken()) order_obj.currencyCode("USD") order_obj.totalAmount("2006") order_obj.customerNotificationEmail("*****@*****.**") profile_obj = Profile(None) profile_obj.id("ee2c3dc6-022c-4d7e-a1ab-685cf28c7aad") profile_obj.paymentToken("Pff1PwG5LFuiq5q") order_obj.profile(profile_obj) # eo_list = [] # eo = ExtendedOptions(None) # eo.key("silentPost") # eo.value("true") # eo_list.append(eo) # order_obj.extendedOptions(eo_list) self._optimal_obj = OptimalApiClient(api_key=self._api_key, api_password=self._api_password, env="TEST", account_number=self._account_number) print("===", self._optimal_obj.to_dictionary(order_obj)) response_object = self._optimal_obj.hosted_payment_service_handler( ).create_order(order_obj) print ("Create Order Response: ") print (response_object.__dict__) print (response_object.id)
def process_order_with_profile_id(self): ''' Process an order with profile Id ''' order_obj = Order(None) order_obj.customerIp("14.140.42.67") order_obj.merchantRefNum(str(RandomTokenGenerator().generateToken())) order_obj.currencyCode("USD") order_obj.totalAmount("3000") order_obj.customerNotificationEmail("*****@*****.**") profile_obj = Profile(None) profile_obj.id("fe141eb8-00a3-4725-83f2-b1e5cbe8b817") order_obj.profile(profile_obj) self._optimal_obj = OptimalApiClient(api_key=self._api_key, api_password=self._api_password, env="TEST", account_number=self._account_number) response_object = self._optimal_obj.hosted_payment_service_handler( ).create_order(order_obj) print ("Create Order Response: ") print (response_object) print (response_object.profile.firstName)
def create_profile_with_order(self): ''' Create Profile with Order ''' order_obj = Order(None) order_obj.merchantRefNum(str(RandomTokenGenerator().generateToken())) order_obj.currencyCode("USD") order_obj.totalAmount(1000) profile_obj = Profile(None) profile_obj.merchantCustomerId(str(RandomTokenGenerator().generateToken())) profile_obj.firstName("Jane") profile_obj.lastName("Smythe") order_obj.profile(profile_obj) self._optimal_obj = OptimalApiClient(api_key=self._api_key, api_password=self._api_password, env="TEST", account_number=self._account_number) response_object = self._optimal_obj.hosted_payment_service_handler( ).create_order(order_obj) print ("Create Order Response: ") print (response_object.__dict__)
#!/usr/bin/env python3 ''' Created on 1-Apr-2015 @author: Asawari.Vaidya ''' from PythonNetBanxSDK.CustomerVault.Profile import Profile from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient from Config import Config from RandomTokenGenerator import RandomTokenGenerator optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number) profile_obj = Profile(None) profile_obj.merchantCustomerId(RandomTokenGenerator().generateToken()) profile_obj.locale("en_US") profile_obj.firstName("John") profile_obj.lastName("Smith") profile_obj.email("john.@[email protected]") profile_obj.phone("713-444-5555") response_object = optimal_obj.customer_vault_service_handler().create_profile(profile_obj) print ('Content-Type: text/html') print () print ('<html>') print ('<head><title>Customer Vault - Create Customer Profile</title></head>') print ('<body>') print (response_object.__dict__)
from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient from Config import Config from RandomTokenGenerator import RandomTokenGenerator optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number) order_obj = Order(None) order_obj.customerIp("14.140.42.67") order_obj.merchantRefNum(str(RandomTokenGenerator().generateToken())) order_obj.currencyCode("USD") order_obj.totalAmount("1125") order_obj.customerNotificationEmail("*****@*****.**") profile_obj = Profile(None) profile_obj.merchantCustomerId(str(RandomTokenGenerator().generateToken())) profile_obj.firstName("Jane") profile_obj.lastName("Smythe") order_obj.profile(profile_obj) response_object = optimal_obj.hosted_payment_service_handler().create_order(order_obj) print ('Content-Type: text/html') print () print ('<html>') print ('<head><title>Hosted Payment - Create Order</title></head>') print ('<body>') print (response_object.__dict__) print ('</body></html>')
@author: Asawari.Vaidya ''' from PythonNetBanxSDK.CustomerVault.Addresses import Address from PythonNetBanxSDK.CustomerVault.EFTBankAccount import EFTBankAccount from PythonNetBanxSDK.CustomerVault.Profile import Profile from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient from utils.Utils import Utils from Config import Config from RandomTokenGenerator import RandomTokenGenerator optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number) # Create Customer Profile profile_obj = Profile(None) profile_obj.merchantCustomerId(RandomTokenGenerator().generateToken()) profile_obj.locale("en_US") profile_obj.firstName("John") profile_obj.lastName("Smith") profile_obj.email("*****@*****.**") profile_obj.phone("713-444-5555") response_object = optimal_obj.customer_vault_service_handler().create_profile(profile_obj) # Create Address address_obj = Address(None) address_obj.nickName("home") address_obj.street("100 Queen Street West") address_obj.street2("Unit 201") address_obj.city("Toronto")
form = cgi.FieldStorage() profile_id = form.getvalue('profileId') card_num = form.getvalue('cardNumber') optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number) card_obj = Card(None) card_obj.nickName("John's corporate Visa") card_obj.holderName("MR. JOHN SMITH") card_obj.cardNum(card_num) #card_obj.cardNum("4510150000000321") card_obj.defaultCardIndicator("true") card_exp_obj = CardExpiry(None) card_exp_obj.month("12") card_exp_obj.year("2019") profile_obj = Profile(None) profile_obj.id(profile_id) #profile_obj.id("e17871ed-5430-4234-a6fb-f3c9ccf995cf") card_obj.profile(profile_obj) card_obj.cardExpiry(card_exp_obj) response_object = optimal_obj.customer_vault_service_handler().create_card(card_obj) print ('Content-Type: text/html') print () print ('<html>') print ('<head><title>Customer Vault - Create Customer Card</title></head>') print ('<body>') print (response_object.__dict__) print ('</body></html>')
from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient from Config import Config from RandomTokenGenerator import RandomTokenGenerator optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number) order_obj = Order(None) order_obj.customerIp("14.140.42.67") order_obj.merchantRefNum(str(RandomTokenGenerator().generateToken())) order_obj.currencyCode("USD") order_obj.totalAmount("1125") order_obj.customerNotificationEmail("*****@*****.**") profile_obj = Profile(None) profile_obj.merchantCustomerId(str(RandomTokenGenerator().generateToken())) profile_obj.firstName("Jane") profile_obj.lastName("Smythe") order_obj.profile(profile_obj) eo_list = [] eo = ExtendedOptions(None) eo.key("silentPost") eo.value("true") eo_list.append(eo.__dict__) order_obj.extendedOptions(eo_list) redirect_list = [] redirect1 = Redirect(None) redirect1.rel("on_success")
from RandomTokenGenerator import RandomTokenGenerator optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number_EFT) purchase_obj = Purchase(None) 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)
profile_id = form.getvalue('profileId') card_num = form.getvalue('cardNumber') optimal_obj = OptimalApiClient(Config.api_key, Config.api_password, Config.environment, Config.account_number) card_obj = Card(None) card_obj.nickName("John's corporate Visa") card_obj.holderName("MR. JOHN SMITH") card_obj.cardNum(card_num) #card_obj.cardNum("4510150000000321") card_obj.defaultCardIndicator("true") card_exp_obj = CardExpiry(None) card_exp_obj.month("12") card_exp_obj.year("2019") profile_obj = Profile(None) profile_obj.id(profile_id) #profile_obj.id("e17871ed-5430-4234-a6fb-f3c9ccf995cf") card_obj.profile(profile_obj) card_obj.cardExpiry(card_exp_obj) response_object = optimal_obj.customer_vault_service_handler().create_card( card_obj) print('Content-Type: text/html') print() print('<html>') print('<head><title>Customer Vault - Create Customer Card</title></head>') print('<body>') print(response_object.__dict__) print('</body></html>')
def testCreateOrderWithPaymenttoken(): # Get the profile profile_Obj = Profile(None) profile_Obj.id("ed853368-b876-4928-8312-69eb7739f3b9") profile_Obj.paymentToken("Px6Fuqsw52UiFNt") # Address with Argentina #addr_obj = Address(None) #addr_obj.country("AR") #addr_obj.city("Buenos Aires") #addr_obj.street("Carlos Pellegrini 551") #addr_obj.street2("1009 Buenos Aires") #addr_obj.zip("C1009ABK") #profile_obj = Profile(prof_respo) #addr_obj.profile(profile_obj) #addr_respo = optimalApiCli.customer_vault_service_handler().create_address(addr_obj) #addr_respo = optimalApiCli.customer_vault_service_handler().lookup_address(addr_respo) #print("Address available with id:" , addr_respo.id) #preetyPrint(prof_respo,"") # Card with Argentina #card_obj = Card(None) #card_obj.nickName("John's corporate Visa") #card_obj.holderName("MR. JOHN SMITH") #card_obj.cardNum("4530910000012345") #card_obj.billingAddressId(addr_respo.id) #card_obj.defaultCardIndicator("true") #card_exp_obj = CardExpiry(None) #card_exp_obj.month("12") #card_exp_obj.year("2019") #profile_obj = Profile(prof_respo) #card_obj.profile(profile_obj) #card_obj.cardExpiry(card_exp_obj) #card_respo = optimalApiCli.customer_vault_service_handler().create_card(card_obj) #card_respo = optimalApiCli.customer_vault_service_handler().lookup_address(card_respo) #print("Address available with id:" , card_respo.id) #preetyPrint(prof_respo,"") # Order with exptended options order_obj = Order(None) order_obj.customerIp("14.140.42.67") order_obj.merchantRefNum(merchantRefNum) order_obj.currencyCode("USD") order_obj.totalAmount(totalAmount) #profile_obj1 = Profile(None) #profile_obj1.id(prof_respo.id) order_obj.profile(profile_Obj) #order_obj.paymentToken(card_obj.paymentToken) order_obj.customerNotificationEmail("*****@*****.**") eolist = [] eo = ExtendedOptions(None) eo.key("authType") eo.value("auth") eolist.append(eo) order_obj.extendedOptions(eolist) response_object = optimalApiCli.hosted_payment_service_handler().create_order(order_obj) print("Order created with id: ", response_object.id) preetyPrint(response_object,"")