WooCommerce MercadoPago - Version 3.1.0

Version Description

Download this release

Release Info

Developer mercadopago
Plugin Icon 128x128 WooCommerce MercadoPago
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.17 to 3.1.0

Files changed (107) hide show
  1. assets/css/custom_checkout_mercadopago.css +0 -0
  2. assets/images/MCO/CUPOM_MCO.jpg +0 -0
  3. assets/images/MCO/MCO.png +0 -0
  4. assets/images/MCO/banner_all_methods.png +0 -0
  5. assets/images/MCO/credit_card.png +0 -0
  6. assets/images/MCO/standard_mco.jpg +0 -0
  7. assets/images/MLA/CUPOM_MLA.jpg +0 -0
  8. assets/images/MLA/MLA.png +0 -0
  9. assets/images/MLA/banner_all_methods.png +0 -0
  10. assets/images/MLA/credit_card.png +0 -0
  11. assets/images/MLA/standard_mla.jpg +0 -0
  12. assets/images/MLB/CUPOM_MLB.jpg +0 -0
  13. assets/images/MLB/MLB.png +0 -0
  14. assets/images/MLB/banner_all_methods.png +0 -0
  15. assets/images/MLB/credit_card.png +0 -0
  16. assets/images/MLB/cupom1.jpg +0 -0
  17. assets/images/MLB/cupom2.jpg +0 -0
  18. assets/images/MLB/cupom3.jpg +0 -0
  19. assets/images/MLB/desconto_MLB.jpg +0 -0
  20. assets/images/MLB/standard_mlb.jpg +0 -0
  21. assets/images/MLC/CUPOM_MLC.jpg +0 -0
  22. assets/images/MLC/MLC.png +0 -0
  23. assets/images/MLC/banner_all_methods.png +0 -0
  24. assets/images/MLC/credit_card.png +0 -0
  25. assets/images/MLC/standard_mlc.gif +0 -0
  26. assets/images/MLM/CUPOM_MLM.jpg +0 -0
  27. assets/images/MLM/MLM.png +0 -0
  28. assets/images/MLM/banner_all_methods.png +0 -0
  29. assets/images/MLM/credit_card.png +0 -0
  30. assets/images/MLM/standard_mlm.jpg +0 -0
  31. assets/images/MLU/CUPOM_MLU.png +0 -0
  32. assets/images/MLU/MLU.png +0 -0
  33. assets/images/MLU/banner_all_methods.png +0 -0
  34. assets/images/MLU/credit_card.png +0 -0
  35. assets/images/MLU/standard_mlu.png +0 -0
  36. assets/images/MLV/CUPOM_MLV.jpg +0 -0
  37. assets/images/MLV/MLV.png +0 -0
  38. assets/images/MLV/banner_all_methods.png +0 -0
  39. assets/images/MLV/credit_card.png +0 -0
  40. assets/images/MLV/standard_mlv.jpg +0 -0
  41. assets/images/MPE/CUPOM_MPE.png +0 -0
  42. assets/images/MPE/MPE.png +0 -0
  43. assets/images/MPE/banner_all_methods.png +0 -0
  44. assets/images/MPE/credit_card.png +0 -0
  45. assets/images/MPE/standard_mpe.png +0 -0
  46. assets/images/bandeiras/amex.png +0 -0
  47. assets/images/bandeiras/boleto.png +0 -0
  48. assets/images/bandeiras/cash.png +0 -0
  49. assets/images/bandeiras/diners.png +0 -0
  50. assets/images/bandeiras/elo.png +0 -0
  51. assets/images/bandeiras/hipercard.png +0 -0
  52. assets/images/bandeiras/master.png +0 -0
  53. assets/images/bandeiras/melicard.png +0 -0
  54. assets/images/bandeiras/visa.png +0 -0
  55. assets/images/banner.png +0 -0
  56. assets/images/bar_code.png +0 -0
  57. assets/images/boleto.png +0 -0
  58. assets/images/cart.png +0 -0
  59. assets/images/check.png +0 -0
  60. assets/images/credit_card.png +0 -0
  61. assets/images/cvv.png +0 -0
  62. assets/images/error.png +0 -0
  63. assets/images/loading.gif +0 -0
  64. assets/images/mercadopago.png +0 -0
  65. assets/images/mplogo.png +0 -0
  66. assets/images/warning.png +0 -0
  67. assets/js/credit-card.js +0 -0
  68. assets/js/ticket.js +0 -0
  69. i18n/languages/woocommerce-mercadopago-es_AR.mo +0 -0
  70. i18n/languages/woocommerce-mercadopago-es_AR.po +4 -16
  71. i18n/languages/woocommerce-mercadopago-es_CL.mo +0 -0
  72. i18n/languages/woocommerce-mercadopago-es_CL.po +4 -16
  73. i18n/languages/woocommerce-mercadopago-es_CO.mo +0 -0
  74. i18n/languages/woocommerce-mercadopago-es_CO.po +4 -16
  75. i18n/languages/woocommerce-mercadopago-es_ES.mo +0 -0
  76. i18n/languages/woocommerce-mercadopago-es_ES.po +4 -16
  77. i18n/languages/woocommerce-mercadopago-es_MX.mo +0 -0
  78. i18n/languages/woocommerce-mercadopago-es_MX.po +4 -16
  79. i18n/languages/woocommerce-mercadopago-es_PE.mo +0 -0
  80. i18n/languages/woocommerce-mercadopago-es_PE.po +4 -16
  81. i18n/languages/woocommerce-mercadopago-es_UY.mo +0 -0
  82. i18n/languages/woocommerce-mercadopago-es_UY.po +4 -16
  83. i18n/languages/woocommerce-mercadopago-es_VE.mo +0 -0
  84. i18n/languages/woocommerce-mercadopago-es_VE.po +4 -16
  85. i18n/languages/woocommerce-mercadopago-pt_BR.mo +0 -0
  86. i18n/languages/woocommerce-mercadopago-pt_BR.po +4 -16
  87. i18n/languages/woocommerce-mercadopago.pot +2 -14
  88. includes/WC_WooMercadoPago_BasicGateway.php +26 -28
  89. includes/WC_WooMercadoPago_CustomGateway.php +3 -3
  90. includes/WC_WooMercadoPago_PSEGateway.php +3 -3
  91. includes/WC_WooMercadoPago_SubscriptionGateway.php +28 -30
  92. includes/WC_WooMercadoPago_TicketGateway.php +0 -0
  93. includes/admin/class-wc-mercadoenvios-admin-orders.php +2 -7
  94. includes/class-wc-product-mp_recurrent.php +0 -0
  95. includes/sdk/lib/cacert.pem +0 -0
  96. includes/sdk/lib/mercadopago.php +1 -1
  97. includes/shipment/abstract-wc-mercadoenvios-shipping.php +23 -17
  98. includes/shipment/class-wc-mercadoenvios-package.php +0 -0
  99. includes/shipment/class-wc-mercadoenvios-shipping-express.php +0 -0
  100. includes/shipment/class-wc-mercadoenvios-shipping-normal.php +0 -0
  101. readme.txt +8 -2
  102. templates/credit-card/payment-form.php +0 -0
  103. templates/mp_main_settings.php +2 -47
  104. templates/pse/pse-form.php +0 -0
  105. templates/ticket/ticket-form.php +0 -0
  106. templates/woocommerce-altas.html +0 -0
  107. woocommerce-mercadopago.php +67 -165
