Changeset 1554761
- Timestamp:
- 12/14/2016 03:59:02 PM (9 years ago)
- Location:
- nimblepayments/trunk
- Files:
-
- 1 added
- 11 edited
-
css/nimble_setting.css (modified) (1 diff)
-
css/wp-nimble-backend.css (modified) (1 diff)
-
includes/class-wc-gateway-nimble.php (modified) (10 diffs)
-
js/nimble-payments.js (modified) (1 diff)
-
lang/woocommerce-nimble-payments-es_ES.mo (modified) (previous)
-
lang/woocommerce-nimble-payments-es_ES.po (modified) (13 diffs)
-
lang/woocommerce-nimble-payments.pot (modified) (8 diffs)
-
lib/Nimble/api/NimbleAPICredentials.php (modified) (1 diff)
-
lib/Nimble/api/NimbleAPIEnvironment.php (added)
-
lib/Nimble/api/NimbleAPIPayments.php (modified) (8 diffs)
-
nimblepayments.php (modified) (20 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nimblepayments/trunk/css/nimble_setting.css
r1534878 r1554761 47 47 background-color: white;*/ 48 48 } 49 .nimble-authorization { 50 text-align: center; 51 } -
nimblepayments/trunk/css/wp-nimble-backend.css
r1435886 r1554761 161 161 font-size: 1.8em; 162 162 } 163 .nimble-authorization { 164 border: solid 1px #ccc; 165 max-width: 400px; 166 margin: 0 auto; 167 border-radius: 15px; 168 background-color: #e7e7e7; 169 } 170 .nimble-authorization #np-oauth3-disassociate { 171 background: #a3b745; 172 border-color: #829237 #727f30 #727f30; 173 color: #fff; 174 -webkit-box-shadow: 0 1px 0 #727f30; 175 box-shadow: 0 1px 0 #727f30; 176 text-shadow: 0 -1px 1px #727f30,1px 0 1px #727f30,0 1px 1px #727f30,-1px 0 1px #727f30; 177 opacity: 0.75; 178 } -
nimblepayments/trunk/includes/class-wc-gateway-nimble.php
r1534878 r1554761 125 125 126 126 function process_stored_card_payment($order){ 127 // Mark as nimble-pending (we're awaiting the payment)128 $order->update_status('nimble-pending' , __('Awaiting payment via Nimble Payments.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE PENDING127 // Mark as nimble-pending (we're awaiting the payment) 128 $order->update_status('nimble-pending'); 129 129 try{ 130 130 $nimbleApi = $this->inicialize_nimble_api(); … … 270 270 $order = wc_get_order( $order_id ); 271 271 272 273 if ($order->needs_payment()){ 272 if ("wc-nimble-pending" == $order->post_status){ 274 273 if ( isset($_GET[$this->storedcard_field]) ){ 275 274 //STORED CARD PAYMENT … … 278 277 } else { 279 278 //BASIC PAYMENT 279 $order->add_order_note(__('Payment processed.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE ON_HOLD 280 280 $order->payment_complete(); 281 282 //Email sending 283 WC_Emails::instance(); 284 $email_actions = apply_filters( 'woocommerce_email_actions', array( 285 'woocommerce_order_status_pending_to_processing', 286 ) ); 287 if (in_array('woocommerce_order_status_pending_to_processing', $email_actions)){ 288 do_action('woocommerce_order_status_pending_to_processing_notification', $order_id); 289 } 281 $this->sendMail($order_id); 290 282 //END BASIC PAYMENT 291 283 } … … 302 294 switch ($_GET['payment_status']){ 303 295 case 'error': 296 global $wp; 297 $order_id = $wp->query_vars['order-pay']; 298 $order = wc_get_order( $order_id ); 299 if ("wc-nimble-pending" == $order->post_status){ 300 //$this->change_order_status( $order ); 301 $order->update_status('pending', __('Denied card.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE DENIED 302 } 304 303 $message = __( 'Card payment was rejected. Please try again.', 'woocommerce-nimble-payments' ); //LANG: CARD PAYMENT REJECTED 305 304 echo '<div class="woocommerce-error">' . $message . '</div>'; … … 318 317 $order = wc_get_order( $order_id ); 319 318 // Mark as nimble-pending (we're awaiting the payment) 320 $order->update_status('nimble-pending' , __('Awaiting payment via Nimble Payments.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE PENDING319 $order->update_status('nimble-pending'); 321 320 322 321 try{ … … 329 328 $payment = $this->set_payment_info($order); 330 329 331 $response = NimbleAPIPayments:: SendPaymentClient($nimbleApi, $payment);330 $response = NimbleAPIPayments::sendPaymentClient($nimbleApi, $payment); 332 331 //Save transaction_id to this order 333 332 if ( isset($response["data"]) && isset($response["data"]["id"])){ … … 336 335 337 336 if (!isset($response["data"]) || !isset($response["data"]["paymentUrl"])){ 338 $order->update_status(' nimble-failed', __('Could not connect to the bank. Code ERR_CONEX.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE 404337 $order->update_status('pending', __('Could not connect to the bank. Code ERR_CONEX.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE 404 339 338 $message = __('Unable to process payment. An error has occurred. ERR_CONEX code. Please try later.', 'woocommerce-nimble-payments'); //LANG: SDK RETURN 404 340 339 } else{ … … 345 344 } 346 345 catch (Exception $e) { 347 $order->update_status(' nimble-failed', __('An error has occurred. Code ERR_PAG.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE ERROR346 $order->update_status('pending', __('An error has occurred. Code ERR_PAG.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE ERROR 348 347 $message = __('Unable to process payment. An error has occurred. ERR_PAG code. Please try later.', 'woocommerce-nimble-payments'); //LANG: SDK ERROR MESSAGE 349 348 } … … 367 366 if ( ( "yes" == $this->get_option('enabled')) && $this->get_option($this->status_field_name) && ! $oWoocommerceNimblePayments->isOauth3Enabled() ){ 368 367 Woocommerce_Nimble_Payments::authorize_notice(); 368 } 369 370 if ( ( "yes" == $this->get_option('enabled')) && $this->get_option($this->status_field_name) && $oWoocommerceNimblePayments->isOauth3Enabled() ){ 371 Woocommerce_Nimble_Payments::disassociate(); 369 372 } 370 373 … … 602 605 switch ($state){ 603 606 case 'SETTLED': 607 //PAYMENT COMPLETE 608 $order->add_order_note(__('Payment processed and settled .', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE SETTLED 609 $order->payment_complete(); 610 $this->sendMail($order_id); 611 break; 604 612 case 'ON_HOLD': 605 613 //PAYMENT COMPLETE 614 $order->add_order_note(__('Payment processed.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE ON_HOLD 606 615 $order->payment_complete(); 607 608 //Email sending 609 WC_Emails::instance(); 610 $email_actions = apply_filters( 'woocommerce_email_actions', array( 611 'woocommerce_order_status_pending_to_processing', 612 ) ); 613 if (in_array('woocommerce_order_status_pending_to_processing', $email_actions)){ 614 do_action('woocommerce_order_status_pending_to_processing_notification', $order_id); 615 } 616 $this->sendMail($order_id); 616 617 break; 617 618 case 'ABANDONED': 619 $order->update_status('pending', __('Checkout page abandoned.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE ABANDONED 620 break; 618 621 case 'DENIED': 619 //PAYMENT DENIED OR ABANDONED 620 $order->update_status( 'wc-nimble-denied' ); 622 $order->update_status('pending', __('Card denied.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE DENIED 621 623 break; 622 624 case 'CANCELLED': 623 //PAYMENT CANCELLED 624 $order->update_status( 'cancelled' ); 625 case 'NOT_FOUND': 626 case 'PAGE_NOT_LOADED': 627 $order->update_status('pending', __('Payment cancelled.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE CANCELLED 625 628 break; 626 629 case 'ERROR': 627 //PAYMENT ERROR 628 $order->update_status( 'failed' ); 630 $order->update_status('pending', __('Payment error.', 'woocommerce-nimble-payments')); //LANG: ORDER NOTE ERROR 629 631 break; 630 case 'NOT_FOUND':631 632 default: 632 633 break; 634 } 635 } 636 637 /** 638 * Email sending 639 */ 640 private function sendMail($order_id) { 641 WC_Emails::instance(); 642 $email_actions = apply_filters( 'woocommerce_email_actions', array( 643 'woocommerce_order_status_pending_to_processing', 644 ) ); 645 if (in_array('woocommerce_order_status_pending_to_processing', $email_actions)){ 646 do_action('woocommerce_order_status_pending_to_processing_notification', $order_id); 633 647 } 634 648 } -
nimblepayments/trunk/js/nimble-payments.js
r1435914 r1554761 56 56 }); 57 57 } 58 59 //Button link Disassociate 60 jQuery("#np-oauth3-disassociate.button").click(function(event) { 61 event.preventDefault(); 62 jQuery.ajax({ 63 type: 'POST', 64 dataType: 'json', 65 url: ajaxurl, 66 data: { 67 'action': 'nimble_payments_oauth3_disassociate' 68 }, 69 success: function (data) { 70 location.reload(); 71 }, 72 error: function (data) { 73 console.log(data); 74 } 75 }); 76 }); 58 77 }); -
nimblepayments/trunk/lang/woocommerce-nimble-payments-es_ES.po
r1435886 r1554761 4 4 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-" 5 5 "nimble-payments\n" 6 "POT-Creation-Date: 2016- 06-08 13:04:16+00:00\n"7 "PO-Revision-Date: 2016- 06-08 15:35+0100\n"6 "POT-Creation-Date: 2016-12-13 16:24:34+00:00\n" 7 "PO-Revision-Date: 2016-12-13 17:26+0100\n" 8 8 "Last-Translator: Carlos Mendoza <cmendoza@opensistemas.com>\n" 9 9 "Language-Team: Opensistemas <acasado@opensistemas.com>\n" … … 22 22 msgstr "Nimble Payments by BBVA" 23 23 24 #. #-#-#-#-# woocommerce-nimble-payments.pot (Nimble Payments 1.0.8) #-#-#-#-#24 #. #-#-#-#-# myfile.pot (Nimble Payments 3.0.0) #-#-#-#-# 25 25 #. Plugin Name of the plugin/theme 26 26 #: includes/class-wc-gateway-nimble.php:30 … … 32 32 msgstr "Paga de manera segura con tarjeta con la garantía de BBVA." 33 33 34 #: includes/class-wc-gateway-nimble.php:128 35 #: includes/class-wc-gateway-nimble.php:310 36 msgid "Awaiting payment via Nimble Payments." 37 msgstr "Esperando pago via Nimble Payments." 38 39 #: includes/class-wc-gateway-nimble.php:223 34 #: includes/class-wc-gateway-nimble.php:233 40 35 msgid "Enable/Disable" 41 36 msgstr "Habilitar/Deshabilitar" 42 37 43 #: includes/class-wc-gateway-nimble.php:2 2438 #: includes/class-wc-gateway-nimble.php:234 44 39 msgid "Enable Nimble Payments" 45 40 msgstr "Habilitar Nimble Payments" 46 41 47 #: includes/class-wc-gateway-nimble.php:2 3042 #: includes/class-wc-gateway-nimble.php:240 48 43 msgid "API Client ID" 49 44 msgstr "API Client ID" 50 45 51 #: includes/class-wc-gateway-nimble.php:2 3252 #: includes/class-wc-gateway-nimble.php:2 3946 #: includes/class-wc-gateway-nimble.php:242 47 #: includes/class-wc-gateway-nimble.php:249 53 48 msgid "Obtained from https://www.nimblepayments.com" 54 49 msgstr "Cópialo de tu pasarela en https://www.nimblepayments.com" 55 50 56 #: includes/class-wc-gateway-nimble.php:2 3751 #: includes/class-wc-gateway-nimble.php:247 57 52 msgid "Client Secret" 58 53 msgstr "Client Secret" 59 54 60 #: includes/class-wc-gateway-nimble.php:294 55 #: includes/class-wc-gateway-nimble.php:284 56 #: includes/class-wc-gateway-nimble.php:615 57 msgid "Payment processed." 58 msgstr "Pago aceptado." 59 60 #: includes/class-wc-gateway-nimble.php:306 61 msgid "Denied card." 62 msgstr "Tarjeta denegada." 63 64 #: includes/class-wc-gateway-nimble.php:308 61 65 msgid "Card payment was rejected. Please try again." 62 66 msgstr "Se ha rechazado el pago. Por favor, inténtalo de nuevo." 63 67 64 #: includes/class-wc-gateway-nimble.php:3 2868 #: includes/class-wc-gateway-nimble.php:342 65 69 msgid "Could not connect to the bank. Code ERR_CONEX." 66 70 msgstr "Error al conectar a Nimbe Payments. Código ERR_CONEX." 67 71 68 #: includes/class-wc-gateway-nimble.php:3 2972 #: includes/class-wc-gateway-nimble.php:343 69 73 msgid "" 70 74 "Unable to process payment. An error has occurred. ERR_CONEX code. Please try " … … 74 78 "ERR_CONEX. Por favor, inténtalo mas tarde." 75 79 76 #: includes/class-wc-gateway-nimble.php:3 3780 #: includes/class-wc-gateway-nimble.php:351 77 81 msgid "An error has occurred. Code ERR_PAG." 78 82 msgstr "Error en el pago. Código ERR_PAG." 79 83 80 #: includes/class-wc-gateway-nimble.php:3 3884 #: includes/class-wc-gateway-nimble.php:352 81 85 msgid "" 82 86 "Unable to process payment. An error has occurred. ERR_PAG code. Please try " … … 86 90 "Por favor, inténtalo mas tarde." 87 91 88 #: includes/class-wc-gateway-nimble.php:3 7292 #: includes/class-wc-gateway-nimble.php:386 89 93 msgid "Need an Nimble Payments account?" 90 94 msgstr "" … … 92 96 "de forma completamente online." 93 97 94 #: includes/class-wc-gateway-nimble.php:3 7498 #: includes/class-wc-gateway-nimble.php:388 95 99 msgid "Signup now" 96 100 msgstr "Regístrate" 97 101 98 #: includes/class-wc-gateway-nimble.php:3 76102 #: includes/class-wc-gateway-nimble.php:390 99 103 msgid "Already registered" 100 104 msgstr "Ya estoy registrado" 101 105 102 #: includes/class-wc-gateway-nimble.php:3 85106 #: includes/class-wc-gateway-nimble.php:399 103 107 msgid "Data invalid gateway to accept payments." 104 108 msgstr "" … … 106 110 "una pasarela de Test." 107 111 108 #: includes/class-wc-gateway-nimble.php: 393112 #: includes/class-wc-gateway-nimble.php:407 109 113 #: templates/nimble-checkout-payment-method.php:26 110 114 #: templates/nimble-checkout-thankyou.php:55 … … 112 116 msgstr "Pago con tarjeta" 113 117 114 #: includes/class-wc-gateway-nimble.php:4 24118 #: includes/class-wc-gateway-nimble.php:438 115 119 msgid "Invalid refund amount" 116 120 msgstr "" 117 121 118 #: includes/class-wc-gateway-nimble.php:4 28119 #: includes/class-wc-gateway-nimble.php:4 85122 #: includes/class-wc-gateway-nimble.php:442 123 #: includes/class-wc-gateway-nimble.php:498 120 124 msgid "Refund Failed: You must authorize the advanced options Nimble Payments." 121 125 msgstr "" … … 123 127 "Payments." 124 128 125 #: includes/class-wc-gateway-nimble.php:5 08129 #: includes/class-wc-gateway-nimble.php:521 126 130 msgid "Refund Failed: " 127 131 msgstr "Falló la devolución: " 128 132 129 #: includes/class-wc-gateway-nimble.php:5 63133 #: includes/class-wc-gateway-nimble.php:576 130 134 msgid "Could not pay with the selected card." 131 135 msgstr "No se ha podido pagar con la tarjeta seleccionada." 132 136 133 #: nimblepayments.php:161 137 #: includes/class-wc-gateway-nimble.php:609 138 msgid "Payment processed and settled ." 139 msgstr "Pago aceptado y liquidado." 140 141 #: includes/class-wc-gateway-nimble.php:620 142 msgid "Checkout page abandoned." 143 msgstr "Página de checkout abandonada." 144 145 #: includes/class-wc-gateway-nimble.php:623 146 msgid "Card denied." 147 msgstr "Tarjeta denegada." 148 149 #: includes/class-wc-gateway-nimble.php:628 150 msgid "Payment cancelled." 151 msgstr "Pago cancelado." 152 153 #: includes/class-wc-gateway-nimble.php:631 154 msgid "Payment error." 155 msgstr "Error en el pago." 156 157 #: nimblepayments.php:175 nimblepayments.php:178 158 msgid "Update Nimble Payments plugin 3.0.0." 159 msgstr "Actualización del plugin Nimble Payments 3.0.0." 160 161 #: nimblepayments.php:237 134 162 msgid "Refund in progress" 135 163 msgstr "Devolución en progreso" 136 164 137 #: nimblepayments.php: 162165 #: nimblepayments.php:238 138 166 msgid "Refund Failed" 139 167 msgstr "Falló la devolución" 140 168 141 #: nimblepayments.php: 238 nimblepayments.php:251169 #: nimblepayments.php:314 nimblepayments.php:327 142 170 msgid "Operation rejected." 143 171 msgstr "Operación denegada." 144 172 145 #: nimblepayments.php: 239173 #: nimblepayments.php:315 146 174 msgid "You have not activated your payment gateway Nimble Payments." 147 175 msgstr "No has configurado tu pasarela Nimble Payments." 148 176 149 #: nimblepayments.php: 241177 #: nimblepayments.php:317 150 178 msgid "Activate" 151 179 msgstr "Activar" 152 180 153 #: nimblepayments.php: 252181 #: nimblepayments.php:328 154 182 msgid "" 155 183 "You have not yet WooCommerce authorized to perform operations on Nimble " … … 157 185 msgstr "Todavía no has autorizado a Woocommerce en Nimble Payments." 158 186 159 #: nimblepayments.php: 254templates/nimble-oauth-form.php:17187 #: nimblepayments.php:330 templates/nimble-oauth-form.php:17 160 188 #: templates/nimble-oauth-form.php:19 161 189 msgid "Authorize Woocommerce" 162 190 msgstr "Autorizar a Woocommerce" 163 191 164 #: nimblepayments.php: 319 nimblepayments.php:327192 #: nimblepayments.php:404 nimblepayments.php:411 165 193 msgctxt "Order status" 166 msgid "Pending Payment (Nimble Payments)" 167 msgstr "Pago Pendiente (Nimble Payments)" 168 169 #: nimblepayments.php:320 nimblepayments.php:335 170 msgctxt "Order status" 171 msgid "Failed (Nimble Payments)" 172 msgstr "Fallido (Nimble Payments)" 173 174 #: nimblepayments.php:332 175 msgid "Pending Payment (Nimble Payments) <span class=\"count\">(%s)</span>" 176 msgid_plural "" 177 "Pending Payment (Nimble Payments) <span class=\"count\">(%s)</span>" 178 msgstr[0] "Pago Pendiente (Nimble Payments) <span class=\"count\">(%s)</span>" 179 msgstr[1] "" 180 "Pagos Pendientes (Nimble Payments) <span class=\"count\">(%s)</span>" 181 182 #: nimblepayments.php:340 183 msgid "Failed (Nimble Payments) <span class=\"count\">(%s)</span>" 184 msgid_plural "Failed (Nimble Payments) <span class=\"count\">(%s)</span>" 185 msgstr[0] "Fallido (Nimble Payments) <span class=\"count\">(%s)</span>" 186 msgstr[1] "Fallidos (Nimble Payments) <span class=\"count\">(%s)</span>" 187 188 #: nimblepayments.php:535 templates/nimble-oauth-form.php:12 194 msgid "Processing transaction" 195 msgstr "Cursando pago" 196 197 #: nimblepayments.php:416 198 msgid "Processing Payment <span class=\"count\">(%s)</span>" 199 msgid_plural "Processing Payment <span class=\"count\">(%s)</span>" 200 msgstr[0] "Cursando pago <span class=\"count\">(%s)</span>" 201 msgstr[1] "Cursando pagos <span class=\"count\">(%s)</span>" 202 203 #: nimblepayments.php:624 templates/nimble-oauth-form.php:12 189 204 #: templates/nimble-summary.php:19 190 205 msgid "Nimble Payments Summary" … … 234 249 msgid "Total available" 235 250 msgstr "Total disponible" 251 252 #: templates/nimble-gateway-footer.php:10 253 msgid "Ecommerce linked to Nimble Payments" 254 msgstr "Tienda vinculada a Nimble Payments" 255 256 #: templates/nimble-gateway-footer.php:12 257 msgid "Disassociate" 258 msgstr "Desvincular" 236 259 237 260 #: templates/nimble-oauth-form.php:13 … … 291 314 msgstr "BBVA" 292 315 316 #~ msgid "Abandoned checkout page." 317 #~ msgstr "Página de checkout abandonada." 318 319 #~ msgid "Error." 320 #~ msgstr "Error." 321 322 #~ msgid "Awaiting payment via Nimble Payments." 323 #~ msgstr "Esperando pago via Nimble Payments." 324 325 #~ msgctxt "Order status" 326 #~ msgid "Pending Payment (Nimble Payments)" 327 #~ msgstr "Pago Pendiente (Nimble Payments)" 328 329 #~ msgctxt "Order status" 330 #~ msgid "Failed (Nimble Payments)" 331 #~ msgstr "Fallido (Nimble Payments)" 332 333 #~ msgid "Pending Payment (Nimble Payments) <span class=\"count\">(%s)</span>" 334 #~ msgid_plural "" 335 #~ "Pending Payment (Nimble Payments) <span class=\"count\">(%s)</span>" 336 #~ msgstr[0] "" 337 #~ "Pago Pendiente (Nimble Payments) <span class=\"count\">(%s)</span>" 338 #~ msgstr[1] "" 339 #~ "Pagos Pendientes (Nimble Payments) <span class=\"count\">(%s)</span>" 340 293 341 #, fuzzy 294 342 #~ msgid "Nimble Payments Account" … … 299 347 #~ msgid "NimblePayments" 300 348 #~ msgstr "Nimble Payments" 301 302 #~ msgid "WooCommerce Nimble Payments"303 #~ msgstr "WooCommerce Nimble Payments"304 349 305 350 #~ msgctxt "Order status" -
nimblepayments/trunk/lang/woocommerce-nimble-payments.pot
r1435886 r1554761 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Nimble Payments 1.0.8\n"5 "Project-Id-Version: Nimble Payments 3.0.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-" 7 7 "nimble-payments\n" 8 "POT-Creation-Date: 2016- 06-08 13:04:16+00:00\n"8 "POT-Creation-Date: 2016-12-13 16:24:34+00:00\n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=UTF-8\n" … … 18 18 msgstr "" 19 19 20 #. #-#-#-#-# woocommerce-nimble-payments.pot (Nimble Payments 1.0.8) #-#-#-#-#20 #. #-#-#-#-# myfile.pot (Nimble Payments 3.0.0) #-#-#-#-# 21 21 #. Plugin Name of the plugin/theme 22 22 #: includes/class-wc-gateway-nimble.php:30 … … 28 28 msgstr "" 29 29 30 #: includes/class-wc-gateway-nimble.php:128 31 #: includes/class-wc-gateway-nimble.php:310 32 msgid "Awaiting payment via Nimble Payments." 33 msgstr "" 34 35 #: includes/class-wc-gateway-nimble.php:223 30 #: includes/class-wc-gateway-nimble.php:233 36 31 msgid "Enable/Disable" 37 32 msgstr "" 38 33 39 #: includes/class-wc-gateway-nimble.php:2 2434 #: includes/class-wc-gateway-nimble.php:234 40 35 msgid "Enable Nimble Payments" 41 36 msgstr "" 42 37 43 #: includes/class-wc-gateway-nimble.php:2 3038 #: includes/class-wc-gateway-nimble.php:240 44 39 msgid "API Client ID" 45 40 msgstr "" 46 41 47 #: includes/class-wc-gateway-nimble.php:2 3248 #: includes/class-wc-gateway-nimble.php:2 3942 #: includes/class-wc-gateway-nimble.php:242 43 #: includes/class-wc-gateway-nimble.php:249 49 44 msgid "Obtained from https://www.nimblepayments.com" 50 45 msgstr "" 51 46 52 #: includes/class-wc-gateway-nimble.php:2 3747 #: includes/class-wc-gateway-nimble.php:247 53 48 msgid "Client Secret" 54 49 msgstr "" 55 50 56 #: includes/class-wc-gateway-nimble.php:294 51 #: includes/class-wc-gateway-nimble.php:284 52 #: includes/class-wc-gateway-nimble.php:615 53 msgid "Payment processed." 54 msgstr "" 55 56 #: includes/class-wc-gateway-nimble.php:306 57 msgid "Denied card." 58 msgstr "" 59 60 #: includes/class-wc-gateway-nimble.php:308 57 61 msgid "Card payment was rejected. Please try again." 58 62 msgstr "" 59 63 60 #: includes/class-wc-gateway-nimble.php:3 2864 #: includes/class-wc-gateway-nimble.php:342 61 65 msgid "Could not connect to the bank. Code ERR_CONEX." 62 66 msgstr "" 63 67 64 #: includes/class-wc-gateway-nimble.php:3 2968 #: includes/class-wc-gateway-nimble.php:343 65 69 msgid "" 66 70 "Unable to process payment. An error has occurred. ERR_CONEX code. Please try " … … 68 72 msgstr "" 69 73 70 #: includes/class-wc-gateway-nimble.php:3 3774 #: includes/class-wc-gateway-nimble.php:351 71 75 msgid "An error has occurred. Code ERR_PAG." 72 76 msgstr "" 73 77 74 #: includes/class-wc-gateway-nimble.php:3 3878 #: includes/class-wc-gateway-nimble.php:352 75 79 msgid "" 76 80 "Unable to process payment. An error has occurred. ERR_PAG code. Please try " … … 78 82 msgstr "" 79 83 80 #: includes/class-wc-gateway-nimble.php:3 7284 #: includes/class-wc-gateway-nimble.php:386 81 85 msgid "Need an Nimble Payments account?" 82 86 msgstr "" 83 87 84 #: includes/class-wc-gateway-nimble.php:3 7488 #: includes/class-wc-gateway-nimble.php:388 85 89 msgid "Signup now" 86 90 msgstr "" 87 91 88 #: includes/class-wc-gateway-nimble.php:3 7692 #: includes/class-wc-gateway-nimble.php:390 89 93 msgid "Already registered" 90 94 msgstr "" 91 95 92 #: includes/class-wc-gateway-nimble.php:3 8596 #: includes/class-wc-gateway-nimble.php:399 93 97 msgid "Data invalid gateway to accept payments." 94 98 msgstr "" 95 99 96 #: includes/class-wc-gateway-nimble.php: 393100 #: includes/class-wc-gateway-nimble.php:407 97 101 #: templates/nimble-checkout-payment-method.php:26 98 102 #: templates/nimble-checkout-thankyou.php:55 … … 100 104 msgstr "" 101 105 102 #: includes/class-wc-gateway-nimble.php:4 24106 #: includes/class-wc-gateway-nimble.php:438 103 107 msgid "Invalid refund amount" 104 108 msgstr "" 105 109 106 #: includes/class-wc-gateway-nimble.php:4 28107 #: includes/class-wc-gateway-nimble.php:4 85110 #: includes/class-wc-gateway-nimble.php:442 111 #: includes/class-wc-gateway-nimble.php:498 108 112 msgid "Refund Failed: You must authorize the advanced options Nimble Payments." 109 113 msgstr "" 110 114 111 #: includes/class-wc-gateway-nimble.php:5 08115 #: includes/class-wc-gateway-nimble.php:521 112 116 msgid "Refund Failed: " 113 117 msgstr "" 114 118 115 #: includes/class-wc-gateway-nimble.php:5 63119 #: includes/class-wc-gateway-nimble.php:576 116 120 msgid "Could not pay with the selected card." 117 121 msgstr "" 118 122 119 #: nimblepayments.php:161 123 #: includes/class-wc-gateway-nimble.php:609 124 msgid "Payment processed and settled ." 125 msgstr "" 126 127 #: includes/class-wc-gateway-nimble.php:620 128 msgid "Checkout page abandoned." 129 msgstr "" 130 131 #: includes/class-wc-gateway-nimble.php:623 132 msgid "Card denied." 133 msgstr "" 134 135 #: includes/class-wc-gateway-nimble.php:628 136 msgid "Payment cancelled." 137 msgstr "" 138 139 #: includes/class-wc-gateway-nimble.php:631 140 msgid "Payment error." 141 msgstr "" 142 143 #: nimblepayments.php:175 nimblepayments.php:178 144 msgid "Update Nimble Payments plugin 3.0.0." 145 msgstr "" 146 147 #: nimblepayments.php:237 120 148 msgid "Refund in progress" 121 149 msgstr "" 122 150 123 #: nimblepayments.php: 162151 #: nimblepayments.php:238 124 152 msgid "Refund Failed" 125 153 msgstr "" 126 154 127 #: nimblepayments.php: 238 nimblepayments.php:251155 #: nimblepayments.php:314 nimblepayments.php:327 128 156 msgid "Operation rejected." 129 157 msgstr "" 130 158 131 #: nimblepayments.php: 239159 #: nimblepayments.php:315 132 160 msgid "You have not activated your payment gateway Nimble Payments." 133 161 msgstr "" 134 162 135 #: nimblepayments.php: 241163 #: nimblepayments.php:317 136 164 msgid "Activate" 137 165 msgstr "" 138 166 139 #: nimblepayments.php: 252167 #: nimblepayments.php:328 140 168 msgid "" 141 169 "You have not yet WooCommerce authorized to perform operations on Nimble " … … 143 171 msgstr "" 144 172 145 #: nimblepayments.php: 254templates/nimble-oauth-form.php:17173 #: nimblepayments.php:330 templates/nimble-oauth-form.php:17 146 174 #: templates/nimble-oauth-form.php:19 147 175 msgid "Authorize Woocommerce" 148 176 msgstr "" 149 177 150 #: nimblepayments.php: 319 nimblepayments.php:327178 #: nimblepayments.php:404 nimblepayments.php:411 151 179 msgctxt "Order status" 152 msgid "Pending Payment (Nimble Payments)" 153 msgstr "" 154 155 #: nimblepayments.php:320 nimblepayments.php:335 156 msgctxt "Order status" 157 msgid "Failed (Nimble Payments)" 158 msgstr "" 159 160 #: nimblepayments.php:332 161 msgid "Pending Payment (Nimble Payments) <span class=\"count\">(%s)</span>" 162 msgid_plural "" 163 "Pending Payment (Nimble Payments) <span class=\"count\">(%s)</span>" 180 msgid "Processing transaction" 181 msgstr "" 182 183 #: nimblepayments.php:416 184 msgid "Processing Payment <span class=\"count\">(%s)</span>" 185 msgid_plural "Processing Payment <span class=\"count\">(%s)</span>" 164 186 msgstr[0] "" 165 187 msgstr[1] "" 166 188 167 #: nimblepayments.php:340 168 msgid "Failed (Nimble Payments) <span class=\"count\">(%s)</span>" 169 msgid_plural "Failed (Nimble Payments) <span class=\"count\">(%s)</span>" 170 msgstr[0] "" 171 msgstr[1] "" 172 173 #: nimblepayments.php:535 templates/nimble-oauth-form.php:12 189 #: nimblepayments.php:624 templates/nimble-oauth-form.php:12 174 190 #: templates/nimble-summary.php:19 175 191 msgid "Nimble Payments Summary" … … 220 236 msgstr "" 221 237 238 #: templates/nimble-gateway-footer.php:10 239 msgid "Ecommerce linked to Nimble Payments" 240 msgstr "" 241 242 #: templates/nimble-gateway-footer.php:12 243 msgid "Disassociate" 244 msgstr "" 245 222 246 #: templates/nimble-oauth-form.php:13 223 247 msgid "" -
nimblepayments/trunk/lib/Nimble/api/NimbleAPICredentials.php
r1435914 r1554761 1 1 <?php 2 require_once(__DIR__.'/../base/NimbleAPIConfig.php'); 2 require_once(dirname(__FILE__).'/../base/NimbleAPIConfig.php'); 3 require_once 'NimbleAPIEnvironment.php'; 3 4 4 /**5 * Class responsible for performing payments services.6 */7 5 class NimbleAPICredentials 8 6 { 9 10 7 /** 11 * Validates mode corresponds with credentials 12 * 13 * @param type $NimbleApi 14 * @return type 15 * @throws Exception 8 * DEPRECATED 16 9 */ 17 10 public static function check($NimbleApi) 18 11 { 19 20 if (empty($NimbleApi)) { 21 throw new Exception('$NimbleApi parameter is empty.'); 22 } 23 24 try { 25 //HEADERS 26 //$this->authorization->buildAuthorizationHeader('tsec'); 27 $NimbleApi->authorization->addHeader('Content-Type', 'application/json'); 28 $NimbleApi->authorization->addHeader('Accept', 'application/json'); 29 30 $NimbleApi->setUri('check'); 31 $NimbleApi->method = 'GET'; 32 $response = $NimbleApi->restApiCall(); 33 return $response; 34 } catch (Exception $e) { 35 throw new Exception('Error in NimbleAPICredentials::check(): ' . $e); 36 } 12 return NimbleAPIEnvironment::verification($NimbleApi); 37 13 } 38 14 } -
nimblepayments/trunk/lib/Nimble/api/NimbleAPIPayments.php
r1435914 r1554761 9 9 * @filesource 10 10 */ 11 require_once( __DIR__. '/../base/NimbleAPIConfig.php');11 require_once(dirname(__FILE__) . '/../base/NimbleAPIConfig.php'); 12 12 13 13 /** … … 50 50 51 51 /** 52 * Method updateCustomerData 52 * Method updateCustomerData (DEPRECATED) 53 53 * 54 54 * @param object $NimbleApi … … 58 58 */ 59 59 public static function updateCustomerData($NimbleApi, $transaction_id, $new_order_id) { 60 self::updateMerchantOrderId($NimbleApi, $transaction_id, $new_order_id); 61 } 62 63 /** 64 * Method updateMerchantOrderId 65 * 66 * @param object $NimbleApi 67 * @param array $transaction_id 68 * @param array $new_order_id 69 * @return array 70 */ 71 public static function updateMerchantOrderId($NimbleApi, $transaction_id, $new_order_id) { 60 72 61 73 if (empty($NimbleApi)) { … … 206 218 * @return array 207 219 */ 208 public static function getPayment($NimbleApi, $IdTransaction ) {220 public static function getPayment($NimbleApi, $IdTransaction, $extendedData = false) { 209 221 210 222 if (empty($NimbleApi)) { … … 221 233 $NimbleApi->authorization->addHeader('Accept', 'application/json'); 222 234 223 $NimbleApi->uri = 'v2/payments/' . $IdTransaction; 235 $query_params = ($extendedData) ? '?extendedData=true' : ''; 236 $NimbleApi->uri = 'v2/payments/' . $IdTransaction . $query_params; 224 237 $NimbleApi->method = 'GET'; 225 238 $response = $NimbleApi->restApiCall(); … … 234 247 * 235 248 * @param object $NimbleApi 236 * @param array $filters (fromDate, toDate, merchantOrderId, stat e, hasRefunds, extendedData, hasDisputes,249 * @param array $filters (fromDate, toDate, merchantOrderId, status, hasRefunds, extendedData, hasDisputes, 237 250 * entryReference, itemReference, itemsPerPage) 238 251 * @return array … … 261 274 262 275 /** 263 * Method getPayment sDisputes276 * Method getPaymentDisputes 264 277 * 265 278 * @param object $NimbleApi … … 267 280 * @return array 268 281 */ 269 public static function getPayment sDisputes($NimbleApi, $IdTransaction) {282 public static function getPaymentDisputes($NimbleApi, $IdTransaction) { 270 283 271 284 if (empty($NimbleApi)) { -
nimblepayments/trunk/nimblepayments.php
r1534878 r1554761 5 5 Plugin URI: https://www.nimblepayments.com 6 6 Description: Nimble Payments is an online payment gateway supported by BBVA that enables you to accept online payments flexibly and safely. 7 Version: 2.1.07 Version: 3.0.0 8 8 Author: BBVA 9 9 Author URI: … … 38 38 protected static $gateway = null; 39 39 protected static $params = null; 40 protected $default_options = array( 41 'version' => '0', 42 'token' => '', 43 'refreshToken' => '' 44 ); 40 45 41 46 static function & getInstance() { … … 59 64 60 65 add_action( 'woocommerce_init', array( $this, 'gateway_loaded'), 0); 66 67 add_action( 'wp_loaded', array( $this, 'check_init'), 99 ); 61 68 62 69 add_action( 'admin_menu', array( $this, 'nimble_menu')); … … 65 72 66 73 add_action( 'init', array( $this, 'register_post_status' ), 9 ); 67 74 68 75 add_filter( 'woocommerce_valid_order_statuses_for_payment', array( $this, 'valid_order_statuses_for_payment' ) ); 69 76 70 77 add_filter( 'woocommerce_valid_order_statuses_for_payment_complete', array( $this, 'valid_order_statuses_for_payment' ) ); 71 78 … … 80 87 add_action( 'wp_ajax_nimble_payments_oauth3', array( $this, 'ajax_oauth3' ) ); 81 88 89 add_action( 'wp_ajax_nimble_payments_oauth3_disassociate', array( $this, 'ajax_oauth3_disassociate' ) ); 90 82 91 add_action( 'wp_ajax_nimble_payments_gateway', array( $this, 'ajax_gateway' ) ); 83 92 … … 86 95 //Custom template checkout/payment-method.php 87 96 add_filter( 'wc_get_template', array( $this, 'filter_templates_checkout' ), 10, 3); 88 89 add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_shop_order_columns' ), 1, 2 ); 90 97 91 98 $this->load_settings(); 92 99 } 93 100 } 94 95 function render_shop_order_columns($column_name, $post_id){ 96 global $post; 97 98 switch ( $column_name ) { 99 case 'order_status' : 100 $pending_statuses = array ('wc-nimble-pending', 'wc-nimble-failed'); 101 if ( self::$gateway && in_array($post->post_status, $pending_statuses) ){ 102 self::$gateway->change_order_status($post_id); 101 102 public function load_settings(){ 103 //Plugin options 104 $this->options = array_merge($this->default_options, get_option($this->options_name, array())); 105 $this->oauth3_enabled = ( $this->options['token'] != '' ); 106 $this->gateway_enabled = $this->isGatewayEnabled(); 107 } 108 109 public function check_init() { 110 //Plugin version 111 $header_options = get_file_data(__FILE__, array('version' => 'Version'), 'plugin' ); 112 113 // Upgrade Plugin 114 if ( version_compare( $this->options['version'], $header_options['version'], '<' ) && $this->isGatewayEnabled() ) { 115 $this->upgrade_version(); 116 $this->options['version'] = $header_options['version']; 117 update_option($this->options_name, $this->options); 118 } 119 120 // Check Nimble-Pending Orders 121 if ( isset( $this->options['check_orders'] ) && $this->options['check_orders'] && $this->isGatewayEnabled() ) { 122 $this->check_orders(); 123 unset($this->options['check_orders']); 124 update_option($this->options_name, $this->options); 125 } 126 } 127 128 private function np_get_orders( $args = array() ) { 129 $orders = array(); 130 global $woocommerce; 131 if( version_compare( $woocommerce->version, '2.6.0', ">=" ) ) { 132 $orders = wc_get_orders( $args ); 133 } else { 134 if (!isset($args['status'])) { 135 return array(); 136 } 137 $where_clause = "post_status "; 138 if (is_array($args['status'])) { 139 $where_clause .= "in ("; 140 foreach ($args['status'] as $status) { 141 $where_clause .= "'".$status."', "; 103 142 } 104 break; 105 } 106 } 107 108 function load_settings(){ 109 //Plugin options 110 $options = get_option($this->options_name); 111 $this->oauth3_enabled = ( $options && isset($options['token']) ) ? true : false; 112 $this->gateway_enabled = $this->isGatewayEnabled(); 113 114 //Plugin version 115 $this->options = get_file_data(__FILE__, array('Version' => 'Version'), 'plugin' ); 143 $where_clause = substr($where_clause, 0, -2); 144 $where_clause .= ");"; 145 } else { 146 $where_clause .= "= '".$args['status']."';"; 147 } 148 global $wpdb; 149 $orders_id = $wpdb->get_results("select ID from {$wpdb->prefix}posts where {$where_clause}"); 150 foreach ($orders_id as $id) { 151 $order = $this->np_get_order( $id ); 152 array_push( $orders, $order ); 153 } 154 } 155 return $orders; 156 } 157 158 private function np_get_order( $order_id ) { 159 global $woocommerce; 160 $order = false; 161 if( version_compare( $woocommerce->version, '2.2.0', "<" ) ) { 162 $order = wc_get_order( $order_id ); 163 } else { 164 $order = new WC_Order( $order_id ); 165 } 166 return $order; 167 } 168 169 private function upgrade_version() { 170 if ( version_compare( $this->options['version'], '3.0.0', '<' ) ) { 171 $older_orders = $this->np_get_orders( array( 'status' => array('wc-nimble-denied', 'wc-nimble-failed'), 'limit' => -1, 'order' => 'ASC' ) ); 172 foreach ($older_orders as $order) { 173 switch ($order->post_status) { 174 case 'wc-nimble-denied': 175 $order->update_status('pending', __('Update Nimble Payments plugin 3.0.0.', 'woocommerce-nimble-payments')); //LANG: OLD DENIED ORDER STATUS 176 break; 177 case 'wc-nimble-failed': 178 $order->update_status('nimble-pending', __('Update Nimble Payments plugin 3.0.0.', 'woocommerce-nimble-payments')); //LANG: OLD FAILED ORDER STATUS 179 self::$gateway->change_order_status($order->id); 180 break; 181 } 182 } 183 } 184 /*FOR FUTURE VERSIONS 185 if ( version_compare( $this->options['version'], 'X.X.X', '<' ) ) { 186 UPGRADE CODE HERE 187 }*/ 188 } 189 190 private function check_orders() { 191 $orders = $this->np_get_orders( array( 'status' => 'wc-nimble-pending', 'limit' => -1, 'order' => 'ASC' ) ); 192 foreach ($orders as $order_number => $order) { 193 self::$gateway->change_order_status($order->id); 194 } 116 195 } 117 196 118 197 function get_plugin_version(){ 119 if ( isset($this->options['Version']) ){ 120 return $this->options['Version']; 121 } 122 return ''; 198 return $this->options['version']; 123 199 } 124 200 … … 138 214 function admin_enqueue_scripts($hook) { 139 215 global $post; 140 wp_enqueue_script('nimble-payments-js', plugins_url("js/nimble-payments.js", __FILE__), array('jquery'), '2016 0329');216 wp_enqueue_script('nimble-payments-js', plugins_url("js/nimble-payments.js", __FILE__), array('jquery'), '20161023'); 141 217 142 218 //Custom JS for refunds … … 257 333 <?php 258 334 } 335 336 337 static function disassociate(){ 338 ?> 339 <div id="np-authorize-message" class="updated wc-nimble-message"><div class="squeezer"> 340 <h4><?php _e('Ecommerce linked to Nimble Payments', 'woocommerce-nimble-payments'); ?></h4> 341 <p class="submit"> 342 <a id="np-oauth3-disassociate" class="button" href="#"><?php _e('Disassociate', 'woocommerce-nimble-payments'); ?></a> 343 </p> 344 </div></div> 345 <?php 346 } 259 347 260 348 function ajax_oauth3(){ … … 264 352 die(); 265 353 } 354 355 public function ajax_oauth3_disassociate() { 356 $this->oauth3_enabled = false; 357 $this->options['token'] = ''; 358 $this->options['refreshToken'] = ''; 359 update_option($this->options_name, $this->options); 360 } 266 361 267 362 static function get_gateway_url(){ … … 286 381 287 382 static function activar_plugin() { 383 $header_options = get_file_data(__FILE__, array('version' => 'Version'), 'plugin' ); 384 update_option('nimble_payments_options', $header_options); 288 385 } 289 386 … … 307 404 308 405 function add_your_gateway_class( $methods ) { 309 $methods[] = 'WC_Gateway_Nimble';310 return $methods;406 $methods[] = 'WC_Gateway_Nimble'; 407 return $methods; 311 408 } 312 409 … … 317 414 function add_custom_statuses($order_statuses){ 318 415 $new_statuses = array( 319 'wc-nimble-pending' => _x( 'Pending Payment (Nimble Payments)', 'Order status', 'woocommerce-nimble-payments' ), //LANG: PENDING STATUS 320 'wc-nimble-failed' => _x( 'Failed (Nimble Payments)', 'Order status', 'woocommerce-nimble-payments' ), //LANG: FAILED STATUS 321 'wc-nimble-denied' => _x( 'Denied (Nimble Payments)', 'Order status', 'woocommerce-nimble-payments' ), //LANG: DENIED STATUS 322 ); 416 'wc-nimble-pending' => _x( 'Processing transaction', 'Order status', 'woocommerce-nimble-payments' ), //LANG: PENDING STATUS 417 ); 323 418 return array_merge($order_statuses, $new_statuses); 324 419 } … … 326 421 function register_post_status() { 327 422 register_post_status('wc-nimble-pending', array( 328 'label' => _x( 'P ending Payment (Nimble Payments)', 'Order status', 'woocommerce-nimble-payments' ), //LANG: PENDING STATUS423 'label' => _x( 'Processing transaction', 'Order status', 'woocommerce-nimble-payments' ), //LANG: PENDING STATUS 329 424 'public' => false, 330 425 'exclude_from_search' => false, 331 426 'show_in_admin_all_list' => true, 332 427 'show_in_admin_status_list' => true, 333 'label_count' => _n_noop('P ending Payment (Nimble Payments) <span class="count">(%s)</span>', 'Pending Payment (Nimble Payments)<span class="count">(%s)</span>', 'woocommerce') //LANG: PENDING STATUS LIST428 'label_count' => _n_noop('Processing Payment <span class="count">(%s)</span>', 'Processing Payment <span class="count">(%s)</span>', 'woocommerce') //LANG: PENDING STATUS LIST 334 429 )); 335 register_post_status('wc-nimble-failed', array( 336 'label' => _x( 'Failed (Nimble Payments)', 'Order status', 'woocommerce-nimble-payments' ), //LANG: FAILED STATUS 337 'public' => false, 338 'exclude_from_search' => false, 339 'show_in_admin_all_list' => true, 340 'show_in_admin_status_list' => true, 341 'label_count' => _n_noop('Failed (Nimble Payments) <span class="count">(%s)</span>', 'Failed (Nimble Payments) <span class="count">(%s)</span>', 'woocommerce') //LANG: FAILED LIST 342 )); 343 register_post_status('wc-nimble-denied', array( 344 'label' => _x( 'Denied (Nimble Payments)', 'Order status', 'woocommerce-nimble-payments' ), //LANG: DENIED STATUS 345 'public' => false, 346 'exclude_from_search' => false, 347 'show_in_admin_all_list' => true, 348 'show_in_admin_status_list' => true, 349 'label_count' => _n_noop('Denied (Nimble Payments) <span class="count">(%s)</span>', 'Denied (Nimble Payments) <span class="count">(%s)</span>', 'woocommerce') //LANG: FAILED LIST 350 )); 351 } 352 430 } 431 353 432 function valid_order_statuses_for_payment($order_statuses){ 354 $order_statuses[]='nimble-pending'; 355 $order_statuses[]='nimble-failed'; 356 return $order_statuses; 357 } 433 $order_statuses[]='nimble-pending'; 434 return $order_statuses; 435 } 358 436 359 437 function filter_templates_checkout($located, $template_name, $args){ … … 416 494 if ( self::$gateway ){ 417 495 try { 418 $options = get_option($this->options_name);419 if (is_array($options) && isset($options['login']) && $options['login']){420 $params = wp_parse_args($ options, self::$params);496 if (isset($this->options['login']) && $this->options['login']){ 497 unset($this->options['login']); 498 $params = wp_parse_args($this->options, self::$params); 421 499 $nimble_api = new WP_NimbleAPI($params); 422 $options = array( 423 'token' => $nimble_api->authorization->getAccessToken(), 424 'refreshToken' => $nimble_api->authorization->getRefreshToken() 500 $this->options = array_merge($this->options, 501 array( 502 'token' => $nimble_api->authorization->getAccessToken(), 503 'refreshToken' => $nimble_api->authorization->getRefreshToken() 504 ) 425 505 ); 426 if ( empty($options['token']) || empty($options['refreshToken']) ){ 427 delete_option($this->options_name); 428 } else { 429 update_option($this->options_name, $options); 506 if ( empty($this->options['token']) || empty($this->options['refreshToken']) ){ 507 $this->options['token'] = ''; 508 $this->options['refreshToken'] = ''; 430 509 } 510 update_option($this->options_name, $this->options); 431 511 $this->oauth3_enabled = true; 432 512 } … … 441 521 */ 442 522 function login_actions($user_login, $user){ 523 // For refreshToken ::: hook woocommerce_init 443 524 if ( user_can($user, 'manage_options') ){ 444 525 $options = get_option($this->options_name); … … 448 529 } 449 530 } 531 // For Check Nimble-Pending Orders ::: hook wp_loaded 532 $is_admin = in_array('administrator', $user->roles); 533 if ( self::$gateway && $is_admin ) { 534 $options = get_option($this->options_name); 535 if (is_array($options)){ 536 $options['check_orders'] = true; 537 update_option($this->options_name, $options); 538 } 539 } 450 540 } 451 541 … … 456 546 if ( self::$gateway ){ 457 547 try { 458 $options = get_option($this->options_name);548 $options = $this->options; 459 549 unset($options['refreshToken']); 460 550 $params = wp_parse_args($options, self::$params); … … 479 569 if ( self::$gateway ){ 480 570 try { 481 $options = get_option($this->options_name);571 $options = $this->options; 482 572 unset($options['refreshToken']); 483 573 $params = wp_parse_args($options, self::$params); … … 498 588 function manageApiError($response){ 499 589 $this->oauth3_enabled = false; 500 delete_option($this->options_name); 590 $this->options['token'] = ''; 591 $this->options['refreshToken'] = ''; 592 update_option($this->options_name, $this->options); 501 593 } 502 594 … … 548 640 //Show resumen 549 641 if ( $this->oauth3_enabled ){ 550 //var_dump(get_option($this->options_name));551 642 $this->getResumen(); 552 //delete_option($this->options_name);553 643 } 554 644 //Show Authentication URL to AOUTH3 -
nimblepayments/trunk/readme.txt
r1534878 r1554761 48 48 == Changelog == 49 49 50 = 3.0.0 = 51 * Nueva opción para desvincular la tienda con la pasarela de Nimble Payments. 52 * Mejoras en la definición de los estados de los pedidos 53 * Otras correcciones menores. 54 50 55 = 2.1.0 = 51 56 * Nuevos estados para los pedidos (Denegado). … … 70 75 == Upgrade Notice == 71 76 77 = 3.0.0 = 78 Actualización importante. Descubre las nuevas funcionalidades de la nueva versión. 79 72 80 = 2.1.0 = 73 81 Mantente actualizado.
Note: See TracChangeset
for help on using the changeset viewer.