pixelpay_sdk 1.0.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d4b20a4b0077958eada69ed725caa66e324eb497a3973879e926b64cb95e32d
4
- data.tar.gz: e6fb746c133ae0941f0d6cd45adf0c539fc7298cf777ce655c87478a9d49c4a5
3
+ metadata.gz: f3fad8309071227abe8c5b9440d6ede64798fed39278bbcf9c3b9c34d415c0f0
4
+ data.tar.gz: f077574ba276639f53e92e75139c43de83741be6aec7e66dc9ad641c59279bb7
5
5
  SHA512:
6
- metadata.gz: b35dfea4cb2529de9caba5e9606ec48fcdf0dceb5ae28663306f52dd7d3aadc4f438d747b8055dc679fac03fe51bfbd0a7a62e67628e384e700f84bbb318054b
7
- data.tar.gz: a634ace97445adbb752999e160969fc050fe7e8ae2f710de39ef85b558e9a8bb60a650f8c621f49a5b1c02cae6e24bca7945097f9b1235acd65500c7a5fb01f1
6
+ metadata.gz: b7e3c0014095332a1150f864edf943b6f0c4d97d59af2fd411fd10cbd60538766fd95dcc84723caa4401f86e1f1559e5dcb0b562f1a9a980f5b3a3397c652f7c
7
+ data.tar.gz: ddbc8ad2636efa52dd36944cac62499dafb81badd69cb58446f96357448b8c117fe68179fc8797cea6778b8dd65ef1a78eba6ce3fb4dd556b7bd7c19b4fc2422
data/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ 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
+
15
+ ## [v1.0.2] - 2024-02-27
16
+ ### Fixed
17
+ - Se arreglan códigos de estados en Nicaragua, Reino Unido, Estados Unidos, Guatemala, Panamá, Perú y Portugal
18
+
8
19
  ## [1.0.1] - 2023-09-21
9
20
  ### Removed
10
21
  - Se elimina lógica de encriptación de datos de tarjeta.
data/CONTRIBUTING.md CHANGED
@@ -2,12 +2,9 @@
2
2
 
3
3
  ## ¿Como publicar?
4
4
 
5
- - Actualizar la versión en la constante `VERSION` de `lib/pixelpay_sdk/version.rb`.
6
- - Ejecutar los test una última vez para asegurar que todo funciona correctamente.
7
- ```
8
- rake test
9
- ```
10
5
  - Agregar al `CHANGELOG.md` las descripciones del cambio.
6
+ - Actualizar la versión en la constante `VERSION` de `lib/pixelpay_sdk/version.rb` y en `README.MD`
7
+ - Ejecutar los test para asegurar que todo funciona correctamente.
11
8
  - Crear un commit con los cambios, agregar una etiqueta con el número de versión y hacer push con los tags.
12
9
 
13
10
  ## Pruebas
@@ -24,4 +21,31 @@ rake test TEST=test/requests/test_sale_transaction.rb
24
21
  Ejecutar unit test en particular:
