def test_find_all(): boleto = transaction.create( transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE) transaction.pay_boleto(boleto['id'], transaction_dictionary.PAY_BOLETO) transfer_dictionary.TRANSFER['recipient_id'] = \ transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE['split_rules'][0]['recipient_id'] transfer.create(transfer_dictionary.TRANSFER) balance_operations = balance_operation.find_all() assert balance_operations is not None
def test_find_by(): boleto = transaction.create( transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE) transaction.pay_boleto(boleto['id'], transaction_dictionary.PAY_BOLETO) transfer_dictionary.TRANSFER['recipient_id'] = \ transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE['split_rules'][0]['recipient_id'] transfer.create(transfer_dictionary.TRANSFER) find_all = balance_operation.find_all() search_params = {'id': find_all[0]['id']} find_balance_operation = balance_operation.find_by(search_params) assert find_balance_operation[0]['id'] == find_all[0]['id']
def test_create_transfer(): boleto = transaction.create(transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE) transaction.pay_boleto(boleto['id'], transaction_dictionary.PAY_BOLETO) transfer_dictionary.TRANSFER['recipient_id'] = \ transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE['split_rules'][0]['recipient_id'] _transfer = transfer.create(transfer_dictionary.TRANSFER) assert _transfer['id'] is not None
def test_recipient_balance_operation(): boleto = transaction.create(transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE) transaction.pay_boleto(boleto['id'], transaction_dictionary.PAY_BOLETO) transfer_dictionary.TRANSFER['recipient_id'] = \ transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE['split_rules'][0]['recipient_id'] _transfer = transfer.create(transfer_dictionary.TRANSFER) recipient_balance_operation = recipient.recipient_balance_operation(_transfer['source_id']) assert recipient_balance_operation[0]['movement_object']['source_id'] == _transfer['source_id']
def test_find_by(): boleto = transaction.create(transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE) transaction.pay_boleto(boleto['id'], transaction_dictionary.PAY_BOLETO) transfer_dictionary.TRANSFER['recipient_id'] = \ transaction_dictionary.BOLETO_TRANSACTION_SPLIT_RULE_PERCENTAGE['split_rules'][0]['recipient_id'] _transfer = transfer.create(transfer_dictionary.TRANSFER) search_params = {'id': str(_transfer['id'])} find_transfer = transfer.find_by(search_params) assert _transfer['id'] == find_transfer[0]['id']
def to_withdraw(self): if not self.was_withdrawn and not self.pagarme_id: data = dict(amount=int(self.value * (100 - settings.CASH_OUT_COMMISSION)), recipient_id=self.professional.pagarme_id) self.__transfer = transfer.create(data) if 'id' in self.__transfer: self.pagarme_id = self.__transfer['id'] self.was_withdrawn = True return self.__transfer