Project

General

Profile

Revision f4a16f5b src/libs/plugins/backends/aqpaypal/provider_getbalance.c

View differences:

src/libs/plugins/backends/aqpaypal/provider_getbalance.c
227 227
  /* now get the transactions */
228 228
  dbCurr=GWEN_DB_GetFirstGroup(dbResponse);
229 229
  while(dbCurr) {
230
    AB_ACCOUNT_STATUS *acst;
231 230
    AB_BALANCE *bal;
232
    GWEN_TIME *t=NULL;
231
    GWEN_DATE *t=NULL;
233 232
    AB_VALUE *vc;
234 233
    const char *p;
235 234
    
236 235
    DBG_NOTICE(AQPAYPAL_LOGDOMAIN, "Got a balance");
237 236
    
238
    acst=AB_AccountStatus_new();
239
    
240 237
    /* read and parse value */
241 238
    p=GWEN_DB_GetCharValue(dbCurr, "L_AMT", 0, 0);
242 239
    if (!p)
......
252 249
    
253 250
    p=GWEN_DB_GetCharValue(dbResponse, "TIMESTAMP", 0, NULL);
254 251
    if (p && *p) {
255
      t=GWEN_Time_fromUtcString(p, "YYYY-MM-DDThh:mm:ssZ");
252
      /*t=GWEN_Time_fromUtcString(p, "YYYY-MM-DDThh:mm:ssZ");*/
253
      t=GWEN_Date_fromStringWithTemplate(p, "YYYY-MM-DD");
254
      if (t==NULL) {
255
        DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Invalid timespec [%s]", p);
256
      }
256 257
    }
257 258
    else {
258
      DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Invalid timespec [%s]", p);
259
      DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Missing timespec");
259 260
    }
260
    
261

  
261 262
    bal=AB_Balance_new();
262
    AB_Balance_SetTime(bal, t);
263
    AB_Balance_SetType(bal, AB_Balance_TypeBooked);
264
    AB_Balance_SetDate(bal, t);
263 265
    AB_Balance_SetValue(bal, vc);
264
    
266

  
265 267
    AB_Value_free(vc);
266
    GWEN_Time_free(t);
267
    
268
    AB_AccountStatus_SetBookedBalance(acst, bal);
269
    AB_AccountStatus_SetTime(acst, AB_Balance_GetTime(bal));
270
    AB_Balance_free(bal);
268
    GWEN_Date_free(t);
271 269
    
272
    /* add new account status */
273
    AB_ImExporterAccountInfo_AddAccountStatus(ai, acst);
270
    /* add new balance */
271
    AB_ImExporterAccountInfo_AddBalance(ai, bal);
274 272
    break; /* break loop, we found the balance */
275 273

  
276 274
    dbCurr=GWEN_DB_GetNextGroup(dbCurr);

Also available in: Unified diff