Skip to content

Commit

Permalink
Tracking pull request to merge release-1.4.0 to main (#190)
Browse files Browse the repository at this point in the history
* update to 1.4.0

* user-email-and-admin-panel (#192)

* Itvr350 -  responsiveness- forms, tables, font sizes (#191)

* -adds styling to details table for smaller screen sizes
-updates media queries on header
-adds error font sizes to media queries
-reduces button text for bceid login on mobile

* -removes font-size from small table css, it was uneccesary and caused the font to be too large on tablets

* -updates css on forms/index so its better for mobile
-changes input label to helper text on spouse email so text wraps

* -capitalizes Enter your spouse email, removes bottom margin from that paragraph

* update backend resource (#194)

* update backend resource

* update backend resource

* check different error codes at response time (#198)

* check different error codes at response time

* fix comment

* itvr-333--admin-console-changes (#197)

* Add test for name truncation (#199)

* Check redeemed rebates in Sharepoint (#193)

* try various api queries

* pull id

* example api response

* query for redeemed rebates

* ncda response cleanup

* remove stuff

* try running task

* task to set redeemed status

* ncda update task

* set modified

* use timezone import

* index ncda ids

* add CRA_ENVIRONMENT (#201)

* itvr-355--logout-button (#202)

* itvr-333--admin-console-msg-change (#200)

* add Home link and button hover (#195)

* add Home link and button hover

* add note and left align BCSC form data

* remove Note: text

* text lowercase

* -renames bcscInfo component, to InfoTable, now accepts householdInfo as well, if bcsc info isn't passed it will expect household info (#204)

-info on forms for bcsc and household info are now tables instead of boxes with spans, this way it can be left aligned
-adds some breakpoints for font size within infotable itself

* dl check integration with rhf (#203)

Co-authored-by: tim738745 <[email protected]>
Co-authored-by: Emily <[email protected]>
Co-authored-by: Naomi <[email protected]>
Co-authored-by: vibhiquartech <[email protected]>
  • Loading branch information
5 people authored Jun 29, 2022
1 parent 0021a0a commit ab51113
Show file tree
Hide file tree
Showing 40 changed files with 978 additions and 159 deletions.
6 changes: 3 additions & 3 deletions .pipeline/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const phases = {
frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 1,
reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://dev.oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-dev-${changeId}.apps.silver.devops.gov.bc.ca`,
reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://dev.oidc.gov.bc.ca/auth/',
backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '120Mi', backendMemoryLimit: '240Mi', backendHealthCheckDelay: 30, backendHost: `itvr-backend-dev-${changeId}.${ocpName}.gov.bc.ca`, backendReplicas: 1, backendDjangoDebug: 'True', bucketName: 'itvrdv',
backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '150Mi', backendMemoryLimit: '300Mi', backendHealthCheckDelay: 30, backendHost: `itvr-backend-dev-${changeId}.${ocpName}.gov.bc.ca`, backendReplicas: 1, backendDjangoDebug: 'True', bucketName: 'itvrdv', craEnvironment: 'A',
minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3Gi',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '1G', rabbitmqPvcSize: '1G', rabbitmqReplica: 1, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard',
Expand All @@ -57,7 +57,7 @@ const phases = {
frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 2, frontendMinReplicas: 1, frontendMaxReplicas: 3,
reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://test.oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-test.apps.silver.devops.gov.bc.ca`,
reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://test.oidc.gov.bc.ca/auth/',
backendCpuRequest: '30m', backendCpuLimit: '60m', backendMemoryRequest: '120Mi', backendMemoryLimit: '240Mi', backendHealthCheckDelay: 30, backendReplicas: 2, backendMinReplicas: 1, backendMaxReplicas: 3, backendHost: `itvr-backend-test.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrts',
backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '150Mi', backendMemoryLimit: '300Mi', backendHealthCheckDelay: 30, backendReplicas: 2, backendMinReplicas: 1, backendMaxReplicas: 3, backendHost: `itvr-backend-test.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrts', craEnvironment: 'A',
minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3G',
schemaspyCpuRequest: '20m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '700M', rabbitmqPvcSize: '1G', rabbitmqReplica: 2, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard',
Expand All @@ -72,7 +72,7 @@ const phases = {
frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-prod.apps.silver.devops.gov.bc.ca`,
reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://oidc.gov.bc.ca/auth/',
backendCpuRequest: '30m', backendCpuLimit: '60m', backendMemoryRequest: '240Mi', backendMemoryLimit: '480Mi', backendHealthCheckDelay: 30, backendReplicas: 3, backendMinReplicas: 3, backendMaxReplicas: 5, backendHost: `itvr-backend-prod.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrpr',
backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '150Mi', backendMemoryLimit: '300Mi', backendHealthCheckDelay: 30, backendReplicas: 3, backendMinReplicas: 3, backendMaxReplicas: 5, backendHost: `itvr-backend-prod.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrpr', craEnvironment: 'P',
minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3G',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '400m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '1G', rabbitmqPvcSize: '5G', rabbitmqReplica: 2, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard',
Expand Down
2 changes: 2 additions & 0 deletions .pipeline/lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ module.exports = settings => {
'HEALTH_CHECK_DELAY': phases[phase].backendHealthCheckDelay,
'REPLICAS': phases[phase].backendReplicas,
'DJANGO_DEBUG': phases[phase].backendDjangoDebug,
'CRA_ENVIRONMENT': phases[phase].craEnvironment,
'BUCKET_NAME': phases[phase].bucketName
}
}))
Expand All @@ -105,6 +106,7 @@ module.exports = settings => {
'MEMORY_REQUEST': phases[phase].taskQueueMemoryRequest,
'MEMORY_LIMIT': phases[phase].taskQueueMemoryLimit,
'REPLICAS': phases[phase].taskQueueReplicas,
'CRA_ENVIRONMENT': phases[phase].craEnvironment,
'DJANGO_DEBUG': phases[phase].taskQueueDjangoDebug
}
}))
Expand Down
16 changes: 16 additions & 0 deletions django/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
)
from .models.household_member import HouseholdMember
from .models.go_electric_rebate import GoElectricRebate
from django.contrib import messages
from . import messages_custom


class HouseholdApplicationInline(admin.StackedInline):
Expand Down Expand Up @@ -57,6 +59,7 @@ class SubmittedGoElectricRebateApplicationAdmin(admin.ModelAdmin):
"first_name",
"middle_names",
"email",
"user_is_bcsc",
"address",
"city",
"postal_code",
Expand Down Expand Up @@ -94,6 +97,19 @@ def response_change(self, request, obj):
obj.save(update_fields=["status"])
return ret

def message_user(
self,
request,
message,
level=messages.INFO,
extra_tags="",
fail_silently=False,
):
revised_level = level
if "reject_application" in request.POST:
revised_level = messages_custom.NEGATIVE_SUCCESS
super().message_user(request, message, revised_level, extra_tags, fail_silently)


@admin.register(GoElectricRebate)
class GoElectricRebateAdmin(admin.ModelAdmin):
Expand Down
1 change: 1 addition & 0 deletions django/api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

class ApiConfig(AppConfig):
name = "api"
verbose_name = "Submitted Rebate Applications"

def ready(self):
import api.signals
Expand Down
2 changes: 1 addition & 1 deletion django/api/authentication/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def authenticate_credentials(self, token):
username=token_info.get("sub"),
defaults={
"display_name": token_info.get("display_name"),
"email": token_info.get("email"),
"email": token_info.get("email", ""),
"identity_provider": token_info.get("identity_provider"),
},
)
Expand Down
5 changes: 5 additions & 0 deletions django/api/messages_custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# modelled after the constants in the django messages module

NEGATIVE_SUCCESS = 26

TAGS = {NEGATIVE_SUCCESS: "negative_success"}
18 changes: 18 additions & 0 deletions django/api/migrations/0002_alter_goelectricrebate_ncda_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.0.1 on 2022-06-24 21:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='goelectricrebate',
name='ncda_id',
field=models.IntegerField(blank=True, db_index=True, null=True),
),
]
2 changes: 1 addition & 1 deletion django/api/models/go_electric_rebate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GoElectricRebate(TimeStampedModel):
redeemed = BooleanField(default=False)
# sharepoint id. If something goes wrong with notification we can find
# issued rebates with blank NCDA ids to try resending.
ncda_id = IntegerField(blank=True, null=True)
ncda_id = IntegerField(blank=True, null=True, db_index=True)

def __str__(self):
return "DL: " + self.drivers_licence + ", $" + str(self.rebate_max_amount)
16 changes: 16 additions & 0 deletions django/api/models/go_electric_rebate_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
)
from django_extensions.db.models import TimeStampedModel
from django.utils.translation import gettext_lazy as _
from django.utils.functional import classproperty

media_storage = get_storage_class()()

Expand Down Expand Up @@ -100,6 +101,13 @@ def doc2_tag(self):
consent_personal = BooleanField(validators=[validate_consent])
consent_tax = BooleanField(validators=[validate_consent])

def user_is_bcsc(self):
if self.user.identity_provider == "bcsc":
return True
return False

user_is_bcsc.short_description = "Address is BCSC Verified"

def __str__(self):
return self.last_name + ", " + self.first_name + ": " + str(self.id)

Expand All @@ -126,3 +134,11 @@ class Meta:
class SubmittedGoElectricRebateApplication(GoElectricRebateApplication):
class Meta:
proxy = True

@classproperty
def admin_label(cls):
return "Review Applications"

@classproperty
def admin_display_change(cls):
return False
17 changes: 10 additions & 7 deletions django/api/services/cra.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ def read(file):
results[current_application_id] = []
current_application = results[current_application_id]

# CRA-NO-DATA-RESPONSE-0023
if subCode == "0023":
sin = line[4:13]
year = line[13:17]
current_application.append({"sin": sin, "year": year, "income": None})
# REQUEST-STATUS-CODE
status_code = line[25:27]
# 55 UNSUCCESSFUL-ACCT-NOT-AVAIL
# 59 UNSUCCESSFUL-REQUEST NO DATA
if status_code in ["59", "55"]:
sin = line[4:13]
year = line[13:17]
current_application.append({"sin": sin, "year": year, "income": None})

# From Susan:
# The business folks did flip flop on the net income
Expand Down Expand Up @@ -56,8 +59,8 @@ def write(
# Write the body
for row in data:
sin = row["sin"]
family_name = row["family_name"].ljust(30)
given_name = row["given_name"].ljust(30)
family_name = row["family_name"].ljust(30)[:30]
given_name = row["given_name"].ljust(30)[:30]
tax_years = " ".join([str(year) for year in row["years"]]).ljust(20)
birth_date = row["birth_date"]
identifier = row["application_id"].ljust(30)
Expand Down
158 changes: 158 additions & 0 deletions django/api/services/ncda.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,161 @@ def notify(drivers_licence, last_name, expiry_date, rebate_amount, rebate_id):
ncda_id = data["d"]["ID"]

GoElectricRebate.objects.filter(pk=rebate_id).update(ncda_id=ncda_id)


# iso_ts ex 2023-08-01T07:00:00Z
def get_rebates_redeemed_since(iso_ts):
api_endpoint = settings.NCDA_SHAREPOINT_URL
access_token = get_ncda_service_token()

headers = {
"Authorization": "Bearer " + access_token,
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
}

url = api_endpoint + "/lists/getbytitle('ITVREligibility')/items"

payload = {
"$select": "Id,Title,Modified,Status",
"$filter": "(Status eq 'Redeemed')and(Modified ge datetime'%s')" % iso_ts,
}

ncda_rs = requests.get(url, headers=headers, params=payload, verify=True)

ncda_rs.raise_for_status()

# {
# "d": {
# "results": [
# {
# "__metadata": {
# "id": "a27d1060-03b2-4f1a-8006-0205c1ce6c43",
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)",
# "etag": '"3"',
# "type": "SP.Data.ITVREligibilityListItem",
# },
# "Id": 5,
# "ID": 5,
# "Title": "44444444",
# "Modified": "2022-06-09T06:01:10Z",
# "Status": "Redeemed",
# }
# ]
# }
# }
data = ncda_rs.json()
items = data["d"]["results"]
ncda_ids = map(lambda item: item["ID"], items)
return list(ncda_ids)


# https://support.shortpoint.com/support/solutions/articles/1000307202-shortpoint-rest-api-selecting-filtering-sorting-results-in-a-sharepoint-list


# Example API response with one Sharepoint list item selecting all fields.
# {
# "d": {
# "results": [
# {
# "__metadata": {
# "id": "e2356fcb-8649-4cc4-81b5-d16fa330244f",
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)",
# "etag": '"3"',
# "type": "SP.Data.ITVREligibilityListItem",
# },
# "FirstUniqueAncestorSecurableObject": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/FirstUniqueAncestorSecurableObject"
# }
# },
# "RoleAssignments": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/RoleAssignments"
# }
# },
# "AttachmentFiles": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/AttachmentFiles"
# }
# },
# "ContentType": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/ContentType"
# }
# },
# "GetDlpPolicyTip": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/GetDlpPolicyTip"
# }
# },
# "FieldValuesAsHtml": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/FieldValuesAsHtml"
# }
# },
# "FieldValuesAsText": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/FieldValuesAsText"
# }
# },
# "FieldValuesForEdit": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/FieldValuesForEdit"
# }
# },
# "File": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/File"
# }
# },
# "Folder": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/Folder"
# }
# },
# "LikedByInformation": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/LikedByInformation"
# }
# },
# "ParentList": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/ParentList"
# }
# },
# "Properties": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/Properties"
# }
# },
# "Versions": {
# "__deferred": {
# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/Versions"
# }
# },
# "FileSystemObjectType": 0,
# "Id": 5,
# "ServerRedirectedEmbedUri": null,
# "ServerRedirectedEmbedUrl": "",
# "ID": 5,
# "ContentTypeId": "0x01008074AAC5CAD1A241B1109194FE6D8D5D00747BB541D61F1F4CA7028C9C97E823CB",
# "Title": "44444444",
# "Modified": "2022-06-09T06:01:10Z",
# "Created": "2022-06-07T16:22:31Z",
# "AuthorId": 1073741822,
# "EditorId": 1073741822,
# "OData__UIVersionString": "3.0",
# "Attachments": false,
# "GUID": "cf205d6e-b0f1-481e-8988-4aa1119a4033",
# "ComplianceAssetId": null,
# "LastName": "Test4",
# "ExpiryDT": "2023-08-01T07:00:00Z",
# "MaxRebateAmt": 1500,
# "Status": "Redeemed",
# "ClaimType": null,
# "OData__vti_ItemDeclaredRecord": null,
# }
# ]
# }
# }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
7100 20220516 BCVRA00009 0
7101270300379 0020SolangeSolangeSolangeSolangeSoAliceAliceAliceAliceAliceAlice197101222020 BCVR1234 0
7101302435839 0020Turner Wendy 197805212020 BCVR1234 0
7101129922258 0020Redding Lily 198307072020 BCVR1234 0
7102 20220516 BCVRA00009 00000005 0
Loading

0 comments on commit ab51113

Please sign in to comment.