assets/css/custom_checkout_mercadopago.css CHANGED
File without changes
assets/images/MCO/CUPOM_MCO.jpg CHANGED
File without changes
assets/images/MCO/MCO.png CHANGED
File without changes
assets/images/MCO/banner_all_methods.png CHANGED
File without changes
assets/images/MCO/credit_card.png CHANGED
File without changes
assets/images/MCO/standard_mco.jpg CHANGED
File without changes
assets/images/MLA/CUPOM_MLA.jpg CHANGED
File without changes
assets/images/MLA/MLA.png CHANGED
File without changes
assets/images/MLA/banner_all_methods.png CHANGED
File without changes
assets/images/MLA/credit_card.png CHANGED
File without changes
assets/images/MLA/standard_mla.jpg CHANGED
File without changes
assets/images/MLB/CUPOM_MLB.jpg CHANGED
File without changes
assets/images/MLB/MLB.png CHANGED
File without changes
assets/images/MLB/banner_all_methods.png CHANGED
File without changes
assets/images/MLB/credit_card.png CHANGED
File without changes
assets/images/MLB/cupom1.jpg CHANGED
File without changes
assets/images/MLB/cupom2.jpg CHANGED
File without changes
assets/images/MLB/cupom3.jpg CHANGED
File without changes
assets/images/MLB/desconto_MLB.jpg CHANGED
File without changes
assets/images/MLB/standard_mlb.jpg CHANGED
File without changes
assets/images/MLC/CUPOM_MLC.jpg CHANGED
File without changes
assets/images/MLC/MLC.png CHANGED
File without changes
assets/images/MLC/banner_all_methods.png CHANGED
File without changes
assets/images/MLC/credit_card.png CHANGED
File without changes
assets/images/MLC/standard_mlc.gif CHANGED
File without changes
assets/images/MLM/CUPOM_MLM.jpg CHANGED
File without changes
assets/images/MLM/MLM.png CHANGED
File without changes
assets/images/MLM/banner_all_methods.png CHANGED
File without changes
assets/images/MLM/credit_card.png CHANGED
File without changes
assets/images/MLM/standard_mlm.jpg CHANGED
File without changes
assets/images/MLU/CUPOM_MLU.png CHANGED
File without changes
assets/images/MLU/MLU.png CHANGED
File without changes
assets/images/MLU/banner_all_methods.png CHANGED
File without changes
assets/images/MLU/credit_card.png CHANGED
File without changes
assets/images/MLU/standard_mlu.png CHANGED
File without changes
assets/images/MLV/CUPOM_MLV.jpg CHANGED
File without changes
assets/images/MLV/MLV.png CHANGED
File without changes
assets/images/MLV/banner_all_methods.png CHANGED
File without changes
assets/images/MLV/credit_card.png CHANGED
File without changes
assets/images/MLV/standard_mlv.jpg CHANGED
File without changes
assets/images/MPE/CUPOM_MPE.png CHANGED
File without changes
assets/images/MPE/MPE.png CHANGED
File without changes
assets/images/MPE/banner_all_methods.png CHANGED
File without changes
assets/images/MPE/credit_card.png CHANGED
File without changes
assets/images/MPE/standard_mpe.png CHANGED
File without changes
assets/images/bandeiras/amex.png CHANGED
File without changes
assets/images/bandeiras/boleto.png CHANGED
File without changes
assets/images/bandeiras/cash.png CHANGED
File without changes
assets/images/bandeiras/diners.png CHANGED
File without changes
assets/images/bandeiras/elo.png CHANGED
File without changes
assets/images/bandeiras/hipercard.png CHANGED
File without changes
assets/images/bandeiras/master.png CHANGED
File without changes
assets/images/bandeiras/melicard.png CHANGED
File without changes
assets/images/bandeiras/visa.png CHANGED
File without changes
assets/images/banner.png CHANGED
File without changes
assets/images/bar_code.png CHANGED
File without changes
assets/images/boleto.png CHANGED
File without changes
assets/images/cart.png CHANGED
File without changes
assets/images/check.png CHANGED
File without changes
assets/images/credit_card.png CHANGED
File without changes
assets/images/cvv.png CHANGED
File without changes
assets/images/error.png CHANGED
File without changes
assets/images/loading.gif CHANGED
File without changes
assets/images/mercadopago.png CHANGED
File without changes
assets/images/mplogo.png CHANGED
File without changes
assets/images/warning.png CHANGED
File without changes
assets/js/credit-card.js CHANGED
File without changes
assets/js/ticket.js CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_AR.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_AR.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Ticket"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure su Client_id y Client_secret para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>válidos</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pago"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Suscripciones"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Personalizado & Tickets"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Inserta su Client_id de Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Inserta su" Client_secret de Mercado Pago.
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversión de Moneda"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Suscripciones"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversión de Moneda"
i18n/languages/woocommerce-mercadopago-es_CL.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_CL.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Ticket"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure su Client_id y Client_secret para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>válidos</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pago"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Suscripciones"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Personalizado & Tickets"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Inserta su Client_id de Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Inserta su" Client_secret de Mercado Pago.
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversión de Moneda"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Suscripciones"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversión de Moneda"
i18n/languages/woocommerce-mercadopago-es_CO.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_CO.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Ticket"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure su Client_id y Client_secret para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>válidos</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pago"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Suscripciones"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Personalizado & Tickets"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Inserta su Client_id de Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Inserta su" Client_secret de Mercado Pago.
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversión de Moneda"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Suscripciones"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversión de Moneda"
i18n/languages/woocommerce-mercadopago-es_ES.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_ES.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Ticket"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure su Client_id y Client_secret para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>válidos</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pago"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Suscripciones"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Personalizado & Tickets"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Inserta su Client_id de Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Inserta su" Client_secret de Mercado Pago.
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversión de Moneda"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Suscripciones"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversión de Moneda"
i18n/languages/woocommerce-mercadopago-es_MX.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_MX.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Ticket"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure su Client_id y Client_secret para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>válidos</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pago"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Suscripciones"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Personalizado & Tickets"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Inserta su Client_id de Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Inserta su" Client_secret de Mercado Pago.
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversión de Moneda"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Suscripciones"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversión de Moneda"
i18n/languages/woocommerce-mercadopago-es_PE.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_PE.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Ticket"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure su Client_id y Client_secret para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>válidos</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pago"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Suscripciones"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Personalizado & Tickets"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Inserta su Client_id de Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Inserta su" Client_secret de Mercado Pago.
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversión de Moneda"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Suscripciones"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversión de Moneda"
i18n/languages/woocommerce-mercadopago-es_UY.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_UY.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Ticket"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure su Client_id y Client_secret para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>válidos</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pago"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Suscripciones"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Personalizado & Tickets"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Inserta su Client_id de Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Inserta su" Client_secret de Mercado Pago.
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversión de Moneda"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Suscripciones"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversión de Moneda"
i18n/languages/woocommerce-mercadopago-es_VE.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-es_VE.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Ticket"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure su Client_id y Client_secret para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>válidos</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Su <strong>client_id</strong> y <strong>client_secret</strong> son <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pago"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Suscripciones"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Personalizado & Tickets"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Inserta su Client_id de Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Inserta su" Client_secret de Mercado Pago.
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversión de Moneda"
121
  msgid "Subscription"
122
  msgstr "Suscripción"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qué tipo de productos se vende en su tienda."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciales se utilizan en <strong>Checkout Básico</strong> y <strong>Suscripciones</strong>. Acceda este para su país en:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Suscripciones"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversión de Moneda"
i18n/languages/woocommerce-mercadopago-pt_BR.mo CHANGED
File without changes
i18n/languages/woocommerce-mercadopago-pt_BR.po CHANGED
@@ -121,18 +121,12 @@ msgstr "Boletos"
121
  msgid "Subscription"
122
  msgstr "Assinaturas"
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
- msgstr "Configure seu Client_id e Client_secret para ter acesso a mais opções."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qual o tipo dos produtos que sua loja vende."
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr "Sua <strong>client_id</strong> e <strong>client_secret</strong> são <strong>válidas</strong> para"
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr "Sua <strong>client_id</strong> e <strong>client_secret</strong> são <strong>inválidas</strong>!"
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr "Estas credenciais são usadas no <strong>Checkout Básico</strong> e <strong>Assinaturas</strong>. Acesse elas para seu país:<br>"
138
 
@@ -157,14 +151,8 @@ msgstr "Gateways de Pagamento"
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr "Checkout Básico & Assinaturas"
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr "Checkout Transparente & Boletos"
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr "Insira seu Client_id do Mercado Pago."
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
- msgstr "Insira seu Client_secret do Mercado Pago."
168
 
169
  msgid "Currency Conversion"
170
  msgstr "Conversão de Moeda"
121
  msgid "Subscription"
122
  msgstr "Assinaturas"
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
+ msgstr "Configure su Public_key y Access_token para tener acceso a más opciones."
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr "Defina qual o tipo dos produtos que sua loja vende."
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr "Estas credenciais são usadas no <strong>Checkout Básico</strong> e <strong>Assinaturas</strong>. Acesse elas para seu país:<br>"
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr "Checkout Básico & Assinaturas"
153
 
154
+ msgid "Your Credentials of Mercado Pago"
155
+ msgstr "Sus credenciales de Mercado Pago"
 
 
 
 
 
 
156
 
157
  msgid "Currency Conversion"
158
  msgstr "Conversão de Moeda"
i18n/languages/woocommerce-mercadopago.pot CHANGED
@@ -121,18 +121,12 @@ msgstr ""
121
  msgid "Subscription"
122
  msgstr ""
123
 
124
- msgid "Configure your Client_id and Client_secret to have access to more options."
125
  msgstr ""
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr ""
129
 
130
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for"
131
- msgstr ""
132
-
133
- msgid "Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!"
134
- msgstr ""
135
-
136
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
137
  msgstr ""
138
 
@@ -157,13 +151,7 @@ msgstr ""
157
  msgid "Basic Checkout & Subscriptions"
158
  msgstr ""
159
 
160
- msgid "Custom Checkout & Tickets"
161
- msgstr ""
162
-
163
- msgid "Insert your Mercado Pago Client_id."
164
- msgstr ""
165
-
166
- msgid "Insert your Mercado Pago Client_secret."
167
  msgstr ""
168
 
169
  msgid "Currency Conversion"
121
  msgid "Subscription"
122
  msgstr ""
123
 
124
+ msgid "Configure your Public_key and Access_token to have access to more options."
125
  msgstr ""
126
 
127
  msgid "Define which type of products your store sells."
128
  msgstr ""
129
 
 
 
 
 
 
 
130
  msgid "These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>"
131
  msgstr ""
132
 
151
  msgid "Basic Checkout & Subscriptions"
152
  msgstr ""
153
 
154
+ msgid "Your Credentials of Mercado Pago"
 
 
 
 
 
 
155
  msgstr ""
156
 
157
  msgid "Currency Conversion"
