Beispiel #1
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__)
Beispiel #2
0
    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__)
Beispiel #3
0
 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__)
Beispiel #4
0
 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__)
    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 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__)
Beispiel #7
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)
Beispiel #8
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__)
Beispiel #9
0
  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)
 def __init__(self):
     '''
     Constructor
     '''
     # OptimalApiClient Object
     self.optimalApiCli = OptimalApiClient(self._api_key, 
                                      self._api_password, 
                                      "TEST", 
                                      self._account_number)
 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)   
    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__)
Beispiel #13
0
    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__)  
Beispiel #14
0
 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__)
    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__)
Beispiel #16
0
 def complete_authorization(self):
     '''
     Complete
     '''
     auth_obj = Authorization(None)
     auth_obj.id("55b77870-266c-4796-bce1-008334aad424")
     auth_obj.status("COMPLETED")
     self._optimal_obj = OptimalApiClient(self._api_key,
                                          self._api_password, 
                                          "TEST", 
                                          self._account_number)
     response_object = self._optimal_obj.card_payments_service_handler(
                                         ).complete_authorization_request(auth_obj)
                                         
     print ("Complete Response : ")
     print (response_object.__dict__)
Beispiel #17
0
    def lookup_verification_using_id(self):
        '''
        dd655ad9-2ebe-4178-9b3f-c88707a193f3
        '''
        verify_obj = Verification(None)
        verify_obj.id("dd655ad9-2ebe-4178-9b3f-c88707a193f3")

        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_id(verify_obj)
                                            
        print ("Complete Response : ")
        print (response_object.__dict__)
Beispiel #18
0
    def verify_card_using_payment_token(self):
        '''
        Sample of verifying a card using payment token
        '''
        verify_obj = Verification(None)
        card_obj = Card(None)
        #card_exp_obj = CardExpiry(None)
        #billing_obj = BillingDetails(None)
        #profile_obj = Profile(None)
        #shipping_obj = ShippingDetails(None)

        verify_obj.merchantRefNum("rp12jb19igryjqff")
        card_obj.paymentToken("C7dEdq9Mcz4nwyy")
        #card_obj.cvv("123")
        verify_obj.card(card_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")
        #verify_obj.shippingDetails(shipping_obj)

        #card_exp_obj.month("09")
        #card_exp_obj.year("2019")
        #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__)
Beispiel #19
0
 def settle_authorization(self):
     '''
     Settle an Authorization
     '''
     auth_obj = Authorization(None)
     auth_obj.id("55b77870-266c-4796-bce1-008334aad424")
     auth_obj.merchantRefNum("5m8652wc1pirizft")
     auth_obj.amount("500")
     #auth_obj.dupCheck(True)
     self._optimal_obj = OptimalApiClient(self._api_key,
                                          self._api_password, 
                                          "TEST", 
                                          self._account_number)
     response_object = self._optimal_obj.card_payments_service_handler(
                                         ).settle_authorization(auth_obj)
                                         
     print ("Complete Response : ")
     print (response_object.__dict__)
Beispiel #20
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__)        
Beispiel #21
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__)
 def cancel_order(self):
     '''
     27CIQ2J6RJ7LXTL1LJ
     Cancel Order
     27CIQ2ANJ7AORAF1LS
     fd1fbb53-2a7d-49fc-9ca0-b4f48ad74e23
     '''
     order_obj = Order(None)
     order_obj.id("27CIQ2PTEWISYYP1L9")
     print ("request data:", order_obj.__dict__)
      
     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(
                                         ).cancel_order(order_obj)    
      
     print ("Create Order Response: ")
     print (response_object)
 def refund_order(self):
     '''
     Settle an Order
     '''
     refund_obj = Refund(None)
     refund_obj.amount("2004")
     refund_obj.merchantRefNum(RandomTokenGenerator().generateToken())
     order_obj = Order(None)
     order_obj.id("127CIQ2P4R4DD89Z1LB")
     refund_obj.order(order_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(
                                         ).refund_order(refund_obj)    
      
     print ("Response: ")
     print (response_object)
 def settle_order(self):
     '''
     27CIQ2P4R4DD89Z1LB
     Settle an Order
     '''
     settle_obj = Settlement(None)
     settle_obj.amount("2004")
     settle_obj.merchantRefNum(RandomTokenGenerator().generateToken())
     order_obj = Order(None)
     order_obj.id("27CIQ2PTEWISYYP1L8")
     settle_obj.order(order_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(
                                         ).settle_order(settle_obj)    
      
     print ("Create Order Response: ")
     print (response_object)
    def get_order_report(self):
        '''
        Get Order Report
        '''
        order_obj = Order(None)
		
        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(
                                            ).get_order_report(order_obj, "5", "0")	
		
        print ("Response Object : ", response_object)
        print ("Length : ", response_object.__len__())
        for c in range(0, response_object.__len__()):
            print ('Records : ', c)
            print ('Order Id : ', response_object[c].id)
            print ('Merchant Reference Number :', response_object[c].merchantRefNum)
            print ('Currency Code : ', response_object[c].currencyCode)
            print ('Total Amount : ', response_object[c].totalAmount)
Beispiel #26
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__)
    def get_order(self):
        '''
        Get Order
        27CIQ2ANJ7AORAF1LS
        fd1fbb53-2a7d-49fc-9ca0-b4f48ad74e23
        '''
        order_obj = Order(None)
        order_obj.id("27CIQ2P65LDFRZF1LZ")
        print ("request data:", order_obj.__dict__)
         
        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(
                                            ).get_order(order_obj)    
                   
        print ("Create Order Response: ")
        print (response_object.__dict__)    

        for c in range(0, response_object.link.__len__()):
            print ('link-rel: ', response_object.link[c].rel)
            print ('link-uri: ', response_object.link[c].uri)
    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__)
