| 1 | /*************************************************************************** |
| 2 | begin : Mon Mar 01 2004 |
| 3 | copyright : (C) 2018 by Martin Preuss |
| 4 | email : [email protected] |
| 5 | |
| 6 | *************************************************************************** |
| 7 | * Please see toplevel file COPYING for license details * |
| 8 | ***************************************************************************/ |
| 9 | |
| 10 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:410:9`! |
| 11 | # include <config.h>cxx . . $ `<file>/config.h`/ |
| 12 | #endif |
| 13 | |
| 14 | #include "sepa_p.h"cxx . . $ `<file>/src/libs/plugins/imexporters/sepa/sepa_p.h`/ |
| 15 | |
| 16 | #include "aqbanking/i18n_l.h"cxx . . $ `<file>/src/libs/aqbanking/i18n_l.h`/ |
| 17 | |
| 18 | #include <aqbanking/banking.h>cxx . . $ `<file>/src/libs/aqbanking/banking.h`/ |
| 19 | #include <aqbanking/banking_be.h>cxx . . $ `<file>/src/libs/aqbanking/banking_be.h`/ |
| 20 | #include <aqbanking/types/balance.h>cxx . . $ `<file>/src/libs/aqbanking/types/balance.h`/ |
| 21 | |
| 22 | #include <gwenhywfar/debug.h> |
| 23 | #include <gwenhywfar/misc.h> |
| 24 | #include <gwenhywfar/gui.h> |
| 25 | #include <gwenhywfar/inherit.h> |
| 26 | |
| 27 | #include <ctype.h> |
| 28 | |
| 29 | |
| 30 | |
| 31 | GWEN_LIST_FUNCTIONScxx . . $ `/usr/include/gwenhywfar5/gwenhywfar/list1.h:367:9`!(AH_IMEXPORTER_SEPA_PMTINF, AH_ImExporter_Sepa_PmtInf) |
| 32 | GWEN_INHERITcxx . . $ `<external>/16905422263774432755/inherit.h:264:9`!(AB_IMEXPORTER, AH_IMEXPORTER_SEPA); |
| 33 | |
| 34 | |
| 35 | |
| 36 | static AH_IMEXPORTER_SEPA_PMTINFcxx . . $ AH_IMEXPORTER_SEPA_PMTINF# *AH_ImExporter_Sepa_PmtInf_newcxx . . $ AH_ImExporter_Sepa_PmtInf_new(1a10200e5f3615cd).() |
| 37 | { |
| 38 | AH_IMEXPORTER_SEPA_PMTINFcxx . . $ AH_IMEXPORTER_SEPA_PMTINF# *pmtinf; |
| 39 | |
| 40 | GWEN_NEW_OBJECTcxx . . $ `<external>/8574018900616580794/memory.h:55:9`!(AH_IMEXPORTER_SEPA_PMTINF, pmtinf) |
| 41 | GWEN_LIST_INITcxx . . $ `/usr/include/gwenhywfar5/gwenhywfar/list1.h:466:9`!(AH_IMEXPORTER_SEPA_PMTINF, pmtinf) |
| 42 | pmtinf->valuecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#value.=AB_Value_newcxx . . $ AB_Value_new(4e323504095ae532).(); |
| 43 | pmtinf->transactionscxx . . $ AH_IMEXPORTER_SEPA_PMTINF#transactions.=AB_Transaction_List2_newcxx . . $ AB_Transaction_List2_new(6ebed5d1e2b10db0).(); |
| 44 | |
| 45 | return pmtinf; |
| 46 | } |
| 47 | |
| 48 | |
| 49 | |
| 50 | static void AH_ImExporter_Sepa_PmtInf_freecxx . . $ AH_ImExporter_Sepa_PmtInf_free(737334de80d3a24).(AH_IMEXPORTER_SEPA_PMTINFcxx . . $ AH_IMEXPORTER_SEPA_PMTINF# *pmtinf) |
| 51 | { |
| 52 | if (pmtinf) { |
| 53 | freecxx . . $ free(5d22bdacc48458e8).(pmtinf->ctrlsumcxx . . $ AH_IMEXPORTER_SEPA_PMTINF#ctrlsum.); |
| 54 | AB_Value_freecxx . . $ AB_Value_free(a2046d1019573ad4).(pmtinf->valuecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#value.); |
| 55 | AB_Transaction_List2_freecxx . . $ AB_Transaction_List2_free(5d0b81d81f5aa89).(pmtinf->transactionscxx . . $ AH_IMEXPORTER_SEPA_PMTINF#transactions.); |
| 56 | GWEN_LIST_FINIcxx . . $ `/usr/include/gwenhywfar5/gwenhywfar/list1.h:475:9`!(AH_IMEXPORTER_SEPA_PMTINF, pmtinf) |
| 57 | GWEN_FREE_OBJECTcxx . . $ `<external>/8574018900616580794/memory.h:61:9`!(pmtinf) |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | |
| 62 | |
| 63 | AB_IMEXPORTERcxx . . $ AB_IMEXPORTER# *AB_ImExporterSEPA_newcxx . . $ AB_ImExporterSEPA_new(a1265161133b69b1).(AB_BANKINGcxx . . $ AB_BANKING# *ab) |
| 64 | { |
| 65 | AB_IMEXPORTERcxx . . $ AB_IMEXPORTER# *ie; |
| 66 | AH_IMEXPORTER_SEPAcxx . . $ AH_IMEXPORTER_SEPA# *ieh; |
| 67 | |
| 68 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, "SEPA plugin is deprecated, please use the XML plugin"); |
| 69 | |
| 70 | ie=AB_ImExporter_newcxx . . $ AB_ImExporter_new(cd192b01c2601117).(ab, "sepa"); |
| 71 | GWEN_NEW_OBJECTcxx . . $ `<external>/8574018900616580794/memory.h:55:9`!(AH_IMEXPORTER_SEPA, ieh); |
| 72 | GWEN_INHERIT_SETDATAcxx . . $ `<external>/16905422263774432755/inherit.h:300:9`!(AB_IMEXPORTER, AH_IMEXPORTER_SEPA, ie, ieh, |
| 73 | AH_ImExporterSEPA_FreeData); |
| 74 | AB_ImExporter_SetImportFncxx . . $ AB_ImExporter_SetImportFn(60a47b9def55ca6e).(ie, AH_ImExporterSEPA_Importcxx . . $ AH_ImExporterSEPA_Import(4f9f214585a4ad88).); |
| 75 | AB_ImExporter_SetExportFncxx . . $ AB_ImExporter_SetExportFn(60a47b9def55ca6e).(ie, AH_ImExporterSEPA_Exportcxx . . $ AH_ImExporterSEPA_Export(4f9f214585a4ad88).); |
| 76 | AB_ImExporter_SetCheckFileFncxx . . $ AB_ImExporter_SetCheckFileFn(cd5cebbf32510ed2).(ie, AH_ImExporterSEPA_CheckFilecxx . . $ AH_ImExporterSEPA_CheckFile(4e97a9f3319a8fe2).); |
| 77 | return ie; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | |
| 82 | void GWENHYWFAR_CBcxx . . $ `<external>/4720745801113220484/gwenhywfarapi.h:89:10`! AH_ImExporterSEPA_FreeDatacxx . . $ AH_ImExporterSEPA_FreeData(6c58c5e2437d25a2).(void *bp, void *p) |
| 83 | { |
| 84 | AH_IMEXPORTER_SEPAcxx . . $ AH_IMEXPORTER_SEPA# *ieh; |
| 85 | |
| 86 | ieh=(AH_IMEXPORTER_SEPAcxx . . $ AH_IMEXPORTER_SEPA# *)p; |
| 87 | GWEN_FREE_OBJECTcxx . . $ `<external>/8574018900616580794/memory.h:61:9`!(ieh); |
| 88 | } |
| 89 | |
| 90 | |
| 91 | |
| 92 | int AH_ImExporterSEPA_Importcxx . . $ AH_ImExporterSEPA_Import(4f9f214585a4ad88).(AB_IMEXPORTERcxx . . $ AB_IMEXPORTER# *ie, |
| 93 | AB_IMEXPORTER_CONTEXTcxx . . $ AB_IMEXPORTER_CONTEXT# *ctx, |
| 94 | GWEN_SYNCIOcxx . . $ GWEN_SYNCIO# *sio, |
| 95 | GWEN_DB_NODEcxx . . $ GWEN_DB_NODE# *params) |
| 96 | { |
| 97 | AH_IMEXPORTER_SEPAcxx . . $ AH_IMEXPORTER_SEPA# *ieh; |
| 98 | |
| 99 | assertcxx . . $ `/usr/include/assert.h:118:11`!(ie); |
| 100 | ieh=GWEN_INHERIT_GETDATAcxx . . $ `<external>/16905422263774432755/inherit.h:279:9`!(AB_IMEXPORTER, AH_IMEXPORTER_SEPA, ie); |
| 101 | assertcxx . . $ `/usr/include/assert.h:118:11`!(ieh); |
| 102 | |
| 103 | |
| 104 | return GWEN_ERROR_NOT_SUPPORTEDcxx . . $ `<external>/12616048237918575559/error.h:109:9`!; |
| 105 | } |
| 106 | |
| 107 | |
| 108 | |
| 109 | static int AH_ImExporterSEPA_Export_Pain_Setupcxx . . $ AH_ImExporterSEPA_Export_Pain_Setup(1b62d491ad628020).(AB_IMEXPORTERcxx . . $ AB_IMEXPORTER# *ie, |
| 110 | AB_IMEXPORTER_CONTEXTcxx . . $ AB_IMEXPORTER_CONTEXT# *ctx, |
| 111 | GWEN_XMLNODEcxx . . $ GWEN_XMLNODE# *painNode, |
| 112 | uint32_tcxx . . $ uint32_t# doctype[], |
| 113 | AH_IMEXPORTER_SEPA_PMTINF_LISTcxx . . $ AH_IMEXPORTER_SEPA_PMTINF_LIST# **pList) |
| 114 | { |
| 115 | GWEN_XMLNODEcxx . . $ GWEN_XMLNODE# *n; |
| 116 | AB_IMEXPORTER_ACCOUNTINFOcxx . . $ AB_IMEXPORTER_ACCOUNTINFO# *ai; |
| 117 | AB_TRANSACTIONcxx . . $ AB_TRANSACTION# *t; |
| 118 | AH_IMEXPORTER_SEPA_PMTINF_LISTcxx . . $ AH_IMEXPORTER_SEPA_PMTINF_LIST# *pl; |
| 119 | AH_IMEXPORTER_SEPA_PMTINFcxx . . $ AH_IMEXPORTER_SEPA_PMTINF# *pmtinf; |
| 120 | int tcount=0; |
| 121 | AB_VALUEcxx . . $ AB_VALUE# *v; |
| 122 | GWEN_BUFFERcxx . . $ GWEN_BUFFER# *tbuf; |
| 123 | char *ctrlsum; |
| 124 | |
| 125 | ai=AB_ImExporterContext_GetFirstAccountInfocxx . . $ AB_ImExporterContext_GetFirstAccountInfo(cdc0ef2bfce5f1f0).(ctx); |
| 126 | if (ai==0) { |
| 127 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, "No account info"); |
| 128 | return GWEN_ERROR_NO_DATAcxx . . $ `<external>/12616048237918575559/error.h:94:9`!; |
| 129 | } |
| 130 | else if (AB_ImExporterAccountInfo_List_Nextcxx . . $ AB_ImExporterAccountInfo_List_Next(b4b65a233be6f991).(ai)) { |
| 131 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, |
| 132 | "Account info for more than one local account"); |
| 133 | return GWEN_ERROR_NOT_SUPPORTEDcxx . . $ `<external>/12616048237918575559/error.h:109:9`!; |
| 134 | } |
| 135 | |
| 136 | t=AB_ImExporterAccountInfo_GetFirstTransactioncxx . . $ AB_ImExporterAccountInfo_GetFirstTransaction(ad04937c27e01fd6).(ai, 0, 0); |
| 137 | if (!t) { |
| 138 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, "No transactions in ImExporter context"); |
| 139 | return GWEN_ERROR_NO_DATAcxx . . $ `<external>/12616048237918575559/error.h:94:9`!; |
| 140 | } |
| 141 | |
| 142 | /* collect matching transactions for storage in a shared PmtInf block */ |
| 143 | pl=AH_ImExporter_Sepa_PmtInf_List_newcxx . . $ AH_ImExporter_Sepa_PmtInf_List_new(d007b7174d6e1bac).(); |
| 144 | pmtinf=AH_ImExporter_Sepa_PmtInf_newcxx . . $ AH_ImExporter_Sepa_PmtInf_new(1a10200e5f3615cd).(); |
| 145 | AH_ImExporter_Sepa_PmtInf_List_Addcxx . . $ AH_ImExporter_Sepa_PmtInf_List_Add(d2f47751e8d8bb85).(pmtinf, pl); |
| 146 | while (t) { |
| 147 | const GWEN_DATEcxx . . $ GWEN_DATE# *da; |
| 148 | int day, month, year; |
| 149 | uint32_tcxx . . $ uint32_t# transDate; |
| 150 | const char *name=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *iban=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *bic=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *cdtrSchmeId=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 151 | AB_TRANSACTION_SEQUENCEcxx . . $ AB_TRANSACTION_SEQUENCE# sequenceType=AB_Transaction_SequenceUnknowncxx . . $ AB_Transaction_SequenceUnknown.; |
| 152 | const char *s; |
| 153 | const AB_VALUEcxx . . $ AB_VALUE# *tv; |
| 154 | |
| 155 | tcount++; |
| 156 | da=AB_Transaction_GetDatecxx . . $ AB_Transaction_GetDate(c365f937d9a15bfe).(t); |
| 157 | if (da) { |
| 158 | year=GWEN_Date_GetYearcxx . . $ GWEN_Date_GetYear(12b55b7e7fb84a50).(da); |
| 159 | month=GWEN_Date_GetMonthcxx . . $ GWEN_Date_GetMonth(12b55b7e7fb84a50).(da)-1; |
| 160 | day=GWEN_Date_GetDaycxx . . $ GWEN_Date_GetDay(12b55b7e7fb84a50).(da); |
| 161 | transDate=(year<<16)+(month<<8)+(day); |
| 162 | } |
| 163 | else |
| 164 | transDate=0; |
| 165 | s=AB_ImExporterAccountInfo_GetOwnercxx . . $ AB_ImExporterAccountInfo_GetOwner(c943f9318f4879c8).(ai); |
| 166 | if (!s || !*s) { |
| 167 | name=AB_Transaction_GetLocalNamecxx . . $ AB_Transaction_GetLocalName(4c86805e7095e825).(t); |
| 168 | if (!name || !*name) { |
| 169 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, |
| 170 | "Missing local name in transaction %d", tcount); |
| 171 | AH_ImExporter_Sepa_PmtInf_List_freecxx . . $ AH_ImExporter_Sepa_PmtInf_List_free(9590ce7e0cb23f1f).(pl); |
| 172 | return GWEN_ERROR_BAD_DATAcxx . . $ `<external>/12616048237918575559/error.h:121:9`!; |
| 173 | } |
| 174 | } |
| 175 | s=AB_ImExporterAccountInfo_GetIbancxx . . $ AB_ImExporterAccountInfo_GetIban(c943f9318f4879c8).(ai); |
| 176 | if (!s || !*s) { |
| 177 | iban=AB_Transaction_GetLocalIbancxx . . $ AB_Transaction_GetLocalIban(4c86805e7095e825).(t); |
| 178 | if (!iban || !*iban) { |
| 179 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, |
| 180 | "Missing local IBAN in transaction %d", tcount); |
| 181 | AH_ImExporter_Sepa_PmtInf_List_freecxx . . $ AH_ImExporter_Sepa_PmtInf_List_free(9590ce7e0cb23f1f).(pl); |
| 182 | return GWEN_ERROR_BAD_DATAcxx . . $ `<external>/12616048237918575559/error.h:121:9`!; |
| 183 | } |
| 184 | } |
| 185 | s=AB_ImExporterAccountInfo_GetBiccxx . . $ AB_ImExporterAccountInfo_GetBic(c943f9318f4879c8).(ai); |
| 186 | if (!s || !*s) { |
| 187 | #if 0 |
| 188 | bic=AB_Transaction_GetLocalBic(t); |
| 189 | if (!bic || !*bic) { |
| 190 | DBG_ERROR(AQBANKING_LOGDOMAIN, |
| 191 | "Missing local BIC in transaction %d", tcount); |
| 192 | AH_ImExporter_Sepa_PmtInf_List_free(pl); |
| 193 | return GWEN_ERROR_BAD_DATA; |
| 194 | } |
| 195 | #endif |
| 196 | } |
| 197 | if (doctype[0]==8) { |
| 198 | sequenceType=AB_Transaction_GetSequencecxx . . $ AB_Transaction_GetSequence(58aaba599b93dc1e).(t); |
| 199 | if (sequenceType==AB_Transaction_SequenceUnknowncxx . . $ AB_Transaction_SequenceUnknown.) { |
| 200 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, |
| 201 | "Missing sequence type in transaction %d", tcount); |
| 202 | AH_ImExporter_Sepa_PmtInf_List_freecxx . . $ AH_ImExporter_Sepa_PmtInf_List_free(9590ce7e0cb23f1f).(pl); |
| 203 | return GWEN_ERROR_BAD_DATAcxx . . $ `<external>/12616048237918575559/error.h:121:9`!; |
| 204 | } |
| 205 | cdtrSchmeId=AB_Transaction_GetCreditorSchemeIdcxx . . $ AB_Transaction_GetCreditorSchemeId(4c86805e7095e825).(t); |
| 206 | if (!cdtrSchmeId || !*cdtrSchmeId) { |
| 207 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, |
| 208 | "Missing creditor scheme id in transaction %d", tcount); |
| 209 | AH_ImExporter_Sepa_PmtInf_List_freecxx . . $ AH_ImExporter_Sepa_PmtInf_List_free(9590ce7e0cb23f1f).(pl); |
| 210 | return GWEN_ERROR_BAD_DATAcxx . . $ `<external>/12616048237918575559/error.h:121:9`!; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | if (pmtinf->tcountcxx . . $ AH_IMEXPORTER_SEPA_PMTINF#tcount.) { |
| 215 | /* specify list of match criteria in one place */ |
| 216 | #define TRANSACTION_DOES_NOT_MATCHcxx . . $ `src/libs/plugins/imexporters/sepa/sepa.c:216:9`! \ |
| 217 | (transDate!=pmtinf->transDate || \ |
| 218 | (name && strcmp(name, pmtinf->localName)) || \ |
| 219 | (iban && strcmp(iban, pmtinf->localIban)) || \ |
| 220 | (bic && strcmp(bic, pmtinf->localBic)) || \ |
| 221 | (doctype[0]==8 && \ |
| 222 | (sequenceType!=pmtinf->sequenceType || \ |
| 223 | (cdtrSchmeId && strcmp(cdtrSchmeId, pmtinf->creditorSchemeId))))) |
| 224 | |
| 225 | /* match against current PmtInf block */ |
| 226 | if (TRANSACTION_DOES_NOT_MATCHcxx . . $ `src/libs/plugins/imexporters/sepa/sepa.c:216:9`!) { |
| 227 | /* search for a fitting PmtInf block */ |
| 228 | pmtinf=AH_ImExporter_Sepa_PmtInf_List_Firstcxx . . $ AH_ImExporter_Sepa_PmtInf_List_First(74ca3a44b39920b4).(pl); |
| 229 | while (pmtinf && TRANSACTION_DOES_NOT_MATCHcxx . . $ `src/libs/plugins/imexporters/sepa/sepa.c:216:9`!) |
| 230 | pmtinf=AH_ImExporter_Sepa_PmtInf_List_Nextcxx . . $ AH_ImExporter_Sepa_PmtInf_List_Next(1591e4a3ecc5ff2a).(pmtinf); |
| 231 | #undef TRANSACTION_DOES_NOT_MATCHcxx . . $ `src/libs/plugins/imexporters/sepa/sepa.c:216:9`! |
| 232 | |
| 233 | if (!pmtinf) { |
| 234 | pmtinf=AH_ImExporter_Sepa_PmtInf_newcxx . . $ AH_ImExporter_Sepa_PmtInf_new(1a10200e5f3615cd).(); |
| 235 | AH_ImExporter_Sepa_PmtInf_List_Addcxx . . $ AH_ImExporter_Sepa_PmtInf_List_Add(d2f47751e8d8bb85).(pmtinf, pl); |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | if (!pmtinf->tcountcxx . . $ AH_IMEXPORTER_SEPA_PMTINF#tcount.) { |
| 241 | /* initialise match data for this PmtInf block */ |
| 242 | pmtinf->localNamecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#localName. = name ? name : AB_ImExporterAccountInfo_GetOwnercxx . . $ AB_ImExporterAccountInfo_GetOwner(c943f9318f4879c8).(ai); |
| 243 | pmtinf->localIbancxx . . $ AH_IMEXPORTER_SEPA_PMTINF#localIban. = iban ? iban : AB_ImExporterAccountInfo_GetIbancxx . . $ AB_ImExporterAccountInfo_GetIban(c943f9318f4879c8).(ai); |
| 244 | pmtinf->localBiccxx . . $ AH_IMEXPORTER_SEPA_PMTINF#localBic. = bic ? bic : AB_ImExporterAccountInfo_GetBiccxx . . $ AB_ImExporterAccountInfo_GetBic(c943f9318f4879c8).(ai); |
| 245 | pmtinf->datecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#date.=da; /* transaction date (AB_Transaction_GetDate()) */ |
| 246 | pmtinf->transDatecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#transDate.=transDate; /* transaction date short representation ((year<<16)+(month<<8)+(day)) */ |
| 247 | if (doctype[0]==8) { |
| 248 | pmtinf->sequenceTypecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#sequenceType.=sequenceType; |
| 249 | pmtinf->creditorSchemeIdcxx . . $ AH_IMEXPORTER_SEPA_PMTINF#creditorSchemeId.=cdtrSchmeId; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | AB_Transaction_List2_PushBackcxx . . $ AB_Transaction_List2_PushBack(3821b725e13fd4cd).(pmtinf->transactionscxx . . $ AH_IMEXPORTER_SEPA_PMTINF#transactions., t); |
| 254 | pmtinf->tcountcxx . . $ AH_IMEXPORTER_SEPA_PMTINF#tcount.++; |
| 255 | tv=AB_Transaction_GetValuecxx . . $ AB_Transaction_GetValue(cea4b295730f7dc2).(t); |
| 256 | if (tv==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 257 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, |
| 258 | "Missing value in transaction %d", tcount); |
| 259 | AH_ImExporter_Sepa_PmtInf_List_freecxx . . $ AH_ImExporter_Sepa_PmtInf_List_free(9590ce7e0cb23f1f).(pl); |
| 260 | return GWEN_ERROR_BAD_DATAcxx . . $ `<external>/12616048237918575559/error.h:121:9`!; |
| 261 | } |
| 262 | AB_Value_AddValuecxx . . $ AB_Value_AddValue(6a51f829c37e4bde).(pmtinf->valuecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#value., tv); |
| 263 | |
| 264 | t=AB_Transaction_List_Nextcxx . . $ AB_Transaction_List_Next(f21500f9f510720f).(t); |
| 265 | } |
| 266 | |
| 267 | /* construct CtrlSum for PmtInf blocks and GrpHdr */ |
| 268 | v=AB_Value_newcxx . . $ AB_Value_new(4e323504095ae532).(); |
| 269 | tbuf=GWEN_Buffer_newcxx . . $ GWEN_Buffer_new(22db50e37c43d07e).(0, 64, 0, 1); |
| 270 | pmtinf=AH_ImExporter_Sepa_PmtInf_List_Firstcxx . . $ AH_ImExporter_Sepa_PmtInf_List_First(74ca3a44b39920b4).(pl); |
| 271 | while (pmtinf) { |
| 272 | AB_Value_toHumanReadableStringcxx . . $ AB_Value_toHumanReadableString(b1e0d8dff52fd83f).(pmtinf->valuecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#value., tbuf, 2, 0); |
| 273 | pmtinf->ctrlsumcxx . . $ AH_IMEXPORTER_SEPA_PMTINF#ctrlsum.=strdupcxx . . $ strdup(a8b8e32347182212).(GWEN_Buffer_GetStartcxx . . $ GWEN_Buffer_GetStart(7b9175a8beda6b09).(tbuf)); |
| 274 | assertcxx . . $ `/usr/include/assert.h:118:11`!(pmtinf->ctrlsum); |
| 275 | GWEN_Buffer_Resetcxx . . $ GWEN_Buffer_Reset(5b6d30950a0a3fde).(tbuf); |
| 276 | AB_Value_AddValuecxx . . $ AB_Value_AddValue(6a51f829c37e4bde).(v, pmtinf->valuecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#value.); |
| 277 | pmtinf=AH_ImExporter_Sepa_PmtInf_List_Nextcxx . . $ AH_ImExporter_Sepa_PmtInf_List_Next(1591e4a3ecc5ff2a).(pmtinf); |
| 278 | } |
| 279 | |
| 280 | AB_Value_toHumanReadableStringcxx . . $ AB_Value_toHumanReadableString(b1e0d8dff52fd83f).(v, tbuf, 2, 0); |
| 281 | ctrlsum=strdupcxx . . $ strdup(a8b8e32347182212).(GWEN_Buffer_GetStartcxx . . $ GWEN_Buffer_GetStart(7b9175a8beda6b09).(tbuf)); |
| 282 | assertcxx . . $ `/usr/include/assert.h:118:11`!(ctrlsum); |
| 283 | GWEN_Buffer_freecxx . . $ GWEN_Buffer_free(5b6d30950a0a3fde).(tbuf); |
| 284 | AB_Value_freecxx . . $ AB_Value_free(a2046d1019573ad4).(v); |
| 285 | |
| 286 | /* create GrpHdr */ |
| 287 | n=GWEN_XMLNode_newcxx . . $ GWEN_XMLNode_new(fbbef9f02e4959cc).(GWEN_XMLNodeTypeTagcxx . . $ GWEN_XMLNodeTypeTag., "GrpHdr"); |
| 288 | if (n) { |
| 289 | GWEN_TIMEcxx . . $ GWEN_TIME# *ti; |
| 290 | uint32_tcxx . . $ uint32_t# uid; |
| 291 | char numbuf[32]; |
| 292 | GWEN_XMLNODEcxx . . $ GWEN_XMLNODE# *nn; |
| 293 | |
| 294 | GWEN_XMLNode_AddChildcxx . . $ GWEN_XMLNode_AddChild(fe3089aa82de114d).(painNode, n); |
| 295 | ti=GWEN_CurrentTimecxx . . $ GWEN_CurrentTime(b262abfa83749b10).(); |
| 296 | |
| 297 | tbuf=GWEN_Buffer_newcxx . . $ GWEN_Buffer_new(22db50e37c43d07e).(0, 64, 0, 1); |
| 298 | |
| 299 | /* generate MsgId */ |
| 300 | uid=AB_Banking_GetNamedUniqueIdcxx . . $ AB_Banking_GetNamedUniqueId(e3497b68b8d0061a).(AB_ImExporter_GetBankingcxx . . $ AB_ImExporter_GetBanking(d3f3b13d25f26791).(ie), "sepamsg", 1); |
| 301 | GWEN_Time_toUtcStringcxx . . $ GWEN_Time_toUtcString(7cdf845d45b195da).(ti, "YYYYMMDD-hh:mm:ss-", tbuf); |
| 302 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(numbuf, sizeof(numbuf)-1, "%08x", uid); |
| 303 | GWEN_Buffer_AppendStringcxx . . $ GWEN_Buffer_AppendString(84baf23481738b1c).(tbuf, numbuf); |
| 304 | GWEN_XMLNode_SetCharValuecxx . . $ GWEN_XMLNode_SetCharValue(53bc8036198d68cf).(n, "MsgId", GWEN_Buffer_GetStartcxx . . $ GWEN_Buffer_GetStart(7b9175a8beda6b09).(tbuf)); |
| 305 | GWEN_Buffer_Resetcxx . . $ GWEN_Buffer_Reset(5b6d30950a0a3fde).(tbuf); |
| 306 | |
| 307 | /* generate CreDtTm */ |
| 308 | GWEN_Time_toUtcStringcxx . . $ GWEN_Time_toUtcString(7cdf845d45b195da).(ti, "YYYY-MM-DDThh:mm:ssZ", tbuf); |
| 309 | GWEN_XMLNode_SetCharValuecxx . . $ GWEN_XMLNode_SetCharValue(53bc8036198d68cf).(n, "CreDtTm", GWEN_Buffer_GetStartcxx . . $ GWEN_Buffer_GetStart(7b9175a8beda6b09).(tbuf)); |
| 310 | GWEN_Time_freecxx . . $ GWEN_Time_free(79d4dee2165f1ab6).(ti); |
| 311 | GWEN_Buffer_freecxx . . $ GWEN_Buffer_free(5b6d30950a0a3fde).(tbuf); |
| 312 | |
| 313 | /* store NbOfTxs */ |
| 314 | GWEN_XMLNode_SetIntValuecxx . . $ GWEN_XMLNode_SetIntValue(22e611991cf8c385).(n, "NbOfTxs", tcount); |
| 315 | #if 0 |
| 316 | /* store CtrlSum */ |
| 317 | GWEN_XMLNode_SetCharValue(n, "CtrlSum", ctrlsum); |
| 318 | #endif |
| 319 | |
| 320 | /* special treatment for pain.001.001.02 and pain.008.001.01 */ |
| 321 | if (doctype[1]==1 && ((doctype[0]==1 && doctype[2]==2) || |
| 322 | (doctype[0]==8 && doctype[2]==1))) |
| 323 | GWEN_XMLNode_SetCharValuecxx . . $ GWEN_XMLNode_SetCharValue(53bc8036198d68cf).(n, "Grpg", "GRPD"); |
| 324 | |
| 325 | nn=GWEN_XMLNode_newcxx . . $ GWEN_XMLNode_new(fbbef9f02e4959cc).(GWEN_XMLNodeTypeTagcxx . . $ GWEN_XMLNodeTypeTag., "InitgPty"); |
| 326 | if (nn) { |
| 327 | GWEN_XMLNode_AddChildcxx . . $ GWEN_XMLNode_AddChild(fe3089aa82de114d).(n, nn); |
| 328 | pmtinf=AH_ImExporter_Sepa_PmtInf_List_Firstcxx . . $ AH_ImExporter_Sepa_PmtInf_List_First(74ca3a44b39920b4).(pl); |
| 329 | AH_ImExporterSEPA_XmlSetCharValueEscapedcxx . . $ AH_ImExporterSEPA_XmlSetCharValueEscaped(b40735a2203e7fd8).(nn, "Nm", pmtinf->localNamecxx . . $ AH_IMEXPORTER_SEPA_PMTINF#localName.); |
| 330 | } |
| 331 | } |
| 332 | freecxx . . $ free(5d22bdacc48458e8).(ctrlsum); |
| 333 | |
| 334 | *pList=pl; |
| 335 | return 0; |
| 336 | } |
| 337 | |
| 338 | |
| 339 | |
| 340 | int AH_ImExporterSEPA_Exportcxx . . $ AH_ImExporterSEPA_Export(4f9f214585a4ad88).(AB_IMEXPORTERcxx . . $ AB_IMEXPORTER# *ie, |
| 341 | AB_IMEXPORTER_CONTEXTcxx . . $ AB_IMEXPORTER_CONTEXT# *ctx, |
| 342 | GWEN_SYNCIOcxx . . $ GWEN_SYNCIO# *sio, |
| 343 | GWEN_DB_NODEcxx . . $ GWEN_DB_NODE# *params) |
| 344 | { |
| 345 | AH_IMEXPORTER_SEPAcxx . . $ AH_IMEXPORTER_SEPA# *ieh; |
| 346 | GWEN_XMLNODEcxx . . $ GWEN_XMLNODE# *root; |
| 347 | GWEN_XMLNODEcxx . . $ GWEN_XMLNODE# *documentNode; |
| 348 | GWEN_XMLNODEcxx . . $ GWEN_XMLNODE# *topNode; |
| 349 | GWEN_XMLNODEcxx . . $ GWEN_XMLNODE# *n; |
| 350 | uint32_tcxx . . $ uint32_t# doctype[]= {0, 0, 0}; |
| 351 | const char *s; |
| 352 | int rv; |
| 353 | |
| 354 | assertcxx . . $ `/usr/include/assert.h:118:11`!(ie); |
| 355 | ieh=GWEN_INHERIT_GETDATAcxx . . $ `<external>/16905422263774432755/inherit.h:279:9`!(AB_IMEXPORTER, AH_IMEXPORTER_SEPA, ie); |
| 356 | assertcxx . . $ `/usr/include/assert.h:118:11`!(ieh); |
| 357 | |
| 358 | s=GWEN_DB_GetCharValuecxx . . $ GWEN_DB_GetCharValue(a0be5f6fbdef7a0).(params, "type", 0, 0); |
| 359 | if (s) { |
| 360 | int i, j; |
| 361 | const char *p; |
| 362 | char *tail; |
| 363 | |
| 364 | /* Parse strings of the form xxx.yyy.zz */ |
| 365 | p=tail=(char *)s; |
| 366 | for (i=0; i<3 && *tail; i++) { |
| 367 | j=strtolcxx . . $ strtol(44bbb87609b212fc).(p, &tail, 10); |
| 368 | if (!isspacecxx . . $ `<external>/17904084882347303253/ctype.h:197:10`!(*p) && |
| 369 | ((*tail=='.' && tail-p==3) || (*tail=='\0' && tail-p==2)) && |
| 370 | j>0) |
| 371 | doctype[i]=j; |
| 372 | else |
| 373 | break; |
| 374 | p=tail+1; |
| 375 | } |
| 376 | if (i<3) |
| 377 | /* Parsing the "type" option failed, record it for later reference */ |
| 378 | doctype[0]=0; |
| 379 | } |
| 380 | |
| 381 | root=GWEN_XMLNode_newcxx . . $ GWEN_XMLNode_new(fbbef9f02e4959cc).(GWEN_XMLNodeTypeTagcxx . . $ GWEN_XMLNodeTypeTag., "root"); |
| 382 | n=GWEN_XMLNode_newcxx . . $ GWEN_XMLNode_new(fbbef9f02e4959cc).(GWEN_XMLNodeTypeTagcxx . . $ GWEN_XMLNodeTypeTag., "?xml"); |
| 383 | if (n) { |
| 384 | GWEN_XMLNode_AddHeadercxx . . $ GWEN_XMLNode_AddHeader(fe3089aa82de114d).(root, n); |
| 385 | GWEN_XMLNode_SetPropertycxx . . $ GWEN_XMLNode_SetProperty(53bc8036198d68cf).(n, "version", "1.0"); |
| 386 | GWEN_XMLNode_SetPropertycxx . . $ GWEN_XMLNode_SetProperty(53bc8036198d68cf).(n, "encoding", "UTF-8"); |
| 387 | } |
| 388 | |
| 389 | documentNode=GWEN_XMLNode_newcxx . . $ GWEN_XMLNode_new(fbbef9f02e4959cc).(GWEN_XMLNodeTypeTagcxx . . $ GWEN_XMLNodeTypeTag., "Document"); |
| 390 | s=GWEN_DB_GetCharValuecxx . . $ GWEN_DB_GetCharValue(a0be5f6fbdef7a0).(params, "xmlns", 0, 0); |
| 391 | if (!s || !*s) { |
| 392 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, |
| 393 | "xmlns not specified in profile \"%s\"", |
| 394 | GWEN_DB_GetCharValue(params, "name", 0, 0)); |
| 395 | GWEN_XMLNode_freecxx . . $ GWEN_XMLNode_free(5861204ca02855b8).(root); |
| 396 | return GWEN_ERROR_INVALIDcxx . . $ `<external>/12616048237918575559/error.h:67:9`!; |
| 397 | } |
| 398 | GWEN_XMLNode_SetPropertycxx . . $ GWEN_XMLNode_SetProperty(53bc8036198d68cf).(documentNode, "xmlns", s); |
| 399 | GWEN_XMLNode_AddChildcxx . . $ GWEN_XMLNode_AddChild(fe3089aa82de114d).(root, documentNode); |
| 400 | |
| 401 | switch (doctype[0]) { |
| 402 | case 1: |
| 403 | if (doctype[1]>1 || doctype[2]>2) |
| 404 | s="CstmrCdtTrfInitn"; |
| 405 | else |
| 406 | s=strstrcxx . . $ strstr(a713fe7b9a57cf96).(s, "pain"); |
| 407 | topNode=GWEN_XMLNode_newcxx . . $ GWEN_XMLNode_new(fbbef9f02e4959cc).(GWEN_XMLNodeTypeTagcxx . . $ GWEN_XMLNodeTypeTag., s); |
| 408 | GWEN_XMLNode_AddChildcxx . . $ GWEN_XMLNode_AddChild(fe3089aa82de114d).(documentNode, topNode); |
| 409 | rv=AH_ImExporterSEPA_Export_Pain_001cxx . . $ AH_ImExporterSEPA_Export_Pain_001(613077ed80d8e1f5).(ie, ctx, topNode, doctype, params); |
| 410 | break; |
| 411 | case 8: |
| 412 | if (!(doctype[1]==1 && doctype[2]==1)) |
| 413 | s="CstmrDrctDbtInitn"; |
| 414 | else |
| 415 | s=strstrcxx . . $ strstr(a713fe7b9a57cf96).(s, "pain"); |
| 416 | topNode=GWEN_XMLNode_newcxx . . $ GWEN_XMLNode_new(fbbef9f02e4959cc).(GWEN_XMLNodeTypeTagcxx . . $ GWEN_XMLNodeTypeTag., s); |
| 417 | GWEN_XMLNode_AddChildcxx . . $ GWEN_XMLNode_AddChild(fe3089aa82de114d).(documentNode, topNode); |
| 418 | rv=AH_ImExporterSEPA_Export_Pain_008cxx . . $ AH_ImExporterSEPA_Export_Pain_008(613077ed80d8e1f5).(ie, ctx, topNode, doctype, params); |
| 419 | break; |
| 420 | default: |
| 421 | DBG_ERRORcxx . . $ `<external>/1532518586372551407/debug.h:97:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, "Unknown SEPA type \"%s\"", |
| 422 | GWEN_DB_GetCharValue(params, "type", 0, 0)); |
| 423 | GWEN_XMLNode_freecxx . . $ GWEN_XMLNode_free(5861204ca02855b8).(root); |
| 424 | return GWEN_ERROR_INVALIDcxx . . $ `<external>/12616048237918575559/error.h:67:9`!; |
| 425 | } |
| 426 | |
| 427 | if (rv==0) { |
| 428 | GWEN_XML_CONTEXTcxx . . $ GWEN_XML_CONTEXT# *xmlctx; |
| 429 | |
| 430 | xmlctx=GWEN_XmlCtxStore_newcxx . . $ GWEN_XmlCtxStore_new(31da1bfe7d03ebd).(root, |
| 431 | GWEN_XML_FLAGS_INDENTcxx . . $ `<external>/15763854373913665307/xml.h:66:9`! | |
| 432 | GWEN_XML_FLAGS_SIMPLEcxx . . $ `<external>/15763854373913665307/xml.h:89:9`! | |
| 433 | GWEN_XML_FLAGS_HANDLE_HEADERScxx . . $ `<external>/15763854373913665307/xml.h:94:9`!); |
| 434 | |
| 435 | rv=GWEN_XMLNode_WriteToStreamcxx . . $ GWEN_XMLNode_WriteToStream(ba50867547e8a45).(root, xmlctx, sio); |
| 436 | if (rv) { |
| 437 | DBG_INFOcxx . . $ `<external>/1532518586372551407/debug.h:181:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, "here (%d)", rv); |
| 438 | } |
| 439 | GWEN_XmlCtx_freecxx . . $ GWEN_XmlCtx_free(acb6a757c43777e9).(xmlctx); |
| 440 | GWEN_XMLNode_freecxx . . $ GWEN_XMLNode_free(5861204ca02855b8).(root); |
| 441 | } |
| 442 | |
| 443 | /* TODO */ |
| 444 | return rv; |
| 445 | } |
| 446 | |
| 447 | |
| 448 | |
| 449 | int AH_ImExporterSEPA_CheckFilecxx . . $ AH_ImExporterSEPA_CheckFile(4e97a9f3319a8fe2).(AB_IMEXPORTERcxx . . $ AB_IMEXPORTER# *ie, const char *fname) |
| 450 | { |
| 451 | AH_IMEXPORTER_SEPAcxx . . $ AH_IMEXPORTER_SEPA# *ieh; |
| 452 | |
| 453 | assertcxx . . $ `/usr/include/assert.h:118:11`!(ie); |
| 454 | ieh=GWEN_INHERIT_GETDATAcxx . . $ `<external>/16905422263774432755/inherit.h:279:9`!(AB_IMEXPORTER, AH_IMEXPORTER_SEPA, ie); |
| 455 | assertcxx . . $ `/usr/include/assert.h:118:11`!(ieh); |
| 456 | |
| 457 | #if 0 |
| 458 | return AB_ERROR_INDIFFERENT; |
| 459 | #else |
| 460 | /* TODO */ |
| 461 | return GWEN_ERROR_NOT_IMPLEMENTEDcxx . . $ `<external>/12616048237918575559/error.h:108:9`!; |
| 462 | #endif |
| 463 | } |
| 464 | |
| 465 | |
| 466 | |
| 467 | int AH_ImExporterSEPA_XmlSetCharValueEscapedcxx . . $ AH_ImExporterSEPA_XmlSetCharValueEscaped(b40735a2203e7fd8).(GWEN_XMLNODEcxx . . $ GWEN_XMLNODE# *n, const char *varName, const char *value) |
| 468 | { |
| 469 | if (value && *value) { |
| 470 | GWEN_BUFFERcxx . . $ GWEN_BUFFER# *dbuf; |
| 471 | int rv; |
| 472 | |
| 473 | dbuf=GWEN_Buffer_newcxx . . $ GWEN_Buffer_new(22db50e37c43d07e).(0, 256, 0, 1); |
| 474 | rv=GWEN_Text_EscapeXmlToBuffercxx . . $ GWEN_Text_EscapeXmlToBuffer(95f4fa12bf4efb03).(value, dbuf); |
| 475 | if (rv<0) { |
| 476 | DBG_INFOcxx . . $ `<external>/1532518586372551407/debug.h:181:10`!(AQBANKING_LOGDOMAINcxx . . $ `src/libs/aqbanking/error.h:76:9`!, "here (%d)", rv); |
| 477 | GWEN_Buffer_freecxx . . $ GWEN_Buffer_free(5b6d30950a0a3fde).(dbuf); |
| 478 | return rv; |
| 479 | } |
| 480 | |
| 481 | GWEN_XMLNode_SetCharValuecxx . . $ GWEN_XMLNode_SetCharValue(53bc8036198d68cf).(n, varName, GWEN_Buffer_GetStartcxx . . $ GWEN_Buffer_GetStart(7b9175a8beda6b09).(dbuf)); |
| 482 | GWEN_Buffer_freecxx . . $ GWEN_Buffer_free(5b6d30950a0a3fde).(dbuf); |
| 483 | } |
| 484 | return 0; |
| 485 | } |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | #include "sepa_pain_001.c"cxx . . $ `<file>/src/libs/plugins/imexporters/sepa/sepa_pain_001.c`/ |
| 493 | #include "sepa_pain_008.c"cxx . . $ `<file>/src/libs/plugins/imexporters/sepa/sepa_pain_008.c`/ |
| 494 | |
| 495 |