本文整理汇总了Python中PythonNetBanxSDK.OptimalApiClient.OptimalApiClient类的典型用法代码示例。如果您正苦于以下问题:Python OptimalApiClient类的具体用法?Python OptimalApiClient怎么用?Python OptimalApiClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OptimalApiClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: partial_authorization_reversal
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__)
示例2: lookup_verification_using_merchant_ref_num
def lookup_verification_using_merchant_ref_num(self):
'''
4lnvozq01d1pbkr0
'''
pagination_obj = Pagination(None)
pagination_obj.limit = "4"
pagination_obj.offset = "0"
#pagination_obj.startDate = "2015-02-10T06:08:56Z"
#pagination_obj.endDate = "2015-02-20T06:08:56Z"
verify_obj = Verification(None)
verify_obj.merchantRefNum("4lnvozq01d1pbkr0")
self._optimal_obj = OptimalApiClient(self._api_key,
self._api_password,
"TEST",
self._account_number)
response_object = self._optimal_obj.card_payments_service_handler(
).lookup_verification_using_merchant_ref_num(verify_obj, pagination_obj)
print ("Complete Response : ")
print (response_object)
#print (response_object.links[0].rel)
#print (response_object.links[0].href)
#print (response_object[0].links[0].href)
print (response_object[0].__dict__)
#print (response_object.error.fieldErrors[0].__dict__)
#print (response_object.error.fieldErrors[1].__dict__)
for c in range(0, response_object.__len__()):
print ('Records : ', c)
print ('Verifications : ', response_object[c].__dict__)
示例3: lookup_authorization_with_merchant_ref_num
def lookup_authorization_with_merchant_ref_num(self):
'''
Lookup Authorization with Id
'''
pagination_obj = Pagination(None)
#pagination_obj.limit = "4"
#pagination_obj.offset = "0"
#pagination_obj.startDate = "2015-02-10T06:08:56Z"
#pagination_obj.endDate = "2015-02-20T06:08:56Z"
#f0yxu8w57de4lris
#zyp2pt3yi8p8ag9c
auth_obj = Authorization(None)
auth_obj.merchantRefNum("f0yxu8w57de4lris")
self._optimal_obj = OptimalApiClient(self._api_key,
self._api_password,
"TEST",
self._account_number)
response_object = self._optimal_obj.card_payments_service_handler(
).lookup_authorization_with_merchant_no(auth_obj, pagination_obj)
print ("Complete Response : ")
print (response_object)
#print (response_object.links[0].rel)
#print (response_object.links[0].href)
#print (response_object[0].links[0].href)
print (response_object[0].__dict__)
示例4: process_rebill_using_Profile
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)
示例5: create_order
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("[email protected]")
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__)
示例6: request_conflict_example_for_auth
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)
示例7: create_authorization_with_payment_token
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__)
示例8: create_complex_authorization
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__)
示例9: test_split
def test_split(self):
##### Create necessary objects
### Listing the requested parameters
ip = '10.8.0.1'
currency = 'CAD'
amount = '1125'
redirecttype = 'on_success'
redirecturi = 'http://localhost/redirect'
redirectkey_id = 'id'
redirectkey_amount = 'transaction.amount'
refnum = str(RandomTokenGenerator().generateToken())
### Creating object that will be sent to netbanx
order_obj = Order(None)
order_obj.customerIp(ip)
order_obj.merchantRefNum(refnum)
order_obj.currencyCode(currency)
order_obj.totalAmount(amount)
redirect = Redirect(None)
redirect.rel(redirecttype)
redirect.uri(redirecturi)
redirect.returnKeys((redirectkey_id, redirectkey_amount))
redirect_list = []
redirect_list.append(redirect.__dict__)
order_obj.redirect((redirect_list))
### Check if the function will send all requested parameters
## If we want to actually send something, configure the followin and
## uncomment the create_order line
apikey = ""
apipassword = ""
apienviro = "TEST"
apiacnum = ""
optimal_obj = OptimalApiClient(apikey, apipassword, apienviro, apiacnum)
#response_object = optimal_obj.hosted_payment_service_handler().create_order(order_obj)
output = optimal_obj.serialize(order_obj)
parsed_json = json.loads(output)
pp = pprint.PrettyPrinter(indent=4)
#pp.pprint("RAW OUTPUT:")
#pp.pprint(parsed_json)
expected = {'currencyCode':currency, 'customerIp':ip, 'merchantRefNum':refnum, 'redirect':[{'rel':redirecttype, 'returnKeys':[redirectkey_id, redirectkey_amount], 'uri':redirecturi}], 'totalAmount':amount}
self.assertEqual(parsed_json, expected)
示例10: __init__
def __init__(self):
'''
Constructor
'''
# OptimalApiClient Object
self.optimalApiCli = OptimalApiClient(self._api_key,
self._api_password,
"TEST",
self._account_number)
示例11: hosted_payment_monitor
def hosted_payment_monitor(self):
'''
Hosted Payment Monitor
'''
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(
).monitor()
print ("response object : ")
print (response_object.status)
示例12: silent_post
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("[email protected]")
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__)
示例13: card_payments_monitor
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__)
示例14: lookup_authorization_with_id
def lookup_authorization_with_id(self):
'''
Lookup Authorization with Id
'''
auth_obj = Authorization(None)
auth_obj.id("5406f84a-c728-499e-b310-c55f4e52af9f")
self._optimal_obj = OptimalApiClient(self._api_key,
self._api_password,
"TEST",
self._account_number)
response_object = self._optimal_obj.card_payments_service_handler(
).lookup_authorization_with_id(auth_obj)
print ("Complete Response : ")
print (response_object.__dict__)
示例15: process_rebill_using_id
def process_rebill_using_id(self):
order_obj = Order(None)
order_obj.id("27CIQ2PTEWISYYP1L8")
order_obj.totalAmount("2004")
order_obj.merchantRefNum(RandomTokenGenerator().generateToken())
order_obj.currencyCode("USD")
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_order_id(order_obj)
print ("Response: ")
print (response_object.__dict__)