cuenta_digital 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +140 -2
- data/lib/cuenta_digital/coupon.rb +2 -1
- data/lib/cuenta_digital/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31c08fb44e5fc556fc0c5cf7cbd612d6a7e5955e16f3315ec0ff1ec202db82e6
|
4
|
+
data.tar.gz: 24fa1ea6fdd39cea7a19a1f2d8aaba63e00622bec077a126ff5752ee98452fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 901f7d23cf7df8116104be5fd9772f05ed54ec921b98feab45b8891409a841140dd7a5b8266f2ffedf5fe208574fdca443dbd8249ac8dbb143f28cce597dfa02
|
7
|
+
data.tar.gz: d6075f7d615b8c81b43747d3dc9e666e33c1db2109c2f7bdd1a9ee993d3e22c8f7de69328378beed56f39072f8a64a699e21f395c77ac3fa3eebe8a2ba2fc175
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cuenta_digital`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
|
-
|
5
|
+
Gem for cuenta digital api service
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,145 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### Coupon
|
26
|
+
|
27
|
+
#### Atributes
|
28
|
+
|
29
|
+
- **id**: CuentaDigital Number.
|
30
|
+
- **price**: The amount to be charged (It must include cents with 2 digits) e.g: 17.23. greater than 5.00
|
31
|
+
- **first_due_date**: Days from the current date until the coupon expires. (Optional)
|
32
|
+
- **site**: Your site or company name.
|
33
|
+
- **code**: Payment reference for integration with your systems, reference of the seller. (The reference can not exceed a maximum of 50 alphanumeric characters).
|
34
|
+
- **email_from**: sender coupon. (Optional)
|
35
|
+
- **email_to**: receiver email. (Optional)
|
36
|
+
- **concept**: Coupon legend.
|
37
|
+
- **currency**: ISO Code e.g ejemplos: :ars, :clp, :rbl, :mxn, :usd, :eur.
|
38
|
+
- **key_hash**: secret key for coupons integration. (Optional)
|
39
|
+
- **price_second_due_date**: The amount to be charged after first due date (It must include cents with 2 digits) e.g: 17.23. (Optional)
|
40
|
+
- **second_due_date**: Days from the current date until the coupon expires. (Optional)
|
41
|
+
- **m0**: Enable all available payments service. 0: disabled 1: enabled. Default: '0'. (Optional)
|
42
|
+
- **m2**: Use service credit card. 0: disabled 1: enabled. Default: '0'. (Optional)
|
43
|
+
- **m4**: Use cash (RapiPago, PagoFacil, etc) and LinkPagos. 0: disabled 1: enabled. Default: '1'. (Optional)
|
44
|
+
|
45
|
+
#### Example
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
coupon = CuentaDigital::Coupon.new(id: '643232',
|
49
|
+
price: 15.00,
|
50
|
+
first_due_date: 10,
|
51
|
+
site: 'Zorchalandia',
|
52
|
+
code: 'IPA',
|
53
|
+
email_from: 'admin@zorcha.com',
|
54
|
+
email_to: zorcha@zorcha.com',
|
55
|
+
concept: 'Pay me now',
|
56
|
+
currency: :ars)
|
57
|
+
```
|
58
|
+
|
59
|
+
#### Generate Coupon
|
60
|
+
|
61
|
+
Options:
|
62
|
+
|
63
|
+
- **xml**: Use **xml** or **http**. Default: true
|
64
|
+
- **wget**: Use **wget** or `Net::HTTP`. Default: false
|
65
|
+
|
66
|
+
This method return `CuentaDigital::Response` object
|
67
|
+
|
68
|
+
```
|
69
|
+
-> response = coupon.generate() # xml: true, wget: false
|
70
|
+
-> response = coupon.generate(xml: false) # xml: false, wget: false
|
71
|
+
-> response = coupon.generate(wget: true) # xml: true, wget: true
|
72
|
+
```
|
73
|
+
|
74
|
+
#### Optional methods
|
75
|
+
|
76
|
+
- **valid?**: If a valid cupoun.
|
77
|
+
- **generated?**: coupon generated on CuentaDigital
|
78
|
+
- **response**: `CuentaDigital::Response`
|
79
|
+
- **params**: params to use in `generate` method
|
80
|
+
|
81
|
+
### Response
|
82
|
+
|
83
|
+
- **request**:
|
84
|
+
- **action**:
|
85
|
+
- **merchant_id**: CuentaDigital Number
|
86
|
+
- **ipaddress**: Client ip
|
87
|
+
- **payment_code_1**: Bar code number
|
88
|
+
- **payment_code_2**: Code red LinkPagos
|
89
|
+
- **payment_code_3**: Field reserved
|
90
|
+
- **payment_code_4**: Field reserved
|
91
|
+
- **payment_code_5**: Field reserved
|
92
|
+
- **payment_code_6**: Field reserved
|
93
|
+
- **payment_code_7**: Field reserved
|
94
|
+
- **payment_code_8**; Field reserved
|
95
|
+
- **payment_code_9**: Field reserved
|
96
|
+
- **payment_code_10**: Field reserved
|
97
|
+
- **barcode_image**: Bar code image URL
|
98
|
+
- **barcode_base_64**: Bar code imagen in base24
|
99
|
+
- **invoice_url**: coupon URL
|
100
|
+
- **site**: Your site or company name.
|
101
|
+
- **merchant_reference**: Payment reference for integration with your systems, reference of the seller. (The reference can not exceed a maximum of 50 alphanumeric characters).(Used in code attribute in model Coupon)
|
102
|
+
- **concept**: Coupon legend.
|
103
|
+
- **curr**: Currency
|
104
|
+
- **amount**: Amount
|
105
|
+
- **second_amount**: Second Amount
|
106
|
+
- **date**: Generation date
|
107
|
+
- **due_date**: First due duate
|
108
|
+
- **second_due_date**: Second due date
|
109
|
+
- **email_to**: send to.
|
110
|
+
- **country**: Country (ISO Code)
|
111
|
+
- **lang**: Language (ISO Code)
|
112
|
+
- **error**:
|
113
|
+
- **exception**:
|
114
|
+
|
115
|
+
### Payment
|
116
|
+
|
117
|
+
#### Attributes
|
118
|
+
|
119
|
+
- **operation_kind**
|
120
|
+
- **payment_date**
|
121
|
+
- **gross_amount**
|
122
|
+
- **net_amount**
|
123
|
+
- **commission**
|
124
|
+
- **reference**
|
125
|
+
- **payment_method**
|
126
|
+
- **operation_id**
|
127
|
+
- **payment_number**
|
128
|
+
- **checksum**
|
129
|
+
- **operation_event_number**
|
130
|
+
- **bar_code**
|
131
|
+
|
132
|
+
#### Methods
|
133
|
+
|
134
|
+
- [class method] `process_webhook`:
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
CuentaDigital::Payment.process_webhook(csv) # String csv separated by ','
|
138
|
+
```
|
139
|
+
|
140
|
+
return arrays of `CuentaDigital::Payment`
|
141
|
+
|
142
|
+
- [class method] `request`. Only get transactions completed
|
143
|
+
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
CuentaDigital::Payment.request(control:, date: Time.now, from: nil, to: nil, opts: { wget: false, sandbox: false })
|
147
|
+
```
|
148
|
+
|
149
|
+
- **control**: this ID appears in https://www.cuentadigital.com/area.php?name=Exportacion
|
150
|
+
- **date**: Day to check
|
151
|
+
- **from**: from a specific time. Default: beginning of day
|
152
|
+
- **to**: to a specific time. Default: end of day
|
153
|
+
- **opts**:
|
154
|
+
- **wget**: Use **wget** or `Net::HTTP`. Default: false.
|
155
|
+
- **sandbod**: Use sandbox tool.
|
156
|
+
|
157
|
+
return arrays of `CuentaDigital::Payment`
|
158
|
+
|
159
|
+
#### Example
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
CuentaDigital::Payment.request(control: 'e9161bfccfba345237fb1311b890203f', date: Time.new(2019, 07, 01), opts: { wget: false, sandbox: true })
|
163
|
+
```
|
26
164
|
|
27
165
|
## Development
|
28
166
|
|
@@ -5,7 +5,7 @@ module CuentaDigital
|
|
5
5
|
ATTRIBUTES_PRECENSE = %i[id price first_due_date code concept currency].freeze
|
6
6
|
|
7
7
|
attr_accessor :id, # Su numero de CuentaDigital
|
8
|
-
:site,
|
8
|
+
:site, # Nombre de la company
|
9
9
|
:price, # El monto a cobrar (Debe de incluir 2 cifras adicionales que indicaran los centavos)
|
10
10
|
:first_due_date, # Dias desde la fecha actual hasta el vencimiento del cupon
|
11
11
|
:code, # Codigo para referencia del pago para integracion con sus sistemas, referencia del vendedor. (La referencia no puede superar el maximo de 50 caracteres alfanumericos)
|
@@ -84,6 +84,7 @@ module CuentaDigital
|
|
84
84
|
@response_code = partial_response.code
|
85
85
|
@response_body = partial_response.body
|
86
86
|
end
|
87
|
+
response
|
87
88
|
rescue => e
|
88
89
|
if retries < 3
|
89
90
|
retries += 1
|