TodoPagoConectorSS 1.8.0 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/issue_template.md +34 -0
- data/.gitignore +37 -0
- data/README.md +1553 -0
- data/TodoPago/DataProvider.rb +273 -0
- data/TodoPago/DiscoverPaymentMethodsTest.rb +71 -0
- data/TodoPago/GetAuthorizeAnswerTest.rb +61 -0
- data/TodoPago/GetCredentialsTest.rb +70 -0
- data/TodoPago/GetOperationsTest.rb +72 -0
- data/TodoPago/MockClient.rb +195 -0
- data/TodoPago/ReturnRequestTest.rb +64 -0
- data/TodoPago/SendAuthorizeRequestTest.rb +63 -0
- data/TodoPago/coverage/.last_run.json +5 -0
- data/TodoPago/coverage/.resultset.json +892 -0
- data/TodoPago/coverage/.resultset.json.lock +0 -0
- data/TodoPago/coverage/assets/0.10.0/application.css +799 -0
- data/TodoPago/coverage/assets/0.10.0/application.js +1707 -0
- data/TodoPago/coverage/assets/0.10.0/colorbox/border.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/colorbox/controls.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
- data/TodoPago/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/favicon_green.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/favicon_red.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/favicon_yellow.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/loading.gif +0 -0
- data/TodoPago/coverage/assets/0.10.0/magnify.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/TodoPago/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/TodoPago/coverage/index.html +5510 -0
- data/TodoPago/test.rb +203 -0
- data/TodoPago/test_validations.rb +108 -0
- data/TodoPago/tests_coverage.rb +11 -0
- data/TodoPagoConector.gemspec +14 -0
- data/lib/Authorize.wsdl +320 -0
- data/lib/Classes/user.rb +30 -0
- data/lib/Connectors/RestConnector.rb +65 -0
- data/lib/Connectors/ServiceConnector.rb +32 -0
- data/lib/Connectors/SoapConnector.rb +139 -0
- data/lib/Exceptions/connection_exception.rb +6 -0
- data/lib/Exceptions/empty_field_exception.rb +6 -0
- data/lib/Exceptions/empty_field_password_exception.rb +8 -0
- data/lib/Exceptions/empty_field_user_exception.rb +8 -0
- data/lib/Exceptions/prueba.rb +5 -0
- data/lib/Exceptions/response_exception.rb +6 -0
- data/lib/FraudControlValidation.rb +406 -0
- data/lib/Operations.wsdl +319 -0
- data/lib/ServiceReferences/Authorize.wsdl +320 -0
- data/lib/ServiceReferences/EchoService.wsdl +125 -0
- data/lib/ServiceReferences/Operations.wsdl +319 -0
- data/lib/Validation/FraudControlValidation.rb +406 -0
- data/lib/config/postalCodes.json +26 -0
- data/lib/config/validations.json +623 -0
- data/lib/prueba.rb +4 -0
- data/lib/user.rb +41 -0
- metadata +65 -1
@@ -0,0 +1,125 @@
|
|
1
|
+
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://ws.wso2.org/dataservice" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://ws.wso2.org/dataservice">
|
2
|
+
<wsdl:types>
|
3
|
+
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ws.wso2.org/dataservice">
|
4
|
+
<xs:element name="DataServiceFault">
|
5
|
+
<xs:complexType>
|
6
|
+
<xs:sequence>
|
7
|
+
<xs:element name="current_params" type="xs:string" />
|
8
|
+
<xs:element name="current_request_name" type="xs:string" />
|
9
|
+
<xs:element name="nested_exception" type="xs:string" />
|
10
|
+
<xs:element name="source_data_service">
|
11
|
+
<xs:complexType>
|
12
|
+
<xs:sequence>
|
13
|
+
<xs:element name="location" type="xs:string" />
|
14
|
+
<xs:element name="default_namespace" type="xs:string" />
|
15
|
+
<xs:element name="description" type="xs:string" />
|
16
|
+
<xs:element name="data_service_name" type="xs:string" />
|
17
|
+
</xs:sequence>
|
18
|
+
</xs:complexType>
|
19
|
+
</xs:element>
|
20
|
+
<xs:element name="ds_code" type="xs:string" />
|
21
|
+
</xs:sequence>
|
22
|
+
</xs:complexType>
|
23
|
+
</xs:element>
|
24
|
+
<xs:element name="REQUEST_STATUS" type="xs:string" />
|
25
|
+
<xs:element name="DATA_SERVICE_RESPONSE">
|
26
|
+
<xs:complexType>
|
27
|
+
<xs:sequence>
|
28
|
+
<xs:any minOccurs="0" />
|
29
|
+
</xs:sequence>
|
30
|
+
</xs:complexType>
|
31
|
+
</xs:element>
|
32
|
+
<xs:element name="echo_operation">
|
33
|
+
<xs:complexType>
|
34
|
+
<xs:sequence>
|
35
|
+
<xs:element name="message" nillable="true" type="xs:string" />
|
36
|
+
</xs:sequence>
|
37
|
+
</xs:complexType>
|
38
|
+
</xs:element>
|
39
|
+
<xs:element name="echo_response" type="ns0:echo_response" />
|
40
|
+
<xs:complexType name="echo_response">
|
41
|
+
<xs:sequence>
|
42
|
+
<xs:element minOccurs="0" name="response" nillable="true" type="xs:string" />
|
43
|
+
</xs:sequence>
|
44
|
+
</xs:complexType>
|
45
|
+
</xs:schema>
|
46
|
+
</wsdl:types>
|
47
|
+
<wsdl:message name="echo_operationRequest">
|
48
|
+
<wsdl:part name="parameters" element="ns0:echo_operation" />
|
49
|
+
</wsdl:message>
|
50
|
+
<wsdl:message name="echo_operationResponse">
|
51
|
+
<wsdl:part name="parameters" element="ns0:echo_response" />
|
52
|
+
</wsdl:message>
|
53
|
+
<wsdl:message name="DataServiceFault">
|
54
|
+
<wsdl:part name="parameters" element="ns0:DataServiceFault" />
|
55
|
+
</wsdl:message>
|
56
|
+
<wsdl:portType name="EchoServiceDSSPortType">
|
57
|
+
<wsdl:operation name="echo_operation">
|
58
|
+
<wsdl:input message="ns0:echo_operationRequest" wsaw:Action="urn:echo_operation" />
|
59
|
+
<wsdl:output message="ns0:echo_operationResponse" wsaw:Action="urn:echo_operationResponse" />
|
60
|
+
<wsdl:fault message="ns0:DataServiceFault" name="DataServiceFault" wsaw:Action="urn:echo_operationDataServiceFault" />
|
61
|
+
</wsdl:operation>
|
62
|
+
</wsdl:portType>
|
63
|
+
<wsdl:binding name="EchoServiceDSSSoap11Binding" type="ns0:EchoServiceDSSPortType">
|
64
|
+
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
|
65
|
+
<wsdl:operation name="echo_operation">
|
66
|
+
<soap:operation soapAction="urn:echo_operation" style="document" />
|
67
|
+
<wsdl:input>
|
68
|
+
<soap:body use="literal" />
|
69
|
+
</wsdl:input>
|
70
|
+
<wsdl:output>
|
71
|
+
<soap:body use="literal" />
|
72
|
+
</wsdl:output>
|
73
|
+
<wsdl:fault name="DataServiceFault">
|
74
|
+
<soap:fault use="literal" name="DataServiceFault" />
|
75
|
+
</wsdl:fault>
|
76
|
+
</wsdl:operation>
|
77
|
+
</wsdl:binding>
|
78
|
+
<wsdl:binding name="EchoServiceDSSSoap12Binding" type="ns0:EchoServiceDSSPortType">
|
79
|
+
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
|
80
|
+
<wsdl:operation name="echo_operation">
|
81
|
+
<soap12:operation soapAction="urn:echo_operation" style="document" />
|
82
|
+
<wsdl:input>
|
83
|
+
<soap12:body use="literal" />
|
84
|
+
</wsdl:input>
|
85
|
+
<wsdl:output>
|
86
|
+
<soap12:body use="literal" />
|
87
|
+
</wsdl:output>
|
88
|
+
<wsdl:fault name="DataServiceFault">
|
89
|
+
<soap12:fault use="literal" name="DataServiceFault" />
|
90
|
+
</wsdl:fault>
|
91
|
+
</wsdl:operation>
|
92
|
+
</wsdl:binding>
|
93
|
+
<wsdl:binding name="EchoServiceDSSHttpBinding" type="ns0:EchoServiceDSSPortType">
|
94
|
+
<http:binding verb="POST" />
|
95
|
+
<wsdl:operation name="echo_operation">
|
96
|
+
<http:operation location="echo_operation" />
|
97
|
+
<wsdl:input>
|
98
|
+
<mime:content type="text/xml" part="parameters" />
|
99
|
+
</wsdl:input>
|
100
|
+
<wsdl:output>
|
101
|
+
<mime:content type="text/xml" part="parameters" />
|
102
|
+
</wsdl:output>
|
103
|
+
</wsdl:operation>
|
104
|
+
</wsdl:binding>
|
105
|
+
<wsdl:service name="EchoServiceDSS">
|
106
|
+
<wsdl:port name="EchoServiceDSSHttpsSoap11Endpoint" binding="ns0:EchoServiceDSSSoap11Binding">
|
107
|
+
<soap:address location="https://10.123.4.71:8243/services/t/1.2/EchoServiceDSS.EchoServiceDSSHttpsSoap11Endpoint" />
|
108
|
+
</wsdl:port>
|
109
|
+
<wsdl:port name="EchoServiceDSSHttpSoap11Endpoint" binding="ns0:EchoServiceDSSSoap11Binding">
|
110
|
+
<soap:address location="http://10.123.4.71:8280/services/t/1.2/EchoServiceDSS.EchoServiceDSSHttpSoap11Endpoint" />
|
111
|
+
</wsdl:port>
|
112
|
+
<wsdl:port name="EchoServiceDSSHttpsSoap12Endpoint" binding="ns0:EchoServiceDSSSoap12Binding">
|
113
|
+
<soap12:address location="https://10.123.4.71:8243/services/t/1.2/EchoServiceDSS.EchoServiceDSSHttpsSoap12Endpoint" />
|
114
|
+
</wsdl:port>
|
115
|
+
<wsdl:port name="EchoServiceDSSHttpSoap12Endpoint" binding="ns0:EchoServiceDSSSoap12Binding">
|
116
|
+
<soap12:address location="http://10.123.4.71:8280/services/t/1.2/EchoServiceDSS.EchoServiceDSSHttpSoap12Endpoint" />
|
117
|
+
</wsdl:port>
|
118
|
+
<wsdl:port name="EchoServiceDSSHttpsEndpoint" binding="ns0:EchoServiceDSSHttpBinding">
|
119
|
+
<http:address location="https://10.123.4.71:8243/services/t/1.2/EchoServiceDSS.EchoServiceDSSHttpsEndpoint" />
|
120
|
+
</wsdl:port>
|
121
|
+
<wsdl:port name="EchoServiceDSSHttpEndpoint" binding="ns0:EchoServiceDSSHttpBinding">
|
122
|
+
<http:address location="http://10.123.4.71:8280/services/t/1.2/EchoServiceDSS.EchoServiceDSSHttpEndpoint" />
|
123
|
+
</wsdl:port>
|
124
|
+
</wsdl:service>
|
125
|
+
</wsdl:definitions>
|
@@ -0,0 +1,319 @@
|
|
1
|
+
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://ws.wso2.org/dataservice" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://api.todopago.com.ar" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://api.todopago.com.ar">
|
2
|
+
<wsdl:documentation>Servicio de Consulta de Operaciones o Transacciones </wsdl:documentation>
|
3
|
+
<wsdl:types>
|
4
|
+
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://api.todopago.com.ar">
|
5
|
+
<xs:element name="GetByRangeDateTime">
|
6
|
+
<xs:complexType>
|
7
|
+
<xs:sequence>
|
8
|
+
<xs:element name="MERCHANT" nillable="true" type="xs:string"/>
|
9
|
+
<xs:element name="STARTDATE" nillable="true" type="xs:date"/>
|
10
|
+
<xs:element name="ENDDATE" nillable="true" type="xs:date"/>
|
11
|
+
</xs:sequence>
|
12
|
+
</xs:complexType>
|
13
|
+
</xs:element>
|
14
|
+
<xs:element name="OperationsColections" type="ns0:OperationsColections"/>
|
15
|
+
<xs:complexType name="OperationsColections">
|
16
|
+
<xs:sequence>
|
17
|
+
<xs:element maxOccurs="unbounded" minOccurs="0" name="Operations" type="ns0:Operations"/>
|
18
|
+
</xs:sequence>
|
19
|
+
</xs:complexType>
|
20
|
+
<xs:complexType name="Operations">
|
21
|
+
<xs:sequence>
|
22
|
+
<xs:element name="RESULTCODE" nillable="true" type="xs:string"/>
|
23
|
+
<xs:element name="RESULTMESSAGE" nillable="true" type="xs:string"/>
|
24
|
+
<xs:element name="DATETIME" nillable="true" type="xs:dateTime"/>
|
25
|
+
<xs:element name="OPERATIONID" nillable="true" type="xs:string"/>
|
26
|
+
<xs:element name="CURRENCYCODE" nillable="true" type="xs:string"/>
|
27
|
+
<xs:element name="AMOUNT" nillable="true" type="xs:float"/>
|
28
|
+
<xs:element name="AMOUNTBUYER" nillable="true" type="xs:float"/>
|
29
|
+
<xs:element name="BANKID" nillable="true" type="xs:float"/>
|
30
|
+
<xs:element name="PROMOTIONID" nillable="true" type="xs:float"/>
|
31
|
+
<xs:element name="TYPE" nillable="true" type="xs:string"/>
|
32
|
+
<xs:element name="INSTALLMENTPAYMENTS" nillable="true" type="xs:string"/>
|
33
|
+
<xs:element name="CUSTOMEREMAIL" nillable="true" type="xs:string"/>
|
34
|
+
<xs:element name="IDENTIFICATIONTYPE" nillable="true" type="xs:string"/>
|
35
|
+
<xs:element name="IDENTIFICATION" nillable="true" type="xs:string"/>
|
36
|
+
<xs:element name="CARDNUMBER" nillable="true" type="xs:string"/>
|
37
|
+
<xs:element name="CARDHOLDERNAME" nillable="true" type="xs:string"/>
|
38
|
+
<xs:element name="TICKETNUMBER" nillable="true" type="xs:integer"/>
|
39
|
+
<xs:element name="AUTHORIZATIONCODE" nillable="true" type="xs:string"/>
|
40
|
+
<xs:element name="BARCODE" nillable="true" type="xs:string"/>
|
41
|
+
<xs:element name="COUPONEXPDATE" nillable="true" type="xs:string"/>
|
42
|
+
<xs:element name="COUPONSECEXPDATE" nillable="true" type="xs:string"/>
|
43
|
+
<xs:element name="COUPONSUBSCRIBER" nillable="true" type="xs:string"/>
|
44
|
+
<xs:element name="PAYMENTMETHODCODE" nillable="true" type="xs:string"/>
|
45
|
+
<xs:element name="PAYMENTMETHODNAME" nillable="true" type="xs:string"/>
|
46
|
+
<xs:element name="PAYMENTMETHODTYPE" nillable="true" type="xs:string"/>
|
47
|
+
<xs:element name="REFUNDED" nillable="true" type="xs:string"/>
|
48
|
+
</xs:sequence>
|
49
|
+
</xs:complexType>
|
50
|
+
<xs:element name="GetByOperationId">
|
51
|
+
<xs:complexType>
|
52
|
+
<xs:sequence>
|
53
|
+
<xs:element name="MERCHANT" nillable="true" type="xs:string"/>
|
54
|
+
<xs:element name="OPERATIONID" nillable="true" type="xs:string"/>
|
55
|
+
</xs:sequence>
|
56
|
+
</xs:complexType>
|
57
|
+
</xs:element>
|
58
|
+
<xs:element name="_getgetbyoperationid">
|
59
|
+
<xs:complexType>
|
60
|
+
<xs:sequence>
|
61
|
+
<xs:element name="MERCHANT" nillable="true" type="xs:string"/>
|
62
|
+
<xs:element name="OPERATIONID" nillable="true" type="xs:string"/>
|
63
|
+
</xs:sequence>
|
64
|
+
</xs:complexType>
|
65
|
+
</xs:element>
|
66
|
+
<xs:element name="_getgetbyrangedatetime">
|
67
|
+
<xs:complexType>
|
68
|
+
<xs:sequence>
|
69
|
+
<xs:element name="MERCHANT" nillable="true" type="xs:string"/>
|
70
|
+
<xs:element name="STARTDATE" nillable="true" type="xs:date"/>
|
71
|
+
<xs:element name="ENDDATE" nillable="true" type="xs:date"/>
|
72
|
+
</xs:sequence>
|
73
|
+
</xs:complexType>
|
74
|
+
</xs:element>
|
75
|
+
</xs:schema>
|
76
|
+
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ws.wso2.org/dataservice">
|
77
|
+
<xs:element name="DataServiceFault">
|
78
|
+
<xs:complexType>
|
79
|
+
<xs:sequence>
|
80
|
+
<xs:element name="current_params" type="xs:string"/>
|
81
|
+
<xs:element name="current_request_name" type="xs:string"/>
|
82
|
+
<xs:element name="nested_exception" type="xs:string"/>
|
83
|
+
<xs:element name="source_data_service">
|
84
|
+
<xs:complexType>
|
85
|
+
<xs:sequence>
|
86
|
+
<xs:element name="location" type="xs:string"/>
|
87
|
+
<xs:element name="default_namespace" type="xs:string"/>
|
88
|
+
<xs:element name="description" type="xs:string"/>
|
89
|
+
<xs:element name="data_service_name" type="xs:string"/>
|
90
|
+
</xs:sequence>
|
91
|
+
</xs:complexType>
|
92
|
+
</xs:element>
|
93
|
+
<xs:element name="ds_code" type="xs:string"/>
|
94
|
+
</xs:sequence>
|
95
|
+
</xs:complexType>
|
96
|
+
</xs:element>
|
97
|
+
<xs:element name="REQUEST_STATUS" type="xs:string"/>
|
98
|
+
<xs:element name="DATA_SERVICE_RESPONSE">
|
99
|
+
<xs:complexType>
|
100
|
+
<xs:sequence>
|
101
|
+
<xs:any minOccurs="0"/>
|
102
|
+
</xs:sequence>
|
103
|
+
</xs:complexType>
|
104
|
+
</xs:element>
|
105
|
+
</xs:schema>
|
106
|
+
</wsdl:types>
|
107
|
+
<wsdl:message name="_getgetbyrangedatetimeRequest">
|
108
|
+
<wsdl:part name="parameters" element="ns0:_getgetbyrangedatetime"/>
|
109
|
+
</wsdl:message>
|
110
|
+
<wsdl:message name="_getgetbyrangedatetimeResponse">
|
111
|
+
<wsdl:part name="parameters" element="ns0:OperationsColections"/>
|
112
|
+
</wsdl:message>
|
113
|
+
<wsdl:message name="DataServiceFault">
|
114
|
+
<wsdl:part name="parameters" element="ns1:DataServiceFault"/>
|
115
|
+
</wsdl:message>
|
116
|
+
<wsdl:message name="GetByRangeDateTimeRequest">
|
117
|
+
<wsdl:part name="parameters" element="ns0:GetByRangeDateTime"/>
|
118
|
+
</wsdl:message>
|
119
|
+
<wsdl:message name="GetByRangeDateTimeResponse">
|
120
|
+
<wsdl:part name="parameters" element="ns0:OperationsColections"/>
|
121
|
+
</wsdl:message>
|
122
|
+
<wsdl:message name="GetByOperationIdRequest">
|
123
|
+
<wsdl:part name="parameters" element="ns0:GetByOperationId"/>
|
124
|
+
</wsdl:message>
|
125
|
+
<wsdl:message name="GetByOperationIdResponse">
|
126
|
+
<wsdl:part name="parameters" element="ns0:OperationsColections"/>
|
127
|
+
</wsdl:message>
|
128
|
+
<wsdl:message name="_getgetbyoperationidRequest">
|
129
|
+
<wsdl:part name="parameters" element="ns0:_getgetbyoperationid"/>
|
130
|
+
</wsdl:message>
|
131
|
+
<wsdl:message name="_getgetbyoperationidResponse">
|
132
|
+
<wsdl:part name="parameters" element="ns0:OperationsColections"/>
|
133
|
+
</wsdl:message>
|
134
|
+
<wsdl:portType name="OperationsPortType">
|
135
|
+
<wsdl:operation name="_getgetbyrangedatetime">
|
136
|
+
<wsdl:input message="ns0:_getgetbyrangedatetimeRequest" wsaw:Action="urn:_getgetbyrangedatetime"/>
|
137
|
+
<wsdl:output message="ns0:_getgetbyrangedatetimeResponse" wsaw:Action="urn:_getgetbyrangedatetimeResponse"/>
|
138
|
+
<wsdl:fault message="ns0:DataServiceFault" name="DataServiceFault" wsaw:Action="urn:_getgetbyrangedatetimeDataServiceFault"/>
|
139
|
+
</wsdl:operation>
|
140
|
+
<wsdl:operation name="GetByRangeDateTime">
|
141
|
+
<wsdl:documentation>Consulta por Comercio y Fecha de Creacion</wsdl:documentation>
|
142
|
+
<wsdl:input message="ns0:GetByRangeDateTimeRequest" wsaw:Action="urn:GetByRangeDateTime"/>
|
143
|
+
<wsdl:output message="ns0:GetByRangeDateTimeResponse" wsaw:Action="urn:GetByRangeDateTimeResponse"/>
|
144
|
+
<wsdl:fault message="ns0:DataServiceFault" name="DataServiceFault" wsaw:Action="urn:GetByRangeDateTimeDataServiceFault"/>
|
145
|
+
</wsdl:operation>
|
146
|
+
<wsdl:operation name="GetByOperationId">
|
147
|
+
<wsdl:documentation>Consulta por id De Operacion y Comercio</wsdl:documentation>
|
148
|
+
<wsdl:input message="ns0:GetByOperationIdRequest" wsaw:Action="urn:GetByOperationId"/>
|
149
|
+
<wsdl:output message="ns0:GetByOperationIdResponse" wsaw:Action="urn:GetByOperationIdResponse"/>
|
150
|
+
<wsdl:fault message="ns0:DataServiceFault" name="DataServiceFault" wsaw:Action="urn:GetByOperationIdDataServiceFault"/>
|
151
|
+
</wsdl:operation>
|
152
|
+
<wsdl:operation name="_getgetbyoperationid">
|
153
|
+
<wsdl:input message="ns0:_getgetbyoperationidRequest" wsaw:Action="urn:_getgetbyoperationid"/>
|
154
|
+
<wsdl:output message="ns0:_getgetbyoperationidResponse" wsaw:Action="urn:_getgetbyoperationidResponse"/>
|
155
|
+
<wsdl:fault message="ns0:DataServiceFault" name="DataServiceFault" wsaw:Action="urn:_getgetbyoperationidDataServiceFault"/>
|
156
|
+
</wsdl:operation>
|
157
|
+
</wsdl:portType>
|
158
|
+
<wsdl:binding name="OperationsSoap11Binding" type="ns0:OperationsPortType">
|
159
|
+
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
|
160
|
+
<wsdl:operation name="_getgetbyrangedatetime">
|
161
|
+
<soap:operation soapAction="urn:_getgetbyrangedatetime" style="document"/>
|
162
|
+
<wsdl:input>
|
163
|
+
<soap:body use="literal"/>
|
164
|
+
</wsdl:input>
|
165
|
+
<wsdl:output>
|
166
|
+
<soap:body use="literal"/>
|
167
|
+
</wsdl:output>
|
168
|
+
<wsdl:fault name="DataServiceFault">
|
169
|
+
<soap:fault use="literal" name="DataServiceFault"/>
|
170
|
+
</wsdl:fault>
|
171
|
+
</wsdl:operation>
|
172
|
+
<wsdl:operation name="GetByRangeDateTime">
|
173
|
+
<soap:operation soapAction="urn:GetByRangeDateTime" style="document"/>
|
174
|
+
<wsdl:input>
|
175
|
+
<soap:body use="literal"/>
|
176
|
+
</wsdl:input>
|
177
|
+
<wsdl:output>
|
178
|
+
<soap:body use="literal"/>
|
179
|
+
</wsdl:output>
|
180
|
+
<wsdl:fault name="DataServiceFault">
|
181
|
+
<soap:fault use="literal" name="DataServiceFault"/>
|
182
|
+
</wsdl:fault>
|
183
|
+
</wsdl:operation>
|
184
|
+
<wsdl:operation name="GetByOperationId">
|
185
|
+
<soap:operation soapAction="urn:GetByOperationId" style="document"/>
|
186
|
+
<wsdl:input>
|
187
|
+
<soap:body use="literal"/>
|
188
|
+
</wsdl:input>
|
189
|
+
<wsdl:output>
|
190
|
+
<soap:body use="literal"/>
|
191
|
+
</wsdl:output>
|
192
|
+
<wsdl:fault name="DataServiceFault">
|
193
|
+
<soap:fault use="literal" name="DataServiceFault"/>
|
194
|
+
</wsdl:fault>
|
195
|
+
</wsdl:operation>
|
196
|
+
<wsdl:operation name="_getgetbyoperationid">
|
197
|
+
<soap:operation soapAction="urn:_getgetbyoperationid" style="document"/>
|
198
|
+
<wsdl:input>
|
199
|
+
<soap:body use="literal"/>
|
200
|
+
</wsdl:input>
|
201
|
+
<wsdl:output>
|
202
|
+
<soap:body use="literal"/>
|
203
|
+
</wsdl:output>
|
204
|
+
<wsdl:fault name="DataServiceFault">
|
205
|
+
<soap:fault use="literal" name="DataServiceFault"/>
|
206
|
+
</wsdl:fault>
|
207
|
+
</wsdl:operation>
|
208
|
+
</wsdl:binding>
|
209
|
+
<wsdl:binding name="OperationsSoap12Binding" type="ns0:OperationsPortType">
|
210
|
+
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
|
211
|
+
<wsdl:operation name="_getgetbyrangedatetime">
|
212
|
+
<soap12:operation soapAction="urn:_getgetbyrangedatetime" style="document"/>
|
213
|
+
<wsdl:input>
|
214
|
+
<soap12:body use="literal"/>
|
215
|
+
</wsdl:input>
|
216
|
+
<wsdl:output>
|
217
|
+
<soap12:body use="literal"/>
|
218
|
+
</wsdl:output>
|
219
|
+
<wsdl:fault name="DataServiceFault">
|
220
|
+
<soap12:fault use="literal" name="DataServiceFault"/>
|
221
|
+
</wsdl:fault>
|
222
|
+
</wsdl:operation>
|
223
|
+
<wsdl:operation name="GetByRangeDateTime">
|
224
|
+
<soap12:operation soapAction="urn:GetByRangeDateTime" style="document"/>
|
225
|
+
<wsdl:input>
|
226
|
+
<soap12:body use="literal"/>
|
227
|
+
</wsdl:input>
|
228
|
+
<wsdl:output>
|
229
|
+
<soap12:body use="literal"/>
|
230
|
+
</wsdl:output>
|
231
|
+
<wsdl:fault name="DataServiceFault">
|
232
|
+
<soap12:fault use="literal" name="DataServiceFault"/>
|
233
|
+
</wsdl:fault>
|
234
|
+
</wsdl:operation>
|
235
|
+
<wsdl:operation name="GetByOperationId">
|
236
|
+
<soap12:operation soapAction="urn:GetByOperationId" style="document"/>
|
237
|
+
<wsdl:input>
|
238
|
+
<soap12:body use="literal"/>
|
239
|
+
</wsdl:input>
|
240
|
+
<wsdl:output>
|
241
|
+
<soap12:body use="literal"/>
|
242
|
+
</wsdl:output>
|
243
|
+
<wsdl:fault name="DataServiceFault">
|
244
|
+
<soap12:fault use="literal" name="DataServiceFault"/>
|
245
|
+
</wsdl:fault>
|
246
|
+
</wsdl:operation>
|
247
|
+
<wsdl:operation name="_getgetbyoperationid">
|
248
|
+
<soap12:operation soapAction="urn:_getgetbyoperationid" style="document"/>
|
249
|
+
<wsdl:input>
|
250
|
+
<soap12:body use="literal"/>
|
251
|
+
</wsdl:input>
|
252
|
+
<wsdl:output>
|
253
|
+
<soap12:body use="literal"/>
|
254
|
+
</wsdl:output>
|
255
|
+
<wsdl:fault name="DataServiceFault">
|
256
|
+
<soap12:fault use="literal" name="DataServiceFault"/>
|
257
|
+
</wsdl:fault>
|
258
|
+
</wsdl:operation>
|
259
|
+
</wsdl:binding>
|
260
|
+
<wsdl:binding name="OperationsHttpBinding" type="ns0:OperationsPortType">
|
261
|
+
<http:binding verb="POST"/>
|
262
|
+
<wsdl:operation name="_getgetbyrangedatetime">
|
263
|
+
<http:operation location="_getgetbyrangedatetime"/>
|
264
|
+
<wsdl:input>
|
265
|
+
<mime:content type="text/xml" part="parameters"/>
|
266
|
+
</wsdl:input>
|
267
|
+
<wsdl:output>
|
268
|
+
<mime:content type="text/xml" part="parameters"/>
|
269
|
+
</wsdl:output>
|
270
|
+
</wsdl:operation>
|
271
|
+
<wsdl:operation name="GetByRangeDateTime">
|
272
|
+
<http:operation location="GetByRangeDateTime"/>
|
273
|
+
<wsdl:input>
|
274
|
+
<mime:content type="text/xml" part="parameters"/>
|
275
|
+
</wsdl:input>
|
276
|
+
<wsdl:output>
|
277
|
+
<mime:content type="text/xml" part="parameters"/>
|
278
|
+
</wsdl:output>
|
279
|
+
</wsdl:operation>
|
280
|
+
<wsdl:operation name="GetByOperationId">
|
281
|
+
<http:operation location="GetByOperationId"/>
|
282
|
+
<wsdl:input>
|
283
|
+
<mime:content type="text/xml" part="parameters"/>
|
284
|
+
</wsdl:input>
|
285
|
+
<wsdl:output>
|
286
|
+
<mime:content type="text/xml" part="parameters"/>
|
287
|
+
</wsdl:output>
|
288
|
+
</wsdl:operation>
|
289
|
+
<wsdl:operation name="_getgetbyoperationid">
|
290
|
+
<http:operation location="_getgetbyoperationid"/>
|
291
|
+
<wsdl:input>
|
292
|
+
<mime:content type="text/xml" part="parameters"/>
|
293
|
+
</wsdl:input>
|
294
|
+
<wsdl:output>
|
295
|
+
<mime:content type="text/xml" part="parameters"/>
|
296
|
+
</wsdl:output>
|
297
|
+
</wsdl:operation>
|
298
|
+
</wsdl:binding>
|
299
|
+
<wsdl:service name="Operations">
|
300
|
+
<wsdl:port name="OperationsHttpsSoap11Endpoint" binding="ns0:OperationsSoap11Binding">
|
301
|
+
<soap:address location="https://10.123.4.121:8243/services/t/1.1/Operations.OperationsHttpsSoap11Endpoint"/>
|
302
|
+
</wsdl:port>
|
303
|
+
<wsdl:port name="OperationsHttpSoap11Endpoint" binding="ns0:OperationsSoap11Binding">
|
304
|
+
<soap:address location="http://10.123.4.121:8280/services/t/1.1/Operations.OperationsHttpSoap11Endpoint"/>
|
305
|
+
</wsdl:port>
|
306
|
+
<wsdl:port name="OperationsHttpsSoap12Endpoint" binding="ns0:OperationsSoap12Binding">
|
307
|
+
<soap12:address location="https://10.123.4.121:8243/services/t/1.1/Operations.OperationsHttpsSoap12Endpoint"/>
|
308
|
+
</wsdl:port>
|
309
|
+
<wsdl:port name="OperationsHttpSoap12Endpoint" binding="ns0:OperationsSoap12Binding">
|
310
|
+
<soap12:address location="http://10.123.4.121:8280/services/t/1.1/Operations.OperationsHttpSoap12Endpoint"/>
|
311
|
+
</wsdl:port>
|
312
|
+
<wsdl:port name="OperationsHttpsEndpoint" binding="ns0:OperationsHttpBinding">
|
313
|
+
<http:address location="https://10.123.4.121:8243/services/t/1.1/Operations.OperationsHttpsEndpoint"/>
|
314
|
+
</wsdl:port>
|
315
|
+
<wsdl:port name="OperationsHttpEndpoint" binding="ns0:OperationsHttpBinding">
|
316
|
+
<http:address location="http://10.123.4.121:8280/services/t/1.1/Operations.OperationsHttpEndpoint"/>
|
317
|
+
</wsdl:port>
|
318
|
+
</wsdl:service>
|
319
|
+
</wsdl:definitions>
|
@@ -0,0 +1,406 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require "json"
|
3
|
+
|
4
|
+
CONST_CSITPRODUCTDESCRIPTION = 'CSITPRODUCTDESCRIPTION'
|
5
|
+
CSBTSTATE = "CSBTSTATE"
|
6
|
+
NUMERAL = "#"
|
7
|
+
FIELD = "field"
|
8
|
+
VALIDATE = "validate"
|
9
|
+
FORMAT = "format"
|
10
|
+
FUNCTION = "function"
|
11
|
+
MESSAGE = "message"
|
12
|
+
PARAMS = "params"
|
13
|
+
DEFAULT = "default"
|
14
|
+
MIN_LENGTH = 20
|
15
|
+
MAX_CHARS = 254
|
16
|
+
URL_VALIDATION_JSON = "../lib/config/validations.json"
|
17
|
+
URL_POSTALCODES_JSON = "../lib/config/postalCodes.json"
|
18
|
+
#########################################
|
19
|
+
# => Validation Class for Fraud Control
|
20
|
+
###########################################
|
21
|
+
class FraudControlValidation
|
22
|
+
# @url = "../validations.json"
|
23
|
+
# @file = File.read(@url)
|
24
|
+
# @data_hash = JSON.parse(file)
|
25
|
+
|
26
|
+
attr_accessor :data_hash , :postalcodes_hash, :csit_hash, :campError, :parameters
|
27
|
+
|
28
|
+
def initialize()
|
29
|
+
|
30
|
+
file_validations = File.read(URL_VALIDATION_JSON)
|
31
|
+
@data_hash = JSON.parse(file_validations)
|
32
|
+
|
33
|
+
file_postalcodes = File.read(URL_POSTALCODES_JSON)
|
34
|
+
@postalcodes_hash = JSON.parse(file_postalcodes)
|
35
|
+
|
36
|
+
@csit_hash = Hash.new
|
37
|
+
@campError = Hash.new
|
38
|
+
@parameters = Hash.new
|
39
|
+
end
|
40
|
+
############################################################
|
41
|
+
# => @boolean: notEmpty => true , empty => false
|
42
|
+
############################################################
|
43
|
+
def notEmpty(str)
|
44
|
+
strResult = str.strip
|
45
|
+
return ( strResult.length > 0 )? true:false
|
46
|
+
end
|
47
|
+
############################################################
|
48
|
+
# => @string: clean special chars
|
49
|
+
############################################################
|
50
|
+
def clean(str)
|
51
|
+
return str.gsub(/([.*+?^${}()|\[\]\/\\])/, '')
|
52
|
+
end
|
53
|
+
############################################################
|
54
|
+
# => @string: truncate string to @max characters
|
55
|
+
############################################################
|
56
|
+
def truncate(str, max)
|
57
|
+
lim = 0.. + max.to_i
|
58
|
+
return str[lim]
|
59
|
+
end
|
60
|
+
############################################################
|
61
|
+
# => Hardcode value to set
|
62
|
+
############################################################
|
63
|
+
def hardcode(strHardCode)
|
64
|
+
return strHardCode
|
65
|
+
end
|
66
|
+
############################################################
|
67
|
+
# => Generate random ID
|
68
|
+
############################################################
|
69
|
+
def random()
|
70
|
+
return (0...8).map { (1 + rand(9)) }.join
|
71
|
+
end
|
72
|
+
############################################################
|
73
|
+
# => Validate with regular Expression
|
74
|
+
############################################################
|
75
|
+
def regex? (str, regExp)
|
76
|
+
( str =~ '/\A('+ regExp + ')\Z/is' )==0
|
77
|
+
end
|
78
|
+
|
79
|
+
def email? (str)
|
80
|
+
(str =~ /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z])+$/)==0
|
81
|
+
end
|
82
|
+
|
83
|
+
def ip? (str)
|
84
|
+
(str =~ /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/)==0
|
85
|
+
end
|
86
|
+
|
87
|
+
def totalAmount? (str)
|
88
|
+
(str =~ /^([0-9]{0,12}).([0-9]{0,2})$/)==0
|
89
|
+
end
|
90
|
+
|
91
|
+
def isBoolean? (str)
|
92
|
+
(str =~ /^[YySsNn]$/)==0
|
93
|
+
end
|
94
|
+
|
95
|
+
def phone? (str)
|
96
|
+
(str =~ /[0-9]/)==0
|
97
|
+
end
|
98
|
+
|
99
|
+
def word? (str)
|
100
|
+
(str =~ /[\w]/)==0
|
101
|
+
end
|
102
|
+
|
103
|
+
def upper (str)
|
104
|
+
return str.upcase
|
105
|
+
end
|
106
|
+
|
107
|
+
def phoneSanitize ( phoneNumber )
|
108
|
+
phoneNumber = phoneNumber.gsub(' ', '')
|
109
|
+
phoneNumber = phoneNumber.gsub(/([+()-])/,'')
|
110
|
+
|
111
|
+
if ( phoneNumber[0..1] == "54")
|
112
|
+
return phoneNumber
|
113
|
+
end
|
114
|
+
if ( phoneNumber[0..1] == "15")
|
115
|
+
phoneNumber = phoneNumber[2, phoneNumber.length]
|
116
|
+
end
|
117
|
+
if ( phoneNumber.length == 8 )
|
118
|
+
return "5411" + phoneNumber
|
119
|
+
end
|
120
|
+
if (phoneNumber[0] == "0" )
|
121
|
+
return "54" + phoneNumber[1, phoneNumber.length]
|
122
|
+
end
|
123
|
+
return "54" + phoneNumber
|
124
|
+
end
|
125
|
+
|
126
|
+
def findState ( field, strState )
|
127
|
+
s = 'C'
|
128
|
+
if (strState && (strState.strip != ''))
|
129
|
+
s = strState[0]
|
130
|
+
elsif (!@parameters['CSBTSTATE'][0].nil? && (@parameters['CSBTSTATE'][0].strip != '') )
|
131
|
+
s = @parameters['CSBTSTATE'][0]
|
132
|
+
end
|
133
|
+
s = s.upcase
|
134
|
+
|
135
|
+
return @postalcodes_hash[s]
|
136
|
+
end
|
137
|
+
|
138
|
+
############################################################
|
139
|
+
# => Load csi Values into csiHash
|
140
|
+
############################################################
|
141
|
+
def loadCsit (field , value)
|
142
|
+
@csit_hash[field] = value
|
143
|
+
return value
|
144
|
+
end
|
145
|
+
|
146
|
+
###########################################################################
|
147
|
+
# => Min chars of ProductDescription = 20
|
148
|
+
# => If length > size , ommit lastest elements until adjust to given size
|
149
|
+
###########################################################################
|
150
|
+
def cutDescription(values, size)
|
151
|
+
result = ''
|
152
|
+
arrayValues = Hash.new
|
153
|
+
arrayValues = values.split(NUMERAL)
|
154
|
+
aux = ''
|
155
|
+
count = arrayValues.length
|
156
|
+
x = (size / count) - 1
|
157
|
+
|
158
|
+
if (x >= 20)
|
159
|
+
arrayValues.each do |value|
|
160
|
+
aux = truncate(value.strip, x) + NUMERAL
|
161
|
+
result = result + aux
|
162
|
+
end
|
163
|
+
else
|
164
|
+
cantProduct = (size / 21)-1
|
165
|
+
for i in(0..cantProduct)
|
166
|
+
aux = truncate(arrayValues[i].strip, (MIN_LENGTH - 1)) + NUMERAL
|
167
|
+
result = result + aux
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
result = result[0, result.length - 1]
|
172
|
+
|
173
|
+
return result
|
174
|
+
end
|
175
|
+
|
176
|
+
def genericCutCsit(values, cant)
|
177
|
+
result = ""
|
178
|
+
arrayValues = values.split(NUMERAL)
|
179
|
+
aux = ''
|
180
|
+
|
181
|
+
for i in(0..arrayValues.length)
|
182
|
+
if (i < cant)
|
183
|
+
aux = truncate(arrayValues[i].strip, (MIN_LENGTH - 1) ) + NUMERAL
|
184
|
+
result = result + aux
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
result = result[0, result.length - 1]
|
189
|
+
|
190
|
+
return result
|
191
|
+
end
|
192
|
+
|
193
|
+
def addError(field, message)
|
194
|
+
|
195
|
+
if(self.campError[field].nil?)
|
196
|
+
self.campError[field] = ' * ' + message
|
197
|
+
else
|
198
|
+
self.campError[field] = self.campError[field] + ' * ' + message
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
############################################################
|
203
|
+
# => Format csi Values into csiHash
|
204
|
+
############################################################
|
205
|
+
def csitFormat(size)
|
206
|
+
mapResult = Hash.new
|
207
|
+
value = nil
|
208
|
+
sizeDescription = 0
|
209
|
+
|
210
|
+
if (!@csit_hash[CONST_CSITPRODUCTDESCRIPTION].nil?)
|
211
|
+
|
212
|
+
value = @csit_hash[CONST_CSITPRODUCTDESCRIPTION]
|
213
|
+
value = cutDescription(value, size)
|
214
|
+
|
215
|
+
aux = value.split(NUMERAL)
|
216
|
+
sizeDescription = aux.length
|
217
|
+
|
218
|
+
@csit_hash.each do |key , val|
|
219
|
+
mapResult[key] = genericCutCsit(val, sizeDescription)
|
220
|
+
end
|
221
|
+
else
|
222
|
+
addError(CONST_CSITPRODUCTDESCRIPTION , 'CSIT Product description está vacio')
|
223
|
+
end
|
224
|
+
|
225
|
+
return mapResult
|
226
|
+
end
|
227
|
+
############################################################
|
228
|
+
# => main validation process
|
229
|
+
############################################################
|
230
|
+
def validate (parameters)
|
231
|
+
@parameters = parameters
|
232
|
+
resultMap = Hash.new
|
233
|
+
begin
|
234
|
+
parameters.each do |field , value|
|
235
|
+
resultMap[field]= self.validateAndFormat(field , value)
|
236
|
+
end
|
237
|
+
# csitformat elements from @csit_hash
|
238
|
+
csitResult = csitFormat(254)
|
239
|
+
csitResult.each do |field , value|
|
240
|
+
resultMap[field]= value
|
241
|
+
end
|
242
|
+
return resultMap
|
243
|
+
rescue Exception=>e
|
244
|
+
e.message
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
###
|
249
|
+
# => get validate item from field
|
250
|
+
###
|
251
|
+
def getValidateItem(field)
|
252
|
+
item = nil
|
253
|
+
@data_hash.each do |value|
|
254
|
+
if (value['field']==field)
|
255
|
+
item = value
|
256
|
+
break
|
257
|
+
end
|
258
|
+
end
|
259
|
+
return item
|
260
|
+
end
|
261
|
+
############################################################
|
262
|
+
# => Validation and format process for each field
|
263
|
+
############################################################
|
264
|
+
def validateAndFormat(field , value)
|
265
|
+
|
266
|
+
item = getValidateItem(field)
|
267
|
+
|
268
|
+
# VALIDATE Value
|
269
|
+
if (!item['validate'].nil? )
|
270
|
+
item['validate'].each do |elem|
|
271
|
+
paramsValidate = Hash.new
|
272
|
+
paramsValidate['str'] = value
|
273
|
+
paramsValidate['field'] = field
|
274
|
+
|
275
|
+
if (!elem['params'].nil? )
|
276
|
+
paramsValidate['parameters'] = elem['params']
|
277
|
+
end
|
278
|
+
|
279
|
+
result = self.executeFunction(elem['function'], paramsValidate )
|
280
|
+
|
281
|
+
# if is empty and required
|
282
|
+
if (!result && (elem['function'] == 'notEmpty') )
|
283
|
+
if(item['required'])
|
284
|
+
if (!elem['default'].nil? )
|
285
|
+
value = self.executeFunction(elem['default'], paramsValidate )
|
286
|
+
elsif (!elem['message'].nil? )
|
287
|
+
|
288
|
+
addError(field, elem['message'])
|
289
|
+
else
|
290
|
+
addError(field, 'El valor de este campo esta vacio o es invalido')
|
291
|
+
end
|
292
|
+
end
|
293
|
+
elsif (!result && (elem['function'] != 'notEmpty') )
|
294
|
+
if(item['required'])
|
295
|
+
if (!elem['default'].nil? )
|
296
|
+
value = self.executeFunction(elem['default'], paramsValidate )
|
297
|
+
elsif (!elem['message'].nil? )
|
298
|
+
# 'notify field error'
|
299
|
+
addError(field, elem['message'])
|
300
|
+
else
|
301
|
+
addError(field, 'El valor de este campo esta vacio o es invalido')
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
|
310
|
+
# FORMAT Value
|
311
|
+
if (!item['format'].nil? )
|
312
|
+
|
313
|
+
item['format'].each do |elem|
|
314
|
+
|
315
|
+
paramsFormat = Hash.new
|
316
|
+
paramsFormat['str'] = value
|
317
|
+
if (!elem['params'].nil? )
|
318
|
+
paramsFormat['parameters'] = elem['params']
|
319
|
+
end
|
320
|
+
if (elem['function'] == 'csitFormat')
|
321
|
+
paramsFormat['field'] = field
|
322
|
+
end
|
323
|
+
|
324
|
+
value = self.executeFunction(elem['function'], paramsFormat)
|
325
|
+
|
326
|
+
if (!elem['default'].nil? )
|
327
|
+
value = self.executeFunction(elem['default'], paramsFormat )
|
328
|
+
elsif (!elem['message'].nil? )
|
329
|
+
# notify field error
|
330
|
+
addError(field, elem['message'])
|
331
|
+
end
|
332
|
+
|
333
|
+
end
|
334
|
+
|
335
|
+
end
|
336
|
+
|
337
|
+
return value
|
338
|
+
|
339
|
+
end
|
340
|
+
############################################################
|
341
|
+
# => Execute @functionName with @params and return result
|
342
|
+
############################################################
|
343
|
+
def executeFunction(functionName, params)
|
344
|
+
case functionName
|
345
|
+
when 'notEmpty'
|
346
|
+
return self.notEmpty(params['str'])
|
347
|
+
when 'clean'
|
348
|
+
return self.clean(params['str'])
|
349
|
+
when 'truncate'
|
350
|
+
return self.truncate(params['str'], params['parameters'][0])
|
351
|
+
when 'hardcode'
|
352
|
+
return self.hardcode(params['parameters'][0])
|
353
|
+
when 'random'
|
354
|
+
return self.random()
|
355
|
+
when 'regex'
|
356
|
+
#puts params['parameters'][0]
|
357
|
+
return self.regex? params['str'], params['parameters'][0]
|
358
|
+
when 'email'
|
359
|
+
#puts params['parameters'][0]
|
360
|
+
return self.email? params['str'].strip
|
361
|
+
when 'ip'
|
362
|
+
#puts params['parameters'][0]
|
363
|
+
return self.ip? params['str'].strip
|
364
|
+
when 'totalAmount'
|
365
|
+
#puts params['parameters'][0]
|
366
|
+
return self.totalAmount? params['str'].strip
|
367
|
+
when 'boolean'
|
368
|
+
#puts params['parameters'][0]
|
369
|
+
return self.isBoolean? params['str'].strip
|
370
|
+
when 'phone'
|
371
|
+
#puts params['parameters'][0]
|
372
|
+
return self.phone? params['str']
|
373
|
+
when 'phoneSanitize'
|
374
|
+
#puts params['parameters'][0]
|
375
|
+
return self.phoneSanitize( params['str'] )
|
376
|
+
when 'word'
|
377
|
+
return self.word? params['str'].strip
|
378
|
+
when 'upper'
|
379
|
+
return self.upper( params['str'] )
|
380
|
+
when 'findState'
|
381
|
+
return self.findState( params['field'], params['str'] )
|
382
|
+
when 'csitFormat'
|
383
|
+
return loadCsit( params['field'], params['str'])
|
384
|
+
when 'N'
|
385
|
+
return self.hardcode("N")
|
386
|
+
when 'C'
|
387
|
+
return self.hardcode("C")
|
388
|
+
else
|
389
|
+
addError(functionName, 'no se encontro implementacion para este método ')
|
390
|
+
return false
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
394
|
+
end
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|