Skip to content

Commit

Permalink
23872 receipt outputs hide temp number (bcgov#3069)
Browse files Browse the repository at this point in the history
  • Loading branch information
kzdev420 authored Nov 12, 2024
1 parent 94805f5 commit 9b656c9
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ def _get_receipt(business: Business, filing: Filing, token):

headers = {'Authorization': 'Bearer ' + token}

corp_name = _get_corp_name(business, filing.storage)

url = f'{current_app.config.get("PAYMENT_SVC_URL")}/{filing.storage.payment_token}/receipts'
receipt = requests.post(
url,
json={
'corpName': business.legal_name if business else filing.storage.temp_reg,
'corpName': corp_name,
'filingDateTime': LegislationDatetime.format_as_report_string(filing.storage.filing_date),
'effectiveDateTime': effective_date if effective_date else '',
'filingIdentifier': str(filing.id),
Expand All @@ -132,3 +134,22 @@ def _get_receipt(business: Business, filing: Filing, token):
current_app.logger.error('Failed to get receipt pdf for filing: %s', filing.id)

return receipt.content, receipt.status_code


def _get_corp_name(business, filing):
"""Get the corp name for the filing."""
if business:
return business.legal_name

name_request = (filing.filing_json
.get('filing')
.get(filing.filing_type)
.get('nameRequest', {}))
if name_request.get('legalName'):
return name_request.get('legalName')

legal_type = name_request.get('legalType')
if legal_type:
return Business.BUSINESSES.get(legal_type, {}).get('numberedDescription')

return ''

0 comments on commit 9b656c9

Please sign in to comment.