25
22
  ```bash
26
23
  rake test TEST=test/models/test_billing.rb TESTOPTS="--name=test_empty_billing"
27
- ```
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pixelpay_sdk (1.0.1)
4
+ pixelpay_sdk (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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.1
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.1'
13
+ gem 'pixelpay_sdk', '~> 1.0.3'
14
14
  ```
15
15
 
16
16
  Y luego ejecutar:
@@ -1116,28 +1116,28 @@
1116
1116
  "GU-YO": "Yona"
1117
1117
  },
1118
1118
  "GT": {
1119
- "GT-AV": "Alta Verapaz",
1120
- "GT-BV": "Baja Verapaz",
1121
- "GT-CM": "Chimaltenango",
1122
- "GT-CQ": "Chiquimula",
1123
- "GT-PR": "El Progreso",
1124
- "GT-ES": "Escuintla",
1125
- "GT-GU": "Guatemala",
1126
- "GT-HU": "Huehuetenango",
1127
- "GT-IZ": "Izabal",
1128
- "GT-JA": "Jalapa",
1129
- "GT-JU": "Jutiapa",
1130
- "GT-PE": "Peten",
1131
- "GT-QZ": "Quetzaltenango",
1132
- "GT-QC": "Quiche",
1133
- "GT-RE": "Retalhuleu",
1134
- "GT-SA": "Sacatepequez",
1135
- "GT-SM": "San Marcos",
1136
- "GT-SR": "Santa Rosa",
1137
- "GT-SO": "Solola",
1138
- "GT-SU": "Suchitepequez",
1139
- "GT-TO": "Totonicapan",
1140
- "GT-ZA": "Zacapa"
1119
+ "GT-16": "Alta Verapaz",
1120
+ "GT-15": "Baja Verapaz",
1121
+ "GT-04": "Chimaltenango",
1122
+ "GT-20": "Chiquimula",
1123
+ "GT-02": "El Progreso",
1124
+ "GT-05": "Escuintla",
1125
+ "GT-01": "Guatemala",
1126
+ "GT-13": "Huehuetenango",
1127
+ "GT-18": "Izabal",
1128
+ "GT-21": "Jalapa",
1129
+ "GT-22": "Jutiapa",
1130
+ "GT-17": "Peten",
1131
+ "GT-09": "Quetzaltenango",
1132
+ "GT-14": "Quiche",
1133
+ "GT-11": "Retalhuleu",
1134
+ "GT-03": "Sacatepequez",
1135
+ "GT-12": "San Marcos",
1136
+ "GT-06": "Santa Rosa",
1137
+ "GT-07": "Solola",
1138
+ "GT-10": "Suchitepequez",
1139
+ "GT-08": "Totonicapan",
1140
+ "GT-19": "Zacapa"
1141
1141
  },
1142
1142
  "GN": {
1143
1143
  "GN-BF": "Boffa",
@@ -2186,8 +2186,8 @@
2186
2186
  "NI-CA": "Carazo",
2187
2187
  "NI-CI": "Chinandega",
2188
2188
  "NI-CO": "Chontales",
2189
- "NI-CN": "Costa Caribe Norte",
2190
- "NI-CS": "Costa Caribe Sur",
2189
+ "NI-AN": "Costa Caribe Norte",
2190
+ "NI-AS": "Costa Caribe Sur",
2191
2191
  "NI-ES": "Esteli",
2192
2192
  "NI-GR": "Granada",
2193
2193
  "NI-JI": "Jinotega",
@@ -2309,6 +2309,7 @@
2309
2309
  "PK-SD": "Sindh"
2310
2310
  },
2311
2311
  "PA": {
2312
+ "PA-5": "Darien",
2312
2313
  "PA-1": "Bocas del Toro",
2313
2314
  "PA-4": "Chiriqui",
2314
2315
  "PA-2": "Cocle",
@@ -2317,9 +2318,10 @@
2317
2318
  "PA-7": "Los Santos",
2318
2319
  "PA-8": "Panama",
2319
2320
  "PA-9": "Veraguas",
2320
- "PA-13": "Panam\u00e1 Oeste",
2321
+ "PA-10": "Panam\u00e1 Oeste",
2321
2322
  "PA-EM": "Embera-Wounaan",
2322
2323
  "PA-KY": "Guna Yala",
2324
+ "PA-NT": "Naso Tjer Di",
2323
2325
  "PA-NB": "Ngobe-Bugle"
2324
2326
  },
2325
2327
  "PG": {
@@ -2379,6 +2381,7 @@
2379
2381
  "PE-LOR": "Loreto",
2380
2382
  "PE-MDD": "Madre de Dios",
2381
2383
  "PE-MOQ": "Moquegua",
2384
+ "PE-LMA": "Municipalidad Metropolitana de Lima",
2382
2385
  "PE-PAS": "Pasco",
2383
2386
  "PE-PIU": "Piura",
2384
2387
  "PE-PUN": "Puno",
@@ -2491,26 +2494,26 @@
2491
2494
  "PL-32": "Zachodniopomorskie"
2492
2495
  },
2493
2496
  "PT": {
2494
- "PT-AV": "Aveiro",
2495
- "PT-BE": "Beja",
2496
- "PT-BR": "Braga",
2497
- "PT-BA": "Braganza",
2498
- "PT-CB": "Castelo Branco",
2499
- "PT-CO": "Coimbra",
2500
- "PT-EV": "Evora",
2501
- "PT-FA": "Faro",
2502
- "PT-GU": "Guarda",
2503
- "PT-LE": "Leiria",
2504
- "PT-LI": "Lisboa",
2505
- "PT-PA": "Portalegre",
2506
- "PT-PO": "Porto",
2507
- "PT-SA": "Santarem",
2508
- "PT-SE": "Setubal",
2509
- "PT-VC": "Viana do Castelo",
2510
- "PT-VR": "Vila Real",
2511
- "PT-VI": "Viseu",
2512
- "PT-MA": "Regiao Autonoma da Madeira",
2513
- "PT-AC": "Regiao Autonoma dos Acores"
2497
+ "PT-01": "Aveiro",
2498
+ "PT-02": "Beja",
2499
+ "PT-03": "Braga",
2500
+ "PT-04": "Braganza",
2501
+ "PT-05": "Castelo Branco",
2502
+ "PT-06": "Coimbra",
2503
+ "PT-07": "Evora",
2504
+ "PT-08": "Faro",
2505
+ "PT-09": "Guarda",
2506
+ "PT-10": "Leiria",
2507
+ "PT-11": "Lisboa",
2508
+ "PT-12": "Portalegre",
2509
+ "PT-13": "Porto",
2510
+ "PT-14": "Santarem",
2511
+ "PT-15": "Setubal",
2512
+ "PT-16": "Viana do Castelo",
2513
+ "PT-17": "Vila Real",
2514
+ "PT-18": "Viseu",
2515
+ "PT-30": "Regiao Autonoma da Madeira",
2516
+ "PT-20": "Regiao Autonoma dos Acores"
2514
2517
  },
2515
2518
  "GW": {
2516
2519
  "GW-BS": "Bissau",
@@ -3723,10 +3726,223 @@
3723
3726
  "EG-SHG": "Suhaj"
3724
3727
  },
3725
3728
  "GB": {
3726
- "GB-ENG": "England",
3727
- "GB-NIR": "Northern Ireland",
3728
- "GB-SCT": "Scotland",
3729
- "GB-WLS": "Wales"
3729
+ "GB-CAM": "Cambridgeshire",
3730
+ "GB-CMA": "Cumbria",
3731
+ "GB-DBY": "Derbyshire",
3732
+ "GB-DEV": "Devon",
3733
+ "GB-DOR": "Dorset",
3734
+ "GB-ESX": "East Sussex",
3735
+ "GB-ESS": "Essex",
3736
+ "GB-GLS": "Gloucestershire",
3737
+ "GB-HAM": "Hampshire",
3738
+ "GB-HRT": "Hertfordshire",
3739
+ "GB-KEN": "Kent",
3740
+ "GB-LAN": "Lancashire",
3741
+ "GB-LEC": "Leicestershire",
3742
+ "GB-LIN": "Lincolnshire",
3743
+ "GB-NFK": "Norfolk",
3744
+ "GB-NYK": "North Yorkshire",
3745
+ "GB-NTT": "Nottinghamshire",
3746
+ "GB-OXF": "Oxfordshire",
3747
+ "GB-SOM": "Somerset",
3748
+ "GB-STS": "Staffordshire",
3749
+ "GB-SFK": "Suffolk",
3750
+ "GB-SRY": "Surrey",
3751
+ "GB-WAR": "Warwickshire",
3752
+ "GB-WSX": "West Sussex",
3753
+ "GB-WOR": "Worcestershire",
3754
+ "GB-LND": "London, City of",
3755
+ "GB-BDG": "Barking and Dagenham",
3756
+ "GB-BNE": "Barnet",
3757
+ "GB-BEX": "Bexley",
3758
+ "GB-BEN": "Brent",
3759
+ "GB-BRY": "Bromley",
3760
+ "GB-CMD": "Camden",
3761
+ "GB-CRY": "Croydon",
3762
+ "GB-EAL": "Ealing",
3763
+ "GB-ENF": "Enfield",
3764
+ "GB-GRE": "Greenwich",
3765
+ "GB-HCK": "Hackney",
3766
+ "GB-HMF": "Hammersmith and Fulham",
3767
+ "GB-HRY": "Haringey",
3768
+ "GB-HRW": "Harrow",
3769
+ "GB-HAV": "Havering",
3770
+ "GB-HIL": "Hillingdon",
3771
+ "GB-HNS": "Hounslow",
3772
+ "GB-ISL": "Islington",
3773
+ "GB-KEC": "Kensington and Chelsea",
3774
+ "GB-KTT": "Kingston upon Thames",
3775
+ "GB-LBH": "Lambeth",
3776
+ "GB-LEW": "Lewisham",
3777
+ "GB-MRT": "Merton",
3778
+ "GB-NWM": "Newham",
3779
+ "GB-RDB": "Redbridge",
3780
+ "GB-RIC": "Richmond upon Thames",
3781
+ "GB-SWK": "Southwark",
3782
+ "GB-STN": "Sutton",
3783
+ "GB-TWH": "Tower Hamlets",
3784
+ "GB-WFT": "Waltham Forest",
3785
+ "GB-WND": "Wandsworth",
3786
+ "GB-WSM": "Westminster",
3787
+ "GB-BNS": "Barnsley",
3788
+ "GB-BIR": "Birmingham",
3789
+ "GB-BOL": "Bolton",
3790
+ "GB-BRD": "Bradford",
3791
+ "GB-BUR": "Bury",
3792
+ "GB-CLD": "Calderdale",
3793
+ "GB-COV": "Coventry",
3794
+ "GB-DNC": "Doncaster",
3795
+ "GB-DUD": "Dudley",
3796
+ "GB-GAT": "Gateshead",
3797
+ "GB-KIR": "Kirklees",
3798
+ "GB-KWL": "Knowsley",
3799
+ "GB-LDS": "Leeds",
3800
+ "GB-LIV": "Liverpool",
3801
+ "GB-MAN": "Manchester",
3802
+ "GB-NET": "Newcastle upon Tyne",
3803
+ "GB-NTY": "North Tyneside",
3804
+ "GB-OLD": "Oldham",
3805
+ "GB-RCH": "Rochdale",
3806
+ "GB-ROT": "Rotherham",
3807
+ "GB-SHN": "St. Helens",
3808
+ "GB-SLF": "Salford",
3809
+ "GB-SAW": "Sandwell",
3810
+ "GB-SFT": "Sefton",
3811
+ "GB-SHF": "Sheffield",
3812
+ "GB-SOL": "Solihull",
3813
+ "GB-STY": "South Tyneside",
3814
+ "GB-SKP": "Stockport",
3815
+ "GB-SND": "Sunderland",
3816
+ "GB-TAM": "Tameside",
3817
+ "GB-TRF": "Trafford",
3818
+ "GB-WKF": "Wakefield",
3819
+ "GB-WLL": "Walsall",
3820
+ "GB-WGN": "Wigan",
3821
+ "GB-WRL": "Wirral",
3822
+ "GB-WLV": "Wolverhampton",
3823
+ "GB-BAS": "Bath and North East Somerset",
3824
+ "GB-BDF": "Bedford",
3825
+ "GB-BBD": "Blackburn with Darwen",
3826
+ "GB-BPL": "Blackpool",
3827
+ "GB-BCP": "Bournemouth, Christchurch and Poole",
3828
+ "GB-BRC": "Bracknell Forest",
3829
+ "GB-BNH": "Brighton and Hove",
3830
+ "GB-BST": "Bristol, City of",
3831
+ "GB-BKM": "Buckinghamshire",
3832
+ "GB-CBF": "Central Bedfordshire",
3833
+ "GB-CHE": "Cheshire East",
3834
+ "GB-CHW": "Cheshire West and Chester",
3835
+ "GB-CON": "Cornwall",
3836
+ "GB-DAL": "Darlington",
3837
+ "GB-DER": "Derby",
3838
+ "GB-DUR": "Durham, County",
3839
+ "GB-ERY": "East Riding of Yorkshire",
3840
+ "GB-HAL": "Halton",
3841
+ "GB-HPL": "Hartlepool",
3842
+ "GB-HEF": "Herefordshire",
3843
+ "GB-IOW": "Isle of Wight",
3844
+ "GB-IOS": "Isles of Scilly",
3845
+ "GB-KHL": "Kingston upon Hull",
3846
+ "GB-LCE": "Leicester",
3847
+ "GB-LUT": "Luton",
3848
+ "GB-MDW": "Medway",
3849
+ "GB-MDB": "Middlesbrough",
3850
+ "GB-MIK": "Milton Keynes",
3851
+ "GB-NEL": "North East Lincolnshire",
3852
+ "GB-NLN": "North Lincolnshire",
3853
+ "GB-NNH": "North Northamptonshire",
3854
+ "GB-NSM": "North Somerset",
3855
+ "GB-NBL": "Northumberland",
3856
+ "GB-NGM": "Nottingham",
3857
+ "GB-PTE": "Peterborough",
3858
+ "GB-PLY": "Plymouth",
3859
+ "GB-POR": "Portsmouth",
3860
+ "GB-RDG": "Reading",
3861
+ "GB-RCC": "Redcar and Cleveland",
3862
+ "GB-RUT": "Rutland",
3863
+ "GB-SHR": "Shropshire",
3864
+ "GB-SLG": "Slough",
3865
+ "GB-SGC": "South Gloucestershire",
3866
+ "GB-STH": "Southampton",
3867
+ "GB-SOS": "Southend-on-Sea",
3868
+ "GB-STT": "Stockton-on-Tees",
3869
+ "GB-STE": "Stoke-on-Trent",
3870
+ "GB-SWD": "Swindon",
3871
+ "GB-TFW": "Telford and Wrekin",
3872
+ "GB-THR": "Thurrock",
3873
+ "GB-TOB": "Torbay",
3874
+ "GB-WRT": "Warrington",
3875
+ "GB-WBK": "West Berkshire",
3876
+ "GB-WNH": "West Northamptonshire",
3877
+ "GB-WIL": "Wiltshire",
3878
+ "GB-WNM": "Windsor and Maidenhead",
3879
+ "GB-WOK": "Wokingham",
3880
+ "GB-YOR": "York",
3881
+ "GB-ANN": "Antrim and Newtownabbey",
3882
+ "GB-AND": "Ards and North Down",
3883
+ "GB-ABC": "Armagh City, Banbridge and Craigavon",
3884
+ "GB-BFS": "Belfast City",
3885
+ "GB-CCG": "Causeway Coast and Glens",
3886
+ "GB-DRS": "Derry and Strabane",
3887
+ "GB-FMO": "Fermanagh and Omagh",
3888
+ "GB-LBC": "Lisburn and Castlereagh",
3889
+ "GB-MEA": "Mid and East Antrim",
3890
+ "GB-MUL": "Mid-Ulster",
3891
+ "GB-NMD": "Newry, Mourne and Down",
3892
+ "GB-ABE": "Aberdeen City",
3893
+ "GB-ABD": "Aberdeenshire",
3894
+ "GB-ANS": "Angus",
3895
+ "GB-AGB": "Argyll and Bute",
3896
+ "GB-CLK": "Clackmannanshire",
3897
+ "GB-DGY": "Dumfries and Galloway",
3898
+ "GB-DND": "Dundee City",
3899
+ "GB-EAY": "East Ayrshire",
3900
+ "GB-EDU": "East Dunbartonshire",
3901
+ "GB-ELN": "East Lothian",
3902
+ "GB-ERW": "East Renfrewshire",
3903
+ "GB-EDH": "Edinburgh, City of",
3904
+ "GB-ELS": "Eilean Siar",
3905
+ "GB-FAL": "Falkirk",
3906
+ "GB-FIF": "Fife",
3907
+ "GB-GLG": "Glasgow City",
3908
+ "GB-HLD": "Highland",
3909
+ "GB-IVC": "Inverclyde",
3910
+ "GB-MLN": "Midlothian",
3911
+ "GB-MRY": "Moray",
3912
+ "GB-NAY": "North Ayrshire",
3913
+ "GB-NLK": "North Lanarkshire",
3914
+ "GB-ORK": "Orkney Islands",
3915
+ "GB-PKN": "Perth and Kinross",
3916
+ "GB-RFW": "Renfrewshire",
3917
+ "GB-SCB": "Scottish Borders",
3918
+ "GB-ZET": "Shetland Islands",
3919
+ "GB-SAY": "South Ayrshire",
3920
+ "GB-SLK": "South Lanarkshire",
3921
+ "GB-STG": "Stirling",
3922
+ "GB-WDU": "West Dunbartonshire",
3923
+ "GB-WLN": "West Lothian",
3924
+ "GB-BGW": "Blaenau Gwent",
3925
+ "GB-BGE": "Bridgend",
3926
+ "GB-CAY": "Caerphilly",
3927
+ "GB-CRF": "Cardiff",
3928
+ "GB-CMN": "Carmarthenshire",
3929
+ "GB-CGN": "Ceredigion",
3930
+ "GB-CWY": "Conwy",
3931
+ "GB-DEN": "Denbighshire",
3932
+ "GB-FLN": "Flintshire",
3933
+ "GB-GWN": "Gwynedd",
3934
+ "GB-AGY": "Isle of Anglesey",
3935
+ "GB-MTY": "Merthyr Tydfil",
3936
+ "GB-MON": "Monmouthshire",
3937
+ "GB-NTL": "Neath Port Talbot",
3938
+ "GB-NWP": "Newport",
3939
+ "GB-PEM": "Pembrokeshire",
3940
+ "GB-POW": "Powys",
3941
+ "GB-RCT": "Rhondda Cynon Taff",
3942
+ "GB-SWA": "Swansea",
3943
+ "GB-TOF": "Torfaen",
3944
+ "GB-VGL": "Vale of Glamorgan",
3945
+ "GB-WRX": "Wrexham"
3730
3946
  },
3731
3947
  "GG": {
3732
3948
  "GG-GR": "Guernsey"
@@ -3819,7 +4035,13 @@
3819
4035
  "US-WA": "Washington",
3820
4036
  "US-WV": "West Virginia",
3821
4037
  "US-WI": "Wisconsin",
3822
- "US-WY": "Wyoming"
4038
+ "US-WY": "Wyoming",
4039
+ "US-AS": "American Samoa",
4040
+ "US-GU": "Guam",
4041
+ "US-MP": "Northern Mariana Islands",
4042
+ "US-PR": "Puerto Rico",
4043
+ "US-UM": "United States Minor Outlying Islands",
4044
+ "US-VI": "Virgin Islands"
3823
4045
  },
3824
4046
  "VI": {
3825
4047
  "VI-SD": "Virgin Islands"
@@ -0,0 +1,2 @@
1
+ class RunningTransactionException < StandardError
2
+ end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PixelpaySdk
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.3"
5
5
  end
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.1
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: 2023-10-17 00:00:00.000000000 Z
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