Beispiel #29
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)
 def update_rebill_order(self):
     '''
     Update Order
     27CIQ2ANJ7AORAF1LS
     fd1fbb53-2a7d-49fc-9ca0-b4f48ad74e23
     '''
     
     order_obj = Order(None)
     order_obj.id("27CIQ2PTE52FWSJ1LK")
     #order_obj.currencyCode("CAD")
     
     #order_obj.id("27CIQ2KBVDHTB3N1L7")
     trans_obj = Transaction(None)
     trans_obj.status("success")
     #trans_obj.status("cancelled")
     order_obj.transaction(trans_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(
                                         ).update_order(order_obj)    
     
     print ("Create Order Response: ")
     print (response_object)
#!/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__)
#!/usr/bin/env python3
'''
Created on 1-June-2016

@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.CustomerVault.BACSBankAccount import BACSBankAccount
from PythonNetBanxSDK.DirectDebit.Purchase import Purchase
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_BACS)
purchase_obj = Purchase(None)
purchase_obj.merchantRefNum(RandomTokenGenerator().generateToken())
purchase_obj.amount("10098")

bacsbank_obj = BACSBankAccount(None)
bacsbank_obj.paymentToken("MPYuiNEUsKG5Y3A")
purchase_obj.bacs(bacsbank_obj)

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

print("\nResponse Values ==========> ")
Utils.print_response(response_object)
Beispiel #33
0
'''
Created on 1-Apr-2015

@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.CustomerVault.Profile import Profile
from PythonNetBanxSDK.HostedPayment.ExtendedOptions import ExtendedOptions
from PythonNetBanxSDK.HostedPayment.Order import Order
from PythonNetBanxSDK.HostedPayment.Redirect import Redirect
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 = []
Beispiel #34
0
'''
Created on 1-June-2016

@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.CustomerVault.Addresses import Address
from PythonNetBanxSDK.CustomerVault.Mandates import Mandates
from PythonNetBanxSDK.CustomerVault.Profile import Profile
from PythonNetBanxSDK.CustomerVault.SEPABankAccount import SEPABankAccount
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)
Beispiel #35
0
'''
Created on 1-June-2016

@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.CardPayments.BillingDetails import BillingDetails
from PythonNetBanxSDK.CustomerVault.ACHBankAccount import ACHBankAccount
from PythonNetBanxSDK.CustomerVault.Profile import Profile
from PythonNetBanxSDK.DirectDebit.StandaloneCredits import StandaloneCredits
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_ACH)
standalone_Obj = StandaloneCredits(None)
standalone_Obj.merchantRefNum(RandomTokenGenerator().generateToken())
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")
Beispiel #36
0
Created on 1-June-2016

@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.CardPayments.Card import Card
from PythonNetBanxSDK.CardPayments.CardExpiry import CardExpiry
from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient
from PythonNetBanxSDK.ThreeDSecure.Authentications import Authentications
from PythonNetBanxSDK.ThreeDSecure.EnrollmentChecks import EnrollmentChecks
from PythonNetBanxSDK.ThreeDSecure.EnrollmentChecks import EnrollmentChecks
from utils.Utils import Utils

from Config import Config
from RandomTokenGenerator import RandomTokenGenerator

optimal_obj = OptimalApiClient(Config.api_key_2, Config.api_password_2,
                               Config.environment, Config.account_number_2)
# Submit Enrollment Request
enrollment_Obj = EnrollmentChecks(None)
enrollment_Obj.merchantRefNum(RandomTokenGenerator().generateToken())
enrollment_Obj.amount("5000")
enrollment_Obj.currency("USD")
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)
import cgitb

from PythonNetBanxSDK.CardPayments.Authorization import Authorization
from PythonNetBanxSDK.CardPayments.Card import Card
from PythonNetBanxSDK.OptimalApiClient import OptimalApiClient

from Config import Config
from RandomTokenGenerator import RandomTokenGenerator


cgitb.enable()

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

optimal_obj = OptimalApiClient(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>')