pixelpay_sdk 1.0.2 → 1.0.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/CHANGELOG.md +7 -0
- data/CONTRIBUTING.md +28 -1
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/pixelpay_sdk/exceptions/RunningTransactionException.rb +2 -0
- data/lib/pixelpay_sdk/libraries/RouterManager.rb +52 -0
- data/lib/pixelpay_sdk/request/PaymentTransaction.rb +4 -1
- data/lib/pixelpay_sdk/services/Transaction.rb +20 -2
- data/lib/pixelpay_sdk/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3fad8309071227abe8c5b9440d6ede64798fed39278bbcf9c3b9c34d415c0f0
|
4
|
+
data.tar.gz: f077574ba276639f53e92e75139c43de83741be6aec7e66dc9ad641c59279bb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7e3c0014095332a1150f864edf943b6f0c4d97d59af2fd411fd10cbd60538766fd95dcc84723caa4401f86e1f1559e5dcb0b562f1a9a980f5b3a3397c652f7c
|
7
|
+
data.tar.gz: ddbc8ad2636efa52dd36944cac62499dafb81badd69cb58446f96357448b8c117fe68179fc8797cea6778b8dd65ef1a78eba6ce3fb4dd556b7bd7c19b4fc2422
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ El formato se basa en [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
y este proyecto se adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
Tipos de cambios: `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`.
|
7
7
|
|
8
|
+
## [v1.0.3] - 2025-06-04
|
9
|
+
### Added
|
10
|
+
- Se agrego la configuración de router a las transacciones con `RouterManager`
|
11
|
+
- Campo source para `PaymentTransaction`
|
12
|
+
### Fixed
|
13
|
+
- Dato de tarjeta actualizado para testing
|
14
|
+
|
8
15
|
## [v1.0.2] - 2024-02-27
|
9
16
|
### Fixed
|
10
17
|
- Se arreglan códigos de estados en Nicaragua, Reino Unido, Estados Unidos, Guatemala, Panamá, Perú y Portugal
|
data/CONTRIBUTING.md
CHANGED
@@ -21,4 +21,31 @@ rake test TEST=test/requests/test_sale_transaction.rb
|
|
21
21
|
Ejecutar unit test en particular:
|
22
22
|
```bash
|
23
23
|
rake test TEST=test/models/test_billing.rb TESTOPTS="--name=test_empty_billing"
|
24
|
-
```
|
24
|
+
```
|
25
|
+
|
26
|
+
Otra opción para ejecutar test en particular:
|
27
|
+
```bash
|
28
|
+
ruby test/services/test_transaction.rb -n test_success_sale_transaction
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
## Preparación de entorno
|
33
|
+
|
34
|
+
El sistema macOS ya trae una versión de **Ruby** instalada, pero es posible que no sea completamente compatible con el **SDK**. Por ello, es mejor instalar otra versión.
|
35
|
+
|
36
|
+
1. Instalar Ruby Version Manager para gestionar versiones de Ruby: [RVM](https://rvm.io/).
|
37
|
+
2. Instalar la versión de ruby: ```rvm install 2.7.6 --with-openssl-dir=$(brew --prefix openssl@1.1) ```
|
38
|
+
3. Correr ```gem install bundler```
|
39
|
+
|
40
|
+
**Nota**: ```openssl@1.1``` ya deberia estar en homebrew. Revisar con ```brew list```. Si no está, instalarlo antes de ejecutar el paso 2.
|
41
|
+
|
42
|
+
**Opción alternativa**
|
43
|
+
Es posible que no se permita instalar ```openssl@1.1``` ya que fue deshabilitado por homebrew. En ese caso se puede utilizar otro manejador de versiones de **Ruby** como [rbenv](https://github.com/rbenv/rbenv).
|
44
|
+
|
45
|
+
Pasos de instalación:
|
46
|
+
|
47
|
+
1. brew install rbenv
|
48
|
+
2. rbenv install 2.7.6
|
49
|
+
3. rbenv global 2.7.6 (Configura la versión de Ruby por defecto de la computadora)
|
50
|
+
|
51
|
+
**Nota** Si se intento la instalación previa de RVM y no se puedo debido al elemento de **openssl@1.1**, comentar en archivo de variables de entorno .zshrc los elementos de RVM.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
Para obtener la versión del SDK de PixelPay con Ruby puedes utilizar este comando para instalar directamente:
|
6
6
|
|
7
7
|
``` bash
|
8
|
-
gem install pixelpay_sdk-1.0.
|
8
|
+
gem install pixelpay_sdk-1.0.3
|
9
9
|
```
|
10
10
|
|
11
11
|
O puedes colocar en el archivo Gemfile la siguiente línea:
|
12
12
|
``` bash
|
13
|
-
gem 'pixelpay_sdk', '~> 1.0.
|
13
|
+
gem 'pixelpay_sdk', '~> 1.0.3'
|
14
14
|
```
|
15
15
|
|
16
16
|
Y luego ejecutar:
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "json"
|
2
|
+
require "base64"
|
3
|
+
|
4
|
+
require_relative "../services/Transaction"
|
5
|
+
require_relative "../request/PaymentTransaction"
|
6
|
+
require_relative "../request/SaleTransaction"
|
7
|
+
require_relative "../models/Settings"
|
8
|
+
|
9
|
+
class RouterManager
|
10
|
+
attr_accessor :transaction, :identifier
|
11
|
+
|
12
|
+
def initialize(request)
|
13
|
+
# Payment transaction
|
14
|
+
@transaction = request
|
15
|
+
|
16
|
+
#Payment transaction source
|
17
|
+
@transaction.source = 'router'
|
18
|
+
|
19
|
+
# PixelPay transaction authentication identifier
|
20
|
+
@identifier = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
# Initialize manager
|
24
|
+
def init_manager(payload)
|
25
|
+
service = Transaction.new(parse_payload(payload))
|
26
|
+
|
27
|
+
if @transaction.is_a?(SaleTransaction)
|
28
|
+
return service.do_sale(@transaction);
|
29
|
+
else
|
30
|
+
return service.do_auth(@transaction)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Parse the payload string to Object Settings
|
35
|
+
def parse_payload(payload)
|
36
|
+
decoded_payload = Base64.decode64(payload)
|
37
|
+
obj_payload = JSON.parse(decoded_payload)
|
38
|
+
|
39
|
+
settings = Settings.new
|
40
|
+
|
41
|
+
settings.setup_environment(obj_payload["env"])
|
42
|
+
settings.setup_credentials(obj_payload["auth_key"], obj_payload["auth_hash"])
|
43
|
+
settings.setup_endpoint(obj_payload["endpoint"]);
|
44
|
+
settings.setup_language(@transaction.lang);
|
45
|
+
|
46
|
+
if obj_payload["auth_user"]
|
47
|
+
settings.setup_platform_user(obj_payload["auth_user"])
|
48
|
+
end
|
49
|
+
|
50
|
+
return settings
|
51
|
+
end
|
52
|
+
end
|
@@ -9,7 +9,7 @@ class PaymentTransaction < RequestBehaviour
|
|
9
9
|
:billing_country, :billing_state, :billing_city, :billing_zip, :billing_phone, :customer_name,
|
10
10
|
:customer_email, :order_id, :order_currency, :order_amount, :order_tax_amount, :order_shipping_amount,
|
11
11
|
:order_content, :order_extras, :order_note, :order_callback, :authentication_request,
|
12
|
-
:authentication_identifier
|
12
|
+
:authentication_identifier, :source
|
13
13
|
|
14
14
|
# Initialize request.
|
15
15
|
def initialize
|
@@ -89,6 +89,9 @@ class PaymentTransaction < RequestBehaviour
|
|
89
89
|
|
90
90
|
# Authentication transaction identifier
|
91
91
|
@authentication_identifier = nil
|
92
|
+
|
93
|
+
# Internal processing flow of the transaction (e.g. router, proxy, etc)
|
94
|
+
@source = nil
|
92
95
|
end
|
93
96
|
|
94
97
|
# Associate and mapping Card model properties to transaction.
|
@@ -6,7 +6,9 @@ require_relative "../request/StatusTransaction"
|
|
6
6
|
require_relative "../request/AuthTransaction"
|
7
7
|
require_relative "../request/CaptureTransaction"
|
8
8
|
require_relative "../request/VoidTransaction"
|
9
|
+
require_relative "../libraries/RouterManager"
|
9
10
|
require_relative "../exceptions/InvalidTransactionTypeException"
|
11
|
+
require_relative "../exceptions/RunningTransactionException"
|
10
12
|
|
11
13
|
# Transaction provides a specific structure for a transaction to be performed.
|
12
14
|
class Transaction < ServiceBehaviour
|
@@ -34,7 +36,15 @@ class Transaction < ServiceBehaviour
|
|
34
36
|
err = eval_authentication_transaction(transaction)
|
35
37
|
raise InvalidTransactionTypeException, err.message if err.instance_of?(InvalidTransactionTypeException)
|
36
38
|
|
37
|
-
post("api/v2/transaction/sale", transaction)
|
39
|
+
response = post("api/v2/transaction/sale", transaction)
|
40
|
+
|
41
|
+
if response.instance_of?(PayloadResponse)
|
42
|
+
if response.data["transaction_type"] == "router"
|
43
|
+
return RouterManager.new(transaction).init_manager(response.data["payload"])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
return response
|
38
48
|
rescue StandardError => e
|
39
49
|
e
|
40
50
|
end
|
@@ -50,7 +60,15 @@ class Transaction < ServiceBehaviour
|
|
50
60
|
err = eval_authentication_transaction(transaction)
|
51
61
|
raise InvalidTransactionTypeException, err.message if err.instance_of?(InvalidTransactionTypeException)
|
52
62
|
|
53
|
-
post("api/v2/transaction/auth", transaction)
|
63
|
+
response = post("api/v2/transaction/auth", transaction)
|
64
|
+
|
65
|
+
if response.instance_of?(PayloadResponse)
|
66
|
+
if response.data["transaction_type"] == "router"
|
67
|
+
return RouterManager.new(transaction).init_manager(response.data["payload"])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
return response
|
54
72
|
rescue StandardError => e
|
55
73
|
e
|
56
74
|
end
|
data/lib/pixelpay_sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixelpay_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sonia Villeda
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -40,6 +40,8 @@ files:
|
|
40
40
|
- lib/pixelpay_sdk/entities/TransactionResult.rb
|
41
41
|
- lib/pixelpay_sdk/exceptions/InvalidCredentialsException.rb
|
42
42
|
- lib/pixelpay_sdk/exceptions/InvalidTransactionTypeException.rb
|
43
|
+
- lib/pixelpay_sdk/exceptions/RunningTransactionException.rb
|
44
|
+
- lib/pixelpay_sdk/libraries/RouterManager.rb
|
43
45
|
- lib/pixelpay_sdk/models/Billing.rb
|
44
46
|
- lib/pixelpay_sdk/models/Card.rb
|
45
47
|
- lib/pixelpay_sdk/models/Item.rb
|