card_num = form.getvalue('cardNumber')

optimal_obj = PaysafeApiClient(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>')
示例#2
0
from Config import Config
from RandomTokenGenerator import RandomTokenGenerator

optimal_obj = PaysafeApiClient(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")
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_obj1 = Profile(None)
profile_obj1.id(response_object.id)