Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

aqbanking / src / libs / plugins / backends / aqofxconnect / provider_accspec.c @ 942309da

History | View | Annotate | Download (2.43 KB)

1
/***************************************************************************
2
    begin       : Fri Nov 30 2018
3
    copyright   : (C) 2018 by Martin Preuss
4
    email       : martin@libchipcard.de
5

6
 ***************************************************************************
7
 *          Please see toplevel file COPYING for license details           *
8
 ***************************************************************************/
9

    
10

    
11
/* included by provider.c */
12

    
13

    
14

    
15
int AO_Provider__CreateTransactionLimitsForAccount(AB_PROVIDER *pro, const AB_ACCOUNT *acc, AB_TRANSACTION_LIMITS_LIST *tll) {
16
  int i;
17
  int jobList[]={
18
    AB_Transaction_CommandGetBalance,
19
    AB_Transaction_CommandGetTransactions,
20
    /* AB_Transaction_CommandLoadCellPhone,             */
21
    /* AB_Transaction_CommandSepaTransfer,              */
22
    /* AB_Transaction_CommandSepaDebitNote,             */
23
    /* AB_Transaction_CommandSepaFlashDebitNote,        */
24
    /* AB_Transaction_CommandSepaCreateStandingOrder,   */
25
    /* AB_Transaction_CommandSepaModifyStandingOrder,   */
26
    /* AB_Transaction_CommandSepaDeleteStandingOrder,   */
27
    /* AB_Transaction_CommandSepaGetStandingOrders,     */
28
    /* AB_Transaction_CommandGetEStatements,            */
29
    AB_Transaction_CommandUnknown};
30

    
31
  i=0;
32
  while(jobList[i]!=AB_Transaction_CommandUnknown) {
33
    AB_TRANSACTION_LIMITS *limits=NULL;
34

    
35
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Handling job \"%s\"", AB_Transaction_Command_toString(jobList[i]));
36

    
37
    limits=AB_TransactionLimits_new();
38
    AB_TransactionLimits_SetCommand(limits, jobList[i]);
39
    AB_TransactionLimits_SetMaxLinesPurpose(limits, AO_Account_GetMaxPurposeLines(acc));
40

    
41
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "- adding limits");
42
    AB_TransactionLimits_List_Add(limits, tll);
43
    i++;
44
  } /* while */
45

    
46
  return 0;
47
}
48

    
49

    
50

    
51
int AO_Provider_UpdateAccountSpec(AB_PROVIDER *pro, AB_ACCOUNT_SPEC *as, int doLock) {
52
  int rv;
53
  AB_ACCOUNT *a=NULL;
54
  AB_TRANSACTION_LIMITS_LIST *tll;
55

    
56
  rv=AB_Provider_GetAccount(pro, AB_AccountSpec_GetUniqueId(as), doLock, doLock, &a);
57
  if (rv<0) {
58
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv);
59
    return rv;
60
  }
61

    
62
  tll=AB_TransactionLimits_List_new();
63
  rv=AO_Provider__CreateTransactionLimitsForAccount(pro, a, tll);
64
  if (rv<0) {
65
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv);
66
    AB_TransactionLimits_List_free(tll);
67
    AB_Account_free(a);
68
    return rv;
69
  }
70
  AB_AccountSpec_SetTransactionLimitsList(as, tll);
71

    
72
  AB_Account_free(a);
73

    
74
  return 0;
75
}
76

    
77

    
78