Merge pull request #3122 from alphagov/add-billing-details-orgs

Add billing details for organisation
This commit is contained in:
Pea Tyczynska
2021-02-08 16:43:08 +00:00
committed by GitHub
3 changed files with 54 additions and 0 deletions

View File

@@ -397,6 +397,12 @@ class Organisation(db.Model):
nullable=True,
)
notes = db.Column(db.Text, nullable=True)
purchase_order_number = db.Column(db.String(255), nullable=True)
billing_contact_names = db.Column(db.Text, nullable=True)
billing_contact_email_addresses = db.Column(db.Text, nullable=True)
billing_reference = db.Column(db.String(255), nullable=True)
@property
def live_services(self):
return [
@@ -428,6 +434,11 @@ class Organisation(db.Model):
"domains": self.domain_list,
"request_to_go_live_notes": self.request_to_go_live_notes,
"count_of_live_services": len(self.live_services),
"notes": self.notes,
"purchase_order_number": self.purchase_order_number,
"billing_contact_names": self.billing_contact_names,
"billing_contact_email_addresses": self.billing_contact_email_addresses,
"billing_reference": self.billing_reference,
}
def serialize_for_list(self):

View File

@@ -0,0 +1,33 @@
"""
Revision ID: 0343_org_billing_details
Revises: 0342_service_broadcast_settings
Create Date: 2021-02-01 14:40:14.809632
"""
from alembic import op
import sqlalchemy as sa
revision = '0343_org_billing_details'
down_revision = '0342_service_broadcast_settings'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('organisation', sa.Column('billing_contact_email_addresses', sa.Text(), nullable=True))
op.add_column('organisation', sa.Column('billing_contact_names', sa.Text(), nullable=True))
op.add_column('organisation', sa.Column('billing_reference', sa.String(length=255), nullable=True))
op.add_column('organisation', sa.Column('notes', sa.Text(), nullable=True))
op.add_column('organisation', sa.Column('purchase_order_number', sa.String(length=255), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('organisation', 'purchase_order_number')
op.drop_column('organisation', 'notes')
op.drop_column('organisation', 'billing_reference')
op.drop_column('organisation', 'billing_contact_names')
op.drop_column('organisation', 'billing_contact_email_addresses')
# ### end Alembic commands ###

View File

@@ -77,6 +77,11 @@ def test_get_organisation_by_id(admin_request, notify_db_session):
'domains',
'request_to_go_live_notes',
'count_of_live_services',
'notes',
'billing_contact_names',
'billing_contact_email_addresses',
'billing_reference',
'purchase_order_number'
}
assert response['id'] == str(org.id)
assert response['name'] == 'test_org_1'
@@ -93,6 +98,11 @@ def test_get_organisation_by_id(admin_request, notify_db_session):
assert response['count_of_live_services'] == 0
assert response['agreement_signed_on_behalf_of_name'] is None
assert response['agreement_signed_on_behalf_of_email_address'] is None
assert response['notes'] is None
assert response['billing_contact_names'] is None
assert response['billing_contact_email_addresses'] is None
assert response['billing_reference'] is None
assert response['purchase_order_number'] is None
def test_get_organisation_by_id_returns_domains(admin_request, notify_db_session):