From ea1da515d7cedb45acdb827214afc99997468326 Mon Sep 17 00:00:00 2001 From: Sylvie Ye Date: Thu, 4 Apr 2019 11:16:28 +0200 Subject: [PATCH] [cragr] handle internal transfer --- modules/cragr/api/browser.py | 8 +++++++- modules/cragr/api/transfer_pages.py | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/cragr/api/browser.py b/modules/cragr/api/browser.py index ae6f7118dd..0270bd03dc 100644 --- a/modules/cragr/api/browser.py +++ b/modules/cragr/api/browser.py @@ -664,10 +664,16 @@ def init_transfer(self, transfer, **params): 'transferCurrencyCode': account.currency, 'transferDate': transfer.exec_date.strftime('%d/%m/%Y'), 'transferFrequency': 'U', - 'transferRef': '', + 'transferRef': transfer.label, 'transferType': 'UNIQUE', 'typeCompte': account.label, } + + # update transfer data according to recipient category + if recipient.category == 'Interne': + data['creditAccountNumber'] = recipient.id + data['recipientName'] = recipient._owner_name + # init transfer request self.transfer.go( space=space, diff --git a/modules/cragr/api/transfer_pages.py b/modules/cragr/api/transfer_pages.py index 13aa393d42..f34da373fb 100644 --- a/modules/cragr/api/transfer_pages.py +++ b/modules/cragr/api/transfer_pages.py @@ -77,6 +77,7 @@ def condition(self): obj_category = 'Interne' obj_enabled_at = date.today() obj__is_recipient = Dict('recipientOfTransfert', default=False) + obj__owner_name = CleanText(Dict('accountHolderLongDesignation')) @method class iter_external_recipient(DictElement): @@ -90,7 +91,7 @@ def condition(self): klass = Recipient obj_id = obj_iban = Dict('ibanCode') - obj_label = Dict('recipientName') + obj_label = CleanText(Dict('recipientName')) obj_category = 'Externe' obj_enabled_at = date.today() @@ -123,8 +124,12 @@ def handle_response(self, transfer): t.account_iban = Dict('currentDebitIbanCode')(self.doc) t.account_label = Dict('typeCompte')(self.doc) + t.recipient_label = CleanText(Dict('currentCreditAccountName'))(self.doc) t.recipient_id = t.recipient_iban = Dict('currentCreditIbanCode')(self.doc) - t.recipient_label = Dict('currentCreditAccountName')(self.doc) + + # Internal transfer + if not Dict('isExternalTransfer')(self.doc): + t.recipient_id = Dict('currentCreditAccountNumber')(self.doc) return t -- GitLab