def update(self, payment_id, body, batch_id):
     if payment_id is None:
         raise InvalidFieldException("Payment id cannot be None.")
     if body is None:
         raise InvalidFieldException("Body cannot be None.")
     endpoint = '/v1/batches/' + batch_id + '/payments/' + payment_id
     paymentrails.configuration.Configuration.client(self.config).patch(
         endpoint, body)
     return True
 def update(self, recipient_id, body):
     if recipient_id is None:
         raise InvalidFieldException("Recipient id cannot be None.")
     if body is None:
         raise InvalidFieldException("Body cannot be None")
     endpoint = '/v1/recipients/' + recipient_id
     paymentrails.configuration.Configuration.client(self.config).patch(
         endpoint, body)
     return True
 def find(self, payment_id, batch_id):
     if payment_id is None:
         raise InvalidFieldException("Payment id cannot be None.")
     if batch_id is None:
         raise InvalidFieldException("Batch id cannot be None.")
     endpoint = '/v1/batches/' + batch_id + '/payments/' + payment_id
     response = paymentrails.configuration.Configuration.client(
         self.config).get(endpoint)
     temppayment = paymentrails.payment.Payment.factory(response)
     payment = namedtuple("Payment",
                          temppayment.keys())(*temppayment.values())
     return payment
Beispiel #4
0
 def create(self, body, batch_id):
     if body is None:
         raise InvalidFieldException("Body cannot be None.")
     elif batch_id is None:
         raise InvalidFieldException("Batch ID cannot be None.")
     endpoint = '/v1/batches/' + batch_id + '/payments/'
     response = paymentrails.configuration.Configuration.client(
         self.config).post(endpoint, body)
     temppayment = paymentrails.payment.Payment.factory(response)
     payment = namedtuple("Payment",
                          temppayment.keys())(*temppayment.values())
     return payment
 def delete(self, recipient_id, recipient_account_id):
     if recipient_id is None:
         raise InvalidFieldException("Recipient id cannot be None.")
     endpoint = '/v1/recipients/' + recipient_id + '/accounts/' + recipient_account_id
     paymentrails.configuration.Configuration.client(
         self.config).delete(endpoint)
     return True
 def delete(self, payment_id, batch_id):
     if payment_id is None:
         raise InvalidFieldException("Payment id cannot be None.")
     endpoint = '/v1/batches/' + batch_id + '/payments/' + payment_id
     paymentrails.configuration.Configuration.client(
         self.config).delete(endpoint)
     return True
 def process_batch(self, batchid):
     if batchid is None:
         raise InvalidFieldException("Batch id cannot be None.")
     endpoint = '/v1/batches/' + batchid + '/start-processing'
     response = paymentrails.configuration.Configuration.client(
         self.config).post(endpoint, {})
     tempbatch = paymentrails.batch.Batch.factory(response)
     batch = namedtuple("Batch", tempbatch.keys())(*tempbatch.values())
     return batch
 def create(self, body):
     if body is None:
         raise InvalidFieldException("Body cannot be None.")
     endpoint = '/v1/batches/'
     response = paymentrails.configuration.Configuration.client(
         self.config).post(endpoint, body)
     tempbatch = paymentrails.batch.Batch.factory(response)
     batch = namedtuple("Batch", tempbatch.keys())(*tempbatch.values())
     return batch
 def find(self, batchid):
     if batchid is None:
         raise InvalidFieldException("Batch id cannot be None.")
     endpoint = '/v1/batches/' + batchid
     response = paymentrails.configuration.Configuration.client(
         self.config).get(endpoint)
     tempbatch = paymentrails.batch.Batch.factory(response)
     batch = namedtuple("Batch", tempbatch.keys())(*tempbatch.values())
     return batch
 def create(self, body):
     if body is None:
         raise InvalidFieldException("Body cannot be None.")
     endpoint = '/v1/recipients/'
     response = paymentrails.configuration.Configuration.client(
         self.config).post(endpoint, body)
     recip = paymentrails.recipient.Recipient.factory(response)
     recipient = namedtuple("Recipient", recip.keys())(*recip.values())
     return recipient
 def find(self, term=""):
     if term is None:
         raise InvalidFieldException("Term cannot be None")
     endpoint = '/v1/balances/' + term
     response = paymentrails.configuration.Configuration.client(
         self.config).get(endpoint)
     oldbalance = paymentrails.balances.Balances.factory(response)
     balance = namedtuple("Balances",
                          oldbalance.keys())(*oldbalance.values())
     return balance
 def update(self, recipient_id, recipient_account_id, body):
     if recipient_id is None:
         raise InvalidFieldException("Recipient id cannot be None.")
     endpoint = '/v1/recipients/' + recipient_id + '/accounts/' + recipient_account_id
     response = paymentrails.configuration.Configuration.client(
         self.config).patch(endpoint, body)
     recipaccount = paymentrails.recipient_account.RecipientAccount.factory(
         response)
     recipientaccount = namedtuple(
         "RecipientAccount", recipaccount.keys())(*recipaccount.values())
     return recipientaccount
 def summary(self, batchid):
     if batchid is None:
         raise InvalidFieldException("Batch id cannot be None.")
     endpoint = '/v1/batches/' + batchid + '/summary'
     response = paymentrails.configuration.Configuration.client(
         self.config).get(endpoint)
     tempbatchsummary = paymentrails.batch_summary.BatchSummary.factory(
         response)
     batchsummary = namedtuple("BatchSummary", tempbatchsummary.keys())(
         *tempbatchsummary.values())
     return batchsummary
 def find(self, recipient_id, term=""):
     if recipient_id is None:
         raise InvalidFieldException("Recipient id cannot be None.")
     endpoint = '/v1/recipients/' + recipient_id + '/' + term
     response = paymentrails.configuration.Configuration.client(
         self.config).get(endpoint)
     recip = paymentrails.recipient.Recipient.factory(response)
     recipient = namedtuple("Recipient", recip.keys())(*recip.values())
     count = 0
     for account in recipient.accounts:
         recipient.accounts[count] = namedtuple(
             "RecipientAccount", account.keys())(*account.values())
         count = count + 1
     return recipient
    def findAll(self, recipient_id):
        if recipient_id is None:
            raise InvalidFieldException("Recipient id cannot be None.")
        endpoint = '/v1/recipients/' + recipient_id + '/accounts/'
        response = paymentrails.configuration.Configuration.client(
            self.config).get(endpoint)

        recipientaccounts = []
        count = 0
        for recipientaccount in response['accounts']:
            recipaccount = paymentrails.recipient_account.RecipientAccount.factory(
                recipientaccount)
            newrecipientaccount = namedtuple(
                "RecipientAccount",
                recipaccount.keys())(*recipaccount.values())
            recipientaccounts.insert(count, newrecipientaccount)
            count = count + 1
        return recipientaccounts