Implement overriding owner name with requisition field

This commit is contained in:
Mark Veidemanis 2023-04-18 08:58:36 +01:00
parent 7448c361bf
commit 495039e6a0
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
5 changed files with 29 additions and 1 deletions

View File

@ -22,6 +22,12 @@ class AggregatorClient(ABC):
for bank, accounts in account_infos.items():
# Iterate the accounts
for index, account in enumerate(list(accounts)):
if account["ownerName"] is None:
requisition = self.instance.get_requisition(
account["requisition_id"]
)
if requisition is not None:
account["ownerName"] = requisition.owner_name
if "account_number" not in account:
account_infos[bank][index]["account_number"] = {}
fields = ["sort_code", "number", "iban"]

View File

@ -234,12 +234,14 @@ class RequisitionForm(RestrictedFormMixin, ModelForm):
model = Requisition
fields = (
"payment_details",
"owner_name",
"transaction_source",
"payees",
)
help_texts = {
"payment_details": "Shown once a user opens a trade.",
"owner_name": "Owner name to send with payment details if not provided by aggregator.",
"transaction_source": "Whether to check pending or booked transactions.",
"payees": "The wallet addresses to send profit concerning this requisition to.",
}

View File

@ -119,7 +119,7 @@ RequisitionSchema = {
class AccountDetailsNested(MyModel):
resourceId: str
currency: str
ownerName: str
ownerName: str | None
cashAccountType: str | None
status: str | None
maskedPan: str | None

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-04-18 07:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0035_ad_require_feedback_score'),
]
operations = [
migrations.AddField(
model_name='requisition',
name='owner_name',
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@ -604,6 +604,8 @@ class Requisition(models.Model):
requisition_id = models.CharField(max_length=255)
payment_details = models.TextField(null=True, blank=True)
owner_name = models.CharField(max_length=255, null=True, blank=True)
transaction_source = models.CharField(
max_length=255, choices=TRANSACTION_SOURCE_CHOICES, default="booked"
)