def verify_transaction(self, transaction: Transaction, data): if data['id'] == 'false': raise TransactionError('Invalid transaction ID') transaction.pan = data.get('cardNumber') print('Transaction verified: \n%s' % transaction.__repr__()) return transaction
def validate_transaction(self, data: dict) -> Transaction: transaction = Transaction() transaction.id = data['id'] transaction.meta = data transaction.validate_status = data.get('validateStatus', True) print('Transaction validated: \n%s' % transaction.__repr__()) return transaction
def verify_transaction(self, transaction: Transaction, data): if data["id"] == "false": raise TransactionError("Invalid transaction ID") transaction.pan = data.get("cardNumber") print("Transaction verified: \n%s" % transaction.__repr__()) return transaction
def validate_transaction(self, data: dict) -> Transaction: transaction = Transaction() transaction.id = data["id"] transaction.meta = data transaction.validate_status = data.get("validateStatus", True) print("Transaction validated: \n%s" % transaction.__repr__()) return transaction
def request_transaction(self, transaction: Transaction) -> Transaction: if int(transaction.amount) > self.maximum_amount: raise TransactionError('Amount is larger than %s' % self.maximum_amount) transaction.id = int(time.time()) print('New transaction requested: \n%s' % transaction.__repr__()) return transaction