def card(self, card):
     if isinstance(card, Card):
         self.__dict__['card'] = card
     else:
         p = Card(card)
         self.__dict__['card'] = p
示例#2
0
from PythonPaysafeSDK.CardPayments.Card import Card
from PythonPaysafeSDK.PaysafeApiClient import PaysafeApiClient

from Config import Config
from RandomTokenGenerator import RandomTokenGenerator

cgitb.enable()

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

optimal_obj = PaysafeApiClient(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>')
from Config import Config
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 = PaysafeApiClient(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(10 * Config.currency_base_units_multiplier)
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)
示例#4
0
                               Config.environment, Config.account_number)
# Submit Enrollment Request
enrollment_Obj = EnrollmentChecks(None)
enrollment_Obj.merchantRefNum(RandomTokenGenerator().generateToken())
enrollment_Obj.amount(50 * Config.currency_base_units_multiplier)
enrollment_Obj.currency(Config.currency_code)
enrollment_Obj.customerIp("172.0.0.1")
enrollment_Obj.userAgent(
    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"
)
enrollment_Obj.acceptHeader(
    "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
)
enrollment_Obj.merchantUrl("https://www.merchant.com")

card_Obj = Card(None)
card_Obj.cardNum("4107857757053670")

card_Expiry_Obj = CardExpiry(None)
card_Expiry_Obj.month("10")
card_Expiry_Obj.year("2020")

card_Obj.cardExpiry(card_Expiry_Obj)
enrollment_Obj.card(card_Obj)

response_object = optimal_obj.three_d_secure_service_handler(
).submit_purchase_enrollment(enrollment_Obj)

# Submit Authentications Request
authentications_Obj = Authentications(None)
authentications_Obj.merchantRefNum(RandomTokenGenerator().generateToken())