includes/WC_WooMercadoPago_BasicGateway.php CHANGED
@@ -21,11 +21,10 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
21
  public function __construct() {
22
 
23
  // Mercao Pago instance.
24
- $this->site_data = WC_Woo_Mercado_Pago_Module::get_site_data( false );
25
  $this->mp = new MP(
26
  WC_Woo_Mercado_Pago_Module::get_module_version(),
27
- get_option( '_mp_client_id' ),
28
- get_option( '_mp_client_secret' )
29
  );
30
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
31
  $this->mp->set_email( $email );
@@ -150,8 +149,8 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
150
  public function init_form_fields() {
151
 
152
  // Show message if credentials are not properly configured.
153
- $_site_id_v0 = get_option( '_site_id_v0', '' );
154
- if ( empty( $_site_id_v0 ) ) {
155
  $this->form_fields = array(
156
  'no_credentials_title' => array(
157
  'title' => sprintf(
@@ -372,14 +371,13 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
372
  }
373
  }
374
  }
375
- $_site_id_v0 = get_option( '_site_id_v0', '' );
376
- $is_test_user = get_option( '_test_user_v0', false );
377
- if ( ! empty( $_site_id_v0 ) ) {
378
  // Create MP instance.
379
  $mp = new MP(
380
  WC_Woo_Mercado_Pago_Module::get_module_version(),
381
- get_option( '_mp_client_id' ),
382
- get_option( '_mp_client_secret' )
383
  );
384
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
385
  $mp->set_email( $email );
@@ -555,10 +553,10 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
555
 
556
  public function add_checkout_script() {
557
 
558
- $client_id = get_option( '_mp_client_id' );
559
- $is_test_user = get_option( '_test_user_v0', false );
560
 
561
- if ( ! empty( $client_id ) && ! $is_test_user ) {
562
 
563
  $w = WC_Woo_Mercado_Pago_Module::woocommerce_instance();
564
  $available_payments = array();
@@ -577,7 +575,7 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
577
  <script type="text/javascript">
578
  try {
579
  var MA = ModuleAnalytics;
580
- MA.setToken( '<?php echo $client_id; ?>' );
581
  MA.setPlatform( 'WooCommerce' );
582
  MA.setPlatformVersion( '<?php echo $w->version; ?>' );
583
  MA.setModuleVersion( '<?php echo WC_Woo_Mercado_Pago_Module::VERSION; ?>' );
@@ -594,9 +592,9 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
594
  }
595
 
596
  public function update_checkout_status( $order_id ) {
597
- $client_id = get_option( '_mp_client_id' );
598
- $is_test_user = get_option( '_test_user_v0', false );
599
- if ( ! empty( $client_id ) && ! $is_test_user ) {
600
  if ( get_post_meta( $order_id, '_used_gateway', true ) != 'WC_WooMercadoPago_BasicGateway' ) {
601
  return;
602
  }
@@ -605,7 +603,7 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
605
  <script type="text/javascript">
606
  try {
607
  var MA = ModuleAnalytics;
608
- MA.setToken( ' . $client_id . ' );
609
  MA.setPaymentType("basic");
610
  MA.setCheckoutType("basic");
611
  MA.put();
@@ -751,8 +749,8 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
751
  $method_discount = $line_amount * ( $this->gateway_discount / 100 );
752
 
753
  $currency_ratio = 1;
754
- $_mp_currency_conversion_v0 = get_option( '_mp_currency_conversion_v0', '' );
755
- if ( ! empty( $_mp_currency_conversion_v0 ) ) {
756
  $currency_ratio = WC_Woo_Mercado_Pago_Module::get_conversion_rate( $this->site_data['currency'] );
757
  $currency_ratio = $currency_ratio > 0 ? $currency_ratio : 1;
758
  }
@@ -953,8 +951,8 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
953
  }
954
 
955
  // Set sponsor ID.
956
- $_test_user_v0 = get_option( '_test_user_v0', false );
957
- if ( ! $_test_user_v0 ) {
958
  $preferences['sponsor_id'] = $this->site_data['sponsor_id'];
959
  }
960
 
@@ -1038,13 +1036,13 @@ class WC_WooMercadoPago_BasicGateway extends WC_Payment_Gateway {
1038
  }
1039
  }
1040
  // Check if this gateway is enabled and well configured.
1041
- $_mp_client_id = get_option( '_mp_client_id' );
1042
- $_mp_client_secret = get_option( '_mp_client_secret' );
1043
- $_site_id_v0 = get_option( '_site_id_v0' );
1044
  $available = ( 'yes' == $this->settings['enabled'] ) &&
1045
- ! empty( $_mp_client_id ) &&
1046
- ! empty( $_mp_client_secret ) &&
1047
- ! empty( $_site_id_v0 );
1048
  return $available;
1049
  }
1050
 
21
  public function __construct() {
22
 
23
  // Mercao Pago instance.
24
+ $this->site_data = WC_Woo_Mercado_Pago_Module::get_site_data();
25
  $this->mp = new MP(
26
  WC_Woo_Mercado_Pago_Module::get_module_version(),
27
+ get_option( '_mp_access_token' )
 
28
  );
29
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
30
  $this->mp->set_email( $email );
149
  public function init_form_fields() {
150
 
151
  // Show message if credentials are not properly configured.
152
+ $_site_id_v1 = get_option( '_site_id_v1', '' );
153
+ if ( empty( $_site_id_v1 ) ) {
154
  $this->form_fields = array(
155
  'no_credentials_title' => array(
156
  'title' => sprintf(
371
  }
372
  }
373
  }
374
+ $_site_id_v1 = get_option( '_site_id_v1', '' );
375
+ $is_test_user = get_option( '_test_user_v1', false );
376
+ if ( ! empty( $_site_id_v1 ) ) {
377
  // Create MP instance.
378
  $mp = new MP(
379
  WC_Woo_Mercado_Pago_Module::get_module_version(),
380
+ get_option( '_mp_access_token' )
 
381
  );
382
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
383
  $mp->set_email( $email );
553
 
554
  public function add_checkout_script() {
555
 
556
+ $_mp_public_key = get_option( '_mp_public_key' );
557
+ $is_test_user = get_option( '_test_user_v1', false );
558
 
559
+ if ( ! empty( $_mp_public_key ) && ! $is_test_user ) {
560
 
561
  $w = WC_Woo_Mercado_Pago_Module::woocommerce_instance();
562
  $available_payments = array();
575
  <script type="text/javascript">
576
  try {
577
  var MA = ModuleAnalytics;
578
+ MA.setPublicKey( '<?php echo $_mp_public_key; ?>' );
579
  MA.setPlatform( 'WooCommerce' );
580
  MA.setPlatformVersion( '<?php echo $w->version; ?>' );
581
  MA.setModuleVersion( '<?php echo WC_Woo_Mercado_Pago_Module::VERSION; ?>' );
592
  }
593
 
594
  public function update_checkout_status( $order_id ) {
595
+ $_mp_public_key = get_option( '_mp_public_key' );
596
+ $is_test_user = get_option( '_test_user_v1', false );
597
+ if ( ! empty( $_mp_public_key ) && ! $is_test_user ) {
598
  if ( get_post_meta( $order_id, '_used_gateway', true ) != 'WC_WooMercadoPago_BasicGateway' ) {
599
  return;
600
  }
603
  <script type="text/javascript">
604
  try {
605
  var MA = ModuleAnalytics;
606
+ MA.setPublicKey('. $_mp_public_key .');
607
  MA.setPaymentType("basic");
608
  MA.setCheckoutType("basic");
609
  MA.put();
749
  $method_discount = $line_amount * ( $this->gateway_discount / 100 );
750
 
751
  $currency_ratio = 1;
752
+ $_mp_currency_conversion_v1 = get_option( '_mp_currency_conversion_v1', '' );
753
+ if ( ! empty( $_mp_currency_conversion_v1 ) ) {
754
  $currency_ratio = WC_Woo_Mercado_Pago_Module::get_conversion_rate( $this->site_data['currency'] );
755
  $currency_ratio = $currency_ratio > 0 ? $currency_ratio : 1;
756
  }
951
  }
952
 
953
  // Set sponsor ID.
954
+ $_test_user_v1 = get_option( '_test_user_v1', false );
955
+ if ( ! $_test_user_v1 ) {
956
  $preferences['sponsor_id'] = $this->site_data['sponsor_id'];
957
  }
958
 
1036
  }
1037
  }
1038
  // Check if this gateway is enabled and well configured.
1039
+ $_mp_public_key = get_option( '_mp_public_key' );
1040
+ $access_token = get_option( '_mp_access_token');
1041
+ $_site_id_v1 = get_option( '_site_id_v1' );
1042
  $available = ( 'yes' == $this->settings['enabled'] ) &&
1043
+ ! empty( $_mp_public_key ) &&
1044
+ ! empty( $access_token ) &&
1045
+ ! empty( $_site_id_v1 );
1046
  return $available;
1047
  }
1048
 
includes/WC_WooMercadoPago_CustomGateway.php CHANGED
@@ -21,7 +21,7 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
21
  public function __construct( $is_instance = false ) {
22
 
23
  // Mercao Pago instance.
24
- $this->site_data = WC_Woo_Mercado_Pago_Module::get_site_data( true );
25
  $this->mp = new MP(
26
  WC_Woo_Mercado_Pago_Module::get_module_version(),
27
  get_option( '_mp_access_token' )
@@ -538,7 +538,6 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
538
  * @return an array containing the result of the processment and the URL to redirect.
539
  */
540
  public function process_payment( $order_id ) {
541
-
542
  if ( ! isset( $_POST['mercadopago_custom'] ) ) {
543
  return;
544
  }
@@ -563,6 +562,7 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
563
  isset( $custom_checkout['installments'] ) && ! empty( $custom_checkout['installments'] ) &&
564
  $custom_checkout['installments'] != -1 ) {
565
  $response = $this->create_url( $order, $custom_checkout );
 
566
  // Check for card save.
567
  if ( method_exists( $order, 'update_meta_data' ) ) {
568
  if ( isset( $custom_checkout['doNotSaveCard'] ) ) {
@@ -930,7 +930,7 @@ class WC_WooMercadoPago_CustomGateway extends WC_Payment_Gateway {
930
  $this->write_log(
931
  __FUNCTION__,
932
  'payment link generated with success from mercado pago, with structure as follow: ' .
933
- json_encode( $checkout_info, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE )
934
  );
935
  // TODO: Verify sandbox availability.
936
  //if ( 'yes' == $this->sandbox ) {
21
  public function __construct( $is_instance = false ) {
22
 
23
  // Mercao Pago instance.
24
+ $this->site_data = WC_Woo_Mercado_Pago_Module::get_site_data();
25
  $this->mp = new MP(
26
  WC_Woo_Mercado_Pago_Module::get_module_version(),
27
  get_option( '_mp_access_token' )
538
  * @return an array containing the result of the processment and the URL to redirect.
539
  */
540
  public function process_payment( $order_id ) {
 
541
  if ( ! isset( $_POST['mercadopago_custom'] ) ) {
542
  return;
543
  }
562
  isset( $custom_checkout['installments'] ) && ! empty( $custom_checkout['installments'] ) &&
563
  $custom_checkout['installments'] != -1 ) {
564
  $response = $this->create_url( $order, $custom_checkout );
565
+
566
  // Check for card save.
567
  if ( method_exists( $order, 'update_meta_data' ) ) {
568
  if ( isset( $custom_checkout['doNotSaveCard'] ) ) {
930
  $this->write_log(
931
  __FUNCTION__,
932
  'payment link generated with success from mercado pago, with structure as follow: ' .
933
+ json_decode( $checkout_info, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE )
934
  );
935
  // TODO: Verify sandbox availability.
936
  //if ( 'yes' == $this->sandbox ) {
includes/WC_WooMercadoPago_PSEGateway.php CHANGED
@@ -21,7 +21,7 @@ class WC_WooMercadoPago_PSEGateway extends WC_Payment_Gateway {
21
  public function __construct( $is_instance = false ) {
22
 
23
  // Mercao Pago instance.
24
- $this->site_data = WC_Woo_Mercado_Pago_Module::get_site_data( true );
25
  $this->mp = new MP(
26
  WC_Woo_Mercado_Pago_Module::get_module_version(),
27
  get_option( '_mp_access_token' )
@@ -134,11 +134,11 @@ class WC_WooMercadoPago_PSEGateway extends WC_Payment_Gateway {
134
 
135
  // Show message if credentials are not properly configured.
136
  $_site_id_v1 = get_option( '_site_id_v1', '' );
137
- if ( empty( $_site_id_v1 ) ) {
138
  $this->form_fields = array(
139
  'no_credentials_title' => array(
140
  'title' => sprintf(
141
- __( 'It appears that your credentials are not properly configured.<br/>Please, go to %s and configure it.', 'woocommerce-mercadopago' ),
142
  '<a href="' . esc_url( admin_url( 'admin.php?page=mercado-pago-settings' ) ) . '">' .
143
  __( 'Mercado Pago Settings', 'woocommerce-mercadopago' ) .
144
  '</a>'
21
  public function __construct( $is_instance = false ) {
22
 
23
  // Mercao Pago instance.
24
+ $this->site_data = WC_Woo_Mercado_Pago_Module::get_site_data();
25
  $this->mp = new MP(
26
  WC_Woo_Mercado_Pago_Module::get_module_version(),
27
  get_option( '_mp_access_token' )
134
 
135
  // Show message if credentials are not properly configured.
136
  $_site_id_v1 = get_option( '_site_id_v1', '' );
137
+ if ( empty( $_site_id_v1 ) || $_site_id_v1!='MCO' ) {
138
  $this->form_fields = array(
139
  'no_credentials_title' => array(
140
  'title' => sprintf(
141
+ __( 'It appears that your credentials are not properly configured or are not from an account in Colombia.<br/>Please, go to %s and configure it.', 'woocommerce-mercadopago' ),
142
  '<a href="' . esc_url( admin_url( 'admin.php?page=mercado-pago-settings' ) ) . '">' .
143
  __( 'Mercado Pago Settings', 'woocommerce-mercadopago' ) .
144
  '</a>'
includes/WC_WooMercadoPago_SubscriptionGateway.php CHANGED
@@ -21,11 +21,10 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
21
  public function __construct() {
22
 
23
  // Mercao Pago instance.
24
- $this->site_data = WC_Woo_Mercado_Pago_Module::get_site_data( false );
25
  $this->mp = new MP(
26
  WC_Woo_Mercado_Pago_Module::get_module_version(),
27
- get_option( '_mp_client_id' ),
28
- get_option( '_mp_client_secret' )
29
  );
30
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
31
  $this->mp->set_email( $email );
@@ -144,8 +143,8 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
144
  public function init_form_fields() {
145
 
146
  // Show message if credentials are not properly configured or country is not supported.
147
- $_site_id_v0 = get_option( '_site_id_v0', '' );
148
- if ( empty( $_site_id_v0 ) ) {
149
  $this->form_fields = array(
150
  'no_credentials_title' => array(
151
  'title' => sprintf(
@@ -158,7 +157,7 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
158
  ),
159
  );
160
  return;
161
- } elseif ( get_option( '_site_id_v0', '' ) != 'MLA' && get_option( '_site_id_v0', '' ) != 'MLB' && get_option( '_site_id_v0', '' ) != 'MLM' ) {
162
  $this->form_fields = array(
163
  'unsupported_country_title' => array(
164
  'title' => sprintf(
@@ -354,14 +353,13 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
354
  }
355
  }
356
  }
357
- $_site_id_v0 = get_option( '_site_id_v0', '' );
358
- $is_test_user = get_option( '_test_user_v0', false );
359
- if ( ! empty( $_site_id_v0 ) && ! $is_test_user ) {
360
  // Create MP instance.
361
  $mp = new MP(
362
  WC_Woo_Mercado_Pago_Module::get_module_version(),
363
- get_option( '_mp_client_id' ),
364
- get_option( '_mp_client_secret' )
365
  );
366
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
367
  $mp->set_email( $email );
@@ -447,10 +445,10 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
447
 
448
  public function add_checkout_script() {
449
 
450
- $client_id = get_option( 'client_id' );
451
- $is_test_user = get_option( '_test_user_v0', false );
452
 
453
- if ( ! empty( $client_id ) && ! $is_test_user ) {
454
 
455
  $w = WC_Woo_Mercado_Pago_Module::woocommerce_instance();
456
  $logged_user_email = null;
@@ -470,7 +468,7 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
470
  <script type="text/javascript">
471
  try {
472
  var MA = ModuleAnalytics;
473
- MA.setToken( '<?php echo $client_id; ?>' );
474
  MA.setPlatform( 'WooCommerce' );
475
  MA.setPlatformVersion( '<?php echo $w->version; ?>' );
476
  MA.setModuleVersion( '<?php echo WC_Woo_Mercado_Pago_Module::VERSION; ?>' );
@@ -487,9 +485,9 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
487
  }
488
 
489
  public function update_checkout_status( $order_id ) {
490
- $client_id = get_option( '_mp_client_id' );
491
- $is_test_user = get_option( '_test_user_v0', false );
492
- if ( ! empty( $client_id ) && ! $is_test_user ) {
493
  if ( get_post_meta( $order_id, '_used_gateway', true ) != 'WC_WooMercadoPago_SubscriptionGateway' ) {
494
  return;
495
  }
@@ -498,7 +496,7 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
498
  <script type="text/javascript">
499
  try {
500
  var MA = ModuleAnalytics;
501
- MA.setToken( ' . $client_id . ' );
502
  MA.setPaymentType("subscription");
503
  MA.setCheckoutType("subscription");
504
  MA.put();
@@ -640,8 +638,8 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
640
  $ship_amount = $order->get_total_shipping() + $order->get_shipping_tax();
641
 
642
  $currency_ratio = 1;
643
- $_mp_currency_conversion_v0 = get_option( '_mp_currency_conversion_v0', '' );
644
- if ( ! empty( $_mp_currency_conversion_v0 ) ) {
645
  $currency_ratio = WC_Woo_Mercado_Pago_Module::get_conversion_rate( $this->site_data['currency'] );
646
  $currency_ratio = $currency_ratio > 0 ? $currency_ratio : 1;
647
  }
@@ -695,8 +693,8 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
695
  }
696
 
697
  // Set sponsor ID.
698
- $_test_user_v0 = get_option( '_test_user_v0', false );
699
- if ( ! $_test_user_v0 ) {
700
  $preapproval['sponsor_id'] = $this->site_data['sponsor_id'];
701
  }
702
 
@@ -776,17 +774,17 @@ class WC_WooMercadoPago_SubscriptionGateway extends WC_Payment_Gateway {
776
  return false;
777
  }
778
  }
779
- $_mp_client_id = get_option( '_mp_client_id' );
780
- $_mp_client_secret = get_option( '_mp_client_secret' );
781
- $_site_id_v0 = get_option( '_site_id_v0' );
782
  // Check for country support.
783
- if ( $_site_id_v0 != 'MLA' && $_site_id_v0 != 'MLB' && $_site_id_v0 != 'MLM') {
784
  return false;
785
  }
786
  $available = ( 'yes' == $this->settings['enabled'] ) &&
787
- ! empty( $_mp_client_id ) &&
788
- ! empty( $_mp_client_secret ) &&
789
- ! empty( $_site_id_v0 );
790
  return $available;
791
  }
792
 
21
  public function __construct() {
22
 
23
  // Mercao Pago instance.
24
+ $this->site_data = WC_Woo_Mercado_Pago_Module::get_site_data();
25
  $this->mp = new MP(
26
  WC_Woo_Mercado_Pago_Module::get_module_version(),
27
+ get_option( '_mp_access_token' )
 
28
  );
29
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
30
  $this->mp->set_email( $email );
143
  public function init_form_fields() {
144
 
145
  // Show message if credentials are not properly configured or country is not supported.
146
+ $_site_id_v1 = get_option( '_site_id_v1', '' );
147
+ if ( empty( $_site_id_v1 ) ) {
148
  $this->form_fields = array(
149
  'no_credentials_title' => array(
150
  'title' => sprintf(
157
  ),
158
  );
159
  return;
160
+ } elseif ( get_option( '_site_id_v1', '' ) != 'MLA' && get_option( '_site_id_v1', '' ) != 'MLB' && get_option( '_site_id_v1', '' ) != 'MLM' ) {
161
  $this->form_fields = array(
162
  'unsupported_country_title' => array(
163
  'title' => sprintf(
353
  }
354
  }
355
  }
356
+ $_site_id_v1 = get_option( '_site_id_v1', '' );
357
+ $is_test_user = get_option( '_test_user_v1', false );
358
+ if ( ! empty( $_site_id_v1 ) && ! $is_test_user ) {
359
  // Create MP instance.
360
  $mp = new MP(
361
  WC_Woo_Mercado_Pago_Module::get_module_version(),
362
+ get_option( '_mp_access_token' )
 
363
  );
364
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
365
  $mp->set_email( $email );
445
 
446
  public function add_checkout_script() {
447
 
448
+ $_mp_public_key = get_option( '_mp_public_key' );
449
+ $is_test_user = get_option( '_test_user_v1', false );
450
 
451
+ if ( ! empty( $_mp_public_key ) && ! $is_test_user ) {
452
 
453
  $w = WC_Woo_Mercado_Pago_Module::woocommerce_instance();
454
  $logged_user_email = null;
468
  <script type="text/javascript">
469
  try {
470
  var MA = ModuleAnalytics;
471
+ MA.setPublicKey( '<?php echo $_mp_public_key; ?>' );
472
  MA.setPlatform( 'WooCommerce' );
473
  MA.setPlatformVersion( '<?php echo $w->version; ?>' );
474
  MA.setModuleVersion( '<?php echo WC_Woo_Mercado_Pago_Module::VERSION; ?>' );
485
  }
486
 
487
  public function update_checkout_status( $order_id ) {
488
+ $_mp_public_key = get_option( '_mp_public_key' );
489
+ $is_test_user = get_option( '_test_user_v1', false );
490
+ if ( ! empty( $_mp_public_key ) && ! $is_test_user ) {
491
  if ( get_post_meta( $order_id, '_used_gateway', true ) != 'WC_WooMercadoPago_SubscriptionGateway' ) {
492
  return;
493
  }
496
  <script type="text/javascript">
497
  try {
498
  var MA = ModuleAnalytics;
499
+ MA.setPublicKey( ' . $_mp_public_key . ' );
500
  MA.setPaymentType("subscription");
501
  MA.setCheckoutType("subscription");
502
  MA.put();
638
  $ship_amount = $order->get_total_shipping() + $order->get_shipping_tax();
639
 
640
  $currency_ratio = 1;
641
+ $_mp_currency_conversion_v1 = get_option( '_mp_currency_conversion_v1', '' );
642
+ if ( ! empty( $_mp_currency_conversion_v1 ) ) {
643
  $currency_ratio = WC_Woo_Mercado_Pago_Module::get_conversion_rate( $this->site_data['currency'] );
644
  $currency_ratio = $currency_ratio > 0 ? $currency_ratio : 1;
645
  }
693
  }
694
 
695
  // Set sponsor ID.
696
+ $_test_user_v1 = get_option( '_test_user_v1', false );
697
+ if ( ! $_test_user_v1 ) {
698
  $preapproval['sponsor_id'] = $this->site_data['sponsor_id'];
699
  }
700
 
774
  return false;
775
  }
776
  }
777
+ $_mp_public_key = get_option( '_mp_public_key' );
778
+ $access_token = get_option( '_mp_access_token');
779
+ $_site_id_v1 = get_option( '_site_id_v1' );
780
  // Check for country support.
781
+ if ( $_site_id_v1 != 'MLA' && $_site_id_v1 != 'MLB' && $_site_id_v1 != 'MLM') {
782
  return false;
783
  }
784
  $available = ( 'yes' == $this->settings['enabled'] ) &&
785
+ ! empty( $_mp_public_key ) &&
786
+ ! empty( $access_token ) &&
787
+ ! empty( $_site_id_v1 );
788
  return $available;
789
  }
790
 
includes/WC_WooMercadoPago_TicketGateway.php CHANGED
File without changes
includes/admin/class-wc-mercadoenvios-admin-orders.php CHANGED
@@ -71,13 +71,8 @@ class WC_MercadoEnvios_Admin_Orders {
71
  esc_attr( $tracking_number ) . '" style="width:100%; text-align:center;" />';
72
  // Check exist shipment_id
73
  if ( isset( $shipment_id ) && $shipment_id != '' ) {
74
- $client_id = get_option( '_mp_client_id', '' );
75
- $client_secret = get_option( '_mp_client_secret', '' );
76
- $mp = new MP(
77
- WC_Woo_Mercado_Pago_Module::get_module_version(),
78
- $client_id,
79
- $client_secret
80
- );
81
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
82
  $mp->set_email( $email );
83
  echo '<br /><label for="mercadoenvios_tracking_number">' . esc_html__( 'Tag:', 'woocommerce-mercadopago' ) . '</label><br />';
71
  esc_attr( $tracking_number ) . '" style="width:100%; text-align:center;" />';
72
  // Check exist shipment_id
73
  if ( isset( $shipment_id ) && $shipment_id != '' ) {
74
+ $access_token = get_option( '_mp_access_token', '' );
75
+ $mp = new MP( WC_Woo_Mercado_Pago_Module::get_module_version(), $access_token );
 
 
 
 
 
76
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
77
  $mp->set_email( $email );
78
  echo '<br /><label for="mercadoenvios_tracking_number">' . esc_html__( 'Tag:', 'woocommerce-mercadopago' ) . '</label><br />';
includes/class-wc-product-mp_recurrent.php CHANGED
File without changes
includes/sdk/lib/cacert.pem CHANGED
File without changes
includes/sdk/lib/mercadopago.php CHANGED
@@ -12,7 +12,7 @@ $GLOBALS['LIB_LOCATION'] = dirname( __FILE__ );
12
 
13
  class MP {
14
 
15
- private $version = '3.0.17';
16
  private $client_id;
17
  private $client_secret;
18
  private $ll_access_token;
12
 
13
  class MP {
14
 
15
+ private $version = '3.1.0';
16
  private $client_id;
17
  private $client_secret;
18
  private $ll_access_token;
includes/shipment/abstract-wc-mercadoenvios-shipping.php CHANGED
@@ -108,14 +108,17 @@ abstract class WC_MercadoEnvios_Shipping extends WC_Shipping_Method {
108
  }
109
 
110
  // Some used variables and its validations.
111
- $client_id = get_option( '_mp_client_id', '' );
112
- $client_secret = get_option( '_mp_client_secret', '' );
113
- $site_id = get_option( '_site_id_v0', '' );
114
- if ( empty( $client_id ) || empty( $client_secret ) ) {
115
  return;
116
  }
117
- if ( ! is_numeric( $client_id ) ) {
118
- return;
 
 
 
119
  }
120
 
121
  // Object package and zipcode.
@@ -137,8 +140,7 @@ abstract class WC_MercadoEnvios_Shipping extends WC_Shipping_Method {
137
  $shipping_method_id = $this->get_shipping_method_id( $site_id );
138
  $mp = new MP(
139
  WC_Woo_Mercado_Pago_Module::get_module_version(),
140
- $client_id,
141
- $client_secret
142
  );
143
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
144
  $mp->set_email( $email );
@@ -306,12 +308,14 @@ abstract class WC_MercadoEnvios_Shipping extends WC_Shipping_Method {
306
  if ( isset( $shipping_methods['woo-mercado-pago-me-normal'] ) && isset( $shipping_methods['woo-mercado-pago-me-express'] ) ) {
307
  if ( $shipping_methods['woo-mercado-pago-me-normal'] === true && $shipping_methods['woo-mercado-pago-me-express'] === true ) {
308
  // Add settings.
309
- $this->update_settings_api( 'true' );
 
310
  // Not display message.
311
  return false;
312
  } elseif ( $shipping_methods['woo-mercado-pago-me-normal'] === false && $shipping_methods['woo-mercado-pago-me-express'] === false ) {
313
  // Remove settings.
314
- $this->update_settings_api( 'false' );
 
315
  // Not display message.
316
  return false;
317
  }
@@ -341,18 +345,20 @@ abstract class WC_MercadoEnvios_Shipping extends WC_Shipping_Method {
341
  public function update_settings_api( $status ) {
342
 
343
  // Some used variables and its validations.
344
- $client_id = get_option( '_mp_client_id', '' );
345
- $client_secret = get_option( '_mp_client_secret', '' );
346
- if ( empty( $client_id ) || empty( $client_secret ) ) {
347
  return;
348
  }
349
- if ( ! is_numeric( $client_id ) ) {
350
- return;
 
 
 
351
  }
352
  $mp = new MP(
353
  WC_Woo_Mercado_Pago_Module::get_module_version(),
354
- $client_id,
355
- $client_secret
356
  );
357
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
358
  $mp->set_email( $email );
108
  }
109
 
110
  // Some used variables and its validations.
111
+ $public_key = get_option( '_mp_public_key', '' );
112
+ $access_token = get_option( '_mp_access_token', '' );
113
+ $site_id = get_option( '_site_id_v1', '' );
114
+ if ( empty( $public_key ) || empty( $access_token ) ) {
115
  return;
116
  }
117
+ if ( strpos( $public_key, 'APP_USR' ) === false && strpos( $public_key, 'TEST' ) === false ) {
118
+ return;
119
+ }
120
+ if ( strpos( $access_token, 'APP_USR' ) === false && strpos( $access_token, 'TEST' ) === false ) {
121
+ return;
122
  }
123
 
124
  // Object package and zipcode.
140
  $shipping_method_id = $this->get_shipping_method_id( $site_id );
141
  $mp = new MP(
142
  WC_Woo_Mercado_Pago_Module::get_module_version(),
143
+ $access_token
 
144
  );
145
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
146
  $mp->set_email( $email );
308
  if ( isset( $shipping_methods['woo-mercado-pago-me-normal'] ) && isset( $shipping_methods['woo-mercado-pago-me-express'] ) ) {
309
  if ( $shipping_methods['woo-mercado-pago-me-normal'] === true && $shipping_methods['woo-mercado-pago-me-express'] === true ) {
310
  // Add settings.
311
+ /**PERFOMANCE*/
312
+ //$this->update_settings_api( 'true' );
313
  // Not display message.
314
  return false;
315
  } elseif ( $shipping_methods['woo-mercado-pago-me-normal'] === false && $shipping_methods['woo-mercado-pago-me-express'] === false ) {
316
  // Remove settings.
317
+ /**PERFOMANCE*/
318
+ //$this->update_settings_api( 'false' );
319
  // Not display message.
320
  return false;
321
  }
345
  public function update_settings_api( $status ) {
346
 
347
  // Some used variables and its validations.
348
+ $public_key = get_option( '_mp_public_key', '' );
349
+ $access_token = get_option( '_mp_access_token', '' );
350
+ if ( empty( $public_key ) || empty( $access_token ) ) {
351
  return;
352
  }
353
+ if ( strpos( $public_key, 'APP_USR' ) === false && strpos( $public_key, 'TEST' ) === false ) {
354
+ return;
355
+ }
356
+ if ( strpos( $access_token, 'APP_USR' ) === false && strpos( $access_token, 'TEST' ) === false ) {
357
+ return;
358
  }
359
  $mp = new MP(
360
  WC_Woo_Mercado_Pago_Module::get_module_version(),
361
+ $access_token
 
362
  );
363
  $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
364
  $mp->set_email( $email );
includes/shipment/class-wc-mercadoenvios-package.php CHANGED
File without changes
includes/shipment/class-wc-mercadoenvios-shipping-express.php CHANGED
File without changes
includes/shipment/class-wc-mercadoenvios-shipping-normal.php CHANGED
File without changes
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ecommerce, mercadopago, woocommerce
4
  Requires at least: 4.9.7
5
  Tested up to: 4.9.7
6
  Requires PHP: 5.6
7
- Stable tag: 3.0.17
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -60,7 +60,7 @@ Is the upper part of the window. Shows platform statuses and system consistency
60
  Here you should place your *Client Id* and *Client Secret* keys, the credentials that uniquely identifies you in Mercado Pago. *Client Id* and *Client Secret* are used for Basic Checkout and Subscriptions payment methods;
61
  Also, just bellow, you can enable currency conversion mode for sells with Basic Checkout and Subscriptions. Currency conversion is a feature that enables you to set an unsupported currency in WooCommerce while maintaining Mercado Pago as payment method. It will convert the unsupported currency for the currency used in your country. Pay attention that this service converts values on-the-fly in real-time and can bring some additional delay to your server.
62
 
63
- - Custom Checkout & Tickets
64
  Here you should place your *Public Key* and *Access Token* keys, the credentials that uniquely identifies you in Mercado Pago. *Public Key* and *Access Token* are used for Custom Checkout and Tickets payment methods;
65
  Also, just bellow, you can enable currency conversion mode for sells with Custom Checkout and Tickets. Currency conversion is a feature that enables you to set an unsupported currency in WooCommerce while maintaining Mercado Pago as payment method. It will convert the unsupported currency for the currency used in your country. Pay attention that this service converts values on-the-fly in real-time and can bring some additional delay to your server.
66
 
@@ -215,6 +215,12 @@ Features: LatAm Basic Checkout support. Great for merchants who want to get goin
215
 
216
  == Changelog ==
217
 
 
 
 
 
 
 
218
  = v3.0.17 (07/08/2018) =
219
  * Feature All
220
  - Adding X Product ID
4
  Requires at least: 4.9.7
5
  Tested up to: 4.9.7
6
  Requires PHP: 5.6
7
+ Stable tag: 3.1.0
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
60
  Here you should place your *Client Id* and *Client Secret* keys, the credentials that uniquely identifies you in Mercado Pago. *Client Id* and *Client Secret* are used for Basic Checkout and Subscriptions payment methods;
61
  Also, just bellow, you can enable currency conversion mode for sells with Basic Checkout and Subscriptions. Currency conversion is a feature that enables you to set an unsupported currency in WooCommerce while maintaining Mercado Pago as payment method. It will convert the unsupported currency for the currency used in your country. Pay attention that this service converts values on-the-fly in real-time and can bring some additional delay to your server.
62
 
63
+ - Your Credentials of Mercado Pago
64
  Here you should place your *Public Key* and *Access Token* keys, the credentials that uniquely identifies you in Mercado Pago. *Public Key* and *Access Token* are used for Custom Checkout and Tickets payment methods;
65
  Also, just bellow, you can enable currency conversion mode for sells with Custom Checkout and Tickets. Currency conversion is a feature that enables you to set an unsupported currency in WooCommerce while maintaining Mercado Pago as payment method. It will convert the unsupported currency for the currency used in your country. Pay attention that this service converts values on-the-fly in real-time and can bring some additional delay to your server.
66
 
215
 
216
  == Changelog ==
217
 
218
+ = v3.1.0 (17/04/2019) =
219
+ * Performance Improvements
220
+ - Removed unnecessary requests.
221
+ - Some functions have had their scope limited, in this way they will be called only when necessary.
222
+ - Removed Client_id and Client_secret, currently only using ACCESS_TOKEN and PUBLIC_KEY.
223
+
224
  = v3.0.17 (07/08/2018) =
225
  * Feature All
226
  - Adding X Product ID
templates/credit-card/payment-form.php CHANGED
File without changes
templates/mp_main_settings.php CHANGED
@@ -5,8 +5,6 @@
5
  <table class="form-table">
6
  <tr>
7
  <td>
8
- <?php echo $v0_credentials_message; ?>
9
- <br>
10
  <?php echo $v1_credentials_message; ?>
11
  <br>
12
  <?php echo $has_woocommerce_message; ?>
@@ -39,54 +37,11 @@
39
  <form method="post" action="" novalidate="novalidate" method="post">
40
 
41
  <?php settings_fields( 'mercadopago' ); ?>
42
-
43
- <table class="form-table" border="0.5" frame="above" rules="void">
44
- <tr>
45
- <th scope="row"><label><h3>
46
- <?php echo esc_html( __( 'Basic Checkout & Subscriptions', 'woocommerce-mercadopago' ) ); ?>
47
- </h3></label></th>
48
- <td><label class="description" id="tagline-description">
49
- <?php echo $v0_credential_locales; ?>
50
- </label></td>
51
- </tr>
52
- <tr>
53
- <th scope="row"><label>Client ID</label></th>
54
- <td>
55
- <input name="client_id" type="text" id="client_id" value="<?php form_option('_mp_client_id'); ?>" class="regular-text" />
56
- <p class="description" id="tagline-description">
57
- <?php echo esc_html( __( 'Insert your Mercado Pago Client_id.', 'woocommerce-mercadopago' ) ); ?>
58
- </p>
59
- </td>
60
- </tr>
61
- <tr>
62
- <th scope="row"><label>Client Secret</label></th>
63
- <td>
64
- <input name="client_secret" type="text" id="client_secret" aria-describedby="tagline-description" value="<?php form_option('_mp_client_secret'); ?>" class="regular-text" />
65
- <p class="description" id="tagline-description">
66
- <?php echo esc_html( __( 'Insert your Mercado Pago Client_secret.', 'woocommerce-mercadopago' ) ); ?>
67
- </p>
68
- </td>
69
- </tr>
70
- <?php if ( ! empty ( $site_id_v0 ) ) { ?>
71
- <tr>
72
- <th scope="row"><label><?php echo __( 'Currency Conversion', 'woocommerce-mercadopago' ); ?></label></th>
73
- <td>
74
- <label>
75
- <input class="" type="checkbox" name="currency_conversion_v0" id="currency_conversion_v0" <?php echo $is_currency_conversion_v0; ?>>
76
- <?php echo __( 'If the used currency in WooCommerce is different or not supported by Mercado Pago, convert values of your transactions using Mercado Pago currency ratio. This service may slow down your server as each conversion is made in the checkout moment.', 'woocommerce-mercadopago' ); ?>
77
- </label>
78
- <p class="description" id="tagline-description">
79
- <?php echo $currency_conversion_v0_message; ?>
80
- </p>
81
- </td>
82
- </tr>
83
- <?php } ?>
84
- </table>
85
 
86
  <table class="form-table" border="0.5" frame="above" rules="void">
87
  <tr>
88
  <th scope="row"><label><h3>
89
- <?php echo esc_html( __( 'Custom Checkout & Tickets', 'woocommerce-mercadopago' ) ); ?>
90
  </h3></label></th>
91
  <td><label class="description" id="tagline-description">
92
  <?php echo $v1_credential_locales; ?>
@@ -353,7 +308,7 @@
353
  'woo-mercado-pago-ticket',
354
  __( 'Tickets', 'woocommerce-mercadopago' )
355
  ),
356
- WC_Woo_Mercado_Pago_Module::build_log_path_string(
357
  'woo-mercado-pago-pse',
358
  __( 'PSE', 'woocommerce-mercadopago' )
359
  ),
5
  <table class="form-table">
6
  <tr>
7
  <td>
 
 
8
  <?php echo $v1_credentials_message; ?>
9
  <br>
10
  <?php echo $has_woocommerce_message; ?>
37
  <form method="post" action="" novalidate="novalidate" method="post">
38
 
39
  <?php settings_fields( 'mercadopago' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  <table class="form-table" border="0.5" frame="above" rules="void">
42
  <tr>
43
  <th scope="row"><label><h3>
44
+ <?php echo esc_html( __( 'Your Credentials of Mercado Pago', 'woocommerce-mercadopago' ) ); ?>
45
  </h3></label></th>
46
  <td><label class="description" id="tagline-description">
47
  <?php echo $v1_credential_locales; ?>
308
  'woo-mercado-pago-ticket',
309
  __( 'Tickets', 'woocommerce-mercadopago' )
310
  ),
311
+ WC_Woo_Mercado_Pago_Module::build_log_path_string(
312
  'woo-mercado-pago-pse',
313
  __( 'PSE', 'woocommerce-mercadopago' )
314
  ),
templates/pse/pse-form.php CHANGED
File without changes
templates/ticket/ticket-form.php CHANGED
File without changes
templates/woocommerce-altas.html CHANGED
File without changes
woocommerce-mercadopago.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce MercadoPago
4
  * Plugin URI: https://github.com/mercadopago/cart-woocommerce
5
  * Description: This is the <strong>oficial</strong> module of Mercado Pago for WooCommerce plugin. This module enables WooCommerce to use Mercado Pago as a payment Gateway for purchases made in your e-commerce store.
6
- * Version: 3.0.17
7
  * Author: Mercado Pago
8
  * Author URI: https://www.mercadopago.com.br/developers/
9
  * Text Domain: woocommerce-mercadopago
@@ -76,14 +76,13 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
76
  * Summary: WooCommerce MercadoPago Module main class.
77
  * Description: Used as a kind of manager to enable/disable each Mercado Pago gateway.
78
  * Available Public Static Functions:
79
- * - validate_credentials_v0()
80
  * - validate_credentials_v1()
81
  * - woocommerce_instance()
82
  * - get_common_error_messages( $key )
83
  * - get_conversion_rate( $used_currency )
84
  * - get_common_settings()
85
  * - get_categories()
86
- * - get_site_data( $is_v1 = false )
87
  * - fix_url_ampersand( $link )
88
  * - get_templates_path()
89
  * - get_module_version()
@@ -106,7 +105,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
106
  // ============================================================
107
 
108
  // General constants.
109
- const VERSION = '3.0.17';
110
  const MIN_PHP = 5.6;
111
 
112
  // Arrays to hold configurations for LatAm environment.
@@ -127,9 +126,9 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
127
 
128
  // Class constructor.
129
  private function __construct() {
130
-
131
- WC_Woo_Mercado_Pago_Module::$categories = WC_Woo_Mercado_Pago_Module::get_categories();
132
- WC_Woo_Mercado_Pago_Module::$country_configs = array(
133
  'MCO' => array(
134
  'site_id' => 'MCO',
135
  'sponsor_id' => 208687643,
@@ -195,7 +194,13 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
195
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_BasicGateway.php';
196
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_CustomGateway.php';
197
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_TicketGateway.php';
198
- include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_PSEGateway.php';
 
 
 
 
 
 
199
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_SubscriptionGateway.php';
200
  include_once dirname( __FILE__ ) . '/includes/class-wc-product-mp_recurrent.php';
201
  add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway' ) );
@@ -215,7 +220,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
215
  add_action( 'admin_notices', array( $this, 'notify_woocommerce_miss' ) );
216
  }
217
 
218
- if ( is_admin() ) {
219
  $this->admin_includes();
220
  }
221
 
@@ -239,7 +244,13 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
239
  $methods[] = 'WC_WooMercadoPago_BasicGateway';
240
  $methods[] = 'WC_WooMercadoPago_CustomGateway';
241
  $methods[] = 'WC_WooMercadoPago_TicketGateway';
242
- $methods[] = 'WC_WooMercadoPago_PSEGateway';
 
 
 
 
 
 
243
  $methods[] = 'WC_WooMercadoPago_SubscriptionGateway';
244
  return $methods;
245
  }
@@ -310,67 +321,6 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
310
 
311
  // ============================================================
312
 
313
- /**
314
- * Summary: Check if we have valid credentials for v0.
315
- * Description: Check if we have valid credentials.
316
- * @return boolean true/false depending on the validation result.
317
- */
318
- public static function validate_credentials_v0() {
319
- $client_id = get_option( '_mp_client_id', '' );
320
- $client_secret = get_option( '_mp_client_secret', '' );
321
- // Pre-validate.
322
- $is_valid_credentials = true;
323
- if ( empty( $client_id ) || empty( $client_secret ) ) {
324
- $is_valid_credentials = false;
325
- }
326
- if ( ! is_numeric( $client_id ) ) {
327
- $is_valid_credentials = false;
328
- }
329
- if ( $is_valid_credentials ) {
330
- try {
331
- $mp_v0 = new MP( WC_Woo_Mercado_Pago_Module::VERSION, $client_id, $client_secret );
332
- $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
333
- $mp_v0->set_email( $email );
334
- $locale = get_locale();
335
- $locale = ( strpos( $locale, '_' ) !== false && strlen( $locale ) == 5 ) ? explode( '_', $locale ) : array('','');
336
- $mp_v0->set_locale( $locale[1] );
337
- $access_token = $mp_v0->get_access_token();
338
- $get_request = $mp_v0->get( '/users/me?access_token=' . $access_token );
339
- if ( isset( $get_request['response']['site_id'] ) && ! empty( $access_token ) ) {
340
- update_option( '_test_user_v0', in_array( 'test_user', $get_request['response']['tags'], true ) );
341
- update_option( '_site_id_v0', $get_request['response']['site_id'], true );
342
- update_option( '_collector_id_v0', $get_request['response']['id'], true );
343
- // Get available payment methods.
344
- $payment_methods = $mp_v0->get( '/v1/payment_methods/?access_token=' . $access_token );
345
- $arr = array();
346
- $arr[] = 'n/d';
347
- foreach ( $payment_methods['response'] as $payment ) {
348
- $arr[] = $payment['id'];
349
- }
350
- update_option( '_all_payment_methods_v0', implode( ',', $arr ), true );
351
- // Check for auto converstion of currency.
352
- $currency_ratio = WC_Woo_Mercado_Pago_Module::get_conversion_rate(
353
- WC_Woo_Mercado_Pago_Module::$country_configs[$get_request['response']['site_id']]['currency']
354
- );
355
- if ( $currency_ratio > 0 ) {
356
- update_option( '_can_do_currency_conversion_v0', true, true );
357
- } else {
358
- update_option( '_can_do_currency_conversion_v0', false, true );
359
- }
360
- return true;
361
- }
362
- } catch ( MercadoPagoException $e ) {
363
- // TODO: should we handle an exception here?
364
- }
365
- }
366
- update_option( '_test_user_v0', '', true );
367
- update_option( '_site_id_v0', '', true );
368
- update_option( '_collector_id_v0', '', true );
369
- update_option( '_all_payment_methods_v0', array(), true );
370
- update_option( '_can_do_currency_conversion_v0', false, true );
371
- return false;
372
- }
373
-
374
  /**
375
  * Summary: Check if we have valid credentials for v1.
376
  * Description: Check if we have valid credentials.
@@ -404,9 +354,25 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
404
  update_option( '_test_user_v1', in_array( 'test_user', $get_request['response']['tags'] ), true );
405
  update_option( '_site_id_v1', $get_request['response']['site_id'], true );
406
  update_option( '_collector_id_v1', $get_request['response']['id'], true );
 
 
 
 
 
 
 
 
 
407
  // Get available payment methods.
408
  $payments = $mp_v1->get( '/v1/payment_methods/?access_token=' . $access_token );
409
  $payment_methods_ticket = array();
 
 
 
 
 
 
 
410
  foreach ( $payments['response'] as $payment ) {
411
  if ( isset( $payment['payment_type_id'] ) ) {
412
  if ( $payment['payment_type_id'] != 'account_money' &&
@@ -441,6 +407,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
441
  update_option( '_test_user_v1', '', true );
442
  update_option( '_site_id_v1', '', true );
443
  update_option( '_collector_id_v1', '', true );
 
444
  update_option( '_all_payment_methods_ticket', '[]', true );
445
  update_option( '_can_do_currency_conversion_v1', false, true );
446
  return false;
@@ -526,26 +493,30 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
526
  * @return an array with found categories and a description for its selector title.
527
  */
528
  public static function get_categories() {
529
- $store_categories_id = array();
530
- $store_categories_description = array();
531
- // Get Mercado Pago store categories.
532
- $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
533
- MPRestClient::set_email( $email );
534
- $categories = MPRestClient::get(
535
- array( 'uri' => '/item_categories' ),
536
- WC_Woo_Mercado_Pago_Module::get_module_version()
537
- );
538
- foreach ( $categories['response'] as $category ) {
539
- array_push(
540
- $store_categories_id, str_replace( '_', ' ', $category['id'] )
541
- );
542
- array_push(
543
- $store_categories_description, str_replace( '_', ' ', $category['description'] )
544
- );
545
- }
546
- return array(
547
- 'store_categories_id' => $store_categories_id,
548
- 'store_categories_description' => $store_categories_description
 
 
 
 
549
  );
550
  }
551
 
@@ -554,12 +525,8 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
554
  * Description: Get information about the used Mercado Pago account based in its site.
555
  * @return an array with the information.
556
  */
557
- public static function get_site_data( $is_v1 = false ) {
558
- if ( ! $is_v1 ) {
559
- $site_id = get_option( '_site_id_v0', '' );
560
- } else {
561
- $site_id = get_option( '_site_id_v1', '' );
562
- }
563
  if ( isset( $site_id ) && ! empty( $site_id ) ) {
564
  return WC_Woo_Mercado_Pago_Module::$country_configs[$site_id];
565
  } else {
@@ -696,6 +663,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
696
  }
697
 
698
  public static function get_map( $selector_id ) {
 
699
  $arr = explode( '_', $selector_id );
700
  $defaults = array(
701
  'pending' => 'pending',
@@ -919,8 +887,6 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
919
 
920
  // Check for submits.
921
  if ( isset( $_POST['submit'] ) ) {
922
- update_option( '_mp_client_id', isset( $_POST['client_id'] ) ? $_POST['client_id'] : '', true );
923
- update_option( '_mp_client_secret', isset( $_POST['client_secret'] ) ? $_POST['client_secret'] : '', true );
924
  update_option( '_mp_public_key', isset( $_POST['public_key'] ) ? $_POST['public_key'] : '', true );
925
  update_option( '_mp_access_token', isset( $_POST['access_token'] ) ? $_POST['access_token'] : '', true );
926
  update_option( '_mp_success_url', isset( $_POST['success_url'] ) ? $_POST['success_url'] : '', true );
@@ -1023,7 +989,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
1023
  $category_id = get_option( '_mp_category_id', 0 );
1024
  if ( count( $store_categories_id ) == 0 ) {
1025
  $store_category_message = '<img width="14" height="14" src="' . plugins_url( 'assets/images/warning.png', __FILE__ ) . '">' . ' ' .
1026
- __( 'Configure your Client_id and Client_secret to have access to more options.', 'woocommerce-mercadopago' );
1027
  } else {
1028
  $store_category_message = __( 'Define which type of products your store sells.', 'woocommerce-mercadopago' );
1029
  }
@@ -1056,71 +1022,6 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
1056
  $is_sandbox_mode = 'checked="checked"';
1057
  }
1058
 
1059
- // ===== v0 verifications =====
1060
- // Trigger v0 API to validate credentials.
1061
- $site_id_v0 = '';
1062
- if ( WC_Woo_Mercado_Pago_Module::validate_credentials_v0() ) {
1063
- $site_id_v0 = get_option( '_site_id_v0', '' );
1064
- $v0_credentials_message = '<img width="14" height="14" src="' . plugins_url( 'assets/images/check.png', __FILE__ ) . '"> ' .
1065
- __( 'Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>valid</strong> for', 'woocommerce-mercadopago' ) . ': ' .
1066
- '<img style="margin-top:2px;" width="18.6" height="12" src="' .
1067
- plugins_url( 'assets/images/' . $site_id_v0 . '/' . $site_id_v0 . '.png', __FILE__ ) . '"> ' .
1068
- WC_Woo_Mercado_Pago_Module::get_country_name( $site_id_v0 );
1069
- } else {
1070
- $v0_credentials_message = '<img width="14" height="14" src="' . plugins_url( 'assets/images/error.png', __FILE__ ) . '"> ' .
1071
- __( 'Your <strong>client_id</strong> and <strong>client_secret</strong> are <strong>not valid</strong>!', 'woocommerce-mercadopago' );
1072
- }
1073
- $v0_credential_locales = sprintf(
1074
- '%s <a href="https://www.mercadopago.com/mla/account/credentials?type=basic" target="_blank">%s</a>, ' .
1075
- '<a href="https://www.mercadopago.com/mlb/account/credentials?type=basic" target="_blank">%s</a>, ' .
1076
- '<a href="https://www.mercadopago.com/mlc/account/credentials?type=basic" target="_blank">%s</a>, ' .
1077
- '<a href="https://www.mercadopago.com/mco/account/credentials?type=basic" target="_blank">%s</a>, ' .
1078
- '<a href="https://www.mercadopago.com/mlm/account/credentials?type=basic" target="_blank">%s</a>, ' .
1079
- '<a href="https://www.mercadopago.com/mpe/account/credentials?type=basic" target="_blank">%s</a>, ' .
1080
- '<a href="https://www.mercadopago.com/mlu/account/credentials?type=basic" target="_blank">%s</a> %s ' .
1081
- '<a href="https://www.mercadopago.com/mlv/account/credentials?type=basic" target="_blank">%s</a>',
1082
- __( 'These credentials are used in <strong>Basic Checkout</strong> and <strong>Subscriptions</strong>. Access it for your country:<br>', 'woocommerce-mercadopago' ),
1083
- __( 'Argentine', 'woocommerce-mercadopago' ),
1084
- __( 'Brazil', 'woocommerce-mercadopago' ),
1085
- __( 'Chile', 'woocommerce-mercadopago' ),
1086
- __( 'Colombia', 'woocommerce-mercadopago' ),
1087
- __( 'Mexico', 'woocommerce-mercadopago' ),
1088
- __( 'Peru', 'woocommerce-mercadopago' ),
1089
- __( 'Uruguay', 'woocommerce-mercadopago' ),
1090
- __( 'or', 'woocommerce-mercadopago' ),
1091
- __( 'Venezuela', 'woocommerce-mercadopago' )
1092
- );
1093
- // Currency conversion.
1094
- $_mp_currency_conversion_v0 = get_option( '_mp_currency_conversion_v0', '' );
1095
- if ( empty( $_mp_currency_conversion_v0 ) ) {
1096
- $is_currency_conversion_v0 = '';
1097
- } else {
1098
- $is_currency_conversion_v0 = 'checked="checked"';
1099
- }
1100
- $_can_do_currency_conversion_v0 = get_option( '_can_do_currency_conversion_v0', false );
1101
- if ( ! empty ( $site_id_v0 ) ) {
1102
- if ( ! WC_Woo_Mercado_Pago_Module::is_supported_currency( $site_id_v0 ) ) {
1103
- if ( empty( $_mp_currency_conversion_v0 ) ) {
1104
- $currency_conversion_v0_message = WC_Woo_Mercado_Pago_Module::build_currency_not_converted_msg(
1105
- WC_Woo_Mercado_Pago_Module::$country_configs[$site_id_v0]['currency'],
1106
- WC_Woo_Mercado_Pago_Module::get_country_name( $site_id_v0 )
1107
- );
1108
- } elseif ( ! empty( $_mp_currency_conversion_v0 ) && $_can_do_currency_conversion_v0 ) {
1109
- $currency_conversion_v0_message = WC_Woo_Mercado_Pago_Module::build_currency_converted_msg(
1110
- WC_Woo_Mercado_Pago_Module::$country_configs[$site_id_v0]['currency']
1111
- );
1112
- } else {
1113
- $currency_conversion_v0_message = WC_Woo_Mercado_Pago_Module::build_currency_conversion_err_msg(
1114
- WC_Woo_Mercado_Pago_Module::$country_configs[$site_id_v0]['currency']
1115
- );
1116
- }
1117
- } else {
1118
- $currency_conversion_v0_message = '';
1119
- }
1120
- } else {
1121
- $currency_conversion_v0_message = '';
1122
- }
1123
-
1124
  // ===== v1 verifications =====
1125
  // Trigger v1 API to validate credentials.
1126
  $site_id_v1 = '';
@@ -1138,6 +1039,7 @@ if ( ! class_exists( 'WC_Woo_Mercado_Pago_Module' ) ) :
1138
  $v1_credentials_message = '<img width="14" height="14" src="' . plugins_url( 'assets/images/error.png', __FILE__ ) . '"> ' .
1139
  __( 'Your <strong>public_key</strong> and <strong>access_token</strong> are <strong>not valid</strong>!', 'woocommerce-mercadopago' );
1140
  }
 
1141
  $v1_credential_locales = sprintf(
1142
  '%s <a href="https://www.mercadopago.com/mla/account/credentials?type=custom" target="_blank">%s</a>, ' .
1143
  '<a href="https://www.mercadopago.com/mlb/account/credentials?type=custom" target="_blank">%s</a>, ' .
3
  * Plugin Name: WooCommerce MercadoPago
4
  * Plugin URI: https://github.com/mercadopago/cart-woocommerce
5
  * Description: This is the <strong>oficial</strong> module of Mercado Pago for WooCommerce plugin. This module enables WooCommerce to use Mercado Pago as a payment Gateway for purchases made in your e-commerce store.
6
+ * Version: 3.1.0
7
  * Author: Mercado Pago
8
  * Author URI: https://www.mercadopago.com.br/developers/
9
  * Text Domain: woocommerce-mercadopago
76
  * Summary: WooCommerce MercadoPago Module main class.
77
  * Description: Used as a kind of manager to enable/disable each Mercado Pago gateway.
78
  * Available Public Static Functions:
 
79
  * - validate_credentials_v1()
80
  * - woocommerce_instance()
81
  * - get_common_error_messages( $key )
82
  * - get_conversion_rate( $used_currency )
83
  * - get_common_settings()
84
  * - get_categories()
85
+ * - get_site_data()
86
  * - fix_url_ampersand( $link )
87
  * - get_templates_path()
88
  * - get_module_version()
105
  // ============================================================
106
 
107
  // General constants.
108
+ const VERSION = '3.1.0';
109
  const MIN_PHP = 5.6;
110
 
111
  // Arrays to hold configurations for LatAm environment.
126
 
127
  // Class constructor.
128
  private function __construct() {
129
+
130
+ WC_Woo_Mercado_Pago_Module::$categories = WC_Woo_Mercado_Pago_Module::get_categories();
131
+ WC_Woo_Mercado_Pago_Module::$country_configs = array(
132
  'MCO' => array(
133
  'site_id' => 'MCO',
134
  'sponsor_id' => 208687643,
194
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_BasicGateway.php';
195
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_CustomGateway.php';
196
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_TicketGateway.php';
197
+
198
+ //Get site_id and enable PSE only when credentials are set up and are from Colombia
199
+ $_site_id_v1 = get_option( '_site_id_v1', '' );
200
+ if ( !empty( $_site_id_v1 ) && $_site_id_v1=='MCO' ) {
201
+ include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_PSEGateway.php';
202
+ }
203
+
204
  include_once dirname( __FILE__ ) . '/includes/WC_WooMercadoPago_SubscriptionGateway.php';
205
  include_once dirname( __FILE__ ) . '/includes/class-wc-product-mp_recurrent.php';
206
  add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway' ) );
220
  add_action( 'admin_notices', array( $this, 'notify_woocommerce_miss' ) );
221
  }
222
 
223
+ if ( is_admin() ) {
224
  $this->admin_includes();
225
  }
226
 
244
  $methods[] = 'WC_WooMercadoPago_BasicGateway';
245
  $methods[] = 'WC_WooMercadoPago_CustomGateway';
246
  $methods[] = 'WC_WooMercadoPago_TicketGateway';
247
+
248
+ //Get site_id and enable PSE only when credentials are set up and are from Colombia
249
+ $_site_id_v1 = get_option( '_site_id_v1', '' );
250
+ if ( !empty( $_site_id_v1 ) && $_site_id_v1=='MCO' ) {
251
+ $methods[] = 'WC_WooMercadoPago_PSEGateway';
252
+ }
253
+
254
  $methods[] = 'WC_WooMercadoPago_SubscriptionGateway';
255
  return $methods;
256
  }
321
 
322
  // ============================================================
323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  /**
325
  * Summary: Check if we have valid credentials for v1.
326
  * Description: Check if we have valid credentials.
354
  update_option( '_test_user_v1', in_array( 'test_user', $get_request['response']['tags'] ), true );
355
  update_option( '_site_id_v1', $get_request['response']['site_id'], true );
356
  update_option( '_collector_id_v1', $get_request['response']['id'], true );
357
+
358
+ // $payment_methods = $mp_v1->get( '/v1/payment_methods/?access_token=' . $access_token );
359
+ // $arr = array();
360
+ // $arr[] = 'n/d';
361
+ // foreach ( $payment_methods['response'] as $payment ) {
362
+ // $arr[] = $payment['id'];
363
+ // }
364
+ // update_option( '_all_payment_methods_v0', implode( ',', $arr ), true );
365
+
366
  // Get available payment methods.
367
  $payments = $mp_v1->get( '/v1/payment_methods/?access_token=' . $access_token );
368
  $payment_methods_ticket = array();
369
+ $arr = array();
370
+ $arr[] = 'n/d';
371
+ foreach ( $payments['response'] as $payment ) {
372
+ $arr[] = $payment['id'];
373
+ }
374
+ update_option( '_all_payment_methods_v0', implode( ',', $arr ), true );
375
+
376
  foreach ( $payments['response'] as $payment ) {
377
  if ( isset( $payment['payment_type_id'] ) ) {
378
  if ( $payment['payment_type_id'] != 'account_money' &&
407
  update_option( '_test_user_v1', '', true );
408
  update_option( '_site_id_v1', '', true );
409
  update_option( '_collector_id_v1', '', true );
410
+ update_option( '_all_payment_methods_v0', array(), true );
411
  update_option( '_all_payment_methods_ticket', '[]', true );
412
  update_option( '_can_do_currency_conversion_v1', false, true );
413
  return false;
493
  * @return an array with found categories and a description for its selector title.
494
  */
495
  public static function get_categories() {
496
+ // $store_categories_id = array();
497
+ // $store_categories_description = array();
498
+ // // Get Mercado Pago store categories.
499
+ // $email = ( wp_get_current_user()->ID != 0 ) ? wp_get_current_user()->user_email : null;
500
+ // MPRestClient::set_email( $email );
501
+ // $categories = MPRestClient::get(
502
+ // array( 'uri' => '/item_categories' ),
503
+ // WC_Woo_Mercado_Pago_Module::get_module_version()
504
+ // );
505
+ // foreach ( $categories['response'] as $category ) {
506
+ // array_push(
507
+ // $store_categories_id, str_replace( '_', ' ', $category['id'] )
508
+ // );
509
+ // array_push(
510
+ // $store_categories_description, str_replace( '_', ' ', $category['description'] )
511
+ // );
512
+ // }
513
+ // return array(
514
+ // 'store_categories_id' => $store_categories_id,
515
+ // 'store_categories_description' => $store_categories_description
516
+ // );
517
+ return array(
518
+ 'store_categories_id' => ["art", "baby", "coupons", "donations", "computing", "cameras", "video games", "television", "car electronics", "electronics", "automotive", "entertainment", "fashion", "games", "home", "musical", "phones", "services", "learnings", "tickets", "travels", "virtual goods", "others"],
519
+ 'store_categories_description' => ["Collectibles & Art", "Toys for Baby, Stroller, Stroller Accessories, Car Safety Seats", "Coupons", "Donations", "Computers & Tablets", "Cameras & Photography", "Video Games & Consoles", "LCD, LED, Smart TV, Plasmas, TVs", "Car Audio, Car Alarm Systems & Security, Car DVRs, Car Video Players, Car PC", "Audio & Surveillance, Video & GPS, Others", "Parts & Accessories", "Music, Movies & Series, Books, Magazines & Comics, Board Games & Toys", "Men's, Women's, Kids & baby, Handbags & Accessories, Health & Beauty, Shoes, Jewelry & Watches", "Online Games & Credits", "Home appliances. Home & Garden", "Instruments & Gear", "Cell Phones & Accessories", "General services", "Trainings, Conferences, Workshops", "Tickets for Concerts, Sports, Arts, Theater, Family, Excursions tickets, Events & more", "Plane tickets, Hotel vouchers, Travel vouchers", "E-books, Music Files, Software, Digital Images, PDF Files and any item which can be electronically stored in a file, Mobile Recharge, DTH Recharge and any Online Recharge", "Other categories"]
520
  );
521
  }
522
 
525
  * Description: Get information about the used Mercado Pago account based in its site.
526
  * @return an array with the information.
527
  */
528
+ public static function get_site_data() {
529
+ $site_id = get_option( '_site_id_v1', '' );
 
 
 
 
530
  if ( isset( $site_id ) && ! empty( $site_id ) ) {
531
  return WC_Woo_Mercado_Pago_Module::$country_configs[$site_id];
532
  } else {
663
  }
664
 
665
  public static function get_map( $selector_id ) {
666
+ $html = '';
667
  $arr = explode( '_', $selector_id );
668
  $defaults = array(
669
  'pending' => 'pending',
887
 
888
  // Check for submits.
889
  if ( isset( $_POST['submit'] ) ) {
 
 
890
  update_option( '_mp_public_key', isset( $_POST['public_key'] ) ? $_POST['public_key'] : '', true );
891
  update_option( '_mp_access_token', isset( $_POST['access_token'] ) ? $_POST['access_token'] : '', true );
892
  update_option( '_mp_success_url', isset( $_POST['success_url'] ) ? $_POST['success_url'] : '', true );
989
  $category_id = get_option( '_mp_category_id', 0 );
990
  if ( count( $store_categories_id ) == 0 ) {
991
  $store_category_message = '<img width="14" height="14" src="' . plugins_url( 'assets/images/warning.png', __FILE__ ) . '">' . ' ' .
992
+ __( 'Configure your Public_key and Access_token to have access to more options.', 'woocommerce-mercadopago' );
993
  } else {
994
  $store_category_message = __( 'Define which type of products your store sells.', 'woocommerce-mercadopago' );
995
  }
1022
  $is_sandbox_mode = 'checked="checked"';
1023
  }
1024
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1025
  // ===== v1 verifications =====
1026
  // Trigger v1 API to validate credentials.
1027
  $site_id_v1 = '';
1039
  $v1_credentials_message = '<img width="14" height="14" src="' . plugins_url( 'assets/images/error.png', __FILE__ ) . '"> ' .
1040
  __( 'Your <strong>public_key</strong> and <strong>access_token</strong> are <strong>not valid</strong>!', 'woocommerce-mercadopago' );
1041
  }
1042
+
1043
  $v1_credential_locales = sprintf(
1044
  '%s <a href="https://www.mercadopago.com/mla/account/credentials?type=custom" target="_blank">%s</a>, ' .
1045
  '<a href="https://www.mercadopago.com/mlb/account/credentials?type=custom" target="_blank">%s</a>, ' .