Merge pull request #3106 from alphagov/billing-fields-for-service

Add billing details fields to Service model and db table
This commit is contained in:
Pea Tyczynska
2021-01-26 15:14:05 +00:00
committed by GitHub
3 changed files with 47 additions and 0 deletions

View File

@@ -488,6 +488,10 @@ class Service(db.Model, Versioned):
organisation = db.relationship('Organisation', backref='services')
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)
email_branding = db.relationship(
'EmailBranding',

View File

@@ -0,0 +1,39 @@
"""
Revision ID: 0339_service_billing_details
Revises: 0338_add_notes_to_service
Create Date: 2021-01-20 17:55:46.555460
"""
from alembic import op
import sqlalchemy as sa
revision = '0339_service_billing_details'
down_revision = '0338_add_notes_to_service'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('services', sa.Column('billing_contact_email_addresses', sa.Text(), nullable=True))
op.add_column('services', sa.Column('billing_contact_names', sa.Text(), nullable=True))
op.add_column('services', sa.Column('billing_reference', sa.String(length=255), nullable=True))
op.add_column('services', sa.Column('purchase_order_number', sa.String(length=255), nullable=True))
op.add_column('services_history', sa.Column('billing_contact_email_addresses', sa.Text(), nullable=True))
op.add_column('services_history', sa.Column('billing_contact_names', sa.Text(), nullable=True))
op.add_column('services_history', sa.Column('billing_reference', sa.String(length=255), nullable=True))
op.add_column('services_history', 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('services_history', 'purchase_order_number')
op.drop_column('services_history', 'billing_reference')
op.drop_column('services_history', 'billing_contact_names')
op.drop_column('services_history', 'billing_contact_email_addresses')
op.drop_column('services', 'purchase_order_number')
op.drop_column('services', 'billing_reference')
op.drop_column('services', 'billing_contact_names')
op.drop_column('services', 'billing_contact_email_addresses')
# ### end Alembic commands ###

View File

@@ -248,6 +248,9 @@ def test_get_service_by_id(admin_request, sample_service):
assert set(json_resp['data'].keys()) == {
'active',
'allowed_broadcast_provider',
'billing_contact_email_addresses',
'billing_contact_names',
'billing_reference',
'consent_to_research',
'contact_link',
'count_as_live',
@@ -266,6 +269,7 @@ def test_get_service_by_id(admin_request, sample_service):
'organisation_type',
'permissions',
'prefix_sms',
'purchase_order_number',
'rate_limit',
'research_mode',
'restricted',