def get_investment_agreement_details(agreement_id): agreement = get_investment_agreement(agreement_id) if agreement.iyo_see_id: iyo_organization_id = get_iyo_organization_id() username = get_iyo_username(agreement.app_user) see_document = get_see_document(iyo_organization_id, username, agreement.iyo_see_id) else: see_document = None return InvestmentAgreementDetailsTO.from_model(agreement, see_document)
def _send_sign_investment_reminder(agreement_id, message_type): agreement = get_investment_agreement(agreement_id) if agreement.status != InvestmentAgreement.STATUS_CREATED: return if message_type == u'long': message = 'Dear ThreeFold Member,\n\n' \ 'Thank you for joining the ThreeFold Foundation! Your contract has been created and is ready to be signed and processed.\n' \ 'You can find your created %s Purchase Agreement in your ThreeFold messages.' % (agreement.token) elif message_type == u'short': message = 'Dear ThreeFold Member,\n\n' \ 'It appears that your created %s Purchase Agreement has not been signed yet.' % (agreement.token) else: return subject = u'Your Purchase Agreement is ready to be signed' send_message_and_email(agreement.app_user, message, subject)
def _invest(agreement_key, email, app_id, retry_count): # type: (ndb.Key, unicode, unicode, long, list[int]) -> None from plugins.tff_backend.bizz.agreements import create_token_agreement_pdf app_user = create_app_user_by_email(email, app_id) logging.debug('Creating Token agreement') agreement = get_investment_agreement(agreement_key.id()) _set_token_count(agreement) agreement.put() currency_full = _get_currency_name(agreement.currency) pdf_name = InvestmentAgreement.filename(agreement_key.id()) username = get_iyo_username(app_user) has_verified_utility_bill = get_tff_profile(username).kyc.utility_bill_verified pdf_contents = create_token_agreement_pdf(agreement.name, agreement.address, agreement.amount, currency_full, agreement.currency, agreement.token, agreement.payment_info, has_verified_utility_bill) pdf_url = upload_to_gcs(pdf_name, pdf_contents, 'application/pdf') logging.debug('Storing Investment Agreement in the datastore') pdf_size = len(pdf_contents) deferred.defer(_create_investment_agreement_iyo_see_doc, agreement_key, app_user, pdf_url, pdf_size=pdf_size) deferred.defer(update_investor_progress, email, app_id, INVESTMENT_TODO_MAPPING[agreement.status])
def send_payment_instructions(app_user, agreement_id, message_prefix): agreement = get_investment_agreement(agreement_id) params = { 'currency': agreement.currency, 'iban': BANK_ACCOUNTS.get(agreement.currency, BANK_ACCOUNTS['USD']), 'account_number': ACCOUNT_NUMBERS.get(agreement.currency), 'reference': agreement.reference, 'message_prefix': message_prefix } if agreement.currency == "BTC": params['amount'] = '{:.8f}'.format(agreement.amount) message = u"""%(message_prefix)sPlease use the following transfer details Amount: %(currency)s %(amount)s - wallet 3GTf7gWhvWqfsurxXpEj6DU7SVoLM3wC6A Please inform us by email at [email protected] when you have made payment. Reference: %(reference)s""" else: params['amount'] = '{:.2f}'.format(agreement.amount) message = u"""%(message_prefix)sPlease use the following transfer details Amount: %(currency)s %(amount)s Bank: Mashreq Bank Bank address: Al Hawai Tower, Ground Floor Sheikh Zayed Road - PO Box 36612 - UAE Dubai Account number: %(account_number)s IBAN: %(iban)s / BIC : BOMLAEAD For the attention of Green IT Globe Holdings FZC, a company incorporated under the laws of Sharjah, United Arab Emirates, with registered office at SAIF Zone, SAIF Desk Q1-07-038/B Important: The payment must be made from a bank account registered under your name. Please use %(reference)s as reference.""" # noQA msg = message % params subject = u'ThreeFold payment instructions' send_message_and_email(app_user, msg, subject)
def send_payment_instructions(app_user, agreement_id, message_prefix, reminder=False): agreement = get_investment_agreement(agreement_id) if reminder and agreement.status != InvestmentAgreement.STATUS_SIGNED: return elif not reminder: deferred.defer(send_payment_instructions, app_user, agreement_id, message_prefix, True, _countdown=14 * DAY, _queue=SCHEDULED_QUEUE) username = get_iyo_username(app_user) profile = get_tff_profile(username) params = { 'currency': agreement.currency, 'reference': agreement.reference, 'message_prefix': message_prefix, 'bank_account': get_bank_account_info(agreement.currency, agreement.payment_info, profile.kyc.utility_bill_verified), } if agreement.currency == 'BTC': params['amount'] = '{:.8f}'.format(agreement.amount) params['notes'] = u'Please inform us by email at [email protected] when you have made payment.' else: params['amount'] = '{:.2f}'.format(agreement.amount) params['notes'] = u'For the attention of ThreeFold FZC, a company incorporated under the laws of Sharjah, ' \ u'United Arab Emirates, with registered office at SAIF Zone, SAIF Desk Q1-07-038/B' subject = u'ThreeFold payment instructions' msg = u"""%(message_prefix)sHere are your payment instructions for the purchase of your ThreeFold Tokens. Please use the following transfer details: Amount: %(currency)s %(amount)s %(bank_account)s %(notes)s Please use %(reference)s as reference.""" % params send_message_and_email(app_user, msg, subject)
def api_get_investment_agreement(agreement_id): return InvestmentAgreementDetailTO.from_dict( get_investment_agreement(agreement_id).to_dict(['username']))
def api_get_investment_agreement(agreement_id): return InvestmentAgreementTO.from_model( get_investment_agreement(agreement_id))