Version Description
2018/08/02 =
Fora o campo "Bairro" como obrigatrio quando checkout transparente est ativado.
Implementada baixa automtica de estoque ao comprar por boleto (funciona apenas no WooCommerce 3 ou superior).
Estoque restaurado automaticamente quando alguma notificao do PagSeguro marca o pedido como reembolsado ou cancelado (funciona apenas no WooCommerce 3 ou superior).
Corrigida a mudana de status do pedido de Cancelado para Processando (funciona apenas no WooCommerce 3 ou superior).
Adicionadas informaes sobre a taxa de intermdio do PagSeguro nos meta dados do pedido.
Download this release
Release Info
Developer | claudiosanches |
Plugin | WooCommerce PagSeguro |
Version | 2.13.0 |
Comparing to | |
See all releases |
Code changes from version 2.12.7 to 2.13.0
- assets/js/admin/admin.js +4 -0
- assets/js/admin/admin.min.js +1 -1
- assets/js/frontend/transparent-checkout.min.js +1 -1
- includes/class-wc-pagseguro-gateway.php +148 -100
- includes/class-wc-pagseguro.php +160 -0
- languages/woocommerce-pagseguro.pot +71 -54
- readme.txt +15 -32
- woocommerce-pagseguro.php +12 -173
assets/js/admin/admin.js
CHANGED
@@ -12,6 +12,8 @@
|
|
12 |
var fields = $( '#woocommerce_pagseguro_tc_credit' ).closest( '.form-table' ),
|
13 |
heading = fields.prev( 'h3' );
|
14 |
|
|
|
|
|
15 |
if ( 'transparent' === method ) {
|
16 |
fields.show();
|
17 |
heading.show();
|
@@ -60,6 +62,8 @@
|
|
60 |
}
|
61 |
}
|
62 |
|
|
|
|
|
63 |
$( 'body' ).on( 'change', '#woocommerce_pagseguro_method', function () {
|
64 |
pagSeguroSwitchTCOptions( $( this ).val() );
|
65 |
}).change();
|
12 |
var fields = $( '#woocommerce_pagseguro_tc_credit' ).closest( '.form-table' ),
|
13 |
heading = fields.prev( 'h3' );
|
14 |
|
15 |
+
console.log( 'foi?' );
|
16 |
+
|
17 |
if ( 'transparent' === method ) {
|
18 |
fields.show();
|
19 |
heading.show();
|
62 |
}
|
63 |
}
|
64 |
|
65 |
+
pagSeguroSwitchTCOptions( $( '#woocommerce_pagseguro_method' ).val() );
|
66 |
+
|
67 |
$( 'body' ).on( 'change', '#woocommerce_pagseguro_method', function () {
|
68 |
pagSeguroSwitchTCOptions( $( this ).val() );
|
69 |
}).change();
|
assets/js/admin/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(
|
1 |
+
!function(r){"use strict";r(function(){function o(o){var e=r("#woocommerce_pagseguro_tc_credit").closest(".form-table"),c=e.prev("h3");console.log("foi?"),"transparent"===o?(e.show(),c.show()):(e.hide(),c.hide())}function e(o){var e=r("#woocommerce_pagseguro_tc_ticket_message").closest("tr");o?e.show():e.hide()}function c(o){var e=r("#woocommerce_pagseguro_email").closest("tr"),c=r("#woocommerce_pagseguro_token").closest("tr"),s=r("#woocommerce_pagseguro_sandbox_email").closest("tr"),t=r("#woocommerce_pagseguro_sandbox_token").closest("tr");o?(e.hide(),c.hide(),s.show(),t.show()):(e.show(),c.show(),s.hide(),t.hide())}o(r("#woocommerce_pagseguro_method").val()),r("body").on("change","#woocommerce_pagseguro_method",function(){o(r(this).val())}).change(),e(r("#woocommerce_pagseguro_tc_ticket").is(":checked")),r("body").on("change","#woocommerce_pagseguro_tc_ticket",function(){e(r(this).is(":checked"))}),c(r("#woocommerce_pagseguro_sandbox").is(":checked")),r("body").on("change","#woocommerce_pagseguro_sandbox",function(){c(r(this).is(":checked"))})})}(jQuery);
|
assets/js/frontend/transparent-checkout.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(
|
1 |
+
!function(p){"use strict";p(function(){var u=!1;function a(e){p("#pagseguro-credit-card-form").attr("data-credit-card-brand",e)}function t(e){return'<option value="'+e.quantity+'" data-installment-value="'+e.installmentAmount+'">'+(r=e,a="R$ "+parseFloat(r.installmentAmount,10).toFixed(2).replace(".",",").toString(),t="R$ "+parseFloat(r.totalAmount,10).toFixed(2).replace(".",",").toString(),o=!0===r.interestFree?" "+wc_pagseguro_params.interest_free:"",n=o||" ("+t+")",r.quantity+"x "+a+n)+"</option>";var r,a,t,o,n}function g(e){var r=p("#pagseguro-credit-card-form");p(".woocommerce-error",r).remove(),r.prepend('<div class="woocommerce-error" style="margin-bottom: 0.5em !important;">'+e+"</div>")}function n(e){p(".pagseguro-method-form").hide(),p("#pagseguro-payment-methods li").removeClass("active"),p("#pagseguro-"+e+"-form").show(),p("#pagseguro-payment-method-"+e).parent("label").parent("li").addClass("active")}function e(){var e;e=p("#pagseguro-payment-methods"),1===p("input[type=radio]",e).length&&e.hide(),p("#pagseguro-payment-form").show(),n(p("#pagseguro-payment-methods input[type=radio]:checked").val()),p("#pagseguro-card-holder-cpf").mask("000.000.000-00"),p("#pagseguro-card-holder-birth-date").mask("00/00/0000");var o=function(e){return 11===e.replace(/\D/g,"").length?"(00) 00000-0000":"(00) 0000-00009"},r={onKeyPress:function(e,r,a,t){a.mask(o.apply({},arguments),t)}};p("#pagseguro-card-holder-phone").mask(o,r),p("#pagseguro-bank-transfer-form input[type=radio]:checked").parent("label").parent("li").addClass("active")}function r(){if(u)return!(u=!1);if(!p("#payment_method_pagseguro").is(":checked"))return!0;if("credit-card"!==p("body li.payment_method_pagseguro input[name=pagseguro_payment_method]:checked").val())return p("form.checkout, form#order_review").append(p('<input name="pagseguro_sender_hash" type="hidden" />').val(PagSeguroDirectPayment.getSenderHash())),!0;var r=p("form.checkout, form#order_review"),e=!1,a="",t=p("#pagseguro-credit-card-form",r).attr("data-credit-card-brand"),o=p("#pagseguro-card-number",r).val().replace(/[^\d]/g,""),n=p("#pagseguro-card-cvc",r).val(),i=p("#pagseguro-card-expiry",r).val().replace(/[^\d]/g,"").substr(0,2),s=p("#pagseguro-card-expiry",r).val().replace(/[^\d]/g,"").substr(2),d=p("#pagseguro-card-installments",r),c=new Date;return a+="<ul>",void 0!==t&&"error"!==t||(a+="<li>"+wc_pagseguro_params.invalid_card+"</li>",e=!0),2===i.length&&4===s.length||(a+="<li>"+wc_pagseguro_params.invalid_expiry+"</li>",e=!0),2===i.length&&4===s.length&&(12<i||s<=c.getFullYear()-1||s>=c.getFullYear()+20||i<c.getMonth()+2&&s.toString()===c.getFullYear().toString())&&(a+="<li>"+wc_pagseguro_params.expired_date+"</li>",e=!0),"0"===d.val()&&(a+="<li>"+wc_pagseguro_params.empty_installments+"</li>",e=!0),a+="</ul>",e?g(a):PagSeguroDirectPayment.createCardToken({brand:t,cardNumber:o,cvv:n,expirationMonth:i,expirationYear:s,success:function(e){p("input[name=pagseguro_credit_card_hash], input[name=pagseguro_credit_card_hash], input[name=pagseguro_installment_value]",r).remove(),r.append(p('<input name="pagseguro_credit_card_hash" type="hidden" />').val(e.card.token)),r.append(p('<input name="pagseguro_sender_hash" type="hidden" />').val(PagSeguroDirectPayment.getSenderHash())),r.append(p('<input name="pagseguro_installment_value" type="hidden" />').val(p("option:selected",d).attr("data-installment-value"))),u=!0,r.submit()},error:function(){g(wc_pagseguro_params.general_error)}}),!1}wc_pagseguro_params.session_id?(PagSeguroDirectPayment.setSessionId(wc_pagseguro_params.session_id),"1"===wc_checkout_params.is_checkout?p("body").on("updated_checkout",function(){e()}):e(),p("body").on("click","#pagseguro-bank-transfer-form input[type=radio]",function(){p("#pagseguro-bank-transfer-form li").removeClass("active"),p(this).parent("label").parent("li").addClass("active")}),p("body").on("click","#pagseguro-payment-methods input[type=radio]",function(){n(p(this).val())}),p("body").on("focusout","#pagseguro-card-number",function(){var e=p(this).val().replace(/[^\d]/g,"").substr(0,6),r=p("body #pagseguro-card-installments");6===e.length&&(r.empty(),r.attr("disabled","disabled"),PagSeguroDirectPayment.getBrand({cardBin:e,success:function(e){p("body").trigger("pagseguro_credit_card_brand",e.brand.name),a(e.brand.name)},error:function(){p("body").trigger("pagseguro_credit_card_brand","error"),a("error")}}))}),p("body").on("updated_checkout",function(){var e=p("body #pagseguro-card-number");0<e.length&&e.focusout()}),p("body").on("focus","#pagseguro-card-number, #pagseguro-card-expiry",function(){p("#pagseguro-credit-card-form .woocommerce-error").remove()}),p("body").on("pagseguro_credit_card_brand",function(e,r){"error"!==r?PagSeguroDirectPayment.getInstallments({amount:p("body #pagseguro-payment-form").data("cart_total"),brand:r,success:function(e){var a=p("body #pagseguro-card-installments");!1===e.error?(a.empty(),a.removeAttr("disabled"),a.append('<option value="0">--</option>'),p.each(e.installments[r],function(e,r){a.append(t(r))})):g(wc_pagseguro_params.invalid_card)},error:function(){g(wc_pagseguro_params.invalid_card)}}):g(wc_pagseguro_params.invalid_card)}),p("form.checkout").on("checkout_place_order_pagseguro",function(){return r()}),p("form#order_review").submit(function(){return r()})):p("body").on("updated_checkout",function(){p("#pagseguro-payment-form").remove()})})}(jQuery);
|
includes/class-wc-pagseguro-gateway.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* WooCommerce PagSeguro Gateway class
|
4 |
*
|
5 |
* @package WooCommerce_PagSeguro/Classes/Gateway
|
6 |
-
* @version 2.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -49,7 +49,7 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
49 |
$this->debug = $this->get_option( 'debug' );
|
50 |
|
51 |
// Active logs.
|
52 |
-
if ( 'yes'
|
53 |
if ( function_exists( 'wc_get_logger' ) ) {
|
54 |
$this->log = wc_get_logger();
|
55 |
} else {
|
@@ -67,7 +67,7 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
67 |
add_action( 'woocommerce_receipt_' . $this->id, array( $this, 'receipt_page' ) );
|
68 |
|
69 |
// Transparent checkout actions.
|
70 |
-
if ( 'transparent'
|
71 |
add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'thankyou_page' ) );
|
72 |
add_action( 'woocommerce_email_after_order_table', array( $this, 'email_instructions' ), 10, 3 );
|
73 |
add_action( 'wp_enqueue_scripts', array( $this, 'checkout_scripts' ) );
|
@@ -112,7 +112,7 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
112 |
// Test if is valid for use.
|
113 |
$available = 'yes' === $this->get_option( 'enabled' ) && '' !== $this->get_email() && '' !== $this->get_token() && $this->using_supported_currency();
|
114 |
|
115 |
-
if ( 'transparent'
|
116 |
$available = false;
|
117 |
}
|
118 |
|
@@ -137,9 +137,9 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
137 |
$session_id = $this->api->get_session_id();
|
138 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
139 |
|
140 |
-
wp_enqueue_style( 'pagseguro-checkout', plugins_url( 'assets/css/frontend/transparent-checkout' . $suffix . '.css', plugin_dir_path( __FILE__ ) ), array(),
|
141 |
-
wp_enqueue_script( 'pagseguro-library', $this->api->get_direct_payment_url(), array(),
|
142 |
-
wp_enqueue_script( 'pagseguro-checkout', plugins_url( 'assets/js/frontend/transparent-checkout' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery', 'pagseguro-library', 'woocommerce-extra-checkout-fields-for-brazil-front' ),
|
143 |
|
144 |
wp_localize_script(
|
145 |
'pagseguro-checkout',
|
@@ -176,31 +176,31 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
176 |
*/
|
177 |
public function init_form_fields() {
|
178 |
$this->form_fields = array(
|
179 |
-
'enabled'
|
180 |
'title' => __( 'Enable/Disable', 'woocommerce-pagseguro' ),
|
181 |
'type' => 'checkbox',
|
182 |
'label' => __( 'Enable PagSeguro', 'woocommerce-pagseguro' ),
|
183 |
'default' => 'yes',
|
184 |
),
|
185 |
-
'title'
|
186 |
'title' => __( 'Title', 'woocommerce-pagseguro' ),
|
187 |
'type' => 'text',
|
188 |
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-pagseguro' ),
|
189 |
'desc_tip' => true,
|
190 |
'default' => __( 'PagSeguro', 'woocommerce-pagseguro' ),
|
191 |
),
|
192 |
-
'description'
|
193 |
'title' => __( 'Description', 'woocommerce-pagseguro' ),
|
194 |
'type' => 'textarea',
|
195 |
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-pagseguro' ),
|
196 |
'default' => __( 'Pay via PagSeguro', 'woocommerce-pagseguro' ),
|
197 |
),
|
198 |
-
'integration'
|
199 |
'title' => __( 'Integration', 'woocommerce-pagseguro' ),
|
200 |
'type' => 'title',
|
201 |
'description' => '',
|
202 |
),
|
203 |
-
'method'
|
204 |
'title' => __( 'Integration method', 'woocommerce-pagseguro' ),
|
205 |
'type' => 'select',
|
206 |
'description' => __( 'Choose how the customer will interact with the PagSeguro. Redirect (Client goes to PagSeguro page) or Lightbox (Inside your store)', 'woocommerce-pagseguro' ),
|
@@ -213,7 +213,7 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
213 |
'transparent' => __( 'Transparent Checkout', 'woocommerce-pagseguro' ),
|
214 |
),
|
215 |
),
|
216 |
-
'sandbox'
|
217 |
'title' => __( 'PagSeguro Sandbox', 'woocommerce-pagseguro' ),
|
218 |
'type' => 'checkbox',
|
219 |
'label' => __( 'Enable PagSeguro Sandbox', 'woocommerce-pagseguro' ),
|
@@ -221,28 +221,31 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
221 |
'default' => 'no',
|
222 |
'description' => __( 'PagSeguro Sandbox can be used to test the payments.', 'woocommerce-pagseguro' ),
|
223 |
),
|
224 |
-
'email'
|
225 |
'title' => __( 'PagSeguro Email', 'woocommerce-pagseguro' ),
|
226 |
'type' => 'text',
|
227 |
'description' => __( 'Please enter your PagSeguro email address. This is needed in order to take payment.', 'woocommerce-pagseguro' ),
|
228 |
'desc_tip' => true,
|
229 |
'default' => '',
|
230 |
),
|
231 |
-
'token'
|
232 |
'title' => __( 'PagSeguro Token', 'woocommerce-pagseguro' ),
|
233 |
'type' => 'text',
|
|
|
234 |
'description' => sprintf( __( 'Please enter your PagSeguro token. This is needed to process the payment and notifications. Is possible generate a new token %s.', 'woocommerce-pagseguro' ), '<a href="https://pagseguro.uol.com.br/integracao/token-de-seguranca.jhtml">' . __( 'here', 'woocommerce-pagseguro' ) . '</a>' ),
|
235 |
'default' => '',
|
236 |
),
|
237 |
-
'sandbox_email'
|
238 |
'title' => __( 'PagSeguro Sandbox Email', 'woocommerce-pagseguro' ),
|
239 |
'type' => 'text',
|
|
|
240 |
'description' => sprintf( __( 'Please enter your PagSeguro sandbox email address. You can get your sandbox email %s.', 'woocommerce-pagseguro' ), '<a href="https://sandbox.pagseguro.uol.com.br/vendedor/configuracoes.html">' . __( 'here', 'woocommerce-pagseguro' ) . '</a>' ),
|
241 |
'default' => '',
|
242 |
),
|
243 |
-
'sandbox_token'
|
244 |
'title' => __( 'PagSeguro Sandbox Token', 'woocommerce-pagseguro' ),
|
245 |
'type' => 'text',
|
|
|
246 |
'description' => sprintf( __( 'Please enter your PagSeguro sandbox token. You can get your sandbox token %s.', 'woocommerce-pagseguro' ), '<a href="https://sandbox.pagseguro.uol.com.br/vendedor/configuracoes.html">' . __( 'here', 'woocommerce-pagseguro' ) . '</a>' ),
|
247 |
'default' => '',
|
248 |
),
|
@@ -251,58 +254,59 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
251 |
'type' => 'title',
|
252 |
'description' => '',
|
253 |
),
|
254 |
-
'tc_credit'
|
255 |
'title' => __( 'Credit Card', 'woocommerce-pagseguro' ),
|
256 |
'type' => 'checkbox',
|
257 |
'label' => __( 'Enable Credit Card for Transparente Checkout', 'woocommerce-pagseguro' ),
|
258 |
'default' => 'yes',
|
259 |
),
|
260 |
-
'tc_transfer'
|
261 |
'title' => __( 'Bank Transfer', 'woocommerce-pagseguro' ),
|
262 |
'type' => 'checkbox',
|
263 |
'label' => __( 'Enable Bank Transfer for Transparente Checkout', 'woocommerce-pagseguro' ),
|
264 |
'default' => 'yes',
|
265 |
),
|
266 |
-
'tc_ticket'
|
267 |
'title' => __( 'Banking Ticket', 'woocommerce-pagseguro' ),
|
268 |
'type' => 'checkbox',
|
269 |
'label' => __( 'Enable Banking Ticket for Transparente Checkout', 'woocommerce-pagseguro' ),
|
270 |
'default' => 'yes',
|
271 |
),
|
272 |
-
'tc_ticket_message'
|
273 |
'title' => __( 'Banking Ticket Tax Message', 'woocommerce-pagseguro' ),
|
274 |
'type' => 'checkbox',
|
275 |
'label' => __( 'Display a message alerting the customer that will be charged R$ 1,00 for payment by Banking Ticket', 'woocommerce-pagseguro' ),
|
276 |
'default' => 'yes',
|
277 |
),
|
278 |
-
'behavior'
|
279 |
'title' => __( 'Integration Behavior', 'woocommerce-pagseguro' ),
|
280 |
'type' => 'title',
|
281 |
'description' => '',
|
282 |
),
|
283 |
-
'send_only_total'
|
284 |
'title' => __( 'Send only the order total', 'woocommerce-pagseguro' ),
|
285 |
'type' => 'checkbox',
|
286 |
'label' => __( 'If this option is enabled will only send the order total, not the list of items.', 'woocommerce-pagseguro' ),
|
287 |
'default' => 'no',
|
288 |
),
|
289 |
-
'invoice_prefix'
|
290 |
'title' => __( 'Invoice Prefix', 'woocommerce-pagseguro' ),
|
291 |
'type' => 'text',
|
292 |
'description' => __( 'Please enter a prefix for your invoice numbers. If you use your PagSeguro account for multiple stores ensure this prefix is unqiue as PagSeguro will not allow orders with the same invoice number.', 'woocommerce-pagseguro' ),
|
293 |
'desc_tip' => true,
|
294 |
'default' => 'WC-',
|
295 |
),
|
296 |
-
'testing'
|
297 |
'title' => __( 'Gateway Testing', 'woocommerce-pagseguro' ),
|
298 |
'type' => 'title',
|
299 |
'description' => '',
|
300 |
),
|
301 |
-
'debug'
|
302 |
'title' => __( 'Debug Log', 'woocommerce-pagseguro' ),
|
303 |
'type' => 'checkbox',
|
304 |
'label' => __( 'Enable logging', 'woocommerce-pagseguro' ),
|
305 |
'default' => 'no',
|
|
|
306 |
'description' => sprintf( __( 'Log PagSeguro events, such as API requests, inside %s', 'woocommerce-pagseguro' ), $this->get_log_view() ),
|
307 |
),
|
308 |
);
|
@@ -314,7 +318,7 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
314 |
public function admin_options() {
|
315 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
316 |
|
317 |
-
wp_enqueue_script( 'pagseguro-admin', plugins_url( 'assets/js/admin/admin' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery' ),
|
318 |
|
319 |
include dirname( __FILE__ ) . '/admin/views/html-admin-page.php';
|
320 |
}
|
@@ -338,21 +342,24 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
338 |
public function payment_fields() {
|
339 |
wp_enqueue_script( 'wc-credit-card-form' );
|
340 |
|
341 |
-
|
342 |
-
|
|
|
343 |
}
|
344 |
|
345 |
$cart_total = $this->get_order_total();
|
346 |
|
347 |
-
if ( 'transparent'
|
348 |
-
wc_get_template(
|
349 |
-
'
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
356 |
}
|
357 |
}
|
358 |
|
@@ -360,21 +367,20 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
360 |
* Process the payment and return the result.
|
361 |
*
|
362 |
* @param int $order_id Order ID.
|
363 |
-
*
|
364 |
* @return array
|
365 |
*/
|
366 |
public function process_payment( $order_id ) {
|
367 |
$order = wc_get_order( $order_id );
|
368 |
|
369 |
-
if ( 'lightbox'
|
370 |
-
if ( isset( $_POST['pagseguro_sender_hash'] ) && 'transparent'
|
371 |
-
$response = $this->api->do_payment_request( $order, $_POST );
|
372 |
|
373 |
if ( $response['data'] ) {
|
374 |
$this->update_order_status( $response['data'] );
|
375 |
}
|
376 |
} else {
|
377 |
-
$response = $this->api->do_checkout_request( $order, $_POST );
|
378 |
}
|
379 |
|
380 |
if ( $response['url'] ) {
|
@@ -396,7 +402,7 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
396 |
);
|
397 |
}
|
398 |
} else {
|
399 |
-
$use_shipping = isset( $_POST['ship_to_different_address'] ) ? true : false;
|
400 |
|
401 |
return array(
|
402 |
'result' => 'success',
|
@@ -412,8 +418,8 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
412 |
*/
|
413 |
public function receipt_page( $order_id ) {
|
414 |
$order = wc_get_order( $order_id );
|
415 |
-
$request_data = $_POST;
|
416 |
-
if ( isset( $_GET['use_shipping'] ) && true
|
417 |
$request_data['ship_to_different_address'] = true;
|
418 |
}
|
419 |
|
@@ -421,7 +427,8 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
421 |
|
422 |
if ( $response['url'] ) {
|
423 |
// Lightbox script.
|
424 |
-
wc_enqueue_js(
|
|
|
425 |
$( "#browser-has-javascript" ).show();
|
426 |
$( "#browser-no-has-javascript, #cancel-payment, #submit-payment" ).hide();
|
427 |
var isOpenLightbox = PagSeguroLightbox({
|
@@ -437,13 +444,16 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
437 |
if ( ! isOpenLightbox ) {
|
438 |
window.location.href = "' . esc_js( $response['url'] ) . '";
|
439 |
}
|
440 |
-
'
|
|
|
441 |
|
442 |
-
wc_get_template(
|
443 |
-
'
|
444 |
-
|
445 |
-
|
446 |
-
|
|
|
|
|
447 |
} else {
|
448 |
include dirname( __FILE__ ) . '/views/html-receipt-page-error.php';
|
449 |
}
|
@@ -453,9 +463,9 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
453 |
* IPN handler.
|
454 |
*/
|
455 |
public function ipn_handler() {
|
456 |
-
@ob_clean();
|
457 |
|
458 |
-
$ipn = $this->api->process_ipn_request( $_POST );
|
459 |
|
460 |
if ( $ipn ) {
|
461 |
header( 'HTTP/1.1 200 OK' );
|
@@ -469,8 +479,8 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
469 |
/**
|
470 |
* Save payment meta data.
|
471 |
*
|
472 |
-
* @param
|
473 |
-
* @param
|
474 |
*/
|
475 |
protected function save_payment_meta_data( $order, $posted ) {
|
476 |
$meta_data = array();
|
@@ -487,22 +497,32 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
487 |
if ( isset( $posted->sender->name ) ) {
|
488 |
$meta_data[ __( 'Payer name', 'woocommerce-pagseguro' ) ] = sanitize_text_field( (string) $posted->sender->name );
|
489 |
}
|
490 |
-
if ( isset( $posted->paymentMethod->type ) ) {
|
491 |
-
$payment_data['type'] = intval( $posted->paymentMethod->type );
|
|
|
492 |
$meta_data[ __( 'Payment type', 'woocommerce-pagseguro' ) ] = $this->api->get_payment_name_by_type( $payment_data['type'] );
|
493 |
}
|
494 |
-
if ( isset( $posted->paymentMethod->code ) ) {
|
495 |
-
$payment_data['method'] = $this->api->get_payment_method_name( intval( $posted->paymentMethod->code ) );
|
|
|
496 |
$meta_data[ __( 'Payment method', 'woocommerce-pagseguro' ) ] = $payment_data['method'];
|
497 |
}
|
498 |
-
if ( isset( $posted->installmentCount ) ) {
|
499 |
-
$payment_data['installments'] = sanitize_text_field( (string) $posted->installmentCount );
|
|
|
500 |
$meta_data[ __( 'Installments', 'woocommerce-pagseguro' ) ] = $payment_data['installments'];
|
501 |
}
|
502 |
-
if ( isset( $posted->paymentLink ) ) {
|
503 |
-
$payment_data['link'] = sanitize_text_field( (string) $posted->paymentLink );
|
|
|
504 |
$meta_data[ __( 'Payment URL', 'woocommerce-pagseguro' ) ] = $payment_data['link'];
|
505 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
|
507 |
$meta_data['_wc_pagseguro_payment_data'] = $payment_data;
|
508 |
|
@@ -547,49 +567,72 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
547 |
$this->save_payment_meta_data( $order, $posted );
|
548 |
|
549 |
switch ( intval( $posted->status ) ) {
|
550 |
-
case 1
|
551 |
$order->update_status( 'on-hold', __( 'PagSeguro: The buyer initiated the transaction, but so far the PagSeguro not received any payment information.', 'woocommerce-pagseguro' ) );
|
552 |
|
553 |
break;
|
554 |
-
case 2
|
555 |
$order->update_status( 'on-hold', __( 'PagSeguro: Payment under review.', 'woocommerce-pagseguro' ) );
|
556 |
|
557 |
-
|
558 |
-
|
559 |
-
|
|
|
560 |
|
561 |
-
|
562 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
|
564 |
break;
|
565 |
-
case 4
|
566 |
$order->add_order_note( __( 'PagSeguro: Payment completed and credited to your account.', 'woocommerce-pagseguro' ) );
|
567 |
|
568 |
break;
|
569 |
-
case 5
|
570 |
$order->update_status( 'on-hold', __( 'PagSeguro: Payment came into dispute.', 'woocommerce-pagseguro' ) );
|
571 |
$this->send_email(
|
|
|
572 |
sprintf( __( 'Payment for order %s came into dispute', 'woocommerce-pagseguro' ), $order->get_order_number() ),
|
573 |
__( 'Payment in dispute', 'woocommerce-pagseguro' ),
|
|
|
574 |
sprintf( __( 'Order %s has been marked as on-hold, because the payment came into dispute in PagSeguro.', 'woocommerce-pagseguro' ), $order->get_order_number() )
|
575 |
);
|
576 |
|
577 |
break;
|
578 |
-
case 6
|
579 |
$order->update_status( 'refunded', __( 'PagSeguro: Payment refunded.', 'woocommerce-pagseguro' ) );
|
580 |
$this->send_email(
|
|
|
581 |
sprintf( __( 'Payment for order %s refunded', 'woocommerce-pagseguro' ), $order->get_order_number() ),
|
582 |
__( 'Payment refunded', 'woocommerce-pagseguro' ),
|
|
|
583 |
sprintf( __( 'Order %s has been marked as refunded by PagSeguro.', 'woocommerce-pagseguro' ), $order->get_order_number() )
|
584 |
);
|
585 |
|
|
|
|
|
|
|
|
|
586 |
break;
|
587 |
-
case 7
|
588 |
$order->update_status( 'cancelled', __( 'PagSeguro: Payment canceled.', 'woocommerce-pagseguro' ) );
|
589 |
|
|
|
|
|
|
|
|
|
590 |
break;
|
591 |
|
592 |
-
default
|
593 |
break;
|
594 |
}
|
595 |
} else {
|
@@ -615,23 +658,24 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
615 |
}
|
616 |
|
617 |
if ( isset( $data['type'] ) ) {
|
618 |
-
wc_get_template(
|
619 |
-
'
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
|
|
|
|
624 |
}
|
625 |
}
|
626 |
|
627 |
/**
|
628 |
* Add content to the WC emails.
|
629 |
*
|
630 |
-
* @param
|
631 |
-
* @param bool
|
632 |
-
* @param bool
|
633 |
-
*
|
634 |
-
* @return string Payment instructions.
|
635 |
*/
|
636 |
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
|
637 |
// WooCommerce 3.0 or later.
|
@@ -651,19 +695,23 @@ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
|
|
651 |
|
652 |
if ( isset( $data['type'] ) ) {
|
653 |
if ( $plain_text ) {
|
654 |
-
wc_get_template(
|
655 |
-
'
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
|
|
|
|
660 |
} else {
|
661 |
-
wc_get_template(
|
662 |
-
'
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
|
|
|
|
667 |
}
|
668 |
}
|
669 |
}
|
3 |
* WooCommerce PagSeguro Gateway class
|
4 |
*
|
5 |
* @package WooCommerce_PagSeguro/Classes/Gateway
|
6 |
+
* @version 2.13.0
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) {
|
49 |
$this->debug = $this->get_option( 'debug' );
|
50 |
|
51 |
// Active logs.
|
52 |
+
if ( 'yes' === $this->debug ) {
|
53 |
if ( function_exists( 'wc_get_logger' ) ) {
|
54 |
$this->log = wc_get_logger();
|
55 |
} else {
|
67 |
add_action( 'woocommerce_receipt_' . $this->id, array( $this, 'receipt_page' ) );
|
68 |
|
69 |
// Transparent checkout actions.
|
70 |
+
if ( 'transparent' === $this->method ) {
|
71 |
add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'thankyou_page' ) );
|
72 |
add_action( 'woocommerce_email_after_order_table', array( $this, 'email_instructions' ), 10, 3 );
|
73 |
add_action( 'wp_enqueue_scripts', array( $this, 'checkout_scripts' ) );
|
112 |
// Test if is valid for use.
|
113 |
$available = 'yes' === $this->get_option( 'enabled' ) && '' !== $this->get_email() && '' !== $this->get_token() && $this->using_supported_currency();
|
114 |
|
115 |
+
if ( 'transparent' === $this->method && ! class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) {
|
116 |
$available = false;
|
117 |
}
|
118 |
|
137 |
$session_id = $this->api->get_session_id();
|
138 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
139 |
|
140 |
+
wp_enqueue_style( 'pagseguro-checkout', plugins_url( 'assets/css/frontend/transparent-checkout' . $suffix . '.css', plugin_dir_path( __FILE__ ) ), array(), WC_PAGSEGURO_VERSION );
|
141 |
+
wp_enqueue_script( 'pagseguro-library', $this->api->get_direct_payment_url(), array(), WC_PAGSEGURO_VERSION, true );
|
142 |
+
wp_enqueue_script( 'pagseguro-checkout', plugins_url( 'assets/js/frontend/transparent-checkout' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery', 'pagseguro-library', 'woocommerce-extra-checkout-fields-for-brazil-front' ), WC_PAGSEGURO_VERSION, true );
|
143 |
|
144 |
wp_localize_script(
|
145 |
'pagseguro-checkout',
|
176 |
*/
|
177 |
public function init_form_fields() {
|
178 |
$this->form_fields = array(
|
179 |
+
'enabled' => array(
|
180 |
'title' => __( 'Enable/Disable', 'woocommerce-pagseguro' ),
|
181 |
'type' => 'checkbox',
|
182 |
'label' => __( 'Enable PagSeguro', 'woocommerce-pagseguro' ),
|
183 |
'default' => 'yes',
|
184 |
),
|
185 |
+
'title' => array(
|
186 |
'title' => __( 'Title', 'woocommerce-pagseguro' ),
|
187 |
'type' => 'text',
|
188 |
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-pagseguro' ),
|
189 |
'desc_tip' => true,
|
190 |
'default' => __( 'PagSeguro', 'woocommerce-pagseguro' ),
|
191 |
),
|
192 |
+
'description' => array(
|
193 |
'title' => __( 'Description', 'woocommerce-pagseguro' ),
|
194 |
'type' => 'textarea',
|
195 |
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-pagseguro' ),
|
196 |
'default' => __( 'Pay via PagSeguro', 'woocommerce-pagseguro' ),
|
197 |
),
|
198 |
+
'integration' => array(
|
199 |
'title' => __( 'Integration', 'woocommerce-pagseguro' ),
|
200 |
'type' => 'title',
|
201 |
'description' => '',
|
202 |
),
|
203 |
+
'method' => array(
|
204 |
'title' => __( 'Integration method', 'woocommerce-pagseguro' ),
|
205 |
'type' => 'select',
|
206 |
'description' => __( 'Choose how the customer will interact with the PagSeguro. Redirect (Client goes to PagSeguro page) or Lightbox (Inside your store)', 'woocommerce-pagseguro' ),
|
213 |
'transparent' => __( 'Transparent Checkout', 'woocommerce-pagseguro' ),
|
214 |
),
|
215 |
),
|
216 |
+
'sandbox' => array(
|
217 |
'title' => __( 'PagSeguro Sandbox', 'woocommerce-pagseguro' ),
|
218 |
'type' => 'checkbox',
|
219 |
'label' => __( 'Enable PagSeguro Sandbox', 'woocommerce-pagseguro' ),
|
221 |
'default' => 'no',
|
222 |
'description' => __( 'PagSeguro Sandbox can be used to test the payments.', 'woocommerce-pagseguro' ),
|
223 |
),
|
224 |
+
'email' => array(
|
225 |
'title' => __( 'PagSeguro Email', 'woocommerce-pagseguro' ),
|
226 |
'type' => 'text',
|
227 |
'description' => __( 'Please enter your PagSeguro email address. This is needed in order to take payment.', 'woocommerce-pagseguro' ),
|
228 |
'desc_tip' => true,
|
229 |
'default' => '',
|
230 |
),
|
231 |
+
'token' => array(
|
232 |
'title' => __( 'PagSeguro Token', 'woocommerce-pagseguro' ),
|
233 |
'type' => 'text',
|
234 |
+
/* translators: %s: link to PagSeguro settings */
|
235 |
'description' => sprintf( __( 'Please enter your PagSeguro token. This is needed to process the payment and notifications. Is possible generate a new token %s.', 'woocommerce-pagseguro' ), '<a href="https://pagseguro.uol.com.br/integracao/token-de-seguranca.jhtml">' . __( 'here', 'woocommerce-pagseguro' ) . '</a>' ),
|
236 |
'default' => '',
|
237 |
),
|
238 |
+
'sandbox_email' => array(
|
239 |
'title' => __( 'PagSeguro Sandbox Email', 'woocommerce-pagseguro' ),
|
240 |
'type' => 'text',
|
241 |
+
/* translators: %s: link to PagSeguro settings */
|
242 |
'description' => sprintf( __( 'Please enter your PagSeguro sandbox email address. You can get your sandbox email %s.', 'woocommerce-pagseguro' ), '<a href="https://sandbox.pagseguro.uol.com.br/vendedor/configuracoes.html">' . __( 'here', 'woocommerce-pagseguro' ) . '</a>' ),
|
243 |
'default' => '',
|
244 |
),
|
245 |
+
'sandbox_token' => array(
|
246 |
'title' => __( 'PagSeguro Sandbox Token', 'woocommerce-pagseguro' ),
|
247 |
'type' => 'text',
|
248 |
+
/* translators: %s: link to PagSeguro settings */
|
249 |
'description' => sprintf( __( 'Please enter your PagSeguro sandbox token. You can get your sandbox token %s.', 'woocommerce-pagseguro' ), '<a href="https://sandbox.pagseguro.uol.com.br/vendedor/configuracoes.html">' . __( 'here', 'woocommerce-pagseguro' ) . '</a>' ),
|
250 |
'default' => '',
|
251 |
),
|
254 |
'type' => 'title',
|
255 |
'description' => '',
|
256 |
),
|
257 |
+
'tc_credit' => array(
|
258 |
'title' => __( 'Credit Card', 'woocommerce-pagseguro' ),
|
259 |
'type' => 'checkbox',
|
260 |
'label' => __( 'Enable Credit Card for Transparente Checkout', 'woocommerce-pagseguro' ),
|
261 |
'default' => 'yes',
|
262 |
),
|
263 |
+
'tc_transfer' => array(
|
264 |
'title' => __( 'Bank Transfer', 'woocommerce-pagseguro' ),
|
265 |
'type' => 'checkbox',
|
266 |
'label' => __( 'Enable Bank Transfer for Transparente Checkout', 'woocommerce-pagseguro' ),
|
267 |
'default' => 'yes',
|
268 |
),
|
269 |
+
'tc_ticket' => array(
|
270 |
'title' => __( 'Banking Ticket', 'woocommerce-pagseguro' ),
|
271 |
'type' => 'checkbox',
|
272 |
'label' => __( 'Enable Banking Ticket for Transparente Checkout', 'woocommerce-pagseguro' ),
|
273 |
'default' => 'yes',
|
274 |
),
|
275 |
+
'tc_ticket_message' => array(
|
276 |
'title' => __( 'Banking Ticket Tax Message', 'woocommerce-pagseguro' ),
|
277 |
'type' => 'checkbox',
|
278 |
'label' => __( 'Display a message alerting the customer that will be charged R$ 1,00 for payment by Banking Ticket', 'woocommerce-pagseguro' ),
|
279 |
'default' => 'yes',
|
280 |
),
|
281 |
+
'behavior' => array(
|
282 |
'title' => __( 'Integration Behavior', 'woocommerce-pagseguro' ),
|
283 |
'type' => 'title',
|
284 |
'description' => '',
|
285 |
),
|
286 |
+
'send_only_total' => array(
|
287 |
'title' => __( 'Send only the order total', 'woocommerce-pagseguro' ),
|
288 |
'type' => 'checkbox',
|
289 |
'label' => __( 'If this option is enabled will only send the order total, not the list of items.', 'woocommerce-pagseguro' ),
|
290 |
'default' => 'no',
|
291 |
),
|
292 |
+
'invoice_prefix' => array(
|
293 |
'title' => __( 'Invoice Prefix', 'woocommerce-pagseguro' ),
|
294 |
'type' => 'text',
|
295 |
'description' => __( 'Please enter a prefix for your invoice numbers. If you use your PagSeguro account for multiple stores ensure this prefix is unqiue as PagSeguro will not allow orders with the same invoice number.', 'woocommerce-pagseguro' ),
|
296 |
'desc_tip' => true,
|
297 |
'default' => 'WC-',
|
298 |
),
|
299 |
+
'testing' => array(
|
300 |
'title' => __( 'Gateway Testing', 'woocommerce-pagseguro' ),
|
301 |
'type' => 'title',
|
302 |
'description' => '',
|
303 |
),
|
304 |
+
'debug' => array(
|
305 |
'title' => __( 'Debug Log', 'woocommerce-pagseguro' ),
|
306 |
'type' => 'checkbox',
|
307 |
'label' => __( 'Enable logging', 'woocommerce-pagseguro' ),
|
308 |
'default' => 'no',
|
309 |
+
/* translators: %s: log page link */
|
310 |
'description' => sprintf( __( 'Log PagSeguro events, such as API requests, inside %s', 'woocommerce-pagseguro' ), $this->get_log_view() ),
|
311 |
),
|
312 |
);
|
318 |
public function admin_options() {
|
319 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
320 |
|
321 |
+
wp_enqueue_script( 'pagseguro-admin', plugins_url( 'assets/js/admin/admin' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery' ), WC_PAGSEGURO_VERSION, true );
|
322 |
|
323 |
include dirname( __FILE__ ) . '/admin/views/html-admin-page.php';
|
324 |
}
|
342 |
public function payment_fields() {
|
343 |
wp_enqueue_script( 'wc-credit-card-form' );
|
344 |
|
345 |
+
$description = $this->get_description();
|
346 |
+
if ( $description ) {
|
347 |
+
echo wpautop( wptexturize( $description ) ); // WPCS: XSS ok.
|
348 |
}
|
349 |
|
350 |
$cart_total = $this->get_order_total();
|
351 |
|
352 |
+
if ( 'transparent' === $this->method ) {
|
353 |
+
wc_get_template(
|
354 |
+
'transparent-checkout-form.php', array(
|
355 |
+
'cart_total' => $cart_total,
|
356 |
+
'tc_credit' => $this->tc_credit,
|
357 |
+
'tc_transfer' => $this->tc_transfer,
|
358 |
+
'tc_ticket' => $this->tc_ticket,
|
359 |
+
'tc_ticket_message' => $this->tc_ticket_message,
|
360 |
+
'flag' => plugins_url( 'assets/images/brazilian-flag.png', plugin_dir_path( __FILE__ ) ),
|
361 |
+
), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path()
|
362 |
+
);
|
363 |
}
|
364 |
}
|
365 |
|
367 |
* Process the payment and return the result.
|
368 |
*
|
369 |
* @param int $order_id Order ID.
|
|
|
370 |
* @return array
|
371 |
*/
|
372 |
public function process_payment( $order_id ) {
|
373 |
$order = wc_get_order( $order_id );
|
374 |
|
375 |
+
if ( 'lightbox' !== $this->method ) {
|
376 |
+
if ( isset( $_POST['pagseguro_sender_hash'] ) && 'transparent' === $this->method ) { // WPCS: input var ok, CSRF ok.
|
377 |
+
$response = $this->api->do_payment_request( $order, $_POST ); // WPCS: input var ok, CSRF ok.
|
378 |
|
379 |
if ( $response['data'] ) {
|
380 |
$this->update_order_status( $response['data'] );
|
381 |
}
|
382 |
} else {
|
383 |
+
$response = $this->api->do_checkout_request( $order, $_POST ); // WPCS: input var ok, CSRF ok.
|
384 |
}
|
385 |
|
386 |
if ( $response['url'] ) {
|
402 |
);
|
403 |
}
|
404 |
} else {
|
405 |
+
$use_shipping = isset( $_POST['ship_to_different_address'] ) ? true : false; // WPCS: input var ok, CSRF ok.
|
406 |
|
407 |
return array(
|
408 |
'result' => 'success',
|
418 |
*/
|
419 |
public function receipt_page( $order_id ) {
|
420 |
$order = wc_get_order( $order_id );
|
421 |
+
$request_data = $_POST; // WPCS: input var ok, CSRF ok.
|
422 |
+
if ( isset( $_GET['use_shipping'] ) && true === (bool) $_GET['use_shipping'] ) { // WPCS: input var ok, CSRF ok.
|
423 |
$request_data['ship_to_different_address'] = true;
|
424 |
}
|
425 |
|
427 |
|
428 |
if ( $response['url'] ) {
|
429 |
// Lightbox script.
|
430 |
+
wc_enqueue_js(
|
431 |
+
'
|
432 |
$( "#browser-has-javascript" ).show();
|
433 |
$( "#browser-no-has-javascript, #cancel-payment, #submit-payment" ).hide();
|
434 |
var isOpenLightbox = PagSeguroLightbox({
|
444 |
if ( ! isOpenLightbox ) {
|
445 |
window.location.href = "' . esc_js( $response['url'] ) . '";
|
446 |
}
|
447 |
+
'
|
448 |
+
);
|
449 |
|
450 |
+
wc_get_template(
|
451 |
+
'lightbox-checkout.php', array(
|
452 |
+
'cancel_order_url' => $order->get_cancel_order_url(),
|
453 |
+
'payment_url' => $response['url'],
|
454 |
+
'lightbox_script_url' => $this->api->get_lightbox_url(),
|
455 |
+
), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path()
|
456 |
+
);
|
457 |
} else {
|
458 |
include dirname( __FILE__ ) . '/views/html-receipt-page-error.php';
|
459 |
}
|
463 |
* IPN handler.
|
464 |
*/
|
465 |
public function ipn_handler() {
|
466 |
+
@ob_clean(); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
|
467 |
|
468 |
+
$ipn = $this->api->process_ipn_request( $_POST ); // WPCS: input var ok, CSRF ok.
|
469 |
|
470 |
if ( $ipn ) {
|
471 |
header( 'HTTP/1.1 200 OK' );
|
479 |
/**
|
480 |
* Save payment meta data.
|
481 |
*
|
482 |
+
* @param WC_Order $order Order instance.
|
483 |
+
* @param array $posted Posted data.
|
484 |
*/
|
485 |
protected function save_payment_meta_data( $order, $posted ) {
|
486 |
$meta_data = array();
|
497 |
if ( isset( $posted->sender->name ) ) {
|
498 |
$meta_data[ __( 'Payer name', 'woocommerce-pagseguro' ) ] = sanitize_text_field( (string) $posted->sender->name );
|
499 |
}
|
500 |
+
if ( isset( $posted->paymentMethod->type ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
501 |
+
$payment_data['type'] = intval( $posted->paymentMethod->type ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
502 |
+
|
503 |
$meta_data[ __( 'Payment type', 'woocommerce-pagseguro' ) ] = $this->api->get_payment_name_by_type( $payment_data['type'] );
|
504 |
}
|
505 |
+
if ( isset( $posted->paymentMethod->code ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
506 |
+
$payment_data['method'] = $this->api->get_payment_method_name( intval( $posted->paymentMethod->code ) ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
507 |
+
|
508 |
$meta_data[ __( 'Payment method', 'woocommerce-pagseguro' ) ] = $payment_data['method'];
|
509 |
}
|
510 |
+
if ( isset( $posted->installmentCount ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
511 |
+
$payment_data['installments'] = sanitize_text_field( (string) $posted->installmentCount ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
512 |
+
|
513 |
$meta_data[ __( 'Installments', 'woocommerce-pagseguro' ) ] = $payment_data['installments'];
|
514 |
}
|
515 |
+
if ( isset( $posted->paymentLink ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
516 |
+
$payment_data['link'] = sanitize_text_field( (string) $posted->paymentLink ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
517 |
+
|
518 |
$meta_data[ __( 'Payment URL', 'woocommerce-pagseguro' ) ] = $payment_data['link'];
|
519 |
}
|
520 |
+
if ( isset( $posted->creditorFees->intermediationRateAmount ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
521 |
+
$meta_data[ __( 'Intermediation Rate', 'woocommerce-pagseguro' ) ] = sanitize_text_field( (string) $posted->creditorFees->intermediationRateAmount ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
522 |
+
}
|
523 |
+
if ( isset( $posted->creditorFees->intermediationFeeAmount ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
524 |
+
$meta_data[ __( 'Intermediation Fee', 'woocommerce-pagseguro' ) ] = sanitize_text_field( (string) $posted->creditorFees->intermediationFeeAmount ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
525 |
+
}
|
526 |
|
527 |
$meta_data['_wc_pagseguro_payment_data'] = $payment_data;
|
528 |
|
567 |
$this->save_payment_meta_data( $order, $posted );
|
568 |
|
569 |
switch ( intval( $posted->status ) ) {
|
570 |
+
case 1:
|
571 |
$order->update_status( 'on-hold', __( 'PagSeguro: The buyer initiated the transaction, but so far the PagSeguro not received any payment information.', 'woocommerce-pagseguro' ) );
|
572 |
|
573 |
break;
|
574 |
+
case 2:
|
575 |
$order->update_status( 'on-hold', __( 'PagSeguro: Payment under review.', 'woocommerce-pagseguro' ) );
|
576 |
|
577 |
+
// Reduce stock for billets.
|
578 |
+
if ( function_exists( 'wc_reduce_stock_levels' ) ) {
|
579 |
+
wc_reduce_stock_levels( $order_id );
|
580 |
+
}
|
581 |
|
582 |
+
break;
|
583 |
+
case 3:
|
584 |
+
// Sometimes PagSeguro should change an order from cancelled to paid, so we need to handle it.
|
585 |
+
if ( method_exists( $order, 'get_status' ) && 'cancelled' === $order->get_status() ) {
|
586 |
+
$order->update_status( 'processing', __( 'PagSeguro: Payment approved.', 'woocommerce-pagseguro' ) );
|
587 |
+
wc_reduce_stock_levels( $order_id );
|
588 |
+
} else {
|
589 |
+
$order->add_order_note( __( 'PagSeguro: Payment approved.', 'woocommerce-pagseguro' ) );
|
590 |
+
|
591 |
+
// Changing the order for processing and reduces the stock.
|
592 |
+
$order->payment_complete( sanitize_text_field( (string) $posted->code ) );
|
593 |
+
}
|
594 |
|
595 |
break;
|
596 |
+
case 4:
|
597 |
$order->add_order_note( __( 'PagSeguro: Payment completed and credited to your account.', 'woocommerce-pagseguro' ) );
|
598 |
|
599 |
break;
|
600 |
+
case 5:
|
601 |
$order->update_status( 'on-hold', __( 'PagSeguro: Payment came into dispute.', 'woocommerce-pagseguro' ) );
|
602 |
$this->send_email(
|
603 |
+
/* translators: %s: order number */
|
604 |
sprintf( __( 'Payment for order %s came into dispute', 'woocommerce-pagseguro' ), $order->get_order_number() ),
|
605 |
__( 'Payment in dispute', 'woocommerce-pagseguro' ),
|
606 |
+
/* translators: %s: order number */
|
607 |
sprintf( __( 'Order %s has been marked as on-hold, because the payment came into dispute in PagSeguro.', 'woocommerce-pagseguro' ), $order->get_order_number() )
|
608 |
);
|
609 |
|
610 |
break;
|
611 |
+
case 6:
|
612 |
$order->update_status( 'refunded', __( 'PagSeguro: Payment refunded.', 'woocommerce-pagseguro' ) );
|
613 |
$this->send_email(
|
614 |
+
/* translators: %s: order number */
|
615 |
sprintf( __( 'Payment for order %s refunded', 'woocommerce-pagseguro' ), $order->get_order_number() ),
|
616 |
__( 'Payment refunded', 'woocommerce-pagseguro' ),
|
617 |
+
/* translators: %s: order number */
|
618 |
sprintf( __( 'Order %s has been marked as refunded by PagSeguro.', 'woocommerce-pagseguro' ), $order->get_order_number() )
|
619 |
);
|
620 |
|
621 |
+
if ( function_exists( 'wc_increase_stock_levels' ) ) {
|
622 |
+
wc_increase_stock_levels( $order_id );
|
623 |
+
}
|
624 |
+
|
625 |
break;
|
626 |
+
case 7:
|
627 |
$order->update_status( 'cancelled', __( 'PagSeguro: Payment canceled.', 'woocommerce-pagseguro' ) );
|
628 |
|
629 |
+
if ( function_exists( 'wc_increase_stock_levels' ) ) {
|
630 |
+
wc_increase_stock_levels( $order_id );
|
631 |
+
}
|
632 |
+
|
633 |
break;
|
634 |
|
635 |
+
default:
|
636 |
break;
|
637 |
}
|
638 |
} else {
|
658 |
}
|
659 |
|
660 |
if ( isset( $data['type'] ) ) {
|
661 |
+
wc_get_template(
|
662 |
+
'payment-instructions.php', array(
|
663 |
+
'type' => $data['type'],
|
664 |
+
'link' => $data['link'],
|
665 |
+
'method' => $data['method'],
|
666 |
+
'installments' => $data['installments'],
|
667 |
+
), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path()
|
668 |
+
);
|
669 |
}
|
670 |
}
|
671 |
|
672 |
/**
|
673 |
* Add content to the WC emails.
|
674 |
*
|
675 |
+
* @param WC_Order $order Order object.
|
676 |
+
* @param bool $sent_to_admin Send to admin.
|
677 |
+
* @param bool $plain_text Plain text or HTML.
|
678 |
+
* @return string
|
|
|
679 |
*/
|
680 |
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
|
681 |
// WooCommerce 3.0 or later.
|
695 |
|
696 |
if ( isset( $data['type'] ) ) {
|
697 |
if ( $plain_text ) {
|
698 |
+
wc_get_template(
|
699 |
+
'emails/plain-instructions.php', array(
|
700 |
+
'type' => $data['type'],
|
701 |
+
'link' => $data['link'],
|
702 |
+
'method' => $data['method'],
|
703 |
+
'installments' => $data['installments'],
|
704 |
+
), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path()
|
705 |
+
);
|
706 |
} else {
|
707 |
+
wc_get_template(
|
708 |
+
'emails/html-instructions.php', array(
|
709 |
+
'type' => $data['type'],
|
710 |
+
'link' => $data['link'],
|
711 |
+
'method' => $data['method'],
|
712 |
+
'installments' => $data['installments'],
|
713 |
+
), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path()
|
714 |
+
);
|
715 |
}
|
716 |
}
|
717 |
}
|
includes/class-wc-pagseguro.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce PagSeguro main class
|
4 |
+
*
|
5 |
+
* @package WooCommerce_PagSeguro
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* WooCommerce bootstrap class.
|
10 |
+
*/
|
11 |
+
class WC_PagSeguro {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Initialize the plugin public actions.
|
15 |
+
*/
|
16 |
+
public static function init() {
|
17 |
+
// Load plugin text domain.
|
18 |
+
add_action( 'init', array( __CLASS__, 'load_plugin_textdomain' ) );
|
19 |
+
|
20 |
+
// Checks with WooCommerce is installed.
|
21 |
+
if ( class_exists( 'WC_Payment_Gateway' ) ) {
|
22 |
+
self::includes();
|
23 |
+
|
24 |
+
add_filter( 'woocommerce_payment_gateways', array( __CLASS__, 'add_gateway' ) );
|
25 |
+
add_filter( 'woocommerce_available_payment_gateways', array( __CLASS__, 'hides_when_is_outside_brazil' ) );
|
26 |
+
add_filter( 'woocommerce_billing_fields', array( __CLASS__, 'transparent_checkout_billing_fields' ), 9999 );
|
27 |
+
add_filter( 'woocommerce_shipping_fields', array( __CLASS__, 'transparent_checkout_shipping_fields' ), 9999 );
|
28 |
+
add_filter( 'plugin_action_links_' . plugin_basename( WC_PAGSEGURO_PLUGIN_FILE ), array( __CLASS__, 'plugin_action_links' ) );
|
29 |
+
|
30 |
+
if ( is_admin() ) {
|
31 |
+
add_action( 'admin_notices', array( __CLASS__, 'ecfb_missing_notice' ) );
|
32 |
+
}
|
33 |
+
} else {
|
34 |
+
add_action( 'admin_notices', array( __CLASS__, 'woocommerce_missing_notice' ) );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get templates path.
|
40 |
+
*
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
public static function get_templates_path() {
|
44 |
+
return plugin_dir_path( WC_PAGSEGURO_PLUGIN_FILE ) . 'templates/';
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Load the plugin text domain for translation.
|
49 |
+
*/
|
50 |
+
public static function load_plugin_textdomain() {
|
51 |
+
load_plugin_textdomain( 'woocommerce-pagseguro', false, dirname( plugin_basename( WC_PAGSEGURO_PLUGIN_FILE ) ) . '/languages/' );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Action links.
|
56 |
+
*
|
57 |
+
* @param array $links Action links.
|
58 |
+
*
|
59 |
+
* @return array
|
60 |
+
*/
|
61 |
+
public static function plugin_action_links( $links ) {
|
62 |
+
$plugin_links = array();
|
63 |
+
$plugin_links[] = '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=pagseguro' ) ) . '">' . __( 'Settings', 'woocommerce-pagseguro' ) . '</a>';
|
64 |
+
|
65 |
+
return array_merge( $plugin_links, $links );
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Includes.
|
70 |
+
*/
|
71 |
+
private static function includes() {
|
72 |
+
include_once dirname( __FILE__ ) . '/class-wc-pagseguro-xml.php';
|
73 |
+
include_once dirname( __FILE__ ) . '/class-wc-pagseguro-api.php';
|
74 |
+
include_once dirname( __FILE__ ) . '/class-wc-pagseguro-gateway.php';
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Add the gateway to WooCommerce.
|
79 |
+
*
|
80 |
+
* @param array $methods WooCommerce payment methods.
|
81 |
+
*
|
82 |
+
* @return array Payment methods with PagSeguro.
|
83 |
+
*/
|
84 |
+
public static function add_gateway( $methods ) {
|
85 |
+
$methods[] = 'WC_PagSeguro_Gateway';
|
86 |
+
|
87 |
+
return $methods;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Hides the PagSeguro with payment method with the customer lives outside Brazil.
|
92 |
+
*
|
93 |
+
* @param array $available_gateways Default Available Gateways.
|
94 |
+
*
|
95 |
+
* @return array New Available Gateways.
|
96 |
+
*/
|
97 |
+
public static function hides_when_is_outside_brazil( $available_gateways ) {
|
98 |
+
// Remove PagSeguro gateway.
|
99 |
+
if ( isset( $_REQUEST['country'] ) && 'BR' !== $_REQUEST['country'] ) { // WPCS: input var ok, CSRF ok.
|
100 |
+
unset( $available_gateways['pagseguro'] );
|
101 |
+
}
|
102 |
+
|
103 |
+
return $available_gateways;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Transparent checkout billing fields.
|
108 |
+
*
|
109 |
+
* @param array $fields Checkout fields.
|
110 |
+
* @return array
|
111 |
+
*/
|
112 |
+
public static function transparent_checkout_billing_fields( $fields ) {
|
113 |
+
$settings = get_option( 'woocommerce_pagseguro_settings', array( 'method' => '' ) );
|
114 |
+
|
115 |
+
if ( 'transparent' === $settings['method'] && class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) {
|
116 |
+
if ( isset( $fields['billing_neighborhood'] ) ) {
|
117 |
+
$fields['billing_neighborhood']['required'] = true;
|
118 |
+
}
|
119 |
+
if ( isset( $fields['billing_number'] ) ) {
|
120 |
+
$fields['billing_number']['required'] = true;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
return $fields;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Transparent checkout billing fields.
|
129 |
+
*
|
130 |
+
* @param array $fields Checkout fields.
|
131 |
+
* @return array
|
132 |
+
*/
|
133 |
+
public static function transparent_checkout_shipping_fields( $fields ) {
|
134 |
+
if ( 'transparent' === $settings['method'] && class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) {
|
135 |
+
if ( isset( $fields['shipping_neighborhood'] ) ) {
|
136 |
+
$fields['shipping_neighborhood']['required'] = true;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
return $fields;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* WooCommerce Extra Checkout Fields for Brazil notice.
|
145 |
+
*/
|
146 |
+
public static function ecfb_missing_notice() {
|
147 |
+
$settings = get_option( 'woocommerce_pagseguro_settings', array( 'method' => '' ) );
|
148 |
+
|
149 |
+
if ( 'transparent' === $settings['method'] && ! class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) {
|
150 |
+
include dirname( __FILE__ ) . '/admin/views/html-notice-missing-ecfb.php';
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* WooCommerce missing notice.
|
156 |
+
*/
|
157 |
+
public static function woocommerce_missing_notice() {
|
158 |
+
include dirname( __FILE__ ) . '/admin/views/html-notice-missing-woocommerce.php';
|
159 |
+
}
|
160 |
+
}
|
languages/woocommerce-pagseguro.pot
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
# Copyright (C) 2018 Claudio Sanches
|
2 |
-
# This file is distributed under the
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce PagSeguro 2.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-pagseguro\n"
|
8 |
-
"POT-Creation-Date: 2018-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
-
"X-Generator: grunt-wp-i18n1.0.
|
16 |
|
17 |
#: includes/admin/views/html-admin-help-message.php:14
|
18 |
msgid ""
|
@@ -75,7 +75,7 @@ msgid "You should inform your token."
|
|
75 |
msgstr ""
|
76 |
|
77 |
#: includes/class-wc-pagseguro-api.php:151
|
78 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
79 |
#: templates/transparent-checkout-form.php:19
|
80 |
msgid "Credit Card"
|
81 |
msgstr ""
|
@@ -85,7 +85,7 @@ msgid "Billet"
|
|
85 |
msgstr ""
|
86 |
|
87 |
#: includes/class-wc-pagseguro-api.php:153
|
88 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
89 |
#: templates/transparent-checkout-form.php:23
|
90 |
msgid "Bank Transfer"
|
91 |
msgstr ""
|
@@ -352,195 +352,216 @@ msgstr ""
|
|
352 |
msgid "PagSeguro Token"
|
353 |
msgstr ""
|
354 |
|
355 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
356 |
msgid ""
|
357 |
"Please enter your PagSeguro token. This is needed to process the payment "
|
358 |
"and notifications. Is possible generate a new token %s."
|
359 |
msgstr ""
|
360 |
|
361 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
362 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
363 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
364 |
msgid "here"
|
365 |
msgstr ""
|
366 |
|
367 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
368 |
msgid "PagSeguro Sandbox Email"
|
369 |
msgstr ""
|
370 |
|
371 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
372 |
msgid ""
|
373 |
"Please enter your PagSeguro sandbox email address. You can get your sandbox "
|
374 |
"email %s."
|
375 |
msgstr ""
|
376 |
|
377 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
378 |
msgid "PagSeguro Sandbox Token"
|
379 |
msgstr ""
|
380 |
|
381 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
382 |
msgid ""
|
383 |
"Please enter your PagSeguro sandbox token. You can get your sandbox token "
|
384 |
"%s."
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
388 |
msgid "Transparent Checkout Options"
|
389 |
msgstr ""
|
390 |
|
391 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
392 |
msgid "Enable Credit Card for Transparente Checkout"
|
393 |
msgstr ""
|
394 |
|
395 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
396 |
msgid "Enable Bank Transfer for Transparente Checkout"
|
397 |
msgstr ""
|
398 |
|
399 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
400 |
#: templates/transparent-checkout-form.php:27
|
401 |
msgid "Banking Ticket"
|
402 |
msgstr ""
|
403 |
|
404 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
405 |
msgid "Enable Banking Ticket for Transparente Checkout"
|
406 |
msgstr ""
|
407 |
|
408 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
409 |
msgid "Banking Ticket Tax Message"
|
410 |
msgstr ""
|
411 |
|
412 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
413 |
msgid ""
|
414 |
"Display a message alerting the customer that will be charged R$ 1,00 for "
|
415 |
"payment by Banking Ticket"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
419 |
msgid "Integration Behavior"
|
420 |
msgstr ""
|
421 |
|
422 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
423 |
msgid "Send only the order total"
|
424 |
msgstr ""
|
425 |
|
426 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
427 |
msgid ""
|
428 |
"If this option is enabled will only send the order total, not the list of "
|
429 |
"items."
|
430 |
msgstr ""
|
431 |
|
432 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
433 |
msgid "Invoice Prefix"
|
434 |
msgstr ""
|
435 |
|
436 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
437 |
msgid ""
|
438 |
"Please enter a prefix for your invoice numbers. If you use your PagSeguro "
|
439 |
"account for multiple stores ensure this prefix is unqiue as PagSeguro will "
|
440 |
"not allow orders with the same invoice number."
|
441 |
msgstr ""
|
442 |
|
443 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
444 |
msgid "Gateway Testing"
|
445 |
msgstr ""
|
446 |
|
447 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
448 |
msgid "Debug Log"
|
449 |
msgstr ""
|
450 |
|
451 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
452 |
msgid "Enable logging"
|
453 |
msgstr ""
|
454 |
|
455 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
456 |
msgid "Log PagSeguro events, such as API requests, inside %s"
|
457 |
msgstr ""
|
458 |
|
459 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
460 |
msgid "PagSeguro Request Unauthorized"
|
461 |
msgstr ""
|
462 |
|
463 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
464 |
msgid "Payer email"
|
465 |
msgstr ""
|
466 |
|
467 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
468 |
msgid "Payer name"
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
472 |
msgid "Payment type"
|
473 |
msgstr ""
|
474 |
|
475 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
476 |
msgid "Payment method"
|
477 |
msgstr ""
|
478 |
|
479 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
480 |
#: templates/transparent-checkout-form.php:53
|
481 |
msgid "Installments"
|
482 |
msgstr ""
|
483 |
|
484 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
485 |
msgid "Payment URL"
|
486 |
msgstr ""
|
487 |
|
488 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
msgid ""
|
490 |
"PagSeguro: The buyer initiated the transaction, but so far the PagSeguro "
|
491 |
"not received any payment information."
|
492 |
msgstr ""
|
493 |
|
494 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
495 |
msgid "PagSeguro: Payment under review."
|
496 |
msgstr ""
|
497 |
|
498 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
499 |
msgid "PagSeguro: Payment approved."
|
500 |
msgstr ""
|
501 |
|
502 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
503 |
msgid "PagSeguro: Payment completed and credited to your account."
|
504 |
msgstr ""
|
505 |
|
506 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
507 |
msgid "PagSeguro: Payment came into dispute."
|
508 |
msgstr ""
|
509 |
|
510 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
511 |
msgid "Payment for order %s came into dispute"
|
512 |
msgstr ""
|
513 |
|
514 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
515 |
msgid "Payment in dispute"
|
516 |
msgstr ""
|
517 |
|
518 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
519 |
msgid ""
|
520 |
"Order %s has been marked as on-hold, because the payment came into dispute "
|
521 |
"in PagSeguro."
|
522 |
msgstr ""
|
523 |
|
524 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
525 |
msgid "PagSeguro: Payment refunded."
|
526 |
msgstr ""
|
527 |
|
528 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
529 |
msgid "Payment for order %s refunded"
|
530 |
msgstr ""
|
531 |
|
532 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
533 |
msgid "Payment refunded"
|
534 |
msgstr ""
|
535 |
|
536 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
|
|
537 |
msgid "Order %s has been marked as refunded by PagSeguro."
|
538 |
msgstr ""
|
539 |
|
540 |
-
#: includes/class-wc-pagseguro-gateway.php:
|
541 |
msgid "PagSeguro: Payment canceled."
|
542 |
msgstr ""
|
543 |
|
|
|
|
|
|
|
|
|
544 |
#: includes/views/html-receipt-page-error.php:19
|
545 |
msgid "Click to try again"
|
546 |
msgstr ""
|
@@ -728,10 +749,6 @@ msgstr ""
|
|
728 |
msgid "Brazilian flag"
|
729 |
msgstr ""
|
730 |
|
731 |
-
#: woocommerce-pagseguro.php:120
|
732 |
-
msgid "Settings"
|
733 |
-
msgstr ""
|
734 |
-
|
735 |
#. Plugin URI of the plugin/theme
|
736 |
msgid "https://github.com/claudiosanches/woocommerce-pagseguro"
|
737 |
msgstr ""
|
1 |
# Copyright (C) 2018 Claudio Sanches
|
2 |
+
# This file is distributed under the GPLv3 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce PagSeguro 2.13.0\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-pagseguro\n"
|
8 |
+
"POT-Creation-Date: 2018-08-02 21:33:03+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
+
"X-Generator: grunt-wp-i18n1.0.2\n"
|
16 |
|
17 |
#: includes/admin/views/html-admin-help-message.php:14
|
18 |
msgid ""
|
75 |
msgstr ""
|
76 |
|
77 |
#: includes/class-wc-pagseguro-api.php:151
|
78 |
+
#: includes/class-wc-pagseguro-gateway.php:258
|
79 |
#: templates/transparent-checkout-form.php:19
|
80 |
msgid "Credit Card"
|
81 |
msgstr ""
|
85 |
msgstr ""
|
86 |
|
87 |
#: includes/class-wc-pagseguro-api.php:153
|
88 |
+
#: includes/class-wc-pagseguro-gateway.php:264
|
89 |
#: templates/transparent-checkout-form.php:23
|
90 |
msgid "Bank Transfer"
|
91 |
msgstr ""
|
352 |
msgid "PagSeguro Token"
|
353 |
msgstr ""
|
354 |
|
355 |
+
#: includes/class-wc-pagseguro-gateway.php:235
|
356 |
+
#. translators: %s: link to PagSeguro settings
|
357 |
msgid ""
|
358 |
"Please enter your PagSeguro token. This is needed to process the payment "
|
359 |
"and notifications. Is possible generate a new token %s."
|
360 |
msgstr ""
|
361 |
|
362 |
+
#: includes/class-wc-pagseguro-gateway.php:235
|
363 |
+
#: includes/class-wc-pagseguro-gateway.php:242
|
364 |
+
#: includes/class-wc-pagseguro-gateway.php:249
|
365 |
msgid "here"
|
366 |
msgstr ""
|
367 |
|
368 |
+
#: includes/class-wc-pagseguro-gateway.php:239
|
369 |
msgid "PagSeguro Sandbox Email"
|
370 |
msgstr ""
|
371 |
|
372 |
+
#: includes/class-wc-pagseguro-gateway.php:242
|
373 |
+
#. translators: %s: link to PagSeguro settings
|
374 |
msgid ""
|
375 |
"Please enter your PagSeguro sandbox email address. You can get your sandbox "
|
376 |
"email %s."
|
377 |
msgstr ""
|
378 |
|
379 |
+
#: includes/class-wc-pagseguro-gateway.php:246
|
380 |
msgid "PagSeguro Sandbox Token"
|
381 |
msgstr ""
|
382 |
|
383 |
+
#: includes/class-wc-pagseguro-gateway.php:249
|
384 |
+
#. translators: %s: link to PagSeguro settings
|
385 |
msgid ""
|
386 |
"Please enter your PagSeguro sandbox token. You can get your sandbox token "
|
387 |
"%s."
|
388 |
msgstr ""
|
389 |
|
390 |
+
#: includes/class-wc-pagseguro-gateway.php:253
|
391 |
msgid "Transparent Checkout Options"
|
392 |
msgstr ""
|
393 |
|
394 |
+
#: includes/class-wc-pagseguro-gateway.php:260
|
395 |
msgid "Enable Credit Card for Transparente Checkout"
|
396 |
msgstr ""
|
397 |
|
398 |
+
#: includes/class-wc-pagseguro-gateway.php:266
|
399 |
msgid "Enable Bank Transfer for Transparente Checkout"
|
400 |
msgstr ""
|
401 |
|
402 |
+
#: includes/class-wc-pagseguro-gateway.php:270
|
403 |
#: templates/transparent-checkout-form.php:27
|
404 |
msgid "Banking Ticket"
|
405 |
msgstr ""
|
406 |
|
407 |
+
#: includes/class-wc-pagseguro-gateway.php:272
|
408 |
msgid "Enable Banking Ticket for Transparente Checkout"
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: includes/class-wc-pagseguro-gateway.php:276
|
412 |
msgid "Banking Ticket Tax Message"
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: includes/class-wc-pagseguro-gateway.php:278
|
416 |
msgid ""
|
417 |
"Display a message alerting the customer that will be charged R$ 1,00 for "
|
418 |
"payment by Banking Ticket"
|
419 |
msgstr ""
|
420 |
|
421 |
+
#: includes/class-wc-pagseguro-gateway.php:282
|
422 |
msgid "Integration Behavior"
|
423 |
msgstr ""
|
424 |
|
425 |
+
#: includes/class-wc-pagseguro-gateway.php:287
|
426 |
msgid "Send only the order total"
|
427 |
msgstr ""
|
428 |
|
429 |
+
#: includes/class-wc-pagseguro-gateway.php:289
|
430 |
msgid ""
|
431 |
"If this option is enabled will only send the order total, not the list of "
|
432 |
"items."
|
433 |
msgstr ""
|
434 |
|
435 |
+
#: includes/class-wc-pagseguro-gateway.php:293
|
436 |
msgid "Invoice Prefix"
|
437 |
msgstr ""
|
438 |
|
439 |
+
#: includes/class-wc-pagseguro-gateway.php:295
|
440 |
msgid ""
|
441 |
"Please enter a prefix for your invoice numbers. If you use your PagSeguro "
|
442 |
"account for multiple stores ensure this prefix is unqiue as PagSeguro will "
|
443 |
"not allow orders with the same invoice number."
|
444 |
msgstr ""
|
445 |
|
446 |
+
#: includes/class-wc-pagseguro-gateway.php:300
|
447 |
msgid "Gateway Testing"
|
448 |
msgstr ""
|
449 |
|
450 |
+
#: includes/class-wc-pagseguro-gateway.php:305
|
451 |
msgid "Debug Log"
|
452 |
msgstr ""
|
453 |
|
454 |
+
#: includes/class-wc-pagseguro-gateway.php:307
|
455 |
msgid "Enable logging"
|
456 |
msgstr ""
|
457 |
|
458 |
+
#: includes/class-wc-pagseguro-gateway.php:310
|
459 |
+
#. translators: %s: log page link
|
460 |
msgid "Log PagSeguro events, such as API requests, inside %s"
|
461 |
msgstr ""
|
462 |
|
463 |
+
#: includes/class-wc-pagseguro-gateway.php:475
|
464 |
msgid "PagSeguro Request Unauthorized"
|
465 |
msgstr ""
|
466 |
|
467 |
+
#: includes/class-wc-pagseguro-gateway.php:495
|
468 |
msgid "Payer email"
|
469 |
msgstr ""
|
470 |
|
471 |
+
#: includes/class-wc-pagseguro-gateway.php:498
|
472 |
msgid "Payer name"
|
473 |
msgstr ""
|
474 |
|
475 |
+
#: includes/class-wc-pagseguro-gateway.php:503
|
476 |
msgid "Payment type"
|
477 |
msgstr ""
|
478 |
|
479 |
+
#: includes/class-wc-pagseguro-gateway.php:508
|
480 |
msgid "Payment method"
|
481 |
msgstr ""
|
482 |
|
483 |
+
#: includes/class-wc-pagseguro-gateway.php:513
|
484 |
#: templates/transparent-checkout-form.php:53
|
485 |
msgid "Installments"
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: includes/class-wc-pagseguro-gateway.php:518
|
489 |
msgid "Payment URL"
|
490 |
msgstr ""
|
491 |
|
492 |
+
#: includes/class-wc-pagseguro-gateway.php:521
|
493 |
+
msgid "Intermediation Rate"
|
494 |
+
msgstr ""
|
495 |
+
|
496 |
+
#: includes/class-wc-pagseguro-gateway.php:524
|
497 |
+
msgid "Intermediation Fee"
|
498 |
+
msgstr ""
|
499 |
+
|
500 |
+
#: includes/class-wc-pagseguro-gateway.php:571
|
501 |
msgid ""
|
502 |
"PagSeguro: The buyer initiated the transaction, but so far the PagSeguro "
|
503 |
"not received any payment information."
|
504 |
msgstr ""
|
505 |
|
506 |
+
#: includes/class-wc-pagseguro-gateway.php:575
|
507 |
msgid "PagSeguro: Payment under review."
|
508 |
msgstr ""
|
509 |
|
510 |
+
#: includes/class-wc-pagseguro-gateway.php:586
|
511 |
+
#: includes/class-wc-pagseguro-gateway.php:589
|
512 |
msgid "PagSeguro: Payment approved."
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: includes/class-wc-pagseguro-gateway.php:597
|
516 |
msgid "PagSeguro: Payment completed and credited to your account."
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: includes/class-wc-pagseguro-gateway.php:601
|
520 |
msgid "PagSeguro: Payment came into dispute."
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: includes/class-wc-pagseguro-gateway.php:604
|
524 |
+
#. translators: %s: order number
|
525 |
msgid "Payment for order %s came into dispute"
|
526 |
msgstr ""
|
527 |
|
528 |
+
#: includes/class-wc-pagseguro-gateway.php:605
|
529 |
msgid "Payment in dispute"
|
530 |
msgstr ""
|
531 |
|
532 |
+
#: includes/class-wc-pagseguro-gateway.php:607
|
533 |
+
#. translators: %s: order number
|
534 |
msgid ""
|
535 |
"Order %s has been marked as on-hold, because the payment came into dispute "
|
536 |
"in PagSeguro."
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: includes/class-wc-pagseguro-gateway.php:612
|
540 |
msgid "PagSeguro: Payment refunded."
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: includes/class-wc-pagseguro-gateway.php:615
|
544 |
+
#. translators: %s: order number
|
545 |
msgid "Payment for order %s refunded"
|
546 |
msgstr ""
|
547 |
|
548 |
+
#: includes/class-wc-pagseguro-gateway.php:616
|
549 |
msgid "Payment refunded"
|
550 |
msgstr ""
|
551 |
|
552 |
+
#: includes/class-wc-pagseguro-gateway.php:618
|
553 |
+
#. translators: %s: order number
|
554 |
msgid "Order %s has been marked as refunded by PagSeguro."
|
555 |
msgstr ""
|
556 |
|
557 |
+
#: includes/class-wc-pagseguro-gateway.php:627
|
558 |
msgid "PagSeguro: Payment canceled."
|
559 |
msgstr ""
|
560 |
|
561 |
+
#: includes/class-wc-pagseguro.php:63
|
562 |
+
msgid "Settings"
|
563 |
+
msgstr ""
|
564 |
+
|
565 |
#: includes/views/html-receipt-page-error.php:19
|
566 |
msgid "Click to try again"
|
567 |
msgstr ""
|
749 |
msgid "Brazilian flag"
|
750 |
msgstr ""
|
751 |
|
|
|
|
|
|
|
|
|
752 |
#. Plugin URI of the plugin/theme
|
753 |
msgid "https://github.com/claudiosanches/woocommerce-pagseguro"
|
754 |
msgstr ""
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://claudiosanches.com/doacoes/
|
|
4 |
Tags: woocommerce, pagseguro, payment
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -255,6 +255,14 @@ Por favor, caso você tenha algum problema com o funcionamento do plugin, [abra
|
|
255 |
|
256 |
== Changelog ==
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
= 2.12.7 - 2018/06/21 =
|
259 |
|
260 |
* Removido métodos do Itaú e Banrisul em débito online no checkout transparente, ambos não são mais suportados pelo PagSeguro.
|
@@ -290,37 +298,12 @@ Por favor, caso você tenha algum problema com o funcionamento do plugin, [abra
|
|
290 |
* Alterado o tipo dos campos para `tel` no Checkout Transparente. (Possível com a ajuda de [Thiago Guimarães](https://github.com/thiagogsr)).
|
291 |
* Correção nas máscaras do campos devido a mudança do plugin no [woocommerce-extra-checkout-fields-for-brazil](https://github.com/claudiosanches/woocommerce-extra-checkout-fields-for-brazil/pull/49). (Possível com a ajuda de [Thiago Guimarães](https://github.com/thiagogsr)).
|
292 |
|
293 |
-
= 2.11.5 - 2017/01/17 =
|
294 |
-
|
295 |
-
* Adicionada nota dizendo que o pedido esta sendo feito no Brasil durante o Checkout Transparente.
|
296 |
-
|
297 |
-
= 2.11.4 - 2016/11/30 =
|
298 |
-
|
299 |
-
* Adicionada nova mensagem de erro quando utilizado o mesmo e-mail para realizar pagamentos com o mesmo e-mail da conta do recebedor.
|
300 |
-
* Removida opção obsoleta de déposito bancário pelo Bradesco.
|
301 |
-
* Corrigido links do Sandbox na página de administração.
|
302 |
-
* Adicionada modificação para enviar nome da empresa quando utilizado CNPJ.
|
303 |
-
|
304 |
-
= 2.11.3 - 2016/03/17 =
|
305 |
-
|
306 |
-
* Corrigida finalização com produtos gratuitos.
|
307 |
-
|
308 |
-
= 2.11.2 - 2015/12/30 =
|
309 |
-
|
310 |
-
* Correção de erro fatal ao tentar finalizar pedido usando CNPJ.
|
311 |
-
|
312 |
-
= 2.11.1 - 2015/12/24 =
|
313 |
-
|
314 |
-
* Corrigido campo bloqueado de telefone no checkout transparente.
|
315 |
-
|
316 |
-
= 2.11.0 - 2015/12/21 =
|
317 |
-
|
318 |
-
* Adicionado suporte a compras com CNPJ.
|
319 |
-
* Melhorado o checkout transparente quando usado o tema Storefront.
|
320 |
-
* Adicionada opções para token e e-mail de sandbox.
|
321 |
-
|
322 |
== Upgrade Notice ==
|
323 |
|
324 |
-
= 2.
|
325 |
|
326 |
-
*
|
|
|
|
|
|
|
|
4 |
Tags: woocommerce, pagseguro, payment
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 2.13.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
255 |
|
256 |
== Changelog ==
|
257 |
|
258 |
+
= 2.13.0 - 2018/08/02 =
|
259 |
+
|
260 |
+
* Força o campo "Bairro" como obrigatório quando checkout transparente está ativado.
|
261 |
+
* Implementada baixa automática de estoque ao comprar por boleto (funciona apenas no WooCommerce 3 ou superior).
|
262 |
+
* Estoque é restaurado automaticamente quando alguma notificação do PagSeguro marca o pedido como reembolsado ou cancelado (funciona apenas no WooCommerce 3 ou superior).
|
263 |
+
* Corrigida a mudança de status do pedido de Cancelado para Processando (funciona apenas no WooCommerce 3 ou superior).
|
264 |
+
* Adicionadas informações sobre a taxa de intermédio do PagSeguro nos meta dados do pedido.
|
265 |
+
|
266 |
= 2.12.7 - 2018/06/21 =
|
267 |
|
268 |
* Removido métodos do Itaú e Banrisul em débito online no checkout transparente, ambos não são mais suportados pelo PagSeguro.
|
298 |
* Alterado o tipo dos campos para `tel` no Checkout Transparente. (Possível com a ajuda de [Thiago Guimarães](https://github.com/thiagogsr)).
|
299 |
* Correção nas máscaras do campos devido a mudança do plugin no [woocommerce-extra-checkout-fields-for-brazil](https://github.com/claudiosanches/woocommerce-extra-checkout-fields-for-brazil/pull/49). (Possível com a ajuda de [Thiago Guimarães](https://github.com/thiagogsr)).
|
300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
== Upgrade Notice ==
|
302 |
|
303 |
+
= 2.13.0 =
|
304 |
|
305 |
+
* Força o campo "Bairro" como obrigatório quando checkout transparente está ativado.
|
306 |
+
* Implementada baixa automática de estoque ao comprar por boleto (funciona apenas no WooCommerce 3 ou superior).
|
307 |
+
* Estoque é restaurado automaticamente quando alguma notificação do PagSeguro marca o pedido como reembolsado ou cancelado (funciona apenas no WooCommerce 3 ou superior).
|
308 |
+
* Corrigida a mudança de status do pedido de Cancelado para Processando (funciona apenas no WooCommerce 3 ou superior).
|
309 |
+
* Adicionadas informações sobre a taxa de intermédio do PagSeguro nos meta dados do pedido.
|
woocommerce-pagseguro.php
CHANGED
@@ -5,8 +5,8 @@
|
|
5 |
* Description: Includes PagSeguro as a payment gateway to WooCommerce.
|
6 |
* Author: Claudio Sanches
|
7 |
* Author URI: https://claudiosanches.com
|
8 |
-
* Version: 2.
|
9 |
-
* License:
|
10 |
* Text Domain: woocommerce-pagseguro
|
11 |
* Domain Path: /languages
|
12 |
* WC requires at least: 3.0.0
|
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* WooCommerce PagSeguro is free software: you can redistribute it and/or modify
|
16 |
* it under the terms of the GNU General Public License as published by
|
17 |
-
* the Free Software Foundation, either version
|
18 |
* any later version.
|
19 |
*
|
20 |
* WooCommerce PagSeguro is distributed in the hope that it will be useful,
|
@@ -24,179 +24,18 @@
|
|
24 |
*
|
25 |
* You should have received a copy of the GNU General Public License
|
26 |
* along with WooCommerce PagSeguro. If not, see
|
27 |
-
* <https://www.gnu.org/licenses/gpl-
|
28 |
*
|
29 |
* @package WooCommerce_PagSeguro
|
30 |
*/
|
31 |
|
32 |
-
|
33 |
-
exit; // Exit if accessed directly.
|
34 |
-
}
|
35 |
-
|
36 |
-
if ( ! class_exists( 'WC_PagSeguro' ) ) :
|
37 |
-
|
38 |
-
/**
|
39 |
-
* WooCommerce PagSeguro main class.
|
40 |
-
*/
|
41 |
-
class WC_PagSeguro {
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Plugin version.
|
45 |
-
*
|
46 |
-
* @var string
|
47 |
-
*/
|
48 |
-
const VERSION = '2.12.7';
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Instance of this class.
|
52 |
-
*
|
53 |
-
* @var object
|
54 |
-
*/
|
55 |
-
protected static $instance = null;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Initialize the plugin public actions.
|
59 |
-
*/
|
60 |
-
private function __construct() {
|
61 |
-
// Load plugin text domain.
|
62 |
-
add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
|
63 |
-
|
64 |
-
// Checks with WooCommerce is installed.
|
65 |
-
if ( class_exists( 'WC_Payment_Gateway' ) ) {
|
66 |
-
$this->includes();
|
67 |
-
|
68 |
-
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway' ) );
|
69 |
-
add_filter( 'woocommerce_available_payment_gateways', array( $this, 'hides_when_is_outside_brazil' ) );
|
70 |
-
add_filter( 'woocommerce_cancel_unpaid_order', array( $this, 'stop_cancel_unpaid_orders' ), 10, 2 );
|
71 |
-
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
|
72 |
-
|
73 |
-
if ( is_admin() ) {
|
74 |
-
add_action( 'admin_notices', array( $this, 'ecfb_missing_notice' ) );
|
75 |
-
}
|
76 |
-
} else {
|
77 |
-
add_action( 'admin_notices', array( $this, 'woocommerce_missing_notice' ) );
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Return an instance of this class.
|
83 |
-
*
|
84 |
-
* @return object A single instance of this class.
|
85 |
-
*/
|
86 |
-
public static function get_instance() {
|
87 |
-
// If the single instance hasn't been set, set it now.
|
88 |
-
if ( null === self::$instance ) {
|
89 |
-
self::$instance = new self;
|
90 |
-
}
|
91 |
-
|
92 |
-
return self::$instance;
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Get templates path.
|
97 |
-
*
|
98 |
-
* @return string
|
99 |
-
*/
|
100 |
-
public static function get_templates_path() {
|
101 |
-
return plugin_dir_path( __FILE__ ) . 'templates/';
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Load the plugin text domain for translation.
|
106 |
-
*/
|
107 |
-
public function load_plugin_textdomain() {
|
108 |
-
load_plugin_textdomain( 'woocommerce-pagseguro', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Action links.
|
113 |
-
*
|
114 |
-
* @param array $links Action links.
|
115 |
-
*
|
116 |
-
* @return array
|
117 |
-
*/
|
118 |
-
public function plugin_action_links( $links ) {
|
119 |
-
$plugin_links = array();
|
120 |
-
$plugin_links[] = '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=pagseguro' ) ) . '">' . __( 'Settings', 'woocommerce-pagseguro' ) . '</a>';
|
121 |
|
122 |
-
|
123 |
-
|
|
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
include_once dirname( __FILE__ ) . '/includes/class-wc-pagseguro-xml.php';
|
130 |
-
include_once dirname( __FILE__ ) . '/includes/class-wc-pagseguro-api.php';
|
131 |
-
include_once dirname( __FILE__ ) . '/includes/class-wc-pagseguro-gateway.php';
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Add the gateway to WooCommerce.
|
136 |
-
*
|
137 |
-
* @param array $methods WooCommerce payment methods.
|
138 |
-
*
|
139 |
-
* @return array Payment methods with PagSeguro.
|
140 |
-
*/
|
141 |
-
public function add_gateway( $methods ) {
|
142 |
-
$methods[] = 'WC_PagSeguro_Gateway';
|
143 |
-
|
144 |
-
return $methods;
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Hides the PagSeguro with payment method with the customer lives outside Brazil.
|
149 |
-
*
|
150 |
-
* @param array $available_gateways Default Available Gateways.
|
151 |
-
*
|
152 |
-
* @return array New Available Gateways.
|
153 |
-
*/
|
154 |
-
public function hides_when_is_outside_brazil( $available_gateways ) {
|
155 |
-
// Remove PagSeguro gateway.
|
156 |
-
if ( isset( $_REQUEST['country'] ) && 'BR' !== $_REQUEST['country'] ) {
|
157 |
-
unset( $available_gateways['pagseguro'] );
|
158 |
-
}
|
159 |
-
|
160 |
-
return $available_gateways;
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Stop cancel unpaid PagSeguro orders.
|
165 |
-
*
|
166 |
-
* @param bool $cancel Check if need cancel the order.
|
167 |
-
* @param WC_Order $order Order object.
|
168 |
-
*
|
169 |
-
* @return bool
|
170 |
-
*/
|
171 |
-
public function stop_cancel_unpaid_orders( $cancel, $order ) {
|
172 |
-
$payment_method = method_exists( $order, 'get_payment_method' ) ? $order->get_payment_method() : $order->payment_method;
|
173 |
-
|
174 |
-
if ( 'pagseguro' === $payment_method ) {
|
175 |
-
return false;
|
176 |
-
}
|
177 |
-
|
178 |
-
return $cancel;
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* WooCommerce Extra Checkout Fields for Brazil notice.
|
183 |
-
*/
|
184 |
-
public function ecfb_missing_notice() {
|
185 |
-
$settings = get_option( 'woocommerce_pagseguro_settings', array( 'method' => '' ) );
|
186 |
-
|
187 |
-
if ( 'transparent' === $settings['method'] && ! class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) {
|
188 |
-
include dirname( __FILE__ ) . '/includes/admin/views/html-notice-missing-ecfb.php';
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* WooCommerce missing notice.
|
194 |
-
*/
|
195 |
-
public function woocommerce_missing_notice() {
|
196 |
-
include dirname( __FILE__ ) . '/includes/admin/views/html-notice-missing-woocommerce.php';
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
add_action( 'plugins_loaded', array( 'WC_PagSeguro', 'get_instance' ) );
|
201 |
-
|
202 |
-
endif;
|
5 |
* Description: Includes PagSeguro as a payment gateway to WooCommerce.
|
6 |
* Author: Claudio Sanches
|
7 |
* Author URI: https://claudiosanches.com
|
8 |
+
* Version: 2.13.0
|
9 |
+
* License: GPLv3 or later
|
10 |
* Text Domain: woocommerce-pagseguro
|
11 |
* Domain Path: /languages
|
12 |
* WC requires at least: 3.0.0
|
14 |
*
|
15 |
* WooCommerce PagSeguro is free software: you can redistribute it and/or modify
|
16 |
* it under the terms of the GNU General Public License as published by
|
17 |
+
* the Free Software Foundation, either version 3 of the License, or
|
18 |
* any later version.
|
19 |
*
|
20 |
* WooCommerce PagSeguro is distributed in the hope that it will be useful,
|
24 |
*
|
25 |
* You should have received a copy of the GNU General Public License
|
26 |
* along with WooCommerce PagSeguro. If not, see
|
27 |
+
* <https://www.gnu.org/licenses/gpl-3.0.txt>.
|
28 |
*
|
29 |
* @package WooCommerce_PagSeguro
|
30 |
*/
|
31 |
|
32 |
+
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
// Plugin constants.
|
35 |
+
define( 'WC_PAGSEGURO_VERSION', '2.13.0' );
|
36 |
+
define( 'WC_PAGSEGURO_PLUGIN_FILE', __FILE__ );
|
37 |
|
38 |
+
if ( ! class_exists( 'WC_PagSeguro' ) ) {
|
39 |
+
include_once dirname( __FILE__ ) . '/includes/class-wc-pagseguro.php';
|
40 |
+
add_action( 'plugins_loaded', array( 'WC_PagSeguro', 'init' ) );
|
41 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|