-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwsfev1.c
107 lines (83 loc) · 2.95 KB
/
wsfev1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* This file is part of PyAfipWs dynamical-link shared library
* Copyright (C) 2013 Mariano Reingart <reingart@gmail.com>
*
* PyAfipWs is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PyAfipWs is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PyAfipWs. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Python.h>
#include "libpyafipws.h"
#define MODULE "wsfev1"
EXPORT bool STDCALL WSFEv1_Conectar(void *object, char *cache, char *wsdl, char *proxy) {
PyObject *pValue;
bool ok = false;
if (object != NULL) {
pValue = PyObject_CallMethod((PyObject *)object, "Conectar", "(sss)", cache, wsdl, proxy);
//fprintf(stderr, "conectar call!!!\n");
if (pValue != NULL) {
ok = PyObject_IsTrue(pValue);
Py_DECREF(pValue);
} else {
PyErr_Print();
//fprintf(stderr,"Call failed\n");
}
}
return ok;
}
EXPORT bool STDCALL WSFEv1_Dummy(void *object) {
PyObject *pValue;
char ok = false;
if (object != NULL) {
pValue = PyObject_CallMethod((PyObject *)object, "Dummy", "");
//fprintf(stderr, "dummy call!!!\n");
if (pValue != NULL) {
ok = PyObject_IsTrue(pValue);
Py_DECREF(pValue);
} else {
PyErr_Print();
//fprintf(stderr,"Call failed\n");
}
}
return ok;
}
EXPORT bool STDCALL WSFEv1_SetTicketAcceso(void *object, char *ta) {
PyObject *pValue;
char ok = false;
if (object != NULL) {
pValue = PyObject_CallMethod((PyObject *)object, "SetTicketAcceso", "s", ta);
//fprintf(stderr, "set TA call!!!\n");
if (pValue != NULL) {
ok = PyObject_IsTrue(pValue);
Py_DECREF(pValue);
} else {
PyErr_Print();
//fprintf(stderr,"Call failed\n");
}
}
return ok;
}
EXPORT long STDCALL WSFEv1_CompUltimoAutorizado(void *object, char *tipo_cbte, char *punto_vta) {
PyObject *pValue;
long nro = -1;
if (object != NULL) {
pValue = PyObject_CallMethod((PyObject *)object, "CompUltimoAutorizado", "(ss)", tipo_cbte, punto_vta);
if (pValue != NULL) {
nro = atol(PyString_AsString(pValue));
Py_DECREF(pValue);
} else {
PyErr_Print();
//fprintf(stderr,"Call failed\n");
}
}
return nro;
}