def withdraw(self): """ Withdraw voucher """ message = otme.withdraw_voucher( self.server_id, self.sender_nym._id, self.sender_account._id, self.recipient_nym and self.recipient_nym._id or "", self.memo, self.amount) assert is_message_success(message) ledger = opentxs.OTAPI_Wrap_Message_GetLedger(message) transaction = opentxs.OTAPI_Wrap_Ledger_GetTransactionByIndex( self.server_id, self.sender_nym._id, self.sender_account._id, ledger, 0) output = opentxs.OTAPI_Wrap_Transaction_GetVoucher( self.server_id, self.sender_nym._id, self.sender_account._id, transaction) if output == '': raise ReturnValueError(output) self._body = output # save a copy for myself in outpayments box, so i can cancel later otme.send_user_payment(self.server_id, self.sender_nym._id, self.sender_nym._id, output) return output
def withdraw(self): """ Withdraw voucher """ message = otme.withdraw_voucher(self.server_id, self.sender_nym._id, self.sender_account._id, self.recipient_nym._id, self.memo, self.amount) assert is_message_success(message) ledger = opentxs.OTAPI_Wrap_Message_GetLedger(message) transaction = opentxs.OTAPI_Wrap_Ledger_GetTransactionByIndex( self.server_id, self.sender_nym._id, self.sender_account._id, ledger, 0) output = opentxs.OTAPI_Wrap_Transaction_GetVoucher(self.server_id, self.sender_nym._id, self.sender_account._id, transaction) if output == '': raise ReturnValueError(output) self._body = output # save a copy for myself in outpayments box, so i can cancel later otme.send_user_payment(self.server_id, self.sender_nym._id, self.sender_nym._id, output) return output
def send(self): if not self._body: self.write() result = otme.send_user_payment(self.server_id, self.sender_nym._id, self.recipient_nym._id, self._body) return is_message_success(result)