WooCommerce PagSeguro - Version 2.10.3

Version Description

  • Melhoradas as mensagens de erro durante o checkout.

=

Download this release

Release Info

Developer claudiosanches
Plugin Icon 128x128 WooCommerce PagSeguro
Version 2.10.3
Comparing to
See all releases

Version 2.10.3

assets/css/transparent-checkout.css ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Payment form */
2
+ #pagseguro-payment-form {
3
+ display: none;
4
+ }
5
+
6
+ #pagseguro-payment-methods:before,
7
+ #pagseguro-payment-methods:after,
8
+ #pagseguro-bank-transfer-form ul:before,
9
+ #pagseguro-bank-transfer-form ul:after {
10
+ content: " ";
11
+ display: table;
12
+ }
13
+
14
+ #pagseguro-payment-methods:after,
15
+ #pagseguro-bank-transfer-form ul:after {
16
+ clear: both;
17
+ }
18
+
19
+ #pagseguro-payment-methods,
20
+ #pagseguro-bank-transfer-form ul {
21
+ list-style: none;
22
+ margin: 0 0 10px;
23
+ padding: 0;
24
+ *zoom: 1;
25
+ }
26
+
27
+ #pagseguro-payment-methods input[type="radio"],
28
+ #pagseguro-bank-transfer-form ul input[type="radio"] {
29
+ display: none;
30
+ }
31
+
32
+ /* Payment methods */
33
+ .woocommerce #payment ul.payment_methods li #pagseguro-payment-methods li,
34
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods li {
35
+ border-color: transparent transparent #bbb;
36
+ border-style: solid;
37
+ border-width: 1px;
38
+ display: block;
39
+ float: left;
40
+ list-style: none;
41
+ margin: 0;
42
+ padding: 0;
43
+ -webkit-border-radius: 4px 4px 0 0;
44
+ border-radius: 4px 4px 0 0;
45
+ }
46
+
47
+ .woocommerce #payment ul.payment_methods li #pagseguro-payment-methods label,
48
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods label {
49
+ cursor: pointer;
50
+ display: block;
51
+ font-weight: bold;
52
+ margin: 0;
53
+ padding: 5px 10px;
54
+ }
55
+
56
+ /* Bank transfer items */
57
+ .woocommerce #payment ul.payment_methods li #pagseguro-payment-methods li.active,
58
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods li.active {
59
+ border-color: #bbb #bbb transparent;
60
+ border-style: solid;
61
+ border-width: 1px;
62
+ }
63
+
64
+ .woocommerce #payment ul.payment_methods li #pagseguro-bank-transfer-form p,
65
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-bank-transfer-form p {
66
+ margin-bottom: .5em;
67
+ }
68
+
69
+ .woocommerce #payment ul.payment_methods li #pagseguro-bank-transfer-form li,
70
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-bank-transfer-form li {
71
+ display: block;
72
+ float: left;
73
+ list-style: none;
74
+ width: 130px;
75
+ margin: 0;
76
+ padding: 0;
77
+ }
78
+
79
+ .woocommerce #payment ul.payment_methods li #pagseguro-bank-transfer-form label,
80
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-bank-transfer-form label {
81
+ cursor: pointer;
82
+ display: block;
83
+ font-weight: bold;
84
+ margin: 0;
85
+ padding: 5px 10px;
86
+ text-align: center;
87
+ }
88
+
89
+ .woocommerce #payment ul.payment_methods li #pagseguro-bank-transfer-form i,
90
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-bank-transfer-form i {
91
+ background-color: transparent;
92
+ background-image: url("../images/transparent-checkout-icons.png");
93
+ background-repeat: no-repeat;
94
+ display: block;
95
+ height: 51px;
96
+ margin: 0 auto;
97
+ width: 51px;
98
+ }
99
+
100
+ #pagseguro-icon-bradesco {
101
+ background-position: 0 -51px;
102
+ }
103
+
104
+ #pagseguro-icon-itau {
105
+ background-position: -204px -51px;
106
+ }
107
+
108
+ #pagseguro-icon-bancodobrasil {
109
+ background-position: -51px -51px;
110
+ }
111
+
112
+ #pagseguro-icon-banrisul {
113
+ background-position: -102px -51px;
114
+ }
115
+
116
+ #pagseguro-icon-hsbc {
117
+ background-position: -153px -51px;
118
+ }
119
+
120
+ #pagseguro-bank-transfer-form li.active #pagseguro-icon-bradesco,
121
+ #pagseguro-icon-bradesco:hover {
122
+ background-position: 0 0;
123
+ }
124
+
125
+ #pagseguro-bank-transfer-form li.active #pagseguro-icon-itau,
126
+ #pagseguro-icon-itau:hover {
127
+ background-position: -204px 0;
128
+ }
129
+
130
+ #pagseguro-bank-transfer-form li.active #pagseguro-icon-bancodobrasil,
131
+ #pagseguro-icon-bancodobrasil:hover {
132
+ background-position: -51px 0;
133
+ }
134
+
135
+ #pagseguro-bank-transfer-form li.active #pagseguro-icon-banrisul,
136
+ #pagseguro-icon-banrisul:hover {
137
+ background-position: -102px 0;
138
+ }
139
+
140
+ #pagseguro-bank-transfer-form li.active #pagseguro-icon-hsbc,
141
+ #pagseguro-icon-hsbc:hover {
142
+ background-position: -153px 0;
143
+ }
144
+
145
+ /* Banking ticket */
146
+ #pagseguro-icon-ticket {
147
+ background: transparent url("../images/transparent-checkout-icons.png") no-repeat top right;
148
+ display: block;
149
+ float: left;
150
+ height: 51px;
151
+ margin: 0 10px 5px 0;
152
+ width: 51px;
153
+ }
154
+
155
+ /* Responsive styles */
156
+ @media screen and (max-width: 500px) {
157
+ .woocommerce #payment ul.payment_methods li #pagseguro-payment-methods li,
158
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods li {
159
+ border: none;
160
+ float: none;
161
+ margin: 0;
162
+ padding: 0;
163
+ -webkit-border-radius: 0;
164
+ border-radius: 0;
165
+ }
166
+
167
+ .woocommerce #payment ul.payment_methods li #pagseguro-payment-methods li.active,
168
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods li.active {
169
+ border: none;
170
+ }
171
+
172
+ #pagseguro-payment-methods input[type="radio"] {
173
+ display: inline;
174
+ }
175
+
176
+ .woocommerce #payment ul.payment_methods li #pagseguro-credit-card-form p.form-row.form-row-first,
177
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-credit-card-form p.form-row.form-row-first,
178
+ .woocommerce #payment ul.payment_methods li #pagseguro-credit-card-form p.form-row.form-row-last,
179
+ .woocommerce-page #payment ul.payment_methods li #pagseguro-credit-card-form p.form-row.form-row-last {
180
+ float: none;
181
+ width: 96%;
182
+ }
183
+
184
+
185
+ }
assets/css/transparent-checkout.min.css ADDED
@@ -0,0 +1 @@
 
1
+ #pagseguro-payment-form{display:none}#pagseguro-bank-transfer-form ul:after,#pagseguro-bank-transfer-form ul:before,#pagseguro-payment-methods:after,#pagseguro-payment-methods:before{content:" ";display:table}#pagseguro-bank-transfer-form ul:after,#pagseguro-payment-methods:after{clear:both}#pagseguro-bank-transfer-form ul,#pagseguro-payment-methods{list-style:none;margin:0 0 10px;padding:0}#pagseguro-bank-transfer-form ul input[type=radio],#pagseguro-payment-methods input[type=radio]{display:none}.woocommerce #payment ul.payment_methods li #pagseguro-payment-methods li,.woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods li{border-color:transparent transparent #bbb;border-style:solid;border-width:1px;display:block;float:left;list-style:none;margin:0;padding:0;-webkit-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.woocommerce #payment ul.payment_methods li #pagseguro-payment-methods label,.woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods label{cursor:pointer;display:block;font-weight:700;margin:0;padding:5px 10px}.woocommerce #payment ul.payment_methods li #pagseguro-payment-methods li.active,.woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods li.active{border-color:#bbb #bbb transparent;border-style:solid;border-width:1px}.woocommerce #payment ul.payment_methods li #pagseguro-bank-transfer-form p,.woocommerce-page #payment ul.payment_methods li #pagseguro-bank-transfer-form p{margin-bottom:.5em}.woocommerce #payment ul.payment_methods li #pagseguro-bank-transfer-form li,.woocommerce-page #payment ul.payment_methods li #pagseguro-bank-transfer-form li{display:block;float:left;list-style:none;width:130px;margin:0;padding:0}.woocommerce #payment ul.payment_methods li #pagseguro-bank-transfer-form label,.woocommerce-page #payment ul.payment_methods li #pagseguro-bank-transfer-form label{cursor:pointer;display:block;font-weight:700;margin:0;padding:5px 10px;text-align:center}.woocommerce #payment ul.payment_methods li #pagseguro-bank-transfer-form i,.woocommerce-page #payment ul.payment_methods li #pagseguro-bank-transfer-form i{background-color:transparent;background-image:url(../images/transparent-checkout-icons.png);background-repeat:no-repeat;display:block;height:51px;margin:0 auto;width:51px}#pagseguro-icon-bradesco{background-position:0 -51px}#pagseguro-icon-itau{background-position:-204px -51px}#pagseguro-icon-bancodobrasil{background-position:-51px -51px}#pagseguro-icon-banrisul{background-position:-102px -51px}#pagseguro-icon-hsbc{background-position:-153px -51px}#pagseguro-bank-transfer-form li.active #pagseguro-icon-bradesco,#pagseguro-icon-bradesco:hover{background-position:0 0}#pagseguro-bank-transfer-form li.active #pagseguro-icon-itau,#pagseguro-icon-itau:hover{background-position:-204px 0}#pagseguro-bank-transfer-form li.active #pagseguro-icon-bancodobrasil,#pagseguro-icon-bancodobrasil:hover{background-position:-51px 0}#pagseguro-bank-transfer-form li.active #pagseguro-icon-banrisul,#pagseguro-icon-banrisul:hover{background-position:-102px 0}#pagseguro-bank-transfer-form li.active #pagseguro-icon-hsbc,#pagseguro-icon-hsbc:hover{background-position:-153px 0}#pagseguro-icon-ticket{background:url(../images/transparent-checkout-icons.png) no-repeat top right;display:block;float:left;height:51px;margin:0 10px 5px 0;width:51px}@media screen and (max-width:500px){.woocommerce #payment ul.payment_methods li #pagseguro-payment-methods li,.woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods li{border:none;float:none;margin:0;padding:0;-webkit-border-radius:0;border-radius:0}.woocommerce #payment ul.payment_methods li #pagseguro-payment-methods li.active,.woocommerce-page #payment ul.payment_methods li #pagseguro-payment-methods li.active{border:none}#pagseguro-payment-methods input[type=radio]{display:inline}.woocommerce #payment ul.payment_methods li #pagseguro-credit-card-form p.form-row.form-row-first,.woocommerce #payment ul.payment_methods li #pagseguro-credit-card-form p.form-row.form-row-last,.woocommerce-page #payment ul.payment_methods li #pagseguro-credit-card-form p.form-row.form-row-first,.woocommerce-page #payment ul.payment_methods li #pagseguro-credit-card-form p.form-row.form-row-last{float:none;width:96%}}
assets/images/pagseguro.png ADDED
Binary file
assets/images/transparent-checkout-icons.png ADDED
Binary file
assets/js/admin.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ( $ ) {
2
+ 'use strict';
3
+
4
+ $( function () {
5
+
6
+ /**
7
+ * Switch transparent checkout options display basead in payment type.
8
+ *
9
+ * @param {string} method
10
+ */
11
+ function pagSeguroSwitchTCOptions( method ) {
12
+ var fields = $( '#mainform h4:eq(0), #mainform .form-table:eq(1)' );
13
+
14
+ if ( 'transparent' === method ) {
15
+ fields.show();
16
+ } else {
17
+ fields.hide();
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Switch banking ticket message display.
23
+ *
24
+ * @param {string} checked
25
+ */
26
+ function pagSeguroSwitchOptions( checked ) {
27
+ var fields = $( '#mainform .form-table:eq(1) tr:eq(3)' );
28
+
29
+ if ( checked ) {
30
+ fields.show();
31
+ } else {
32
+ fields.hide();
33
+ }
34
+ }
35
+
36
+ pagSeguroSwitchTCOptions( $( '#woocommerce_pagseguro_method option:selected' ).val() );
37
+
38
+ $( 'body' ).on( 'change', '#woocommerce_pagseguro_method', function () {
39
+ pagSeguroSwitchTCOptions( $( this ).val() );
40
+ });
41
+
42
+ pagSeguroSwitchOptions( $( '#woocommerce_pagseguro_tc_ticket' ).is( ':checked' ) );
43
+
44
+ $( 'body' ).on( 'click', '#woocommerce_pagseguro_tc_ticket', function () {
45
+ pagSeguroSwitchOptions( $( this ).is( ':checked' ) );
46
+ });
47
+ });
48
+
49
+ }( jQuery ));
assets/js/admin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){"use strict";a(function(){function b(b){var c=a("#mainform h4:eq(0), #mainform .form-table:eq(1)");"transparent"===b?c.show():c.hide()}function c(b){var c=a("#mainform .form-table:eq(1) tr:eq(3)");b?c.show():c.hide()}b(a("#woocommerce_pagseguro_method option:selected").val()),a("body").on("change","#woocommerce_pagseguro_method",function(){b(a(this).val())}),c(a("#woocommerce_pagseguro_tc_ticket").is(":checked")),a("body").on("click","#woocommerce_pagseguro_tc_ticket",function(){c(a(this).is(":checked"))})})}(jQuery);
assets/js/transparent-checkout.js ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global wc_pagseguro_params, PagSeguroDirectPayment, wc_checkout_params */
2
+ (function( $ ) {
3
+ 'use strict';
4
+
5
+ $( function() {
6
+
7
+ var pagseguro_submit = false;
8
+
9
+ /**
10
+ * Set credit card brand.
11
+ *
12
+ * @param {string} brand
13
+ */
14
+ function pagSeguroSetCreditCardBrand( brand ) {
15
+ $( '#pagseguro-credit-card-form' ).attr( 'data-credit-card-brand', brand );
16
+ }
17
+
18
+ /**
19
+ * Format price.
20
+ *
21
+ * @param {int|float} price
22
+ *
23
+ * @return {string}
24
+ */
25
+ function pagSeguroGetPriceText( price ) {
26
+ return 'R$ ' + parseFloat( price, 10 ).toFixed( 2 ).replace( '.', ',' ).toString();
27
+ }
28
+
29
+ /**
30
+ * Get installment option.
31
+ *
32
+ * @param {object} installment
33
+ *
34
+ * @return {string}
35
+ */
36
+ function pagSeguroGetInstallmentOption( installment ) {
37
+ var interestFree = ( true === installment.interestFree ) ? ' ' + wc_pagseguro_params.interest_free : '';
38
+
39
+ return '<option value="' + installment.quantity + '" data-installment-value="' + installment.installmentAmount + '">' + installment.quantity + 'x ' + pagSeguroGetPriceText( installment.installmentAmount ) + interestFree + '</option>';
40
+ }
41
+
42
+ /**
43
+ * Add error message
44
+ *
45
+ * @param {string} error
46
+ */
47
+ function pagSeguroAddErrorMessage( error ) {
48
+ var wrapper = $( '#pagseguro-credit-card-form' );
49
+
50
+ $( '.woocommerce-error', wrapper ).remove();
51
+ wrapper.prepend( '<div class="woocommerce-error" style="margin-bottom: 0.5em !important;">' + error + '</div>' );
52
+ }
53
+
54
+ /**
55
+ * Hide payment methods if have only one.
56
+ */
57
+ function pagSeguroHidePaymentMethods() {
58
+ var paymentMethods = $( '#pagseguro-payment-methods' );
59
+
60
+ if ( 1 === $( 'input[type=radio]', paymentMethods ).length ) {
61
+ paymentMethods.hide();
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Show/hide the method form.
67
+ *
68
+ * @param {string} method
69
+ */
70
+ function pagSeguroShowHideMethodForm( method ) {
71
+ // window.alert( method );
72
+ $( '.pagseguro-method-form' ).hide();
73
+ $( '#pagseguro-payment-methods li' ).removeClass( 'active' );
74
+ $( '#pagseguro-' + method + '-form' ).show();
75
+ $( '#pagseguro-payment-method-' + method ).parent( 'label' ).parent( 'li' ).addClass( 'active' );
76
+ }
77
+
78
+ /**
79
+ * Initialize the payment form.
80
+ */
81
+ function pagSeguroInitPaymentForm() {
82
+ pagSeguroHidePaymentMethods();
83
+
84
+ $( '#pagseguro-payment-form' ).show();
85
+
86
+ pagSeguroShowHideMethodForm( $( '#pagseguro-payment-methods input[type=radio]:checked' ).val() );
87
+
88
+ // CPF.
89
+ $( '#pagseguro-card-holder-cpf' ).mask( '999.999.999-99', { placeholder: ' ' } );
90
+
91
+ // Birth Date.
92
+ $( '#pagseguro-card-holder-birth-date' ).mask( '99 / 99 / 9999', { placeholder: ' ' } );
93
+
94
+ // Phone.
95
+ $( '#pagseguro-card-holder-phone' ).focusout( function() {
96
+ var phone, element;
97
+ element = $( this );
98
+ element.unmask();
99
+ phone = element.val().replace( /\D/g, '' );
100
+
101
+ if ( phone.length > 10 ) {
102
+ element.mask( '(99) 99999-999?9', { placeholder: ' ' } );
103
+ } else {
104
+ element.mask( '(99) 9999-9999?9', { placeholder: ' ' } );
105
+ }
106
+ }).trigger( 'focusout' );
107
+
108
+ $( '#pagseguro-bank-transfer-form input[type=radio]:checked' ).parent( 'label' ).parent( 'li' ).addClass( 'active' );
109
+ }
110
+
111
+ /**
112
+ * Form Handler.
113
+ *
114
+ * @return {bool}
115
+ */
116
+ function pagSeguroformHandler() {
117
+ if ( pagseguro_submit ) {
118
+ pagseguro_submit = false;
119
+
120
+ return true;
121
+ }
122
+
123
+ if ( ! $( '#payment_method_pagseguro' ).is( ':checked' ) ) {
124
+ return true;
125
+ }
126
+
127
+ if ( 'credit-card' !== $( 'body li.payment_method_pagseguro input[name=pagseguro_payment_method]:checked' ).val() ) {
128
+ $( 'form.checkout, form#order_review' ).append( $( '<input name="pagseguro_sender_hash" type="hidden" />' ).val( PagSeguroDirectPayment.getSenderHash() ) );
129
+
130
+ return true;
131
+ }
132
+
133
+ var form = $( 'form.checkout, form#order_review' ),
134
+ creditCardForm = $( '#pagseguro-credit-card-form', form ),
135
+ error = false,
136
+ errorHtml = '',
137
+ brand = creditCardForm.attr( 'data-credit-card-brand' ),
138
+ cardNumber = $( '#pagseguro-card-number', form ).val().replace( /[^\d]/g, '' ),
139
+ cvv = $( '#pagseguro-card-cvc', form ).val(),
140
+ expirationMonth = $( '#pagseguro-card-expiry', form ).val().replace( /[^\d]/g, '' ).substr( 0, 2 ),
141
+ expirationYear = $( '#pagseguro-card-expiry', form ).val().replace( /[^\d]/g, '' ).substr( 2 ),
142
+ installments = $( '#pagseguro-card-installments', form ),
143
+ today = new Date();
144
+
145
+ // Validate the credit card data.
146
+ errorHtml += '<ul>';
147
+
148
+ // Validate the card brand.
149
+ if ( typeof brand === 'undefined' || 'error' === brand ) {
150
+ errorHtml += '<li>' + wc_pagseguro_params.invalid_card + '</li>';
151
+ error = true;
152
+ }
153
+
154
+ // Validate the expiry date.
155
+ if ( 2 !== expirationMonth.length || 4 !== expirationYear.length ) {
156
+ errorHtml += '<li>' + wc_pagseguro_params.invalid_expiry + '</li>';
157
+ error = true;
158
+ }
159
+
160
+ if ( ( 2 === expirationMonth.length && 4 === expirationYear.length ) && ( expirationMonth > 12 || expirationYear <= ( today.getFullYear() - 1 ) || expirationYear >= ( today.getFullYear() + 20 ) || ( expirationMonth < ( today.getMonth() + 2 ) && expirationYear.toString() === today.getFullYear().toString() ) ) ) {
161
+ errorHtml += '<li>' + wc_pagseguro_params.expired_date + '</li>';
162
+ error = true;
163
+ }
164
+
165
+ // Installments.
166
+ if ( '0' === installments.val() ) {
167
+ errorHtml += '<li>' + wc_pagseguro_params.empty_installments + '</li>';
168
+ error = true;
169
+ }
170
+
171
+ errorHtml += '</ul>';
172
+
173
+ // Create the card token.
174
+ if ( ! error ) {
175
+ PagSeguroDirectPayment.createCardToken({
176
+ brand: brand,
177
+ cardNumber: cardNumber,
178
+ cvv: cvv,
179
+ expirationMonth: expirationMonth,
180
+ expirationYear: expirationYear,
181
+ success: function( data ) {
182
+ // Remove any old hash input.
183
+ $( 'input[name=pagseguro_credit_card_hash], input[name=pagseguro_credit_card_hash], input[name=pagseguro_installment_value]', form ).remove();
184
+
185
+ // Add the hash input.
186
+ form.append( $( '<input name="pagseguro_credit_card_hash" type="hidden" />' ).val( data.card.token ) );
187
+ form.append( $( '<input name="pagseguro_sender_hash" type="hidden" />' ).val( PagSeguroDirectPayment.getSenderHash() ) );
188
+ form.append( $( '<input name="pagseguro_installment_value" type="hidden" />' ).val( $( 'option:selected', installments ).attr( 'data-installment-value' ) ) );
189
+
190
+ // Submit the form.
191
+ pagseguro_submit = true;
192
+ form.submit();
193
+ },
194
+ error: function() {
195
+ pagSeguroAddErrorMessage( wc_pagseguro_params.general_error );
196
+ }
197
+ });
198
+
199
+ // Display the error messages.
200
+ } else {
201
+ pagSeguroAddErrorMessage( errorHtml );
202
+ }
203
+
204
+ return false;
205
+ }
206
+
207
+ // Transparent checkout actions.
208
+ if ( wc_pagseguro_params.session_id ) {
209
+ // Initialize the transparent checkout.
210
+ PagSeguroDirectPayment.setSessionId( wc_pagseguro_params.session_id );
211
+
212
+ // Display the payment for and init the input masks.
213
+ if ( '1' === wc_checkout_params.is_checkout ) {
214
+ $( 'body' ).on( 'updated_checkout', function() {
215
+ pagSeguroInitPaymentForm();
216
+ });
217
+ } else {
218
+ pagSeguroInitPaymentForm();
219
+ }
220
+
221
+ // Update the bank transfer icons classes.
222
+ $( 'body' ).on( 'click', '#pagseguro-bank-transfer-form input[type=radio]', function() {
223
+ $( '#pagseguro-bank-transfer-form li' ).removeClass( 'active' );
224
+ $( this ).parent( 'label' ).parent( 'li' ).addClass( 'active' );
225
+ });
226
+
227
+ // Switch the payment method form.
228
+ $( 'body' ).on( 'click', '#pagseguro-payment-methods input[type=radio]', function() {
229
+ pagSeguroShowHideMethodForm( $( this ).val() );
230
+ });
231
+
232
+ // Get the credit card brand.
233
+ $( 'body' ).on( 'focusout', '#pagseguro-card-number', function() {
234
+ var bin = $( this ).val().replace( /[^\d]/g, '' ).substr( 0, 6 ),
235
+ instalmments = $( 'body #pagseguro-card-installments' );
236
+
237
+ if ( 6 === bin.length ) {
238
+ // Reset the installments.
239
+ instalmments.empty();
240
+ instalmments.attr( 'disabled', 'disabled' );
241
+
242
+ PagSeguroDirectPayment.getBrand({
243
+ cardBin: bin,
244
+ success: function( data ) {
245
+ $( 'body' ).trigger( 'pagseguro_credit_card_brand', data.brand.name );
246
+ pagSeguroSetCreditCardBrand( data.brand.name );
247
+ },
248
+ error: function() {
249
+ $( 'body' ).trigger( 'pagseguro_credit_card_brand', 'error' );
250
+ pagSeguroSetCreditCardBrand( 'error' );
251
+ }
252
+ });
253
+ }
254
+ });
255
+
256
+ // Set the errors.
257
+ $( 'body' ).on( 'focus', '#pagseguro-card-number, #pagseguro-card-expiry', function() {
258
+ $( '#pagseguro-credit-card-form .woocommerce-error' ).remove();
259
+ });
260
+
261
+ // Get the installments.
262
+ $( 'body' ).on( 'pagseguro_credit_card_brand', function( event, brand ) {
263
+ if ( 'error' !== brand ) {
264
+ PagSeguroDirectPayment.getInstallments({
265
+ amount: $( 'body #pagseguro-cart-total' ).val(),
266
+ brand: brand,
267
+ success: function( data ) {
268
+ var instalmments = $( 'body #pagseguro-card-installments' );
269
+
270
+ if ( false === data.error ) {
271
+ instalmments.empty();
272
+ instalmments.removeAttr( 'disabled' );
273
+ instalmments.append( '<option value="0">--</option>' );
274
+
275
+ $.each( data.installments[brand], function( index, installment ) {
276
+ instalmments.append( pagSeguroGetInstallmentOption( installment ) );
277
+ });
278
+ } else {
279
+ pagSeguroAddErrorMessage( wc_pagseguro_params.invalid_card );
280
+ }
281
+ },
282
+ error: function() {
283
+ pagSeguroAddErrorMessage( wc_pagseguro_params.invalid_card );
284
+ }
285
+ });
286
+ } else {
287
+ pagSeguroAddErrorMessage( wc_pagseguro_params.invalid_card );
288
+ }
289
+ });
290
+
291
+ // Process the credit card data when submit the checkout form.
292
+ $( 'form.checkout' ).on( 'checkout_place_order_pagseguro', function() {
293
+ return pagSeguroformHandler();
294
+ });
295
+
296
+ $( 'form#order_review' ).submit( function() {
297
+ return pagSeguroformHandler();
298
+ });
299
+
300
+ } else {
301
+ $( 'body' ).on( 'updated_checkout', function() {
302
+ $( '#pagseguro-payment-form' ).remove();
303
+ });
304
+ }
305
+ });
306
+
307
+ }( jQuery ));
assets/js/transparent-checkout.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){"use strict";a(function(){function b(b){a("#pagseguro-credit-card-form").attr("data-credit-card-brand",b)}function c(a){return"R$ "+parseFloat(a,10).toFixed(2).replace(".",",").toString()}function d(a){var b=!0===a.interestFree?" "+wc_pagseguro_params.interest_free:"";return'<option value="'+a.quantity+'" data-installment-value="'+a.installmentAmount+'">'+a.quantity+"x "+c(a.installmentAmount)+b+"</option>"}function e(b){var c=a("#pagseguro-credit-card-form");a(".woocommerce-error",c).remove(),c.prepend('<div class="woocommerce-error" style="margin-bottom: 0.5em !important;">'+b+"</div>")}function f(){var b=a("#pagseguro-payment-methods");1===a("input[type=radio]",b).length&&b.hide()}function g(b){a(".pagseguro-method-form").hide(),a("#pagseguro-payment-methods li").removeClass("active"),a("#pagseguro-"+b+"-form").show(),a("#pagseguro-payment-method-"+b).parent("label").parent("li").addClass("active")}function h(){f(),a("#pagseguro-payment-form").show(),g(a("#pagseguro-payment-methods input[type=radio]:checked").val()),a("#pagseguro-card-holder-cpf").mask("999.999.999-99",{placeholder:" "}),a("#pagseguro-card-holder-birth-date").mask("99 / 99 / 9999",{placeholder:" "}),a("#pagseguro-card-holder-phone").focusout(function(){var b,c;c=a(this),c.unmask(),b=c.val().replace(/\D/g,""),b.length>10?c.mask("(99) 99999-999?9",{placeholder:" "}):c.mask("(99) 9999-9999?9",{placeholder:" "})}).trigger("focusout"),a("#pagseguro-bank-transfer-form input[type=radio]:checked").parent("label").parent("li").addClass("active")}function i(){if(j)return j=!1,!0;if(!a("#payment_method_pagseguro").is(":checked"))return!0;if("credit-card"!==a("body li.payment_method_pagseguro input[name=pagseguro_payment_method]:checked").val())return a("form.checkout, form#order_review").append(a('<input name="pagseguro_sender_hash" type="hidden" />').val(PagSeguroDirectPayment.getSenderHash())),!0;var b=a("form.checkout, form#order_review"),c=a("#pagseguro-credit-card-form",b),d=!1,f="",g=c.attr("data-credit-card-brand"),h=a("#pagseguro-card-number",b).val().replace(/[^\d]/g,""),i=a("#pagseguro-card-cvc",b).val(),k=a("#pagseguro-card-expiry",b).val().replace(/[^\d]/g,"").substr(0,2),l=a("#pagseguro-card-expiry",b).val().replace(/[^\d]/g,"").substr(2),m=a("#pagseguro-card-installments",b),n=new Date;return f+="<ul>",("undefined"==typeof g||"error"===g)&&(f+="<li>"+wc_pagseguro_params.invalid_card+"</li>",d=!0),(2!==k.length||4!==l.length)&&(f+="<li>"+wc_pagseguro_params.invalid_expiry+"</li>",d=!0),2===k.length&&4===l.length&&(k>12||l<=n.getFullYear()-1||l>=n.getFullYear()+20||k<n.getMonth()+2&&l.toString()===n.getFullYear().toString())&&(f+="<li>"+wc_pagseguro_params.expired_date+"</li>",d=!0),"0"===m.val()&&(f+="<li>"+wc_pagseguro_params.empty_installments+"</li>",d=!0),f+="</ul>",d?e(f):PagSeguroDirectPayment.createCardToken({brand:g,cardNumber:h,cvv:i,expirationMonth:k,expirationYear:l,success:function(c){a("input[name=pagseguro_credit_card_hash], input[name=pagseguro_credit_card_hash], input[name=pagseguro_installment_value]",b).remove(),b.append(a('<input name="pagseguro_credit_card_hash" type="hidden" />').val(c.card.token)),b.append(a('<input name="pagseguro_sender_hash" type="hidden" />').val(PagSeguroDirectPayment.getSenderHash())),b.append(a('<input name="pagseguro_installment_value" type="hidden" />').val(a("option:selected",m).attr("data-installment-value"))),j=!0,b.submit()},error:function(){e(wc_pagseguro_params.general_error)}}),!1}var j=!1;wc_pagseguro_params.session_id?(PagSeguroDirectPayment.setSessionId(wc_pagseguro_params.session_id),"1"===wc_checkout_params.is_checkout?a("body").on("updated_checkout",function(){h()}):h(),a("body").on("click","#pagseguro-bank-transfer-form input[type=radio]",function(){a("#pagseguro-bank-transfer-form li").removeClass("active"),a(this).parent("label").parent("li").addClass("active")}),a("body").on("click","#pagseguro-payment-methods input[type=radio]",function(){g(a(this).val())}),a("body").on("focusout","#pagseguro-card-number",function(){var c=a(this).val().replace(/[^\d]/g,"").substr(0,6),d=a("body #pagseguro-card-installments");6===c.length&&(d.empty(),d.attr("disabled","disabled"),PagSeguroDirectPayment.getBrand({cardBin:c,success:function(c){a("body").trigger("pagseguro_credit_card_brand",c.brand.name),b(c.brand.name)},error:function(){a("body").trigger("pagseguro_credit_card_brand","error"),b("error")}}))}),a("body").on("focus","#pagseguro-card-number, #pagseguro-card-expiry",function(){a("#pagseguro-credit-card-form .woocommerce-error").remove()}),a("body").on("pagseguro_credit_card_brand",function(b,c){"error"!==c?PagSeguroDirectPayment.getInstallments({amount:a("body #pagseguro-cart-total").val(),brand:c,success:function(b){var f=a("body #pagseguro-card-installments");!1===b.error?(f.empty(),f.removeAttr("disabled"),f.append('<option value="0">--</option>'),a.each(b.installments[c],function(a,b){f.append(d(b))})):e(wc_pagseguro_params.invalid_card)},error:function(){e(wc_pagseguro_params.invalid_card)}}):e(wc_pagseguro_params.invalid_card)}),a("form.checkout").on("checkout_place_order_pagseguro",function(){return i()}),a("form#order_review").submit(function(){return i()})):a("body").on("updated_checkout",function(){a("#pagseguro-payment-form").remove()})})}(jQuery);
includes/class-wc-pagseguro-api.php ADDED
@@ -0,0 +1,853 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WC PagSeguro API Class.
4
+ */
5
+ class WC_PagSeguro_API {
6
+
7
+ /**
8
+ * Gateway class.
9
+ *
10
+ * @var WC_PagSeguro_Gateway
11
+ */
12
+ protected $gateway;
13
+
14
+ /**
15
+ * Constructor.
16
+ *
17
+ * @param WC_PagSeguro_Gateway $gateway
18
+ */
19
+ public function __construct( $gateway = null ) {
20
+ $this->gateway = $gateway;
21
+ }
22
+
23
+ /**
24
+ * Get the API environment.
25
+ *
26
+ * @return string
27
+ */
28
+ protected function get_environment() {
29
+ return ( 'yes' == $this->gateway->sandbox ) ? 'sandbox.' : '';
30
+ }
31
+
32
+ /**
33
+ * Get the checkout URL.
34
+ *
35
+ * @return string.
36
+ */
37
+ protected function get_checkout_url() {
38
+ return 'https://ws.' . $this->get_environment() . 'pagseguro.uol.com.br/v2/checkout';
39
+ }
40
+
41
+ /**
42
+ * Get the sessions URL.
43
+ *
44
+ * @return string.
45
+ */
46
+ protected function get_sessions_url() {
47
+ return 'https://ws.' . $this->get_environment() . 'pagseguro.uol.com.br/v2/sessions';
48
+ }
49
+
50
+ /**
51
+ * Get the payment URL.
52
+ *
53
+ * @param string $token
54
+ *
55
+ * @return string.
56
+ */
57
+ protected function get_payment_url( $token ) {
58
+ return 'https://' . $this->get_environment() . 'pagseguro.uol.com.br/v2/checkout/payment.html?code=' . $token;
59
+ }
60
+
61
+ /**
62
+ * Get the transactions URL.
63
+ *
64
+ * @return string.
65
+ */
66
+ protected function get_transactions_url() {
67
+ return 'https://ws.' . $this->get_environment() . 'pagseguro.uol.com.br/v2/transactions';
68
+ }
69
+
70
+ /**
71
+ * Get the lightbox URL.
72
+ *
73
+ * @return string.
74
+ */
75
+ public function get_lightbox_url() {
76
+ return 'https://stc.' . $this->get_environment() . 'pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.lightbox.js';
77
+ }
78
+
79
+ /**
80
+ * Get the direct payment URL.
81
+ *
82
+ * @return string.
83
+ */
84
+ public function get_direct_payment_url() {
85
+ return 'https://stc.' . $this->get_environment() . 'pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js';
86
+ }
87
+
88
+ /**
89
+ * Get the notification URL.
90
+ *
91
+ * @return string.
92
+ */
93
+ protected function get_notification_url() {
94
+ return 'https://ws.' . $this->get_environment() . 'pagseguro.uol.com.br/v2/transactions/notifications/';
95
+ }
96
+
97
+ /**
98
+ * Money format.
99
+ *
100
+ * @param int/float $value Value to fix.
101
+ *
102
+ * @return float Fixed value.
103
+ */
104
+ protected function money_format( $value ) {
105
+ return number_format( $value, 2, '.', '' );
106
+ }
107
+
108
+ /**
109
+ * Sanitize the item description.
110
+ *
111
+ * @param string $description
112
+ *
113
+ * @return string
114
+ */
115
+ protected function sanitize_description( $description ) {
116
+ return sanitize_text_field( substr( $description, 0, 95 ) );
117
+ }
118
+
119
+ /**
120
+ * Get payment name by type.
121
+ *
122
+ * @param int $value Payment Type number.
123
+ *
124
+ * @return string Payment name.
125
+ */
126
+ public function get_payment_name_by_type( $value ) {
127
+ $types = array(
128
+ 1 => __( 'Credit Card', 'woocommerce-pagseguro' ),
129
+ 2 => __( 'Billet', 'woocommerce-pagseguro' ),
130
+ 3 => __( 'Bank Transfer', 'woocommerce-pagseguro' ),
131
+ 4 => __( 'PagSeguro credit', 'woocommerce-pagseguro' ),
132
+ 5 => __( 'Oi Paggo', 'woocommerce-pagseguro' ),
133
+ 7 => __( 'Account deposit', 'woocommerce-pagseguro' )
134
+ );
135
+
136
+ if ( isset( $types[ $value ] ) ) {
137
+ return $types[ $value ];
138
+ } else {
139
+ return __( 'Unknown', 'woocommerce-pagseguro' );
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Get payment method name.
145
+ *
146
+ * @param int $value Payment method number.
147
+ *
148
+ * @return string Payment method name.
149
+ */
150
+ public function get_payment_method_name( $value ) {
151
+ $credit = __( 'Credit Card', 'woocommerce-pagseguro' );
152
+ $ticket = __( 'Billet', 'woocommerce-pagseguro' );
153
+ $debit = __( 'Bank Transfer', 'woocommerce-pagseguro' );
154
+
155
+ $methods = array(
156
+ 101 => $credit . ' ' . 'Visa',
157
+ 102 => $credit . ' ' . 'MasterCard',
158
+ 103 => $credit . ' ' . 'American Express',
159
+ 104 => $credit . ' ' . 'Diners',
160
+ 105 => $credit . ' ' . 'Hipercard',
161
+ 106 => $credit . ' ' . 'Aura',
162
+ 107 => $credit . ' ' . 'Elo',
163
+ 108 => $credit . ' ' . 'PLENOCard',
164
+ 109 => $credit . ' ' . 'PersonalCard',
165
+ 110 => $credit . ' ' . 'JCB',
166
+ 111 => $credit . ' ' . 'Discover',
167
+ 112 => $credit . ' ' . 'BrasilCard',
168
+ 113 => $credit . ' ' . 'FORTBRASIL',
169
+ 114 => $credit . ' ' . 'CARDBAN',
170
+ 115 => $credit . ' ' . 'VALECARD',
171
+ 116 => $credit . ' ' . 'Cabal',
172
+ 117 => $credit . ' ' . 'Mais!',
173
+ 118 => $credit . ' ' . 'Avista',
174
+ 119 => $credit . ' ' . 'GRANDCARD',
175
+ 201 => $ticket . ' ' . 'Bradesco',
176
+ 202 => $ticket . ' ' . 'Santander',
177
+ 301 => $debit . ' ' . 'Bradesco',
178
+ 302 => $debit . ' ' . 'Itaú',
179
+ 303 => $debit . ' ' . 'Unibanco',
180
+ 304 => $debit . ' ' . 'Banco do Brasil',
181
+ 305 => $debit . ' ' . 'Real',
182
+ 306 => $debit . ' ' . 'Banrisul',
183
+ 307 => $debit . ' ' . 'HSBC',
184
+ 401 => __( 'PagSeguro credit', 'woocommerce-pagseguro' ),
185
+ 501 => __( 'Oi Paggo', 'woocommerce-pagseguro' ),
186
+ 701 => __( 'Account deposit', 'woocommerce-pagseguro' )
187
+ );
188
+
189
+ if ( isset( $methods[ $value ] ) ) {
190
+ return $methods[ $value ];
191
+ } else {
192
+ return __( 'Unknown', 'woocommerce-pagseguro' );
193
+ }
194
+ }
195
+
196
+ /**
197
+ * Get the paymet method.
198
+ *
199
+ * @param string $method
200
+ *
201
+ * @return string
202
+ */
203
+ public function get_payment_method( $method ) {
204
+ switch ( $method ) {
205
+ case 'credit-card' :
206
+ return 'creditCard';
207
+ break;
208
+ case 'banking-ticket' :
209
+ return 'boleto';
210
+ break;
211
+ case 'bank-transfer' :
212
+ return 'eft';
213
+ break;
214
+
215
+ default:
216
+ return '';
217
+ break;
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Get error message.
223
+ *
224
+ * @param int $code Error code.
225
+ *
226
+ * @return string Error message.
227
+ */
228
+ public function get_error_message( $code ) {
229
+ switch ( $code ) {
230
+ case 11013 :
231
+ case 11014 :
232
+ case 53018 :
233
+ case 53019 :
234
+ case 53020 :
235
+ case 53021 :
236
+ return __( 'Please enter with a valid phone number with DDD. Example: (11) 5555-5555.', 'woocommerce-pagseguro' );
237
+ break;
238
+ case 11017 :
239
+ case 53022 :
240
+ case 53023 :
241
+ case 53053 :
242
+ case 53054 :
243
+ return __( 'Please enter with a valid zip code number.', 'woocommerce-pagseguro' );
244
+ break;
245
+ case 11164 :
246
+ return __( 'Please enter with a valid CPF number.', 'woocommerce-pagseguro' );
247
+ break;
248
+ case 53110 :
249
+ case 53111 :
250
+ return __( 'Please select a bank to make payment by bank transfer.', 'woocommerce-pagseguro' );
251
+ break;
252
+ case 53045 :
253
+ return __( 'Credit card holder CPF is required.', 'woocommerce-pagseguro' );
254
+ break;
255
+ case 53047 :
256
+ return __( 'Credit card holder birthdate is required.', 'woocommerce-pagseguro' );
257
+ break;
258
+ case 53042 :
259
+ return __( 'Credit card holder name is required.', 'woocommerce-pagseguro' );
260
+ break;
261
+ case 53049 :
262
+ case 53051 :
263
+ return __( 'Credit card holder phone is required.', 'woocommerce-pagseguro' );
264
+ break;
265
+ case 11020 :
266
+ case 53028 :
267
+ return __( 'The address complement is too long, it cannot be more than 40 characters.', 'woocommerce-pagseguro' );
268
+ break;
269
+ case 53029 :
270
+ return __( '<strong>Neighborhood</strong> is a required field.', 'woocommerce-pagseguro' );
271
+ break;
272
+ case 53046 :
273
+ return __( 'Credit card holder CPF invalid.', 'woocommerce-pagseguro' );
274
+ break;
275
+ case 53122 :
276
+ return __( 'Invalid email domain. You must use an email @sandbox.pagseguro.com.br while you are using the PagSeguro Sandbox.', 'woocommerce-pagseguro' );
277
+ break;
278
+
279
+ default:
280
+ return __( 'An error has occurred while processing your payment, please review your data and try again. Or contact us for assistance.', 'woocommerce-pagseguro' );
281
+ break;
282
+ }
283
+ }
284
+
285
+ /**
286
+ * Get the available payment methods.
287
+ *
288
+ * @return array
289
+ */
290
+ protected function get_available_payment_methods() {
291
+ $methods = array();
292
+
293
+ if ( 'yes' == $this->gateway->tc_credit ) {
294
+ $methods[] = 'credit-card';
295
+ }
296
+
297
+ if ( 'yes' == $this->gateway->tc_transfer ) {
298
+ $methods[] = 'bank-transfer';
299
+ }
300
+
301
+ if ( 'yes' == $this->gateway->tc_ticket ) {
302
+ $methods[] = 'banking-ticket';
303
+ }
304
+
305
+ return $methods;
306
+ }
307
+
308
+ /**
309
+ * Do requests in the PagSeguro API.
310
+ *
311
+ * @param string $url URL.
312
+ * @param string $method Request method.
313
+ * @param array $data Request data.
314
+ * @param array $headers Request headers.
315
+ *
316
+ * @return array Request response.
317
+ */
318
+ protected function do_request( $url, $method = 'POST', $data = array(), $headers = array() ) {
319
+ $params = array(
320
+ 'method' => $method,
321
+ 'timeout' => 60
322
+ );
323
+
324
+ if ( 'POST' == $method && ! empty( $data ) ) {
325
+ $params['body'] = $data;
326
+ }
327
+
328
+ if ( ! empty( $headers ) ) {
329
+ $params['headers'] = $headers;
330
+ }
331
+
332
+ return wp_safe_remote_post( $url, $params );
333
+ }
334
+
335
+ /**
336
+ * Safe load XML.
337
+ *
338
+ * @param string $source
339
+ * @param int $options
340
+ *
341
+ * @return SimpleXMLElement|bool
342
+ */
343
+ protected function safe_load_xml( $source, $options = 0 ) {
344
+ $old = null;
345
+
346
+ if ( '<' !== substr( $source, 0, 1 ) ) {
347
+ return false;
348
+ }
349
+
350
+ if ( function_exists( 'libxml_disable_entity_loader' ) ) {
351
+ $old = libxml_disable_entity_loader( true );
352
+ }
353
+
354
+ $dom = new DOMDocument();
355
+ $return = $dom->loadXML( $source, $options );
356
+
357
+ if ( ! is_null( $old ) ) {
358
+ libxml_disable_entity_loader( $old );
359
+ }
360
+
361
+ if ( ! $return ) {
362
+ return false;
363
+ }
364
+
365
+ if ( isset( $dom->doctype ) ) {
366
+ if ( 'yes' == $this->gateway->debug ) {
367
+ $this->gateway->log->add( $this->gateway->id, 'Unsafe DOCTYPE Detected while XML parsing' );
368
+ }
369
+
370
+ return false;
371
+ }
372
+
373
+ return simplexml_import_dom( $dom );
374
+ }
375
+
376
+ /**
377
+ * Get order items.
378
+ *
379
+ * @param WC_Order $order Order data.
380
+ *
381
+ * @return array Items list, extra amount and shipping cost.
382
+ */
383
+ protected function get_order_items( $order ) {
384
+ $items = array();
385
+ $extra_amount = 0;
386
+ $shipping_cost = 0;
387
+
388
+ // Force only one item.
389
+ if ( 'yes' == $this->gateway->send_only_total ) {
390
+ $items[] = array(
391
+ 'description' => $this->sanitize_description( sprintf( __( 'Order %s', 'woocommerce-pagseguro' ), $order->get_order_number() ) ),
392
+ 'amount' => $this->money_format( $order->get_total() ),
393
+ 'quantity' => 1
394
+ );
395
+ } else {
396
+
397
+ // Products.
398
+ if ( 0 < sizeof( $order->get_items() ) ) {
399
+ foreach ( $order->get_items() as $order_item ) {
400
+ if ( $order_item['qty'] ) {
401
+ $item_name = $order_item['name'];
402
+
403
+ if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.4.0', '<' ) ) {
404
+ $item_meta = new WC_Order_Item_Meta( $order_item['item_meta'] );
405
+ } else {
406
+ $item_meta = new WC_Order_Item_Meta( $order_item );
407
+ }
408
+
409
+ if ( $meta = $item_meta->display( true, true ) ) {
410
+ $item_name .= ' - ' . $meta;
411
+ }
412
+
413
+ $items[] = array(
414
+ 'description' => $this->sanitize_description( $item_name ),
415
+ 'amount' => $this->money_format( $order->get_item_total( $order_item, false ) ),
416
+ 'quantity' => $order_item['qty']
417
+ );
418
+ }
419
+ }
420
+ }
421
+
422
+ // Fees.
423
+ if ( 0 < sizeof( $order->get_fees() ) ) {
424
+ foreach ( $order->get_fees() as $fee ) {
425
+ $items[] = array(
426
+ 'description' => $this->sanitize_description( $fee['name'] ),
427
+ 'amount' => $this->money_format( $fee['line_total'] ),
428
+ 'quantity' => 1
429
+ );
430
+ }
431
+ }
432
+
433
+ // Taxes.
434
+ if ( 0 < sizeof( $order->get_taxes() ) ) {
435
+ foreach ( $order->get_taxes() as $tax ) {
436
+ $items[] = array(
437
+ 'description' => $this->sanitize_description( $tax['label'] ),
438
+ 'amount' => $this->money_format( $tax['tax_amount'] + $tax['shipping_tax_amount'] ),
439
+ 'quantity' => 1
440
+ );
441
+ }
442
+ }
443
+
444
+ // Shipping Cost.
445
+ if ( 0 < $order->get_total_shipping() ) {
446
+ $shipping_cost = $this->money_format( $order->get_total_shipping() );
447
+ }
448
+
449
+ // Discount.
450
+ if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '<' ) ) {
451
+ if ( 0 < $order->get_order_discount() ) {
452
+ $extra_amount = '-' . $this->money_format( $order->get_order_discount() );
453
+ }
454
+ }
455
+ }
456
+
457
+ return array(
458
+ 'items' => $items,
459
+ 'extra_amount' => $extra_amount,
460
+ 'shipping_cost' => $shipping_cost
461
+ );
462
+ }
463
+
464
+ /**
465
+ * Get the checkout xml.
466
+ *
467
+ * @param object $order Order data.
468
+ *
469
+ * @return string Payment xml.
470
+ */
471
+ protected function get_checkout_xml( $order, $posted ) {
472
+ $data = $this->get_order_items( $order );
473
+ $ship_to = isset( $posted['ship_to_different_address'] ) ? true : false;
474
+
475
+ // Creates the checkout xml.
476
+ $xml = new WC_PagSeguro_XML( '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><checkout></checkout>' );
477
+ $xml->add_currency( get_woocommerce_currency() );
478
+ $xml->add_reference( $this->gateway->invoice_prefix . $order->id );
479
+ $xml->add_sender_data( $order );
480
+ $xml->add_shipping_data( $order, $ship_to, $data['shipping_cost'] );
481
+ $xml->add_items( $data['items'] );
482
+ $xml->add_extra_amount( $data['extra_amount'] );
483
+
484
+ // Checks if is localhost... PagSeguro not accept localhost urls!
485
+ if ( ! in_array( $_SERVER['HTTP_HOST'], array( 'localhost', '127.0.0.1' ) ) ) {
486
+ $xml->add_redirect_url( $this->gateway->get_return_url( $order ) );
487
+ $xml->add_notification_url( WC()->api_request_url( 'WC_PagSeguro_Gateway' ) );
488
+ }
489
+
490
+ $xml->add_max_uses( 1 );
491
+ $xml->add_max_age( 120 );
492
+
493
+ // Filter the XML.
494
+ $xml = apply_filters( 'woocommerce_pagseguro_checkout_xml', $xml, $order );
495
+
496
+ return $xml->render();
497
+ }
498
+
499
+ /**
500
+ * Get the direct payment xml.
501
+ *
502
+ * @param object $order Order data.
503
+ *
504
+ * @return string Payment xml.
505
+ */
506
+ protected function get_payment_xml( $order, $posted ) {
507
+ $data = $this->get_order_items( $order );
508
+ $ship_to = isset( $posted['ship_to_different_address'] ) ? true : false;
509
+ $method = isset( $posted['pagseguro_payment_method'] ) ? $this->get_payment_method( $posted['pagseguro_payment_method'] ) : '';
510
+ $hash = isset( $posted['pagseguro_sender_hash'] ) ? sanitize_text_field( $posted['pagseguro_sender_hash'] ) : '';
511
+
512
+ // Creates the payment xml.
513
+ $xml = new WC_PagSeguro_XML( '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><payment></payment>' );
514
+ $xml->add_mode( 'default' );
515
+ $xml->add_method( $method );
516
+ $xml->add_sender_data( $order, $hash );
517
+ $xml->add_currency( get_woocommerce_currency() );
518
+ if ( ! in_array( $_SERVER['HTTP_HOST'], array( 'localhost', '127.0.0.1' ) ) ) {
519
+ $xml->add_notification_url( WC()->api_request_url( 'WC_PagSeguro_Gateway' ) );
520
+ }
521
+ $xml->add_items( $data['items'] );
522
+ $xml->add_extra_amount( $data['extra_amount'] );
523
+ $xml->add_reference( $this->gateway->invoice_prefix . $order->id );
524
+ $xml->add_shipping_data( $order, $ship_to, $data['shipping_cost'] );
525
+
526
+ // Items related to the payment method.
527
+ if ( 'creditCard' == $method ) {
528
+ $credit_card_token = isset( $posted['pagseguro_credit_card_hash'] ) ? sanitize_text_field( $posted['pagseguro_credit_card_hash'] ) : '';
529
+ $installment = array(
530
+ 'quantity' => isset( $posted['pagseguro_card_installments'] ) ? absint( $posted['pagseguro_card_installments'] ) : '',
531
+ 'value' => isset( $posted['pagseguro_installment_value'] ) ? $this->money_format( $posted['pagseguro_installment_value'] ) : ''
532
+ );
533
+ $holder_data = array(
534
+ 'name' => isset( $posted['pagseguro_card_holder_name'] ) ? sanitize_text_field( $posted['pagseguro_card_holder_name'] ) : '',
535
+ 'cpf' => isset( $posted['pagseguro_card_holder_cpf'] ) ? sanitize_text_field( $posted['pagseguro_card_holder_cpf'] ) : '',
536
+ 'birth_date' => isset( $posted['pagseguro_card_holder_birth_date'] ) ? sanitize_text_field( $posted['pagseguro_card_holder_birth_date'] ) : '',
537
+ 'phone' => isset( $posted['pagseguro_card_holder_phone'] ) ? sanitize_text_field( $posted['pagseguro_card_holder_phone'] ) : '',
538
+ );
539
+
540
+ $xml->add_credit_card_data( $order, $credit_card_token, $installment, $holder_data );
541
+ } elseif ( 'eft' == $method ) {
542
+ $bank_name = isset( $posted['pagseguro_bank_transfer'] ) ? sanitize_text_field( $posted['pagseguro_bank_transfer'] ) : '';
543
+ $xml->add_bank_data( $bank_name );
544
+ }
545
+
546
+ // Filter the XML.
547
+ $xml = apply_filters( 'woocommerce_pagseguro_payment_xml', $xml, $order );
548
+
549
+ return $xml->render();
550
+ }
551
+
552
+ /**
553
+ * Do checkout request.
554
+ *
555
+ * @param WC_Order $order Order data.
556
+ * @param array $posted Posted data.
557
+ *
558
+ * @return array
559
+ */
560
+ public function do_checkout_request( $order, $posted ) {
561
+ // Sets the xml.
562
+ $xml = $this->get_checkout_xml( $order, $posted );
563
+
564
+ if ( 'yes' == $this->gateway->debug ) {
565
+ $this->gateway->log->add( $this->gateway->id, 'Requesting token for order ' . $order->get_order_number() . ' with the following data: ' . $xml );
566
+ }
567
+
568
+ $url = add_query_arg( array( 'email' => $this->gateway->email, 'token' => $this->gateway->token ), $this->get_checkout_url() );
569
+ $response = $this->do_request( $url, 'POST', $xml, array( 'Content-Type' => 'application/xml;charset=UTF-8' ) );
570
+
571
+ if ( is_wp_error( $response ) ) {
572
+ if ( 'yes' == $this->gateway->debug ) {
573
+ $this->gateway->log->add( $this->gateway->id, 'WP_Error in generate payment token: ' . $response->get_error_message() );
574
+ }
575
+ } else if ( 401 === $response['response']['code'] ) {
576
+ if ( 'yes' == $this->gateway->debug ) {
577
+ $this->gateway->log->add( $this->gateway->id, 'Invalid token and/or email settings!' );
578
+ }
579
+
580
+ return array(
581
+ 'url' => '',
582
+ 'data' => '',
583
+ 'error' => array( __( 'Too bad! The email or token from the PagSeguro are invalids my little friend!', 'woocommerce-pagseguro' ) )
584
+ );
585
+ } else {
586
+ try {
587
+ libxml_disable_entity_loader( true );
588
+ $body = $this->safe_load_xml( $response['body'], LIBXML_NOCDATA );
589
+ } catch ( Exception $e ) {
590
+ $body = '';
591
+
592
+ if ( 'yes' == $this->gateway->debug ) {
593
+ $this->gateway->log->add( $this->gateway->id, 'Error while parsing the PagSeguro response: ' . print_r( $e->getMessage(), true ) );
594
+ }
595
+ }
596
+
597
+ if ( isset( $body->code ) ) {
598
+ $token = (string) $body->code;
599
+
600
+ if ( 'yes' == $this->gateway->debug ) {
601
+ $this->gateway->log->add( $this->gateway->id, 'PagSeguro Payment Token created with success! The Token is: ' . $token );
602
+ }
603
+
604
+ return array(
605
+ 'url' => $this->get_payment_url( $token ),
606
+ 'token' => $token,
607
+ 'error' => ''
608
+ );
609
+ }
610
+
611
+ if ( isset( $body->error ) ) {
612
+ $errors = array();
613
+
614
+ if ( 'yes' == $this->gateway->debug ) {
615
+ $this->gateway->log->add( $this->gateway->id, 'Failed to generate the PagSeguro Payment Token: ' . print_r( $response, true ) );
616
+ }
617
+
618
+ foreach ( $body->error as $error_key => $error ) {
619
+ $errors[] = '<strong>' . __( 'PagSeguro', 'woocommerce-pagseguro' ) . '</strong>: ' . $this->get_error_message( $error->code );
620
+ }
621
+
622
+ return array(
623
+ 'url' => '',
624
+ 'token' => '',
625
+ 'error' => $errors
626
+ );
627
+ }
628
+ }
629
+
630
+ if ( 'yes' == $this->gateway->debug ) {
631
+ $this->gateway->log->add( $this->gateway->id, 'Error generating the PagSeguro payment token: ' . print_r( $response, true ) );
632
+ }
633
+
634
+ // Return error message.
635
+ return array(
636
+ 'url' => '',
637
+ 'token' => '',
638
+ 'error' => array( '<strong>' . __( 'PagSeguro', 'woocommerce-pagseguro' ) . '</strong>: ' . __( 'An error has occurred while processing your payment, please try again. Or contact us for assistance.', 'woocommerce-pagseguro' ) )
639
+ );
640
+ }
641
+
642
+ /**
643
+ * Do payment request.
644
+ *
645
+ * @param WC_Order $order Order data.
646
+ * @param array $posted Posted data.
647
+ *
648
+ * @return array
649
+ */
650
+ public function do_payment_request( $order, $posted ) {
651
+ $payment_method = isset( $posted['pagseguro_payment_method'] ) ? $posted['pagseguro_payment_method'] : '';
652
+
653
+ /**
654
+ * Validate if has selected a payment method.
655
+ */
656
+ if ( ! in_array( $payment_method, $this->get_available_payment_methods() ) ) {
657
+ return array(
658
+ 'url' => '',
659
+ 'data' => '',
660
+ 'error' => array( '<strong>' . __( 'PagSeguro', 'woocommerce-pagseguro' ) . '</strong>: ' . __( 'Please, select a payment method.', 'woocommerce-pagseguro' ) )
661
+ );
662
+ }
663
+
664
+ // Sets the xml.
665
+ $xml = $this->get_payment_xml( $order, $posted );
666
+
667
+ if ( 'yes' == $this->gateway->debug ) {
668
+ $this->gateway->log->add( $this->gateway->id, 'Requesting direct payment for order ' . $order->get_order_number() . ' with the following data: ' . $xml );
669
+ }
670
+
671
+ $url = add_query_arg( array( 'email' => $this->gateway->email, 'token' => $this->gateway->token ), $this->get_transactions_url() );
672
+ $response = $this->do_request( $url, 'POST', $xml, array( 'Content-Type' => 'application/xml;charset=UTF-8' ) );
673
+
674
+ if ( is_wp_error( $response ) ) {
675
+ if ( 'yes' == $this->gateway->debug ) {
676
+ $this->gateway->log->add( $this->gateway->id, 'WP_Error in requesting the direct payment: ' . $response->get_error_message() );
677
+ }
678
+ } else if ( 401 === $response['response']['code'] ) {
679
+ if ( 'yes' == $this->gateway->debug ) {
680
+ $this->gateway->log->add( $this->gateway->id, 'The user does not have permissions to use the PagSeguro Transparent Checkout!' );
681
+ }
682
+
683
+ return array(
684
+ 'url' => '',
685
+ 'data' => '',
686
+ 'error' => array( __( 'You are not allowed to use the PagSeguro Transparent Checkout. Looks like you neglected to installation guide of this plugin. This is not pretty, do you know?', 'woocommerce-pagseguro' ) )
687
+ );
688
+ } else {
689
+ try {
690
+ $data = $this->safe_load_xml( $response['body'], LIBXML_NOCDATA );
691
+ } catch ( Exception $e ) {
692
+ $data = '';
693
+
694
+ if ( 'yes' == $this->gateway->debug ) {
695
+ $this->gateway->log->add( $this->gateway->id, 'Error while parsing the PagSeguro response: ' . print_r( $e->getMessage(), true ) );
696
+ }
697
+ }
698
+
699
+ if ( isset( $data->code ) ) {
700
+ if ( 'yes' == $this->gateway->debug ) {
701
+ $this->gateway->log->add( $this->gateway->id, 'PagSeguro direct payment created successfully!' );
702
+ }
703
+
704
+ return array(
705
+ 'url' => $this->gateway->get_return_url( $order ),
706
+ 'data' => $data,
707
+ 'error' => ''
708
+ );
709
+ }
710
+
711
+ if ( isset( $data->error ) ) {
712
+ $errors = array();
713
+
714
+ if ( 'yes' == $this->gateway->debug ) {
715
+ $this->gateway->log->add( $this->gateway->id, 'An error occurred while generating the PagSeguro direct payment: ' . print_r( $response, true ) );
716
+ }
717
+
718
+ foreach ( $data->error as $error_key => $error ) {
719
+ $errors[] = '<strong>' . __( 'PagSeguro', 'woocommerce-pagseguro' ) . '</strong>: ' . $this->get_error_message( $error->code );
720
+ }
721
+
722
+ return array(
723
+ 'url' => '',
724
+ 'data' => '',
725
+ 'error' => $errors
726
+ );
727
+ }
728
+ }
729
+
730
+ if ( 'yes' == $this->gateway->debug ) {
731
+ $this->gateway->log->add( $this->gateway->id, 'An error occurred while generating the PagSeguro direct payment: ' . print_r( $response, true ) );
732
+ }
733
+
734
+ // Return error message.
735
+ return array(
736
+ 'url' => '',
737
+ 'data' => '',
738
+ 'error' => array( '<strong>' . __( 'PagSeguro', 'woocommerce-pagseguro' ) . '</strong>: ' . __( 'An error has occurred while processing your payment, please try again. Or contact us for assistance.', 'woocommerce-pagseguro' ) )
739
+ );
740
+ }
741
+
742
+ /**
743
+ * Process the IPN.
744
+ *
745
+ * @return bool|SimpleXMLElement
746
+ */
747
+ public function process_ipn_request( $data ) {
748
+
749
+ if ( 'yes' == $this->gateway->debug ) {
750
+ $this->gateway->log->add( $this->gateway->id, 'Checking IPN request...' );
751
+ }
752
+
753
+ // Valid the post data.
754
+ if ( ! isset( $data['notificationCode'] ) && ! isset( $data['notificationType'] ) ) {
755
+ if ( 'yes' == $this->gateway->debug ) {
756
+ $this->gateway->log->add( $this->gateway->id, 'Invalid IPN request: ' . print_r( $data, true ) );
757
+ }
758
+
759
+ return false;
760
+ }
761
+
762
+ // Checks the notificationType.
763
+ if ( 'transaction' != $data['notificationType'] ) {
764
+ if ( 'yes' == $this->gateway->debug ) {
765
+ $this->gateway->log->add( $this->gateway->id, 'Invalid IPN request, invalid "notificationType": ' . print_r( $data, true ) );
766
+ }
767
+
768
+ return false;
769
+ }
770
+
771
+ // Gets the PagSeguro response.
772
+ $url = add_query_arg( array( 'email' => $this->gateway->email, 'token' => $this->gateway->token ), $this->get_notification_url() . esc_attr( $data['notificationCode'] ) );
773
+ $response = $this->do_request( $url, 'GET' );
774
+
775
+ // Check to see if the request was valid.
776
+ if ( is_wp_error( $response ) ) {
777
+ if ( 'yes' == $this->gateway->debug ) {
778
+ $this->gateway->log->add( $this->gateway->id, 'WP_Error in IPN: ' . $response->get_error_message() );
779
+ }
780
+ } else {
781
+ try {
782
+ $body = $this->safe_load_xml( $response['body'], LIBXML_NOCDATA );
783
+ } catch ( Exception $e ) {
784
+ $body = '';
785
+
786
+ if ( 'yes' == $this->gateway->debug ) {
787
+ $this->gateway->log->add( $this->gateway->id, 'Error while parsing the PagSeguro IPN response: ' . print_r( $e->getMessage(), true ) );
788
+ }
789
+ }
790
+
791
+ if ( isset( $body->code ) ) {
792
+ if ( 'yes' == $this->gateway->debug ) {
793
+ $this->gateway->log->add( $this->gateway->id, 'PagSeguro IPN is valid! The return is: ' . print_r( $body, true ) );
794
+ }
795
+
796
+ return $body;
797
+ }
798
+ }
799
+
800
+ if ( 'yes' == $this->gateway->debug ) {
801
+ $this->gateway->log->add( $this->gateway->id, 'IPN Response: ' . print_r( $response, true ) );
802
+ }
803
+
804
+ return false;
805
+ }
806
+
807
+ /**
808
+ * Get session ID.
809
+ *
810
+ * @return string
811
+ */
812
+ public function get_session_id() {
813
+
814
+ if ( 'yes' == $this->gateway->debug ) {
815
+ $this->gateway->log->add( $this->gateway->id, 'Requesting session ID...' );
816
+ }
817
+
818
+ $url = add_query_arg( array( 'email' => $this->gateway->email, 'token' => $this->gateway->token ), $this->get_sessions_url() );
819
+ $response = $this->do_request( $url, 'POST' );
820
+
821
+ // Check to see if the request was valid.
822
+ if ( is_wp_error( $response ) ) {
823
+ if ( 'yes' == $this->gateway->debug ) {
824
+ $this->gateway->log->add( $this->gateway->id, 'WP_Error requesting session ID: ' . $response->get_error_message() );
825
+ }
826
+ } else {
827
+ try {
828
+ $session = $this->safe_load_xml( $response['body'], LIBXML_NOCDATA );
829
+ } catch ( Exception $e ) {
830
+ $session = '';
831
+
832
+ if ( 'yes' == $this->gateway->debug ) {
833
+ $this->gateway->log->add( $this->gateway->id, 'Error while parsing the PagSeguro session response: ' . print_r( $e->getMessage(), true ) );
834
+ }
835
+ }
836
+
837
+ if ( isset( $session->id ) ) {
838
+ if ( 'yes' == $this->gateway->debug ) {
839
+ $this->gateway->log->add( $this->gateway->id, 'PagSeguro session is valid! The return is: ' . print_r( $session, true ) );
840
+ }
841
+
842
+ return (string) $session->id;
843
+ }
844
+ }
845
+
846
+ if ( 'yes' == $this->gateway->debug ) {
847
+ $this->gateway->log->add( $this->gateway->id, 'Session Response: ' . print_r( $response, true ) );
848
+ }
849
+
850
+ return false;
851
+ }
852
+
853
+ }
includes/class-wc-pagseguro-gateway.php ADDED
@@ -0,0 +1,668 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WC PagSeguro Gateway Class.
4
+ *
5
+ * Built the PagSeguro method.
6
+ */
7
+ class WC_PagSeguro_Gateway extends WC_Payment_Gateway {
8
+
9
+ /**
10
+ * Constructor for the gateway.
11
+ */
12
+ public function __construct() {
13
+ $this->id = 'pagseguro';
14
+ $this->icon = apply_filters( 'woocommerce_pagseguro_icon', plugins_url( 'assets/images/pagseguro.png', plugin_dir_path( __FILE__ ) ) );
15
+ $this->method_title = __( 'PagSeguro', 'woocommerce-pagseguro' );
16
+ $this->method_description = __( 'Accept payments by credit card, bank debit or banking ticket using the PagSeguro.', 'woocommerce-pagseguro' );
17
+ $this->order_button_text = __( 'Proceed to payment', 'woocommerce-pagseguro' );
18
+
19
+ // Load the form fields.
20
+ $this->init_form_fields();
21
+
22
+ // Load the settings.
23
+ $this->init_settings();
24
+
25
+ // Define user set variables.
26
+ $this->title = $this->get_option( 'title' );
27
+ $this->description = $this->get_option( 'description' );
28
+ $this->email = $this->get_option( 'email' );
29
+ $this->token = $this->get_option( 'token' );
30
+ $this->method = $this->get_option( 'method', 'direct' );
31
+ $this->tc_credit = $this->get_option( 'tc_credit', 'yes' );
32
+ $this->tc_transfer = $this->get_option( 'tc_transfer', 'yes' );
33
+ $this->tc_ticket = $this->get_option( 'tc_ticket', 'yes' );
34
+ $this->tc_ticket_message = $this->get_option( 'tc_ticket_message', 'yes' );
35
+ $this->send_only_total = $this->get_option( 'send_only_total', 'no' );
36
+ $this->invoice_prefix = $this->get_option( 'invoice_prefix', 'WC-' );
37
+ $this->sandbox = $this->get_option( 'sandbox', 'no' );
38
+ $this->debug = $this->get_option( 'debug' );
39
+
40
+ // Active logs.
41
+ if ( 'yes' == $this->debug ) {
42
+ $this->log = new WC_Logger();
43
+ }
44
+
45
+ // Set the API.
46
+ $this->api = new WC_PagSeguro_API( $this );
47
+
48
+ // Main actions.
49
+ add_action( 'woocommerce_api_wc_pagseguro_gateway', array( $this, 'ipn_handler' ) );
50
+ add_action( 'valid_pagseguro_ipn_request', array( $this, 'update_order_status' ) );
51
+ add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
52
+ add_action( 'woocommerce_receipt_' . $this->id, array( $this, 'receipt_page' ) );
53
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
54
+
55
+ // Transparent checkout actions.
56
+ if ( 'transparent' == $this->method ) {
57
+ add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'thankyou_page' ) );
58
+ add_action( 'woocommerce_email_after_order_table', array( $this, 'email_instructions' ), 10, 3 );
59
+ add_action( 'wp_enqueue_scripts', array( $this, 'checkout_scripts' ) );
60
+ }
61
+
62
+ if ( is_admin() ) {
63
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Displays notifications when the admin has something wrong with the configuration.
69
+ */
70
+ public function admin_notices() {
71
+ if ( 'yes' == $this->get_option( 'enabled' ) ) {
72
+ // Checks if email is not empty.
73
+ if ( empty( $this->email ) ) {
74
+ include_once 'views/html-notice-email-missing.php';
75
+ }
76
+
77
+ // Checks if token is not empty.
78
+ if ( empty( $this->token ) ) {
79
+ include_once 'views/html-notice-token-missing.php';
80
+ }
81
+
82
+ if ( 'transparent' == $this->method && ! class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) {
83
+ include_once 'views/html-notice-ecfb-missing.php';
84
+ }
85
+
86
+ // Checks that the currency is supported
87
+ if ( ! $this->using_supported_currency() && ! class_exists( 'woocommerce_wpml' ) ) {
88
+ include_once 'views/html-notice-currency-not-supported.php';
89
+ }
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Returns a bool that indicates if currency is amongst the supported ones.
95
+ *
96
+ * @return bool
97
+ */
98
+ public function using_supported_currency() {
99
+ return in_array( get_woocommerce_currency(), array( 'BRL' ) );
100
+ }
101
+
102
+ /**
103
+ * Returns a value indicating the the Gateway is available or not. It's called
104
+ * automatically by WooCommerce before allowing customers to use the gateway
105
+ * for payment.
106
+ *
107
+ * @return bool
108
+ */
109
+ public function is_available() {
110
+ // Test if is valid for use.
111
+ $available = ( 'yes' == $this->get_option( 'enabled' ) ) && ! empty( $this->email ) && ! empty( $this->token ) && $this->using_supported_currency();
112
+
113
+ if ( 'transparent' == $this->method && ! class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) {
114
+ $available = false;
115
+ }
116
+
117
+ return $available;
118
+ }
119
+
120
+ /**
121
+ * Has fields.
122
+ *
123
+ * @return bool
124
+ */
125
+ public function has_fields() {
126
+ return ( 'transparent' == $this->method ) ? true : false;
127
+ }
128
+
129
+ /**
130
+ * Admin scripts.
131
+ *
132
+ * @param string $hook Page slug.
133
+ */
134
+ public function admin_scripts( $hook ) {
135
+ if ( in_array( $hook, array( 'woocommerce_page_wc-settings', 'woocommerce_page_woocommerce_settings' ) ) && ( isset( $_GET['section'] ) && 'wc_pagseguro_gateway' == strtolower( $_GET['section'] ) ) ) {
136
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
137
+
138
+ wp_enqueue_script( 'pagseguro-admin', plugins_url( 'assets/js/admin' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery' ), WC_PagSeguro::VERSION, true );
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Checkout scripts.
144
+ */
145
+ public function checkout_scripts() {
146
+ if ( is_checkout() && $this->is_available() ) {
147
+ if ( ! get_query_var( 'order-received' ) ) {
148
+ $session_id = $this->api->get_session_id();
149
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
150
+
151
+ wp_enqueue_style( 'pagseguro-checkout', plugins_url( 'assets/css/transparent-checkout' . $suffix . '.css', plugin_dir_path( __FILE__ ) ), array(), WC_PagSeguro::VERSION );
152
+ wp_enqueue_script( 'pagseguro-library', $this->api->get_direct_payment_url(), array(), null, true );
153
+ wp_enqueue_script( 'pagseguro-checkout', plugins_url( 'assets/js/transparent-checkout' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery', 'pagseguro-library', 'woocommerce-extra-checkout-fields-for-brazil-front' ), WC_PagSeguro::VERSION, true );
154
+
155
+ wp_localize_script(
156
+ 'pagseguro-checkout',
157
+ 'wc_pagseguro_params',
158
+ array(
159
+ 'session_id' => $session_id,
160
+ 'interest_free' => __( 'interest free', 'woocommerce-pagseguro' ),
161
+ 'invalid_card' => __( 'Invalid credit card number.', 'woocommerce-pagseguro' ),
162
+ 'invalid_expiry' => __( 'Invalid expiry date, please use the MM / YYYY date format.', 'woocommerce-pagseguro' ),
163
+ 'expired_date' => __( 'Please check the expiry date and use a valid format as MM / YYYY.', 'woocommerce-pagseguro' ),
164
+ 'general_error' => __( 'Unable to process the data from your credit card on the PagSeguro, please try again or contact us for assistance.', 'woocommerce-pagseguro' ),
165
+ 'empty_installments' => __( 'Select a number of installments.', 'woocommerce-pagseguro' ),
166
+ )
167
+ );
168
+ }
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Get log.
174
+ *
175
+ * @return string
176
+ */
177
+ protected function get_log_view() {
178
+ if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.2', '>=' ) ) {
179
+ return '<a href="' . esc_url( admin_url( 'admin.php?page=wc-status&tab=logs&log_file=' . esc_attr( $this->id ) . '-' . sanitize_file_name( wp_hash( $this->id ) ) . '.log' ) ) . '">' . __( 'System Status &gt; Logs', 'woocommerce-pagseguro' ) . '</a>';
180
+ }
181
+
182
+ return '<code>woocommerce/logs/' . esc_attr( $this->id ) . '-' . sanitize_file_name( wp_hash( $this->id ) ) . '.txt</code>';
183
+ }
184
+
185
+ /**
186
+ * Initialise Gateway Settings Form Fields.
187
+ */
188
+ public function init_form_fields() {
189
+ $this->form_fields = array(
190
+ 'enabled' => array(
191
+ 'title' => __( 'Enable/Disable', 'woocommerce-pagseguro' ),
192
+ 'type' => 'checkbox',
193
+ 'label' => __( 'Enable PagSeguro', 'woocommerce-pagseguro' ),
194
+ 'default' => 'yes'
195
+ ),
196
+ 'title' => array(
197
+ 'title' => __( 'Title', 'woocommerce-pagseguro' ),
198
+ 'type' => 'text',
199
+ 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-pagseguro' ),
200
+ 'desc_tip' => true,
201
+ 'default' => __( 'PagSeguro', 'woocommerce-pagseguro' )
202
+ ),
203
+ 'description' => array(
204
+ 'title' => __( 'Description', 'woocommerce-pagseguro' ),
205
+ 'type' => 'textarea',
206
+ 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-pagseguro' ),
207
+ 'default' => __( 'Pay via PagSeguro', 'woocommerce-pagseguro' )
208
+ ),
209
+ 'email' => array(
210
+ 'title' => __( 'PagSeguro Email', 'woocommerce-pagseguro' ),
211
+ 'type' => 'text',
212
+ 'description' => __( 'Please enter your PagSeguro email address. This is needed in order to take payment.', 'woocommerce-pagseguro' ),
213
+ 'desc_tip' => true,
214
+ 'default' => ''
215
+ ),
216
+ 'token' => array(
217
+ 'title' => __( 'PagSeguro Token', 'woocommerce-pagseguro' ),
218
+ 'type' => 'text',
219
+ '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>' ),
220
+ 'default' => ''
221
+ ),
222
+ 'method' => array(
223
+ 'title' => __( 'Integration method', 'woocommerce-pagseguro' ),
224
+ 'type' => 'select',
225
+ 'description' => __( 'Choose how the customer will interact with the PagSeguro. Redirect (Client goes to PagSeguro page) or Lightbox (Inside your store)', 'woocommerce-pagseguro' ),
226
+ 'desc_tip' => true,
227
+ 'default' => 'direct',
228
+ 'class' => 'wc-enhanced-select',
229
+ 'options' => array(
230
+ 'redirect' => __( 'Redirect (default)', 'woocommerce-pagseguro' ),
231
+ 'lightbox' => __( 'Lightbox', 'woocommerce-pagseguro' ),
232
+ 'transparent' => __( 'Transparent Checkout', 'woocommerce-pagseguro' )
233
+ )
234
+ ),
235
+ 'transparent_checkout' => array(
236
+ 'title' => __( 'Transparent Checkout Options', 'woocommerce-pagseguro' ),
237
+ 'type' => 'title',
238
+ 'description' => ''
239
+ ),
240
+ 'tc_credit' => array(
241
+ 'title' => __( 'Credit Card', 'woocommerce-pagseguro' ),
242
+ 'type' => 'checkbox',
243
+ 'label' => __( 'Enable Credit Card for Transparente Checkout', 'woocommerce-pagseguro' ),
244
+ 'default' => 'yes'
245
+ ),
246
+ 'tc_transfer' => array(
247
+ 'title' => __( 'Bank Transfer', 'woocommerce-pagseguro' ),
248
+ 'type' => 'checkbox',
249
+ 'label' => __( 'Enable Bank Transfer for Transparente Checkout', 'woocommerce-pagseguro' ),
250
+ 'default' => 'yes'
251
+ ),
252
+ 'tc_ticket' => array(
253
+ 'title' => __( 'Banking Ticket', 'woocommerce-pagseguro' ),
254
+ 'type' => 'checkbox',
255
+ 'label' => __( 'Enable Banking Ticket for Transparente Checkout', 'woocommerce-pagseguro' ),
256
+ 'default' => 'yes'
257
+ ),
258
+ 'tc_ticket_message' => array(
259
+ 'title' => __( 'Banking Ticket Tax Message', 'woocommerce-pagseguro' ),
260
+ 'type' => 'checkbox',
261
+ 'label' => __( 'Display a message alerting the customer that will be charged R$ 1,00 for payment by Banking Ticket', 'woocommerce-pagseguro' ),
262
+ 'default' => 'yes'
263
+ ),
264
+ 'behavior' => array(
265
+ 'title' => __( 'Integration Behavior', 'woocommerce-pagseguro' ),
266
+ 'type' => 'title',
267
+ 'description' => ''
268
+ ),
269
+ 'send_only_total' => array(
270
+ 'title' => __( 'Send only the order total', 'woocommerce-pagseguro' ),
271
+ 'type' => 'checkbox',
272
+ 'label' => __( 'If this option is enabled will only send the order total, not the list of items.', 'woocommerce-pagseguro' ),
273
+ 'default' => 'no'
274
+ ),
275
+ 'invoice_prefix' => array(
276
+ 'title' => __( 'Invoice Prefix', 'woocommerce-pagseguro' ),
277
+ 'type' => 'text',
278
+ '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' ),
279
+ 'desc_tip' => true,
280
+ 'default' => 'WC-'
281
+ ),
282
+ 'testing' => array(
283
+ 'title' => __( 'Gateway Testing', 'woocommerce-pagseguro' ),
284
+ 'type' => 'title',
285
+ 'description' => ''
286
+ ),
287
+ 'sandbox' => array(
288
+ 'title' => __( 'PagSeguro Sandbox', 'woocommerce-pagseguro' ),
289
+ 'type' => 'checkbox',
290
+ 'label' => __( 'Enable PagSeguro Sandbox', 'woocommerce-pagseguro' ),
291
+ 'default' => 'no',
292
+ 'description' => sprintf( __( 'PagSeguro Sandbox can be used to test the payments. <strong>Note:</strong> you must use the development token that can be found in %s.', 'woocommerce-pagseguro' ), '<a href="https://sandbox.pagseguro.uol.com.br/comprador-de-testes.html" target="_blank">' . __( 'PagSeguro Sandbox', 'woocommerce-pagseguro' ) .'</a>' )
293
+ ),
294
+ 'debug' => array(
295
+ 'title' => __( 'Debug Log', 'woocommerce-pagseguro' ),
296
+ 'type' => 'checkbox',
297
+ 'label' => __( 'Enable logging', 'woocommerce-pagseguro' ),
298
+ 'default' => 'no',
299
+ 'description' => sprintf( __( 'Log PagSeguro events, such as API requests, inside %s', 'woocommerce-pagseguro' ), $this->get_log_view() )
300
+ )
301
+ );
302
+ }
303
+
304
+ /**
305
+ * Admin page.
306
+ */
307
+ public function admin_options() {
308
+ include 'views/html-admin-page.php';
309
+ }
310
+
311
+ /**
312
+ * Send email notification.
313
+ *
314
+ * @param string $subject Email subject.
315
+ * @param string $title Email title.
316
+ * @param string $message Email message.
317
+ */
318
+ protected function send_email( $subject, $title, $message ) {
319
+ $mailer = WC()->mailer();
320
+
321
+ $mailer->send( get_option( 'admin_email' ), $subject, $mailer->wrap_message( $title, $message ) );
322
+ }
323
+
324
+ /**
325
+ * Payment fields.
326
+ *
327
+ * @return string
328
+ */
329
+ public function payment_fields() {
330
+ wp_enqueue_script( 'wc-credit-card-form' );
331
+
332
+ if ( $description = $this->get_description() ) {
333
+ echo wpautop( wptexturize( $description ) );
334
+ }
335
+
336
+ $cart_total = $this->get_order_total();
337
+
338
+ if ( 'transparent' == $this->method ) {
339
+ wc_get_template( 'transparent-checkout-form.php', array(
340
+ 'cart_total' => $cart_total,
341
+ 'tc_credit' => $this->tc_credit,
342
+ 'tc_transfer' => $this->tc_transfer,
343
+ 'tc_ticket' => $this->tc_ticket,
344
+ 'tc_ticket_message' => $this->tc_ticket_message,
345
+ ), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path() );
346
+ }
347
+ }
348
+
349
+ /**
350
+ * Process the payment and return the result.
351
+ *
352
+ * @param int $order_id Order ID.
353
+ *
354
+ * @return array Redirect.
355
+ */
356
+ public function process_payment( $order_id ) {
357
+ $order = new WC_Order( $order_id );
358
+
359
+ if ( 'lightbox' != $this->method ) {
360
+ if ( isset( $_POST['pagseguro_sender_hash'] ) && 'transparent' == $this->method ) {
361
+ $response = $this->api->do_payment_request( $order, $_POST );
362
+
363
+ if ( $response['data'] ) {
364
+ $this->update_order_status( $response['data'] );
365
+ }
366
+ } else {
367
+ $response = $this->api->do_checkout_request( $order, $_POST );
368
+ }
369
+
370
+ if ( $response['url'] ) {
371
+ // Remove cart.
372
+ WC()->cart->empty_cart();
373
+
374
+ return array(
375
+ 'result' => 'success',
376
+ 'redirect' => $response['url']
377
+ );
378
+ } else {
379
+ foreach ( $response['error'] as $error ) {
380
+ wc_add_notice( $error, 'error' );
381
+ }
382
+
383
+ return array(
384
+ 'result' => 'fail',
385
+ 'redirect' => ''
386
+ );
387
+ }
388
+ } else {
389
+ $use_shipping = isset( $_POST['ship_to_different_address'] ) ? true : false;
390
+
391
+ return array(
392
+ 'result' => 'success',
393
+ 'redirect' => add_query_arg( array( 'use_shipping' => $use_shipping ), $order->get_checkout_payment_url( true ) )
394
+ );
395
+ }
396
+ }
397
+
398
+ /**
399
+ * Output for the order received page.
400
+ *
401
+ * @param $order_id Order ID.
402
+ *
403
+ * @return string PagSeguro lightbox.
404
+ */
405
+ public function receipt_page( $order_id ) {
406
+ $order = new WC_Order( $order_id );
407
+ $request_data = $_POST;
408
+ if ( isset( $_GET['use_shipping'] ) && true == $_GET['use_shipping'] ) {
409
+ $request_data['ship_to_different_address'] = true;
410
+ }
411
+
412
+ $response = $this->api->do_checkout_request( $order, $request_data );
413
+
414
+ if ( $response['url'] ) {
415
+ // Lightbox script.
416
+ wc_enqueue_js( '
417
+ $( "#browser-has-javascript" ).show();
418
+ $( "#browser-no-has-javascript, #cancel-payment, #submit-payment" ).hide();
419
+ var isOpenLightbox = PagSeguroLightbox({
420
+ code: "' . esc_js( $response['token'] ) . '"
421
+ }, {
422
+ success: function ( transactionCode ) {
423
+ window.location.href = "' . str_replace( '&amp;', '&', esc_js( $this->get_return_url( $order ) ) ) . '";
424
+ },
425
+ abort: function () {
426
+ window.location.href = "' . str_replace( '&amp;', '&', esc_js( $order->get_cancel_order_url() ) ) . '";
427
+ }
428
+ });
429
+ if ( ! isOpenLightbox ) {
430
+ window.location.href = "' . esc_js( $response['url'] ) . '";
431
+ }
432
+ ' );
433
+
434
+ wc_get_template( 'lightbox-checkout.php', array(
435
+ 'cancel_order_url' => $order->get_cancel_order_url(),
436
+ 'payment_url' => $response['url'],
437
+ 'lightbox_script_url' => $this->api->get_lightbox_url(),
438
+ ), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path() );
439
+ } else {
440
+ $html = '<ul class="woocommerce-error">';
441
+ foreach ( $response['error'] as $message ) {
442
+ $html .= '<li>' . $message . '</li>';
443
+ }
444
+ $html .= '</ul>';
445
+
446
+ $html .= '<a class="button cancel" href="' . esc_url( $order->get_cancel_order_url() ) . '">' . __( 'Click to try again', 'woocommerce-pagseguro' ) . '</a>';
447
+
448
+ echo $html;
449
+ }
450
+ }
451
+
452
+ /**
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' );
462
+ do_action( 'valid_pagseguro_ipn_request', $ipn );
463
+ exit();
464
+ } else {
465
+ $message = __( 'PagSeguro Request Unauthorized', 'woocommerce-pagseguro' );
466
+ wp_die( $message, $message, array( 'response' => 401 ) );
467
+ }
468
+ }
469
+
470
+ /**
471
+ * Update order status.
472
+ *
473
+ * @param array $posted PagSeguro post data.
474
+ */
475
+ public function update_order_status( $posted ) {
476
+
477
+ if ( isset( $posted->reference ) ) {
478
+ $order_id = (int) str_replace( $this->invoice_prefix, '', $posted->reference );
479
+ $order = new WC_Order( $order_id );
480
+
481
+ // Checks whether the invoice number matches the order.
482
+ // If true processes the payment.
483
+ if ( $order->id === $order_id ) {
484
+
485
+ if ( 'yes' == $this->debug ) {
486
+ $this->log->add( $this->id, 'PagSeguro payment status for order ' . $order->get_order_number() . ' is: ' . intval( $posted->status ) );
487
+ }
488
+
489
+ // Order details.
490
+ $order_details = array(
491
+ 'type' => '',
492
+ 'method' => '',
493
+ 'installments' => '',
494
+ 'link' => ''
495
+ );
496
+
497
+ if ( isset( $posted->code ) ) {
498
+ update_post_meta(
499
+ $order->id,
500
+ __( 'PagSeguro Transaction ID', 'woocommerce-pagseguro' ),
501
+ (string) $posted->code
502
+ );
503
+ }
504
+ if ( isset( $posted->sender->email ) ) {
505
+ update_post_meta(
506
+ $order->id,
507
+ __( 'Payer email', 'woocommerce-pagseguro' ),
508
+ (string) $posted->sender->email
509
+ );
510
+ }
511
+ if ( isset( $posted->sender->name ) ) {
512
+ update_post_meta(
513
+ $order->id,
514
+ __( 'Payer name', 'woocommerce-pagseguro' ),
515
+ (string) $posted->sender->name
516
+ );
517
+ }
518
+ if ( isset( $posted->paymentMethod->type ) ) {
519
+ $order_details['type'] = intval( $posted->paymentMethod->type );
520
+ update_post_meta(
521
+ $order->id,
522
+ __( 'Payment type', 'woocommerce-pagseguro' ),
523
+ $this->api->get_payment_name_by_type( $order_details['type'] )
524
+ );
525
+ }
526
+ if ( isset( $posted->paymentMethod->code ) ) {
527
+ $order_details['method'] = $this->api->get_payment_method_name( intval( $posted->paymentMethod->code ) );
528
+ update_post_meta(
529
+ $order->id,
530
+ __( 'Payment method', 'woocommerce-pagseguro' ),
531
+ $order_details['method']
532
+ );
533
+ }
534
+ if ( isset( $posted->installmentCount ) ) {
535
+ $order_details['installments'] = (string) $posted->installmentCount;
536
+ update_post_meta(
537
+ $order->id,
538
+ __( 'Installments', 'woocommerce-pagseguro' ),
539
+ $order_details['installments']
540
+ );
541
+ }
542
+ if ( isset( $posted->paymentLink ) ) {
543
+ $order_details['link'] = (string) $posted->paymentLink;
544
+ update_post_meta(
545
+ $order->id,
546
+ __( 'Payment url', 'woocommerce-pagseguro' ),
547
+ $order_details['link']
548
+ );
549
+ }
550
+
551
+ // Save/update payment information for transparente checkout.
552
+ if ( 'transparent' == $this->method ) {
553
+ update_post_meta( $order->id, '_wc_pagseguro_payment_data', $order_details );
554
+ }
555
+
556
+ switch ( intval( $posted->status ) ) {
557
+ case 1 :
558
+ $order->update_status( 'on-hold', __( 'PagSeguro: The buyer initiated the transaction, but so far the PagSeguro not received any payment information.', 'woocommerce-pagseguro' ) );
559
+
560
+ break;
561
+ case 2 :
562
+ $order->update_status( 'on-hold', __( 'PagSeguro: Payment under review.', 'woocommerce-pagseguro' ) );
563
+
564
+ break;
565
+ case 3 :
566
+ $order->add_order_note( __( 'PagSeguro: Payment approved.', 'woocommerce-pagseguro' ) );
567
+
568
+ // For WooCommerce 2.2 or later.
569
+ add_post_meta( $order->id, '_transaction_id', (string) $posted->code, true );
570
+
571
+ // Changing the order for processing and reduces the stock.
572
+ $order->payment_complete();
573
+
574
+ break;
575
+ case 4 :
576
+ $order->add_order_note( __( 'PagSeguro: Payment completed and credited to your account.', 'woocommerce-pagseguro' ) );
577
+
578
+ break;
579
+ case 5 :
580
+ $order->update_status( 'on-hold', __( 'PagSeguro: Payment came into dispute.', 'woocommerce-pagseguro' ) );
581
+ $this->send_email(
582
+ sprintf( __( 'Payment for order %s came into dispute', 'woocommerce-pagseguro' ), $order->get_order_number() ),
583
+ __( 'Payment in dispute', 'woocommerce-pagseguro' ),
584
+ sprintf( __( 'Order %s has been marked as on-hold, because the payment came into dispute in PagSeguro.', 'woocommerce-pagseguro' ), $order->get_order_number() )
585
+ );
586
+
587
+ break;
588
+ case 6 :
589
+ $order->update_status( 'refunded', __( 'PagSeguro: Payment refunded.', 'woocommerce-pagseguro' ) );
590
+ $this->send_email(
591
+ sprintf( __( 'Payment for order %s refunded', 'woocommerce-pagseguro' ), $order->get_order_number() ),
592
+ __( 'Payment refunded', 'woocommerce-pagseguro' ),
593
+ sprintf( __( 'Order %s has been marked as refunded by PagSeguro.', 'woocommerce-pagseguro' ), $order->get_order_number() )
594
+ );
595
+
596
+ break;
597
+ case 7 :
598
+ $order->update_status( 'cancelled', __( 'PagSeguro: Payment canceled.', 'woocommerce-pagseguro' ) );
599
+
600
+ break;
601
+
602
+ default :
603
+ // No action xD.
604
+ break;
605
+ }
606
+ } else {
607
+ if ( 'yes' == $this->debug ) {
608
+ $this->log->add( $this->id, 'Error: Order Key does not match with PagSeguro reference.' );
609
+ }
610
+ }
611
+ }
612
+ }
613
+
614
+ /**
615
+ * Thank You page message.
616
+ *
617
+ * @param int $order_id Order ID.
618
+ *
619
+ * @return string
620
+ */
621
+ public function thankyou_page( $order_id ) {
622
+ $data = get_post_meta( $order_id, '_wc_pagseguro_payment_data', true );
623
+
624
+ if ( isset( $data['type'] ) ) {
625
+ wc_get_template( 'payment-instructions.php', array(
626
+ 'type' => $data['type'],
627
+ 'link' => $data['link'],
628
+ 'method' => $data['method'],
629
+ 'installments' => $data['installments'],
630
+ ), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path() );
631
+ }
632
+ }
633
+
634
+ /**
635
+ * Add content to the WC emails.
636
+ *
637
+ * @param object $order Order object.
638
+ * @param bool $sent_to_admin Send to admin.
639
+ * @param bool $plain_text Plain text or HTML.
640
+ *
641
+ * @return string Payment instructions.
642
+ */
643
+ public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
644
+ if ( $sent_to_admin || 'on-hold' !== $order->status || $this->id !== $order->payment_method ) {
645
+ return;
646
+ }
647
+
648
+ $data = get_post_meta( $order->id, '_wc_pagseguro_payment_data', true );
649
+
650
+ if ( isset( $data['type'] ) ) {
651
+ if ( $plain_text ) {
652
+ wc_get_template( 'emails/plain-instructions.php', array(
653
+ 'type' => $data['type'],
654
+ 'link' => $data['link'],
655
+ 'method' => $data['method'],
656
+ 'installments' => $data['installments'],
657
+ ), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path() );
658
+ } else {
659
+ wc_get_template( 'emails/html-instructions.php', array(
660
+ 'type' => $data['type'],
661
+ 'link' => $data['link'],
662
+ 'method' => $data['method'],
663
+ 'installments' => $data['installments'],
664
+ ), 'woocommerce/pagseguro/', WC_PagSeguro::get_templates_path() );
665
+ }
666
+ }
667
+ }
668
+ }
includes/class-wc-pagseguro-xml.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Extends the SimpleXMLElement class to add CDATA element.
4
+ */
5
+ class WC_PagSeguro_XML extends SimpleXMLElement {
6
+
7
+ /**
8
+ * Extract numbers from a string.
9
+ *
10
+ * @param string $string
11
+ *
12
+ * @return string
13
+ */
14
+ protected function get_numbers( $string ) {
15
+ return preg_replace( '([^0-9])', '', $string );
16
+ }
17
+
18
+ /**
19
+ * Add CDATA.
20
+ *
21
+ * @param string $string Some string.
22
+ */
23
+ public function add_cdata( $string ) {
24
+ $node = dom_import_simplexml( $this );
25
+ $no = $node->ownerDocument;
26
+
27
+ $node->appendChild( $no->createCDATASection( trim( $string ) ) );
28
+ }
29
+
30
+ /**
31
+ * Add currency.
32
+ *
33
+ * @param string $currency Currency code.
34
+ */
35
+ public function add_currency( $currency ) {
36
+ $this->addChild( 'currency', $currency );
37
+ }
38
+
39
+ /**
40
+ * Add payment mode.
41
+ *
42
+ * @param string $mode Payment mode.
43
+ */
44
+ public function add_mode( $mode = 'default' ) {
45
+ $this->addChild( 'mode', $mode );
46
+ }
47
+
48
+ /**
49
+ * Add payment method.
50
+ *
51
+ * @param string $method Payment method (creditCard, boleto or eft).
52
+ */
53
+ public function add_method( $method = 'creditCard' ) {
54
+ $this->addChild( 'method', $method );
55
+ }
56
+
57
+ /**
58
+ * Add reference.
59
+ *
60
+ * @param string $reference Payment reference.
61
+ */
62
+ public function add_reference( $reference ) {
63
+ $this->addChild( 'reference' )->add_cdata( $reference );
64
+ }
65
+
66
+ /**
67
+ * Add receiver email.
68
+ *
69
+ * @param string $receiver_email Receiver email.
70
+ */
71
+ public function add_receiver_email( $receiver_email ) {
72
+ $receiver = $this->addChild( 'receiver' );
73
+ $receiver->addChild( 'email', $receiver_email );
74
+ }
75
+
76
+ /**
77
+ * Add sender data.
78
+ *
79
+ * @param WC_Order $order Order data.
80
+ * @param string $hash Sender hash.
81
+ */
82
+ public function add_sender_data( $order, $hash = '' ) {
83
+ $sender = $this->addChild( 'sender' );
84
+ $sender->addChild( 'name' )->add_cdata( $order->billing_first_name . ' ' . $order->billing_last_name );
85
+ $sender->addChild( 'email' )->add_cdata( $order->billing_email );
86
+
87
+ if ( isset( $order->billing_cpf ) && ! empty( $order->billing_cpf ) ) {
88
+ $documents = $sender->addChild( 'documents' );
89
+ $document = $documents->addChild( 'document' );
90
+ $document->addChild( 'type', 'CPF' );
91
+ $document->addChild( 'value', $this->get_numbers( $order->billing_cpf ) );
92
+ }
93
+
94
+ if ( isset( $order->billing_phone ) && ! empty( $order->billing_phone ) ) {
95
+ $phone_number = $this->get_numbers( $order->billing_phone );
96
+ $phone = $sender->addChild( 'phone' );
97
+ $phone->addChild( 'areaCode', substr( $phone_number, 0, 2 ) );
98
+ $phone->addChild( 'number', substr( $phone_number, 2 ) );
99
+ }
100
+
101
+ if ( '' != $hash ) {
102
+ $sender->addChild( 'hash', $hash );
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Add shipping data.
108
+ *
109
+ * @param WC_Order $order Order data.
110
+ * @param bool $ship_to Ship to (true = shipping address, false = billing address).
111
+ * @param float $shipping_cost Shipping cost.
112
+ */
113
+ public function add_shipping_data( $order, $ship_to = false, $shipping_cost = 0 ) {
114
+ $type = ( $ship_to ) ? 'shipping' : 'billing';
115
+
116
+ $shipping = $this->addChild( 'shipping' );
117
+ $shipping->addChild( 'type', 3 );
118
+
119
+ if ( isset( $order->{ $type . '_postcode' } ) && ! empty( $order->{ $type . '_postcode' } ) ) {
120
+ $address = $shipping->addChild( 'address' );
121
+ $address->addChild( 'street' )->add_cdata( $order->{ $type . '_address_1' } );
122
+
123
+ if ( isset( $order->{ $type . '_number' } ) ) {
124
+ $address->addChild( 'number', $order->{ $type . '_number' } );
125
+ }
126
+
127
+ if ( ! empty( $order->{ $type . '_address_2' } ) ) {
128
+ $address->addChild( 'complement' )->add_cdata( $order->{ $type . '_address_2' } );
129
+ }
130
+
131
+ if ( isset( $order->{ $type . '_neighborhood' } ) ) {
132
+ $address->addChild( 'district' )->add_cdata( $order->{ $type . '_neighborhood' } );
133
+ }
134
+
135
+ $address->addChild( 'postalCode', $this->get_numbers( $order->{ $type . '_postcode' } ) );
136
+ $address->addChild( 'city' )->add_cdata( $order->{ $type . '_city' } );
137
+ $address->addChild( 'state', $order->{ $type . '_state' } );
138
+ $address->addChild( 'country', 'BRA' );
139
+ }
140
+
141
+ $shipping->addChild( 'cost', $shipping_cost );
142
+ }
143
+
144
+ /**
145
+ * Add order items.
146
+ *
147
+ * @param array $items Order items.
148
+ */
149
+ public function add_items( $_items ) {
150
+ $items = $this->addChild( 'items' );
151
+
152
+ foreach ( $_items as $id => $_item ) {
153
+ $item = $items->addChild( 'item' );
154
+
155
+ $item->addChild( 'id', $id + 1 );
156
+ $item->addChild( 'description' )->add_cdata( $_item['description'] );
157
+ $item->addChild( 'amount', $_item['amount'] );
158
+ $item->addChild( 'quantity', $_item['quantity'] );
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Add extra amount.
164
+ *
165
+ * @param float $extra_amount Extra amount.
166
+ */
167
+ public function add_extra_amount( $extra_amount = 0 ) {
168
+ if ( 0 != $extra_amount ) {
169
+ $this->addChild( 'extraAmount', $extra_amount );
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Add credit card data.
175
+ *
176
+ * @param WC_Order $order Order data.
177
+ * @param string $credit_card_token Credit card token.
178
+ * @param array $installment_data Installment data (quantity and value).
179
+ * @param array $holder_data Holder data (name, cpf, birth_date and phone).
180
+ */
181
+ public function add_credit_card_data( $order, $credit_card_token, $installment_data, $holder_data ) {
182
+ $credit_card = $this->addChild( 'creditCard' );
183
+
184
+ $credit_card->addChild( 'token', $credit_card_token );
185
+
186
+ $installment = $credit_card->addChild( 'installment' );
187
+ $installment->addChild( 'quantity', $installment_data['quantity'] );
188
+ $installment->addChild( 'value', $installment_data['value'] );
189
+
190
+ $holder = $credit_card->addChild( 'holder' );
191
+ $holder->addChild( 'name' )->add_cdata( $holder_data['name'] );
192
+ $documents = $holder->addChild( 'documents' );
193
+ $document = $documents->addChild( 'document' );
194
+ $document->addChild( 'type', 'CPF' );
195
+ $document->addChild( 'value', $this->get_numbers( $holder_data['cpf'] ) );
196
+ $holder->addChild( 'birthDate', str_replace( ' ', '', $holder_data['birth_date'] ) );
197
+ $phone_number = $this->get_numbers( $holder_data['phone'] );
198
+ $phone = $holder->addChild( 'phone' );
199
+ $phone->addChild( 'areaCode', substr( $phone_number, 0, 2 ) );
200
+ $phone->addChild( 'number', substr( $phone_number, 2 ) );
201
+
202
+ $billing_address = $credit_card->addChild( 'billingAddress' );
203
+ $billing_address->addChild( 'street' )->add_cdata( $order->billing_address_1 );
204
+ if ( isset( $order->billing_number ) ) {
205
+ $billing_address->addChild( 'number', $order->billing_number );
206
+ }
207
+ if ( ! empty( $order->billing_address_2 ) ) {
208
+ $billing_address->addChild( 'complement' )->add_cdata( $order->billing_address_2 );
209
+ }
210
+ if ( isset( $order->billing_neighborhood ) ) {
211
+ $billing_address->addChild( 'district' )->add_cdata( $order->billing_neighborhood );
212
+ }
213
+ $billing_address->addChild( 'city' )->add_cdata( $order->billing_city );
214
+ $billing_address->addChild( 'state', $order->billing_state );
215
+ $billing_address->addChild( 'country', 'BRA' );
216
+ $billing_address->addChild( 'postalCode', $this->get_numbers( $order->billing_postcode ) );
217
+ }
218
+
219
+ /**
220
+ * Add bank data.
221
+ *
222
+ * @param string $bank_name bradesco, itau, bancodobrasil, banrisul or hsbc.
223
+ */
224
+ public function add_bank_data( $bank_name ) {
225
+ $bank = $this->addChild( 'bank' );
226
+ $bank->addChild( 'name', $bank_name );
227
+ }
228
+
229
+ /**
230
+ * Add redirect URL.
231
+ *
232
+ * @param string $redirect_url URL to redirect from PagSeguro.
233
+ */
234
+ public function add_redirect_url( $redirect_url ) {
235
+ $this->addChild( 'redirectURL' )->add_cdata( $redirect_url );
236
+ }
237
+
238
+ /**
239
+ * Add notification URL.
240
+ *
241
+ * @param string $notification_url URL to PagSeguro send the payment status notification.
242
+ */
243
+ public function add_notification_url( $notification_url ) {
244
+ $this->addChild( 'notificationURL' )->add_cdata( $notification_url );
245
+ }
246
+
247
+ /**
248
+ * Add max uses.
249
+ *
250
+ * @param int $max
251
+ */
252
+ public function add_max_uses( $max = 1 ) {
253
+ $this->addChild( 'maxUses', $max );
254
+ }
255
+
256
+ /**
257
+ * Add max age.
258
+ *
259
+ * @param int $max
260
+ */
261
+ public function add_max_age( $max = 120 ) {
262
+ $this->addChild( 'maxAge', $max );
263
+ }
264
+
265
+ /**
266
+ * Render the formated XML.
267
+ *
268
+ * @return string
269
+ */
270
+ public function render() {
271
+ $node = dom_import_simplexml( $this );
272
+ $dom = $node->ownerDocument;
273
+ $dom->formatOutput = true;
274
+
275
+ return $dom->saveXML();
276
+ }
277
+ }
includes/views/html-admin-page.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin options screen.
4
+ */
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ $reviews_url = 'https://wordpress.org/support/view/plugin-reviews/woocommerce-pagseguro?filter=5#postform';
10
+
11
+ ?>
12
+
13
+ <h3><?php echo $this->method_title; ?></h3>
14
+
15
+ <?php echo $this->method_description; ?>
16
+
17
+ <?php if ( apply_filters( 'woocommerce_pagseguro_help_message', true ) ) : ?>
18
+ <div class="updated woocommerce-message">
19
+ <p><?php printf( __( 'Help us keep the %s plugin free making a %s or rate %s on %s. Thank you in advance!', 'woocommerce-pagseguro' ), '<strong>' . __( 'WooCommerce PagSeguro', 'woocommerce-pagseguro' ) . '</strong>', '<a href="http://claudiosmweb.com/doacoes/">' . __( 'donation', 'woocommerce-pagseguro' ) . '</a>', '<a href="' . esc_url( $reviews_url ) . '" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>', '<a href="' . esc_url( $reviews_url ) . '" target="_blank">' . __( 'WordPress.org', 'woocommerce-pagseguro' ) . '</a>' ); ?></p>
20
+ </div>
21
+ <?php endif; ?>
22
+
23
+ <table class="form-table">
24
+ <?php $this->generate_settings_html(); ?>
25
+ </table>
includes/views/html-notice-currency-not-supported.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Notice - Currency not supported.
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ ?>
11
+
12
+ <div class="error">
13
+ <p><strong><?php _e( 'PagSeguro Disabled', 'woocommerce-pagseguro' ); ?></strong>: <?php printf( __( 'Currency <code>%s</code> is not supported. Works only with Brazilian Real.', 'woocommerce-pagseguro' ), get_woocommerce_currency() ); ?>
14
+ </p>
15
+ </div>
includes/views/html-notice-ecfb-missing.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Notice - WooCommerce Extra Checkout Fields for Brazil missing.
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ $plugin_slug = 'woocommerce-extra-checkout-fields-for-brazil';
11
+
12
+ if ( current_user_can( 'install_plugins' ) ) {
13
+ $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug ), 'install-plugin_' . $plugin_slug );
14
+ } else {
15
+ $url = 'http://wordpress.org/plugins/' . $plugin_slug;
16
+ }
17
+ ?>
18
+
19
+ <div class="error">
20
+ <p><strong><?php _e( 'PagSeguro Disabled', 'woocommerce-pagseguro' ); ?></strong>: <?php printf( __( 'Checkout Transparent requires the latest version of the %s to works.', 'woocommerce-pagseguro' ), '<a href="' . esc_url( $url ) . '">' . __( 'Extra Checkout Fields for Brazil', 'woocommerce-pagseguro' ) . '</a>' ); ?></p>
21
+ </div>
includes/views/html-notice-email-missing.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Notice - Email missing
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ ?>
11
+
12
+ <div class="error">
13
+ <p><strong><?php _e( 'PagSeguro Disabled', 'woocommerce-pagseguro' ); ?></strong>: <?php printf( __( 'You should inform your email address. %s', 'woocommerce-pagseguro' ), '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout&section=wc_pagseguro_gateway' ) ) . '">' . __( 'Click here to configure!', 'woocommerce-pagseguro' ) . '</a>' ); ?>
14
+ </p>
15
+ </div>
includes/views/html-notice-token-missing.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Notice - Token missing
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ ?>
11
+
12
+ <div class="error">
13
+ <p><strong><?php _e( 'PagSeguro Disabled', 'woocommerce-pagseguro' ); ?></strong>: <?php printf( __( 'You should inform your token. %s', 'woocommerce-pagseguro' ), '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout&section=wc_pagseguro_gateway' ) ) . '">' . __( 'Click here to configure!', 'woocommerce-pagseguro' ) . '</a>' ); ?>
14
+ </p>
15
+ </div>
languages/woocommerce-pagseguro-pt_BR.mo ADDED
Binary file
languages/woocommerce-pagseguro-pt_BR.po ADDED
@@ -0,0 +1,818 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WooCommerce PagSeguro 2.8.1\n"
4
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/woocommerce-"
5
+ "pagseguro\n"
6
+ "POT-Creation-Date: 2015-08-20 00:50:35+00:00\n"
7
+ "PO-Revision-Date: 2015-08-19 21:51-0300\n"
8
+ "Last-Translator: Claudio Sanches <contato@claudiosmweb.com>\n"
9
+ "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
10
+ "Language: Portuguese (Brazil)\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Generator: Poedit 1.5.4\n"
17
+ "X-Poedit-Basepath: .\n"
18
+ "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
19
+ "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
20
+ "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
21
+ "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
22
+ "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
23
+ "X-Loco-Target-Locale: pt_BR\n"
24
+ "X-Poedit-SearchPath-0: ..\n"
25
+
26
+ #: includes/class-wc-pagseguro-api.php:128
27
+ #: includes/class-wc-pagseguro-api.php:151
28
+ #: includes/class-wc-pagseguro-gateway.php:241
29
+ #: templates/transparent-checkout-form.php:20
30
+ msgid "Credit Card"
31
+ msgstr "Cartão de Crédito"
32
+
33
+ #: includes/class-wc-pagseguro-api.php:129
34
+ #: includes/class-wc-pagseguro-api.php:152
35
+ msgid "Billet"
36
+ msgstr "Boleto"
37
+
38
+ #: includes/class-wc-pagseguro-api.php:130
39
+ #: includes/class-wc-pagseguro-api.php:153
40
+ #: includes/class-wc-pagseguro-gateway.php:247
41
+ #: templates/transparent-checkout-form.php:24
42
+ msgid "Bank Transfer"
43
+ msgstr "Débito Online"
44
+
45
+ #: includes/class-wc-pagseguro-api.php:131
46
+ #: includes/class-wc-pagseguro-api.php:184
47
+ msgid "PagSeguro credit"
48
+ msgstr "Saldo PagSeguro"
49
+
50
+ #: includes/class-wc-pagseguro-api.php:132
51
+ #: includes/class-wc-pagseguro-api.php:185
52
+ msgid "Oi Paggo"
53
+ msgstr "Oi Paggo"
54
+
55
+ #: includes/class-wc-pagseguro-api.php:133
56
+ #: includes/class-wc-pagseguro-api.php:186
57
+ msgid "Account deposit"
58
+ msgstr "Depósito em conta"
59
+
60
+ #: includes/class-wc-pagseguro-api.php:139
61
+ #: includes/class-wc-pagseguro-api.php:192
62
+ msgid "Unknown"
63
+ msgstr "Desconhecido"
64
+
65
+ #: includes/class-wc-pagseguro-api.php:236
66
+ msgid ""
67
+ "Please enter with a valid phone number with DDD. Example: (11) 5555-5555."
68
+ msgstr ""
69
+ "Por favor, digite um número de telefone válido com DDD. Exemplo: (11) "
70
+ "5555-5555."
71
+
72
+ #: includes/class-wc-pagseguro-api.php:243
73
+ msgid "Please enter with a valid zip code number."
74
+ msgstr "Por favor, digite um número de CEP válido."
75
+
76
+ #: includes/class-wc-pagseguro-api.php:246
77
+ msgid "Please enter with a valid CPF number."
78
+ msgstr "Por favor, digite um número de CPF válido."
79
+
80
+ #: includes/class-wc-pagseguro-api.php:250
81
+ msgid "Please select a bank to make payment by bank transfer."
82
+ msgstr ""
83
+ "Por favor, selecione o banco que você irá utilizar para fazer a "
84
+ "transferência bancária."
85
+
86
+ #: includes/class-wc-pagseguro-api.php:253
87
+ msgid "Credit card holder CPF is required."
88
+ msgstr "É obrigatório informar o CPF do portador do cartão de crédito."
89
+
90
+ #: includes/class-wc-pagseguro-api.php:256
91
+ msgid "Credit card holder birthdate is required."
92
+ msgstr ""
93
+ "É obrigatório informar da data de nascimento do portador do cartão de "
94
+ "crédito."
95
+
96
+ #: includes/class-wc-pagseguro-api.php:259
97
+ msgid "Credit card holder name is required."
98
+ msgstr "É obrigatório informar o nome do portador do cartão de crédito."
99
+
100
+ #: includes/class-wc-pagseguro-api.php:263
101
+ msgid "Credit card holder phone is required."
102
+ msgstr ""
103
+ "É obrigatório informar o número de telefone do portador do cartão de crédito."
104
+
105
+ #: includes/class-wc-pagseguro-api.php:267
106
+ msgid ""
107
+ "The address complement is too long, it cannot be more than 40 characters."
108
+ msgstr ""
109
+ "O complemento do endereço é muito grande, não pode ter mais do que 40 "
110
+ "caráteres."
111
+
112
+ #: includes/class-wc-pagseguro-api.php:270
113
+ msgid "<strong>Neighborhood</strong> is a required field."
114
+ msgstr "<strong>Bairro</strong> é um campo obrigatório."
115
+
116
+ #: includes/class-wc-pagseguro-api.php:273
117
+ msgid "Credit card holder CPF invalid."
118
+ msgstr "CPF do dono do cartão de crédito é inválido."
119
+
120
+ #: includes/class-wc-pagseguro-api.php:276
121
+ msgid ""
122
+ "Invalid email domain. You must use an email @sandbox.pagseguro.com.br while "
123
+ "you are using the PagSeguro Sandbox."
124
+ msgstr ""
125
+ "Domínio do e-mail é inválido. Você deve utilizar um e-mail @sandbox."
126
+ "pagseguro.com.br enquanto você esta usando o Sandbox do PagSeguro."
127
+
128
+ #: includes/class-wc-pagseguro-api.php:280
129
+ msgid ""
130
+ "An error has occurred while processing your payment, please review your data "
131
+ "and try again. Or contact us for assistance."
132
+ msgstr ""
133
+ "Um erro ocorreu ao processar o seu pagamento, por favor, revise os seus "
134
+ "dados e tente novamente. Ou entre em contato conosco para obter assistência."
135
+
136
+ #: includes/class-wc-pagseguro-api.php:391
137
+ msgid "Order %s"
138
+ msgstr "Pedido %s"
139
+
140
+ #: includes/class-wc-pagseguro-api.php:583
141
+ msgid ""
142
+ "Too bad! The email or token from the PagSeguro are invalids my little friend!"
143
+ msgstr "Que feio! O e-mail ou token do PagSeguro são inválidos amiguinho!"
144
+
145
+ #: includes/class-wc-pagseguro-api.php:619
146
+ #: includes/class-wc-pagseguro-api.php:638
147
+ #: includes/class-wc-pagseguro-api.php:660
148
+ #: includes/class-wc-pagseguro-api.php:719
149
+ #: includes/class-wc-pagseguro-api.php:738
150
+ #: includes/class-wc-pagseguro-gateway.php:15
151
+ #: includes/class-wc-pagseguro-gateway.php:201
152
+ msgid "PagSeguro"
153
+ msgstr "PagSeguro"
154
+
155
+ #: includes/class-wc-pagseguro-api.php:638
156
+ #: includes/class-wc-pagseguro-api.php:738
157
+ msgid ""
158
+ "An error has occurred while processing your payment, please try again. Or "
159
+ "contact us for assistance."
160
+ msgstr ""
161
+ "Um erro ocorreu ao processar o seu pagamento, por favor, tente novamente ou "
162
+ "entre em contato para obter ajuda."
163
+
164
+ #: includes/class-wc-pagseguro-api.php:660
165
+ msgid "Please, select a payment method."
166
+ msgstr "Por favor, selecione um método de pagamento."
167
+
168
+ #: includes/class-wc-pagseguro-api.php:686
169
+ msgid ""
170
+ "You are not allowed to use the PagSeguro Transparent Checkout. Looks like "
171
+ "you neglected to installation guide of this plugin. This is not pretty, do "
172
+ "you know?"
173
+ msgstr ""
174
+ "Você não tem permissão para usar o Checkout Transparente do PagSeguro. "
175
+ "Parace que você negligenciou o guia de instalação deste plugin. Que feio "
176
+ "isso hein?"
177
+
178
+ #: includes/class-wc-pagseguro-gateway.php:16
179
+ msgid ""
180
+ "Accept payments by credit card, bank debit or banking ticket using the "
181
+ "PagSeguro."
182
+ msgstr ""
183
+ "Aceite pagamentos por cartão de crédito, débito bancário ou boleto bancário "
184
+ "utilizando o PagSeguro."
185
+
186
+ #: includes/class-wc-pagseguro-gateway.php:17
187
+ msgid "Proceed to payment"
188
+ msgstr "Realizar pagamento"
189
+
190
+ #: includes/class-wc-pagseguro-gateway.php:160
191
+ msgid "interest free"
192
+ msgstr "sem juros"
193
+
194
+ #: includes/class-wc-pagseguro-gateway.php:161
195
+ msgid "Invalid credit card number."
196
+ msgstr "O número do cartão de crédito é inválido."
197
+
198
+ #: includes/class-wc-pagseguro-gateway.php:162
199
+ msgid "Invalid expiry date, please use the MM / YYYY date format."
200
+ msgstr ""
201
+ "A data de expiração é inválida, por favor, utilize o formato MM / AAAA."
202
+
203
+ #: includes/class-wc-pagseguro-gateway.php:163
204
+ msgid "Please check the expiry date and use a valid format as MM / YYYY."
205
+ msgstr ""
206
+ "Por favor, verifique a data de expiração e utilize o formato MM / AAAA."
207
+
208
+ #: includes/class-wc-pagseguro-gateway.php:164
209
+ msgid ""
210
+ "Unable to process the data from your credit card on the PagSeguro, please "
211
+ "try again or contact us for assistance."
212
+ msgstr ""
213
+ "Não foi possível processar os dados do seu cartão de crédito no PagSeguro, "
214
+ "por favor, tente novamente ou entre em contato para receber ajuda."
215
+
216
+ #: includes/class-wc-pagseguro-gateway.php:165
217
+ msgid "Select a number of installments."
218
+ msgstr "Selecione o número de parcelas."
219
+
220
+ #: includes/class-wc-pagseguro-gateway.php:179
221
+ msgid "System Status &gt; Logs"
222
+ msgstr "Status do Sistema &gt; Logs"
223
+
224
+ #: includes/class-wc-pagseguro-gateway.php:191
225
+ msgid "Enable/Disable"
226
+ msgstr "Habilita/Desabilita"
227
+
228
+ #: includes/class-wc-pagseguro-gateway.php:193
229
+ msgid "Enable PagSeguro"
230
+ msgstr "Ativar o PagSeguro"
231
+
232
+ #: includes/class-wc-pagseguro-gateway.php:197
233
+ msgid "Title"
234
+ msgstr "Título"
235
+
236
+ #: includes/class-wc-pagseguro-gateway.php:199
237
+ msgid "This controls the title which the user sees during checkout."
238
+ msgstr "Isto controla o título que o usuário vê durante o checkout."
239
+
240
+ #: includes/class-wc-pagseguro-gateway.php:204
241
+ msgid "Description"
242
+ msgstr "Descrição"
243
+
244
+ #: includes/class-wc-pagseguro-gateway.php:206
245
+ msgid "This controls the description which the user sees during checkout."
246
+ msgstr "Isso controla a descrição que o usuário vê durante o checkout."
247
+
248
+ #: includes/class-wc-pagseguro-gateway.php:207
249
+ #: templates/lightbox-checkout.php:19
250
+ msgid "Pay via PagSeguro"
251
+ msgstr "Pagar com PagSeguro"
252
+
253
+ #: includes/class-wc-pagseguro-gateway.php:210
254
+ msgid "PagSeguro Email"
255
+ msgstr "Email cadastrado no PagSeguro"
256
+
257
+ #: includes/class-wc-pagseguro-gateway.php:212
258
+ msgid ""
259
+ "Please enter your PagSeguro email address. This is needed in order to take "
260
+ "payment."
261
+ msgstr ""
262
+ "Por favor digite o seu endereço de email do PagSeguro. É necessário para "
263
+ "receber o pagamento."
264
+
265
+ #: includes/class-wc-pagseguro-gateway.php:217
266
+ msgid "PagSeguro Token"
267
+ msgstr "Token do PagSeguro"
268
+
269
+ #: includes/class-wc-pagseguro-gateway.php:219
270
+ msgid ""
271
+ "Please enter your PagSeguro token. This is needed to process the payment and "
272
+ "notifications. Is possible generate a new token %s."
273
+ msgstr ""
274
+ "Por favor digite seu token do PagSeguro. É necessário para processar o "
275
+ "pagamento e as notificações de status da compra. É possível gerar um novo "
276
+ "token %s."
277
+
278
+ #: includes/class-wc-pagseguro-gateway.php:219
279
+ msgid "here"
280
+ msgstr "aqui"
281
+
282
+ #: includes/class-wc-pagseguro-gateway.php:223
283
+ msgid "Integration method"
284
+ msgstr "Método de integração"
285
+
286
+ #: includes/class-wc-pagseguro-gateway.php:225
287
+ msgid ""
288
+ "Choose how the customer will interact with the PagSeguro. Redirect (Client "
289
+ "goes to PagSeguro page) or Lightbox (Inside your store)"
290
+ msgstr ""
291
+ "Escolha como o cliente irá interagir com o PagSeguro. Redirecionamento (O "
292
+ "cliente vai para a página do PagSeguro) ou Lightbox (cliente paga dentro da "
293
+ "loja)"
294
+
295
+ #: includes/class-wc-pagseguro-gateway.php:230
296
+ msgid "Redirect (default)"
297
+ msgstr "Redirecionamento (padrão)"
298
+
299
+ #: includes/class-wc-pagseguro-gateway.php:231
300
+ msgid "Lightbox"
301
+ msgstr "Lightbox"
302
+
303
+ #: includes/class-wc-pagseguro-gateway.php:232
304
+ msgid "Transparent Checkout"
305
+ msgstr "Checkout Transparente"
306
+
307
+ #: includes/class-wc-pagseguro-gateway.php:236
308
+ msgid "Transparent Checkout Options"
309
+ msgstr "Opções do Checkout Transparente"
310
+
311
+ #: includes/class-wc-pagseguro-gateway.php:243
312
+ msgid "Enable Credit Card for Transparente Checkout"
313
+ msgstr "Ativar cartão de crédito para o checkout transparente"
314
+
315
+ #: includes/class-wc-pagseguro-gateway.php:249
316
+ msgid "Enable Bank Transfer for Transparente Checkout"
317
+ msgstr "Ativar transferência bancária para o checkout transparente"
318
+
319
+ #: includes/class-wc-pagseguro-gateway.php:253
320
+ #: templates/transparent-checkout-form.php:28
321
+ msgid "Banking Ticket"
322
+ msgstr "Boleto Bancário"
323
+
324
+ #: includes/class-wc-pagseguro-gateway.php:255
325
+ msgid "Enable Banking Ticket for Transparente Checkout"
326
+ msgstr "Ativar boleto bancário para o checkout transparente"
327
+
328
+ #: includes/class-wc-pagseguro-gateway.php:259
329
+ msgid "Banking Ticket Tax Message"
330
+ msgstr "Mensagem sobre a taxa do boleto bancário"
331
+
332
+ #: includes/class-wc-pagseguro-gateway.php:261
333
+ msgid ""
334
+ "Display a message alerting the customer that will be charged R$ 1,00 for "
335
+ "payment by Banking Ticket"
336
+ msgstr ""
337
+ "Exibir uma mensagem alertando o cliente que será cobrado R$ 1,00 para "
338
+ "pagamento por boleto bancário"
339
+
340
+ #: includes/class-wc-pagseguro-gateway.php:265
341
+ msgid "Integration Behavior"
342
+ msgstr "Comportamento da Integração"
343
+
344
+ #: includes/class-wc-pagseguro-gateway.php:270
345
+ msgid "Send only the order total"
346
+ msgstr "Enviar apenas o total do pedido"
347
+
348
+ #: includes/class-wc-pagseguro-gateway.php:272
349
+ msgid ""
350
+ "If this option is enabled will only send the order total, not the list of "
351
+ "items."
352
+ msgstr ""
353
+ "Caso esta opção esteja ativada será enviado apenas o total do pedido e não a "
354
+ "lista de itens."
355
+
356
+ #: includes/class-wc-pagseguro-gateway.php:276
357
+ msgid "Invoice Prefix"
358
+ msgstr "Prefixo de pedido"
359
+
360
+ #: includes/class-wc-pagseguro-gateway.php:278
361
+ msgid ""
362
+ "Please enter a prefix for your invoice numbers. If you use your PagSeguro "
363
+ "account for multiple stores ensure this prefix is unqiue as PagSeguro will "
364
+ "not allow orders with the same invoice number."
365
+ msgstr ""
366
+ "Por favor informe um prefixo para utilizar com os números de pedidos. Caso "
367
+ "você utilize sua conta do PagSeguro em mais de uma loja, procure utilizar um "
368
+ "prefixo único para cada loja."
369
+
370
+ #: includes/class-wc-pagseguro-gateway.php:283
371
+ msgid "Gateway Testing"
372
+ msgstr "Teste de Gateway"
373
+
374
+ #: includes/class-wc-pagseguro-gateway.php:288
375
+ #: includes/class-wc-pagseguro-gateway.php:292
376
+ msgid "PagSeguro Sandbox"
377
+ msgstr "PagSeguro Sandbox"
378
+
379
+ #: includes/class-wc-pagseguro-gateway.php:290
380
+ msgid "Enable PagSeguro Sandbox"
381
+ msgstr "Ativar Sandbox do PagSeguro"
382
+
383
+ #: includes/class-wc-pagseguro-gateway.php:292
384
+ msgid ""
385
+ "PagSeguro Sandbox can be used to test the payments. <strong>Note:</strong> "
386
+ "you must use the development token that can be found in %s."
387
+ msgstr ""
388
+ "Você pode usar o PagSeguro Sandbox para testar os pagamentos. <strong>Nota:</"
389
+ "strong> você deve usar um token de desenvolvedor que pode ser encontrado em "
390
+ "%s."
391
+
392
+ #: includes/class-wc-pagseguro-gateway.php:295
393
+ msgid "Debug Log"
394
+ msgstr "Log de depuração"
395
+
396
+ #: includes/class-wc-pagseguro-gateway.php:297
397
+ msgid "Enable logging"
398
+ msgstr "Habilitar log"
399
+
400
+ #: includes/class-wc-pagseguro-gateway.php:299
401
+ msgid "Log PagSeguro events, such as API requests, inside %s"
402
+ msgstr ""
403
+ "Grava eventos do PagSeguro, como solicitações de API, dentro do arquivo %s"
404
+
405
+ #: includes/class-wc-pagseguro-gateway.php:446
406
+ msgid "Click to try again"
407
+ msgstr "Clique para tentar novamente"
408
+
409
+ #: includes/class-wc-pagseguro-gateway.php:465
410
+ msgid "PagSeguro Request Unauthorized"
411
+ msgstr "PagSeguro pedido não autorizado"
412
+
413
+ #: includes/class-wc-pagseguro-gateway.php:500
414
+ msgid "PagSeguro Transaction ID"
415
+ msgstr "PagSeguro: ID da transação"
416
+
417
+ #: includes/class-wc-pagseguro-gateway.php:507
418
+ msgid "Payer email"
419
+ msgstr "E-mail do comprador"
420
+
421
+ #: includes/class-wc-pagseguro-gateway.php:514
422
+ msgid "Payer name"
423
+ msgstr "Nome do comprador"
424
+
425
+ #: includes/class-wc-pagseguro-gateway.php:522
426
+ msgid "Payment type"
427
+ msgstr "Tipo de pagamento"
428
+
429
+ #: includes/class-wc-pagseguro-gateway.php:530
430
+ msgid "Payment method"
431
+ msgstr "Método de pagamento"
432
+
433
+ #: includes/class-wc-pagseguro-gateway.php:538
434
+ #: templates/transparent-checkout-form.php:54
435
+ msgid "Installments"
436
+ msgstr "Parcelas"
437
+
438
+ #: includes/class-wc-pagseguro-gateway.php:546
439
+ msgid "Payment url"
440
+ msgstr "Link de pagamento"
441
+
442
+ #: includes/class-wc-pagseguro-gateway.php:558
443
+ msgid ""
444
+ "PagSeguro: The buyer initiated the transaction, but so far the PagSeguro not "
445
+ "received any payment information."
446
+ msgstr ""
447
+ "PagSeguro: O comprador iniciou a transação, mas até o momento o PagSeguro "
448
+ "não recebeu nenhuma informação sobre o pagamento."
449
+
450
+ #: includes/class-wc-pagseguro-gateway.php:562
451
+ msgid "PagSeguro: Payment under review."
452
+ msgstr "PagSeguro: Pagamento em análise."
453
+
454
+ #: includes/class-wc-pagseguro-gateway.php:566
455
+ msgid "PagSeguro: Payment approved."
456
+ msgstr "PagSeguro: Pagamento aprovado."
457
+
458
+ #: includes/class-wc-pagseguro-gateway.php:576
459
+ msgid "PagSeguro: Payment completed and credited to your account."
460
+ msgstr "PagSeguro: Pagamento concluído e creditado na sua conta."
461
+
462
+ #: includes/class-wc-pagseguro-gateway.php:580
463
+ msgid "PagSeguro: Payment came into dispute."
464
+ msgstr "PagSeguro: O pagamento entrou em disputa."
465
+
466
+ #: includes/class-wc-pagseguro-gateway.php:582
467
+ msgid "Payment for order %s came into dispute"
468
+ msgstr "Pagamento do pedido %s entrou em disputa"
469
+
470
+ #: includes/class-wc-pagseguro-gateway.php:583
471
+ msgid "Payment in dispute"
472
+ msgstr "Pagamento em disputa"
473
+
474
+ #: includes/class-wc-pagseguro-gateway.php:584
475
+ msgid ""
476
+ "Order %s has been marked as on-hold, because the payment came into dispute "
477
+ "in PagSeguro."
478
+ msgstr ""
479
+ "O pedido %s mudou de status para aguardando, porque o pagamento entrou em "
480
+ "disputa no PagSeguro."
481
+
482
+ #: includes/class-wc-pagseguro-gateway.php:589
483
+ msgid "PagSeguro: Payment refunded."
484
+ msgstr "PagSeguro: Pagamento devolvido."
485
+
486
+ #: includes/class-wc-pagseguro-gateway.php:591
487
+ msgid "Payment for order %s refunded"
488
+ msgstr "O pagamento do pedido %s foi devolvido"
489
+
490
+ #: includes/class-wc-pagseguro-gateway.php:592
491
+ msgid "Payment refunded"
492
+ msgstr "Pagamento reembolsado"
493
+
494
+ #: includes/class-wc-pagseguro-gateway.php:593
495
+ msgid "Order %s has been marked as refunded by PagSeguro."
496
+ msgstr "O pedido %s mudou de status para reembolsado pelo PagSeguro."
497
+
498
+ #: includes/class-wc-pagseguro-gateway.php:598
499
+ msgid "PagSeguro: Payment canceled."
500
+ msgstr "PagSeguro: Pagamento cancelado."
501
+
502
+ #: includes/views/html-admin-page.php:19
503
+ msgid ""
504
+ "Help us keep the %s plugin free making a %s or rate %s on %s. Thank you in "
505
+ "advance!"
506
+ msgstr ""
507
+ "Ajude-nos a manter o %s gratuito, para isso faça uma %s ou vote %s no %s. "
508
+ "Muito obrigado!"
509
+
510
+ #. #-#-#-#-# woocommerce-pagseguro.pot (WooCommerce PagSeguro 2.10.3) #-#-#-#-#
511
+ #. Plugin Name of the plugin/theme
512
+ #: includes/views/html-admin-page.php:19
513
+ msgid "WooCommerce PagSeguro"
514
+ msgstr "WooCommerce PagSeguro"
515
+
516
+ #: includes/views/html-admin-page.php:19
517
+ msgid "donation"
518
+ msgstr "doação"
519
+
520
+ #: includes/views/html-admin-page.php:19
521
+ msgid "WordPress.org"
522
+ msgstr "WordPress.org"
523
+
524
+ #: includes/views/html-notice-currency-not-supported.php:13
525
+ #: includes/views/html-notice-ecfb-missing.php:20
526
+ #: includes/views/html-notice-email-missing.php:13
527
+ #: includes/views/html-notice-token-missing.php:13
528
+ msgid "PagSeguro Disabled"
529
+ msgstr "PagSeguro Desabilitado"
530
+
531
+ #: includes/views/html-notice-currency-not-supported.php:13
532
+ msgid ""
533
+ "Currency <code>%s</code> is not supported. Works only with Brazilian Real."
534
+ msgstr ""
535
+ "A moeda <code>%s</code> não é suportada. Funciona apenas com Real (BRL)."
536
+
537
+ #: includes/views/html-notice-ecfb-missing.php:20
538
+ msgid "Checkout Transparent requires the latest version of the %s to works."
539
+ msgstr ""
540
+ "Para utilizar o Checkout Transparente é necessário instalar a última versão "
541
+ "do %s."
542
+
543
+ #: includes/views/html-notice-ecfb-missing.php:20
544
+ msgid "Extra Checkout Fields for Brazil"
545
+ msgstr "Extra Checkout Fields for Brazil"
546
+
547
+ #: includes/views/html-notice-email-missing.php:13
548
+ msgid "You should inform your email address. %s"
549
+ msgstr "Você deve informar o seu endereço de email. %s"
550
+
551
+ #: includes/views/html-notice-email-missing.php:13
552
+ #: includes/views/html-notice-token-missing.php:13
553
+ msgid "Click here to configure!"
554
+ msgstr "Clique aqui para configurar!"
555
+
556
+ #: includes/views/html-notice-token-missing.php:13
557
+ msgid "You should inform your token. %s"
558
+ msgstr "Você deve informar o seu token. %s"
559
+
560
+ #: templates/emails/html-instructions.php:15
561
+ #: templates/emails/plain-instructions.php:14
562
+ msgid "Payment"
563
+ msgstr "Pagamento"
564
+
565
+ #: templates/emails/html-instructions.php:19
566
+ #: templates/emails/plain-instructions.php:20
567
+ msgid ""
568
+ "Please use the link below to view your Banking Ticket, you can print and pay "
569
+ "in your internet banking or in a lottery retailer:"
570
+ msgstr ""
571
+ "Por favor, utilize o link abaixo para ver o seu boleto bancário, você pode "
572
+ "imprimi-lo e fazer o pagamento pelo site do seu banco ou por uma casa "
573
+ "lotérica."
574
+
575
+ #: templates/emails/html-instructions.php:19
576
+ #: templates/payment-instructions.php:18
577
+ msgid "Pay the Banking Ticket"
578
+ msgstr "Pagar boleto bancário"
579
+
580
+ #: templates/emails/html-instructions.php:19
581
+ #: templates/emails/plain-instructions.php:28
582
+ #: templates/payment-instructions.php:18
583
+ msgid ""
584
+ "After we receive the ticket payment confirmation, your order will be "
585
+ "processed."
586
+ msgstr ""
587
+ "O seu pedido será processado assim que recebermos a confirmação do pagamento "
588
+ "do seu boleto."
589
+
590
+ #: templates/emails/html-instructions.php:23
591
+ #: templates/emails/plain-instructions.php:32
592
+ msgid "Please use the link below to make the payment in your bankline:"
593
+ msgstr ""
594
+ "Por favor, utilize o link abaixo para realizar o pagamento pelo do seu banco:"
595
+
596
+ #: templates/emails/html-instructions.php:23
597
+ #: templates/payment-instructions.php:24
598
+ msgid "Pay at your bank"
599
+ msgstr "Pagar no seu banco"
600
+
601
+ #: templates/emails/html-instructions.php:23
602
+ #: templates/emails/plain-instructions.php:40
603
+ #: templates/payment-instructions.php:24
604
+ msgid ""
605
+ "After we receive the confirmation from the bank, your order will be "
606
+ "processed."
607
+ msgstr ""
608
+ "O seu pedido será processado assim que recebermos a confirmação do pagamento "
609
+ "pelo seu banco."
610
+
611
+ #: templates/emails/html-instructions.php:27
612
+ #: templates/emails/plain-instructions.php:44
613
+ #: templates/payment-instructions.php:30
614
+ msgid "You just made the payment in %s using the %s."
615
+ msgstr "Você acabou de fazer o pagamento em %s usando %s."
616
+
617
+ #: templates/emails/html-instructions.php:27
618
+ #: templates/emails/plain-instructions.php:48
619
+ #: templates/payment-instructions.php:30
620
+ msgid ""
621
+ "As soon as the credit card operator confirm the payment, your order will be "
622
+ "processed."
623
+ msgstr ""
624
+ "O seu pedido será processado assim que a operadora do seu cartão de crédito "
625
+ "confirmar o pagamento."
626
+
627
+ #: templates/lightbox-checkout.php:15
628
+ msgid ""
629
+ "Thank you for your order, please wait a few seconds to make the payment with "
630
+ "PagSeguro."
631
+ msgstr ""
632
+ "Obrigado pelo seu pedido, por favor, aguarde alguns segundos para fazer o "
633
+ "pagamento com o PagSeguro."
634
+
635
+ #: templates/lightbox-checkout.php:17
636
+ msgid ""
637
+ "Thank you for your order, please click the button below to pay with "
638
+ "PagSeguro."
639
+ msgstr ""
640
+ "Obrigado pelo seu pedido, por favor, clique no botão abaixo para pagar com o "
641
+ "PagSeguro."
642
+
643
+ #: templates/lightbox-checkout.php:19
644
+ msgid "Cancel order &amp; restore cart"
645
+ msgstr "Cancelar pedido &amp; restaurar carrinho"
646
+
647
+ #: templates/payment-instructions.php:18
648
+ msgid "Please click in the following button to view your Banking Ticket."
649
+ msgstr ""
650
+ "Por favor, click no botão a seguir para visualizar o seu boleto bancário."
651
+
652
+ #: templates/payment-instructions.php:18
653
+ msgid ""
654
+ "You can print and pay in your internet banking or in a lottery retailer."
655
+ msgstr ""
656
+ "Você pode imprimi-lo e fazer o pagamento pelo site do seu banco ou por uma "
657
+ "casa lotérica."
658
+
659
+ #: templates/payment-instructions.php:24
660
+ msgid "Please use the following button to make the payment in your bankline."
661
+ msgstr ""
662
+ "Por favor, utilize o botão a seguinte para fazer o pagamento no seu banco."
663
+
664
+ #: templates/transparent-checkout-form.php:36
665
+ msgid "Card Holder Name"
666
+ msgstr "Nome do portador"
667
+
668
+ #: templates/transparent-checkout-form.php:36
669
+ msgid "as recorded on the card"
670
+ msgstr "como gravado no cartão"
671
+
672
+ #: templates/transparent-checkout-form.php:40
673
+ msgid "Card Number"
674
+ msgstr "Número do cartão"
675
+
676
+ #: templates/transparent-checkout-form.php:45
677
+ msgid "Expiry (MM/YYYY)"
678
+ msgstr "Validade (MM/AAAA)"
679
+
680
+ #: templates/transparent-checkout-form.php:46
681
+ msgid "MM / YYYY"
682
+ msgstr "MM / AAAA"
683
+
684
+ #: templates/transparent-checkout-form.php:49
685
+ msgid "Security Code"
686
+ msgstr "Código de segurança"
687
+
688
+ #: templates/transparent-checkout-form.php:50
689
+ msgid "CVC"
690
+ msgstr "CVV"
691
+
692
+ #: templates/transparent-checkout-form.php:54
693
+ msgid "the minimum value of the installment is R$ 5,00"
694
+ msgstr "o valor mínimo da parcela é R$ 5,00"
695
+
696
+ #: templates/transparent-checkout-form.php:60
697
+ msgid "Card Holder CPF"
698
+ msgstr "CPF do portador"
699
+
700
+ #: templates/transparent-checkout-form.php:65
701
+ msgid "Card Holder Birth Date"
702
+ msgstr "Data de nascimento do portador"
703
+
704
+ #: templates/transparent-checkout-form.php:66
705
+ msgid "DD / MM / YYYY"
706
+ msgstr "DD / MM / AAAA"
707
+
708
+ #: templates/transparent-checkout-form.php:69
709
+ msgid "Card Holder Phone"
710
+ msgstr "Telefone do portador"
711
+
712
+ #: templates/transparent-checkout-form.php:70
713
+ msgid "(xx) xxxx-xxxx"
714
+ msgstr "(xx) xxxx-xxxx"
715
+
716
+ #: templates/transparent-checkout-form.php:78
717
+ msgid "Select your bank:"
718
+ msgstr "Selecione o seu banco:"
719
+
720
+ #: templates/transparent-checkout-form.php:80
721
+ msgid "Banco Bradesco"
722
+ msgstr "Banco Bradesco"
723
+
724
+ #: templates/transparent-checkout-form.php:81
725
+ msgid "Banco Ita&uacute;"
726
+ msgstr "Banco Ita&uacute;"
727
+
728
+ #: templates/transparent-checkout-form.php:82
729
+ msgid "Banco do Brasil"
730
+ msgstr "Banco do Brasil"
731
+
732
+ #: templates/transparent-checkout-form.php:83
733
+ msgid "Banco Banrisul"
734
+ msgstr "Banco Banrisul"
735
+
736
+ #: templates/transparent-checkout-form.php:84
737
+ msgid "Banco HSBC"
738
+ msgstr "Banco HSBC"
739
+
740
+ #: templates/transparent-checkout-form.php:86
741
+ msgid ""
742
+ "* After clicking \"Proceed to payment\" you will have access to the link "
743
+ "that will take you to your bank's website, so you can make the payment in "
744
+ "total security."
745
+ msgstr ""
746
+ "* Após clicar em \"Realizar pagamento\" você receberá acesso ao link que o "
747
+ "levará ao site do seu banco, assim é possível realizar o pagamento em total "
748
+ "segurança."
749
+
750
+ #: templates/transparent-checkout-form.php:95
751
+ msgid "The order will be confirmed only after the payment approval."
752
+ msgstr "O pedido será confirmado apenas após a confirmação do pagamento."
753
+
754
+ #: templates/transparent-checkout-form.php:98
755
+ msgid "Tax"
756
+ msgstr "Taxa"
757
+
758
+ #: templates/transparent-checkout-form.php:98
759
+ msgid ""
760
+ "R$ 1,00 (rate applied to cover management risk costs of the payment method)."
761
+ msgstr ""
762
+ "R$ 1,00 (taxa aplicada para cobrir custos de gestão de risco do meio de "
763
+ "pagamento)."
764
+
765
+ #: templates/transparent-checkout-form.php:101
766
+ msgid ""
767
+ "* After clicking \"Proceed to payment\" you will have access to banking "
768
+ "ticket which you can print and pay in your internet banking or in a lottery "
769
+ "retailer."
770
+ msgstr ""
771
+ "* Após clicar em \"Realizar pagamento\" você receberá o seu boleto bancário, "
772
+ "é possível imprimi-lo e pagar pelo site do seu banco ou por uma casa "
773
+ "lotérica."
774
+
775
+ #: woocommerce-pagseguro.php:99
776
+ msgid "Settings"
777
+ msgstr "Configurações"
778
+
779
+ #: woocommerce-pagseguro.php:165
780
+ msgid ""
781
+ "WooCommerce PagSeguro Gateway depends on the last version of %s to work!"
782
+ msgstr ""
783
+ "WooCommerce PagSeguro Gateway depende da última versão do %s para funcionar!"
784
+
785
+ #: woocommerce-pagseguro.php:165
786
+ msgid "WooCommerce"
787
+ msgstr "WooCommerce"
788
+
789
+ #. Plugin URI of the plugin/theme
790
+ msgid "http://github.com/claudiosmweb/woocommerce-pagseguro"
791
+ msgstr "http://github.com/claudiosmweb/woocommerce-pagseguro"
792
+
793
+ #. Description of the plugin/theme
794
+ msgid "Gateway de pagamento PagSeguro para WooCommerce."
795
+ msgstr "Gateway de pagamento PagSeguro para WooCommerce."
796
+
797
+ #. Author of the plugin/theme
798
+ msgid "Claudio Sanches, Gabriel Reguly"
799
+ msgstr "Claudio Sanches, Gabriel Reguly"
800
+
801
+ #. Author URI of the plugin/theme
802
+ msgid "http://claudiosmweb.com/"
803
+ msgstr "http://claudiosmweb.com/"
804
+
805
+ #~ msgid "Documentation"
806
+ #~ msgstr "Documentação"
807
+
808
+ #~ msgid "Support"
809
+ #~ msgstr "Suporte"
810
+
811
+ #~ msgid "Need help? Check the %s or %s."
812
+ #~ msgstr "Precisa de ajuda? Confira a %s ou %s."
813
+
814
+ #~ msgid "official documentation"
815
+ #~ msgstr "documentação oficial"
816
+
817
+ #~ msgid "contact us"
818
+ #~ msgstr "entre em contato conosco"
languages/woocommerce-pagseguro.pot ADDED
@@ -0,0 +1,714 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2015 WooCommerce PagSeguro
2
+ # This file is distributed under the same license as the WooCommerce PagSeguro package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WooCommerce PagSeguro 2.10.3\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/woocommerce-"
7
+ "pagseguro\n"
8
+ "POT-Creation-Date: 2015-08-20 00:50:35+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: 2015-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: includes/class-wc-pagseguro-api.php:128
17
+ #: includes/class-wc-pagseguro-api.php:151
18
+ #: includes/class-wc-pagseguro-gateway.php:241
19
+ #: templates/transparent-checkout-form.php:20
20
+ msgid "Credit Card"
21
+ msgstr ""
22
+
23
+ #: includes/class-wc-pagseguro-api.php:129
24
+ #: includes/class-wc-pagseguro-api.php:152
25
+ msgid "Billet"
26
+ msgstr ""
27
+
28
+ #: includes/class-wc-pagseguro-api.php:130
29
+ #: includes/class-wc-pagseguro-api.php:153
30
+ #: includes/class-wc-pagseguro-gateway.php:247
31
+ #: templates/transparent-checkout-form.php:24
32
+ msgid "Bank Transfer"
33
+ msgstr ""
34
+
35
+ #: includes/class-wc-pagseguro-api.php:131
36
+ #: includes/class-wc-pagseguro-api.php:184
37
+ msgid "PagSeguro credit"
38
+ msgstr ""
39
+
40
+ #: includes/class-wc-pagseguro-api.php:132
41
+ #: includes/class-wc-pagseguro-api.php:185
42
+ msgid "Oi Paggo"
43
+ msgstr ""
44
+
45
+ #: includes/class-wc-pagseguro-api.php:133
46
+ #: includes/class-wc-pagseguro-api.php:186
47
+ msgid "Account deposit"
48
+ msgstr ""
49
+
50
+ #: includes/class-wc-pagseguro-api.php:139
51
+ #: includes/class-wc-pagseguro-api.php:192
52
+ msgid "Unknown"
53
+ msgstr ""
54
+
55
+ #: includes/class-wc-pagseguro-api.php:236
56
+ msgid ""
57
+ "Please enter with a valid phone number with DDD. Example: (11) 5555-5555."
58
+ msgstr ""
59
+
60
+ #: includes/class-wc-pagseguro-api.php:243
61
+ msgid "Please enter with a valid zip code number."
62
+ msgstr ""
63
+
64
+ #: includes/class-wc-pagseguro-api.php:246
65
+ msgid "Please enter with a valid CPF number."
66
+ msgstr ""
67
+
68
+ #: includes/class-wc-pagseguro-api.php:250
69
+ msgid "Please select a bank to make payment by bank transfer."
70
+ msgstr ""
71
+
72
+ #: includes/class-wc-pagseguro-api.php:253
73
+ msgid "Credit card holder CPF is required."
74
+ msgstr ""
75
+
76
+ #: includes/class-wc-pagseguro-api.php:256
77
+ msgid "Credit card holder birthdate is required."
78
+ msgstr ""
79
+
80
+ #: includes/class-wc-pagseguro-api.php:259
81
+ msgid "Credit card holder name is required."
82
+ msgstr ""
83
+
84
+ #: includes/class-wc-pagseguro-api.php:263
85
+ msgid "Credit card holder phone is required."
86
+ msgstr ""
87
+
88
+ #: includes/class-wc-pagseguro-api.php:267
89
+ msgid ""
90
+ "The address complement is too long, it cannot be more than 40 characters."
91
+ msgstr ""
92
+
93
+ #: includes/class-wc-pagseguro-api.php:270
94
+ msgid "<strong>Neighborhood</strong> is a required field."
95
+ msgstr ""
96
+
97
+ #: includes/class-wc-pagseguro-api.php:273
98
+ msgid "Credit card holder CPF invalid."
99
+ msgstr ""
100
+
101
+ #: includes/class-wc-pagseguro-api.php:276
102
+ msgid ""
103
+ "Invalid email domain. You must use an email @sandbox.pagseguro.com.br while "
104
+ "you are using the PagSeguro Sandbox."
105
+ msgstr ""
106
+
107
+ #: includes/class-wc-pagseguro-api.php:280
108
+ msgid ""
109
+ "An error has occurred while processing your payment, please review your data "
110
+ "and try again. Or contact us for assistance."
111
+ msgstr ""
112
+
113
+ #: includes/class-wc-pagseguro-api.php:391
114
+ msgid "Order %s"
115
+ msgstr ""
116
+
117
+ #: includes/class-wc-pagseguro-api.php:583
118
+ msgid ""
119
+ "Too bad! The email or token from the PagSeguro are invalids my little friend!"
120
+ msgstr ""
121
+
122
+ #: includes/class-wc-pagseguro-api.php:619
123
+ #: includes/class-wc-pagseguro-api.php:638
124
+ #: includes/class-wc-pagseguro-api.php:660
125
+ #: includes/class-wc-pagseguro-api.php:719
126
+ #: includes/class-wc-pagseguro-api.php:738
127
+ #: includes/class-wc-pagseguro-gateway.php:15
128
+ #: includes/class-wc-pagseguro-gateway.php:201
129
+ msgid "PagSeguro"
130
+ msgstr ""
131
+
132
+ #: includes/class-wc-pagseguro-api.php:638
133
+ #: includes/class-wc-pagseguro-api.php:738
134
+ msgid ""
135
+ "An error has occurred while processing your payment, please try again. Or "
136
+ "contact us for assistance."
137
+ msgstr ""
138
+
139
+ #: includes/class-wc-pagseguro-api.php:660
140
+ msgid "Please, select a payment method."
141
+ msgstr ""
142
+
143
+ #: includes/class-wc-pagseguro-api.php:686
144
+ msgid ""
145
+ "You are not allowed to use the PagSeguro Transparent Checkout. Looks like "
146
+ "you neglected to installation guide of this plugin. This is not pretty, do "
147
+ "you know?"
148
+ msgstr ""
149
+
150
+ #: includes/class-wc-pagseguro-gateway.php:16
151
+ msgid ""
152
+ "Accept payments by credit card, bank debit or banking ticket using the "
153
+ "PagSeguro."
154
+ msgstr ""
155
+
156
+ #: includes/class-wc-pagseguro-gateway.php:17
157
+ msgid "Proceed to payment"
158
+ msgstr ""
159
+
160
+ #: includes/class-wc-pagseguro-gateway.php:160
161
+ msgid "interest free"
162
+ msgstr ""
163
+
164
+ #: includes/class-wc-pagseguro-gateway.php:161
165
+ msgid "Invalid credit card number."
166
+ msgstr ""
167
+
168
+ #: includes/class-wc-pagseguro-gateway.php:162
169
+ msgid "Invalid expiry date, please use the MM / YYYY date format."
170
+ msgstr ""
171
+
172
+ #: includes/class-wc-pagseguro-gateway.php:163
173
+ msgid "Please check the expiry date and use a valid format as MM / YYYY."
174
+ msgstr ""
175
+
176
+ #: includes/class-wc-pagseguro-gateway.php:164
177
+ msgid ""
178
+ "Unable to process the data from your credit card on the PagSeguro, please "
179
+ "try again or contact us for assistance."
180
+ msgstr ""
181
+
182
+ #: includes/class-wc-pagseguro-gateway.php:165
183
+ msgid "Select a number of installments."
184
+ msgstr ""
185
+
186
+ #: includes/class-wc-pagseguro-gateway.php:179
187
+ msgid "System Status &gt; Logs"
188
+ msgstr ""
189
+
190
+ #: includes/class-wc-pagseguro-gateway.php:191
191
+ msgid "Enable/Disable"
192
+ msgstr ""
193
+
194
+ #: includes/class-wc-pagseguro-gateway.php:193
195
+ msgid "Enable PagSeguro"
196
+ msgstr ""
197
+
198
+ #: includes/class-wc-pagseguro-gateway.php:197
199
+ msgid "Title"
200
+ msgstr ""
201
+
202
+ #: includes/class-wc-pagseguro-gateway.php:199
203
+ msgid "This controls the title which the user sees during checkout."
204
+ msgstr ""
205
+
206
+ #: includes/class-wc-pagseguro-gateway.php:204
207
+ msgid "Description"
208
+ msgstr ""
209
+
210
+ #: includes/class-wc-pagseguro-gateway.php:206
211
+ msgid "This controls the description which the user sees during checkout."
212
+ msgstr ""
213
+
214
+ #: includes/class-wc-pagseguro-gateway.php:207
215
+ #: templates/lightbox-checkout.php:19
216
+ msgid "Pay via PagSeguro"
217
+ msgstr ""
218
+
219
+ #: includes/class-wc-pagseguro-gateway.php:210
220
+ msgid "PagSeguro Email"
221
+ msgstr ""
222
+
223
+ #: includes/class-wc-pagseguro-gateway.php:212
224
+ msgid ""
225
+ "Please enter your PagSeguro email address. This is needed in order to take "
226
+ "payment."
227
+ msgstr ""
228
+
229
+ #: includes/class-wc-pagseguro-gateway.php:217
230
+ msgid "PagSeguro Token"
231
+ msgstr ""
232
+
233
+ #: includes/class-wc-pagseguro-gateway.php:219
234
+ msgid ""
235
+ "Please enter your PagSeguro token. This is needed to process the payment and "
236
+ "notifications. Is possible generate a new token %s."
237
+ msgstr ""
238
+
239
+ #: includes/class-wc-pagseguro-gateway.php:219
240
+ msgid "here"
241
+ msgstr ""
242
+
243
+ #: includes/class-wc-pagseguro-gateway.php:223
244
+ msgid "Integration method"
245
+ msgstr ""
246
+
247
+ #: includes/class-wc-pagseguro-gateway.php:225
248
+ msgid ""
249
+ "Choose how the customer will interact with the PagSeguro. Redirect (Client "
250
+ "goes to PagSeguro page) or Lightbox (Inside your store)"
251
+ msgstr ""
252
+
253
+ #: includes/class-wc-pagseguro-gateway.php:230
254
+ msgid "Redirect (default)"
255
+ msgstr ""
256
+
257
+ #: includes/class-wc-pagseguro-gateway.php:231
258
+ msgid "Lightbox"
259
+ msgstr ""
260
+
261
+ #: includes/class-wc-pagseguro-gateway.php:232
262
+ msgid "Transparent Checkout"
263
+ msgstr ""
264
+
265
+ #: includes/class-wc-pagseguro-gateway.php:236
266
+ msgid "Transparent Checkout Options"
267
+ msgstr ""
268
+
269
+ #: includes/class-wc-pagseguro-gateway.php:243
270
+ msgid "Enable Credit Card for Transparente Checkout"
271
+ msgstr ""
272
+
273
+ #: includes/class-wc-pagseguro-gateway.php:249
274
+ msgid "Enable Bank Transfer for Transparente Checkout"
275
+ msgstr ""
276
+
277
+ #: includes/class-wc-pagseguro-gateway.php:253
278
+ #: templates/transparent-checkout-form.php:28
279
+ msgid "Banking Ticket"
280
+ msgstr ""
281
+
282
+ #: includes/class-wc-pagseguro-gateway.php:255
283
+ msgid "Enable Banking Ticket for Transparente Checkout"
284
+ msgstr ""
285
+
286
+ #: includes/class-wc-pagseguro-gateway.php:259
287
+ msgid "Banking Ticket Tax Message"
288
+ msgstr ""
289
+
290
+ #: includes/class-wc-pagseguro-gateway.php:261
291
+ msgid ""
292
+ "Display a message alerting the customer that will be charged R$ 1,00 for "
293
+ "payment by Banking Ticket"
294
+ msgstr ""
295
+
296
+ #: includes/class-wc-pagseguro-gateway.php:265
297
+ msgid "Integration Behavior"
298
+ msgstr ""
299
+
300
+ #: includes/class-wc-pagseguro-gateway.php:270
301
+ msgid "Send only the order total"
302
+ msgstr ""
303
+
304
+ #: includes/class-wc-pagseguro-gateway.php:272
305
+ msgid ""
306
+ "If this option is enabled will only send the order total, not the list of "
307
+ "items."
308
+ msgstr ""
309
+
310
+ #: includes/class-wc-pagseguro-gateway.php:276
311
+ msgid "Invoice Prefix"
312
+ msgstr ""
313
+
314
+ #: includes/class-wc-pagseguro-gateway.php:278
315
+ msgid ""
316
+ "Please enter a prefix for your invoice numbers. If you use your PagSeguro "
317
+ "account for multiple stores ensure this prefix is unqiue as PagSeguro will "
318
+ "not allow orders with the same invoice number."
319
+ msgstr ""
320
+
321
+ #: includes/class-wc-pagseguro-gateway.php:283
322
+ msgid "Gateway Testing"
323
+ msgstr ""
324
+
325
+ #: includes/class-wc-pagseguro-gateway.php:288
326
+ #: includes/class-wc-pagseguro-gateway.php:292
327
+ msgid "PagSeguro Sandbox"
328
+ msgstr ""
329
+
330
+ #: includes/class-wc-pagseguro-gateway.php:290
331
+ msgid "Enable PagSeguro Sandbox"
332
+ msgstr ""
333
+
334
+ #: includes/class-wc-pagseguro-gateway.php:292
335
+ msgid ""
336
+ "PagSeguro Sandbox can be used to test the payments. <strong>Note:</strong> "
337
+ "you must use the development token that can be found in %s."
338
+ msgstr ""
339
+
340
+ #: includes/class-wc-pagseguro-gateway.php:295
341
+ msgid "Debug Log"
342
+ msgstr ""
343
+
344
+ #: includes/class-wc-pagseguro-gateway.php:297
345
+ msgid "Enable logging"
346
+ msgstr ""
347
+
348
+ #: includes/class-wc-pagseguro-gateway.php:299
349
+ msgid "Log PagSeguro events, such as API requests, inside %s"
350
+ msgstr ""
351
+
352
+ #: includes/class-wc-pagseguro-gateway.php:446
353
+ msgid "Click to try again"
354
+ msgstr ""
355
+
356
+ #: includes/class-wc-pagseguro-gateway.php:465
357
+ msgid "PagSeguro Request Unauthorized"
358
+ msgstr ""
359
+
360
+ #: includes/class-wc-pagseguro-gateway.php:500
361
+ msgid "PagSeguro Transaction ID"
362
+ msgstr ""
363
+
364
+ #: includes/class-wc-pagseguro-gateway.php:507
365
+ msgid "Payer email"
366
+ msgstr ""
367
+
368
+ #: includes/class-wc-pagseguro-gateway.php:514
369
+ msgid "Payer name"
370
+ msgstr ""
371
+
372
+ #: includes/class-wc-pagseguro-gateway.php:522
373
+ msgid "Payment type"
374
+ msgstr ""
375
+
376
+ #: includes/class-wc-pagseguro-gateway.php:530
377
+ msgid "Payment method"
378
+ msgstr ""
379
+
380
+ #: includes/class-wc-pagseguro-gateway.php:538
381
+ #: templates/transparent-checkout-form.php:54
382
+ msgid "Installments"
383
+ msgstr ""
384
+
385
+ #: includes/class-wc-pagseguro-gateway.php:546
386
+ msgid "Payment url"
387
+ msgstr ""
388
+
389
+ #: includes/class-wc-pagseguro-gateway.php:558
390
+ msgid ""
391
+ "PagSeguro: The buyer initiated the transaction, but so far the PagSeguro not "
392
+ "received any payment information."
393
+ msgstr ""
394
+
395
+ #: includes/class-wc-pagseguro-gateway.php:562
396
+ msgid "PagSeguro: Payment under review."
397
+ msgstr ""
398
+
399
+ #: includes/class-wc-pagseguro-gateway.php:566
400
+ msgid "PagSeguro: Payment approved."
401
+ msgstr ""
402
+
403
+ #: includes/class-wc-pagseguro-gateway.php:576
404
+ msgid "PagSeguro: Payment completed and credited to your account."
405
+ msgstr ""
406
+
407
+ #: includes/class-wc-pagseguro-gateway.php:580
408
+ msgid "PagSeguro: Payment came into dispute."
409
+ msgstr ""
410
+
411
+ #: includes/class-wc-pagseguro-gateway.php:582
412
+ msgid "Payment for order %s came into dispute"
413
+ msgstr ""
414
+
415
+ #: includes/class-wc-pagseguro-gateway.php:583
416
+ msgid "Payment in dispute"
417
+ msgstr ""
418
+
419
+ #: includes/class-wc-pagseguro-gateway.php:584
420
+ msgid ""
421
+ "Order %s has been marked as on-hold, because the payment came into dispute "
422
+ "in PagSeguro."
423
+ msgstr ""
424
+
425
+ #: includes/class-wc-pagseguro-gateway.php:589
426
+ msgid "PagSeguro: Payment refunded."
427
+ msgstr ""
428
+
429
+ #: includes/class-wc-pagseguro-gateway.php:591
430
+ msgid "Payment for order %s refunded"
431
+ msgstr ""
432
+
433
+ #: includes/class-wc-pagseguro-gateway.php:592
434
+ msgid "Payment refunded"
435
+ msgstr ""
436
+
437
+ #: includes/class-wc-pagseguro-gateway.php:593
438
+ msgid "Order %s has been marked as refunded by PagSeguro."
439
+ msgstr ""
440
+
441
+ #: includes/class-wc-pagseguro-gateway.php:598
442
+ msgid "PagSeguro: Payment canceled."
443
+ msgstr ""
444
+
445
+ #: includes/views/html-admin-page.php:19
446
+ msgid ""
447
+ "Help us keep the %s plugin free making a %s or rate %s on %s. Thank you in "
448
+ "advance!"
449
+ msgstr ""
450
+
451
+ #. #-#-#-#-# woocommerce-pagseguro.pot (WooCommerce PagSeguro 2.10.3) #-#-#-#-#
452
+ #. Plugin Name of the plugin/theme
453
+ #: includes/views/html-admin-page.php:19
454
+ msgid "WooCommerce PagSeguro"
455
+ msgstr ""
456
+
457
+ #: includes/views/html-admin-page.php:19
458
+ msgid "donation"
459
+ msgstr ""
460
+
461
+ #: includes/views/html-admin-page.php:19
462
+ msgid "WordPress.org"
463
+ msgstr ""
464
+
465
+ #: includes/views/html-notice-currency-not-supported.php:13
466
+ #: includes/views/html-notice-ecfb-missing.php:20
467
+ #: includes/views/html-notice-email-missing.php:13
468
+ #: includes/views/html-notice-token-missing.php:13
469
+ msgid "PagSeguro Disabled"
470
+ msgstr ""
471
+
472
+ #: includes/views/html-notice-currency-not-supported.php:13
473
+ msgid ""
474
+ "Currency <code>%s</code> is not supported. Works only with Brazilian Real."
475
+ msgstr ""
476
+
477
+ #: includes/views/html-notice-ecfb-missing.php:20
478
+ msgid "Checkout Transparent requires the latest version of the %s to works."
479
+ msgstr ""
480
+
481
+ #: includes/views/html-notice-ecfb-missing.php:20
482
+ msgid "Extra Checkout Fields for Brazil"
483
+ msgstr ""
484
+
485
+ #: includes/views/html-notice-email-missing.php:13
486
+ msgid "You should inform your email address. %s"
487
+ msgstr ""
488
+
489
+ #: includes/views/html-notice-email-missing.php:13
490
+ #: includes/views/html-notice-token-missing.php:13
491
+ msgid "Click here to configure!"
492
+ msgstr ""
493
+
494
+ #: includes/views/html-notice-token-missing.php:13
495
+ msgid "You should inform your token. %s"
496
+ msgstr ""
497
+
498
+ #: templates/emails/html-instructions.php:15
499
+ #: templates/emails/plain-instructions.php:14
500
+ msgid "Payment"
501
+ msgstr ""
502
+
503
+ #: templates/emails/html-instructions.php:19
504
+ #: templates/emails/plain-instructions.php:20
505
+ msgid ""
506
+ "Please use the link below to view your Banking Ticket, you can print and pay "
507
+ "in your internet banking or in a lottery retailer:"
508
+ msgstr ""
509
+
510
+ #: templates/emails/html-instructions.php:19
511
+ #: templates/payment-instructions.php:18
512
+ msgid "Pay the Banking Ticket"
513
+ msgstr ""
514
+
515
+ #: templates/emails/html-instructions.php:19
516
+ #: templates/emails/plain-instructions.php:28
517
+ #: templates/payment-instructions.php:18
518
+ msgid ""
519
+ "After we receive the ticket payment confirmation, your order will be "
520
+ "processed."
521
+ msgstr ""
522
+
523
+ #: templates/emails/html-instructions.php:23
524
+ #: templates/emails/plain-instructions.php:32
525
+ msgid "Please use the link below to make the payment in your bankline:"
526
+ msgstr ""
527
+
528
+ #: templates/emails/html-instructions.php:23
529
+ #: templates/payment-instructions.php:24
530
+ msgid "Pay at your bank"
531
+ msgstr ""
532
+
533
+ #: templates/emails/html-instructions.php:23
534
+ #: templates/emails/plain-instructions.php:40
535
+ #: templates/payment-instructions.php:24
536
+ msgid ""
537
+ "After we receive the confirmation from the bank, your order will be "
538
+ "processed."
539
+ msgstr ""
540
+
541
+ #: templates/emails/html-instructions.php:27
542
+ #: templates/emails/plain-instructions.php:44
543
+ #: templates/payment-instructions.php:30
544
+ msgid "You just made the payment in %s using the %s."
545
+ msgstr ""
546
+
547
+ #: templates/emails/html-instructions.php:27
548
+ #: templates/emails/plain-instructions.php:48
549
+ #: templates/payment-instructions.php:30
550
+ msgid ""
551
+ "As soon as the credit card operator confirm the payment, your order will be "
552
+ "processed."
553
+ msgstr ""
554
+
555
+ #: templates/lightbox-checkout.php:15
556
+ msgid ""
557
+ "Thank you for your order, please wait a few seconds to make the payment with "
558
+ "PagSeguro."
559
+ msgstr ""
560
+
561
+ #: templates/lightbox-checkout.php:17
562
+ msgid ""
563
+ "Thank you for your order, please click the button below to pay with "
564
+ "PagSeguro."
565
+ msgstr ""
566
+
567
+ #: templates/lightbox-checkout.php:19
568
+ msgid "Cancel order &amp; restore cart"
569
+ msgstr ""
570
+
571
+ #: templates/payment-instructions.php:18
572
+ msgid "Please click in the following button to view your Banking Ticket."
573
+ msgstr ""
574
+
575
+ #: templates/payment-instructions.php:18
576
+ msgid ""
577
+ "You can print and pay in your internet banking or in a lottery retailer."
578
+ msgstr ""
579
+
580
+ #: templates/payment-instructions.php:24
581
+ msgid "Please use the following button to make the payment in your bankline."
582
+ msgstr ""
583
+
584
+ #: templates/transparent-checkout-form.php:36
585
+ msgid "Card Holder Name"
586
+ msgstr ""
587
+
588
+ #: templates/transparent-checkout-form.php:36
589
+ msgid "as recorded on the card"
590
+ msgstr ""
591
+
592
+ #: templates/transparent-checkout-form.php:40
593
+ msgid "Card Number"
594
+ msgstr ""
595
+
596
+ #: templates/transparent-checkout-form.php:45
597
+ msgid "Expiry (MM/YYYY)"
598
+ msgstr ""
599
+
600
+ #: templates/transparent-checkout-form.php:46
601
+ msgid "MM / YYYY"
602
+ msgstr ""
603
+
604
+ #: templates/transparent-checkout-form.php:49
605
+ msgid "Security Code"
606
+ msgstr ""
607
+
608
+ #: templates/transparent-checkout-form.php:50
609
+ msgid "CVC"
610
+ msgstr ""
611
+
612
+ #: templates/transparent-checkout-form.php:54
613
+ msgid "the minimum value of the installment is R$ 5,00"
614
+ msgstr ""
615
+
616
+ #: templates/transparent-checkout-form.php:60
617
+ msgid "Card Holder CPF"
618
+ msgstr ""
619
+
620
+ #: templates/transparent-checkout-form.php:65
621
+ msgid "Card Holder Birth Date"
622
+ msgstr ""
623
+
624
+ #: templates/transparent-checkout-form.php:66
625
+ msgid "DD / MM / YYYY"
626
+ msgstr ""
627
+
628
+ #: templates/transparent-checkout-form.php:69
629
+ msgid "Card Holder Phone"
630
+ msgstr ""
631
+
632
+ #: templates/transparent-checkout-form.php:70
633
+ msgid "(xx) xxxx-xxxx"
634
+ msgstr ""
635
+
636
+ #: templates/transparent-checkout-form.php:78
637
+ msgid "Select your bank:"
638
+ msgstr ""
639
+
640
+ #: templates/transparent-checkout-form.php:80
641
+ msgid "Banco Bradesco"
642
+ msgstr ""
643
+
644
+ #: templates/transparent-checkout-form.php:81
645
+ msgid "Banco Ita&uacute;"
646
+ msgstr ""
647
+
648
+ #: templates/transparent-checkout-form.php:82
649
+ msgid "Banco do Brasil"
650
+ msgstr ""
651
+
652
+ #: templates/transparent-checkout-form.php:83
653
+ msgid "Banco Banrisul"
654
+ msgstr ""
655
+
656
+ #: templates/transparent-checkout-form.php:84
657
+ msgid "Banco HSBC"
658
+ msgstr ""
659
+
660
+ #: templates/transparent-checkout-form.php:86
661
+ msgid ""
662
+ "* After clicking \"Proceed to payment\" you will have access to the link "
663
+ "that will take you to your bank's website, so you can make the payment in "
664
+ "total security."
665
+ msgstr ""
666
+
667
+ #: templates/transparent-checkout-form.php:95
668
+ msgid "The order will be confirmed only after the payment approval."
669
+ msgstr ""
670
+
671
+ #: templates/transparent-checkout-form.php:98
672
+ msgid "Tax"
673
+ msgstr ""
674
+
675
+ #: templates/transparent-checkout-form.php:98
676
+ msgid ""
677
+ "R$ 1,00 (rate applied to cover management risk costs of the payment method)."
678
+ msgstr ""
679
+
680
+ #: templates/transparent-checkout-form.php:101
681
+ msgid ""
682
+ "* After clicking \"Proceed to payment\" you will have access to banking "
683
+ "ticket which you can print and pay in your internet banking or in a lottery "
684
+ "retailer."
685
+ msgstr ""
686
+
687
+ #: woocommerce-pagseguro.php:99
688
+ msgid "Settings"
689
+ msgstr ""
690
+
691
+ #: woocommerce-pagseguro.php:165
692
+ msgid ""
693
+ "WooCommerce PagSeguro Gateway depends on the last version of %s to work!"
694
+ msgstr ""
695
+
696
+ #: woocommerce-pagseguro.php:165
697
+ msgid "WooCommerce"
698
+ msgstr ""
699
+
700
+ #. Plugin URI of the plugin/theme
701
+ msgid "http://github.com/claudiosmweb/woocommerce-pagseguro"
702
+ msgstr ""
703
+
704
+ #. Description of the plugin/theme
705
+ msgid "Gateway de pagamento PagSeguro para WooCommerce."
706
+ msgstr ""
707
+
708
+ #. Author of the plugin/theme
709
+ msgid "Claudio Sanches, Gabriel Reguly"
710
+ msgstr ""
711
+
712
+ #. Author URI of the plugin/theme
713
+ msgid "http://claudiosmweb.com/"
714
+ msgstr ""
readme.txt ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WooCommerce PagSeguro ===
2
+ Contributors: claudiosanches, Gabriel Reguly
3
+ Donate link: http://claudiosmweb.com/doacoes/
4
+ Tags: woocommerce, pagseguro, payment
5
+ Requires at least: 4.0
6
+ Tested up to: 4.3
7
+ Stable tag: 2.10.3
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Adds PagSeguro gateway to the WooCommerce plugin
12
+
13
+ == Description ==
14
+
15
+ ### Add PagSeguro gateway to WooCommerce ###
16
+
17
+ This plugin adds PagSeguro gateway to WooCommerce.
18
+
19
+ Please notice that WooCommerce must be installed and active.
20
+
21
+ = Contribute =
22
+
23
+ You can contribute to the source code in our [GitHub](https://github.com/claudiosmweb/woocommerce-pagseguro) page.
24
+
25
+ ### Descrição em Português: ###
26
+
27
+ Adicione o PagSeguro como método de pagamento em sua loja WooCommerce.
28
+
29
+ [PagSeguro](https://pagseguro.uol.com.br/) é um método de pagamento brasileiro desenvolvido pela UOL.
30
+
31
+ O plugin WooCommerce PagSeguro foi desenvolvido sem nenhum incentivo do PagSeguro ou da UOL. Nenhum dos desenvolvedores deste plugin possuem vínculos com estas duas empresas.
32
+
33
+ Este plugin foi desenvolvido a partir da [documentação oficial do PagSeguro](https://pagseguro.uol.com.br/v2/guia-de-integracao/visao-geral.html) e utiliza a última versão da API de pagamentos.
34
+
35
+ Estão disponíveis as seguintes modalidades de pagamento:
36
+
37
+ - **Padrão:** Cliente é redirecionado ao PagSeguro para concluir a compra.
38
+ - **Lightbox:** Uma janela do PagSeguro é aberta na finalização para o cliente fazer o pagamento.
39
+ - **Transparente:** O cliente faz o pagamento direto no seu site sem precisar ir ao site do PagSeguro.
40
+
41
+ Além que é possível utilizar o novo [sandbox do PagSeguro](https://sandbox.pagseguro.uol.com.br/comprador-de-testes.html).
42
+
43
+ = Compatibilidade =
44
+
45
+ Compatível com as versões 2.1.x, 2.2.x, 2.3.x e 2.4.x do WooCommerce.
46
+
47
+ Este plugin também é compatível com o [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/), desta forma é possível enviar os campos de "CPF", "número do endereço" e "bairro" (para o Checkout Transparente é obrigatório o uso deste plugin).
48
+
49
+ = Instalação =
50
+
51
+ Confira o nosso guia de instalação e configuração do PagSeguro na aba [Installation](http://wordpress.org/plugins/woocommerce-pagseguro/installation/).
52
+
53
+ = Integração =
54
+
55
+ Este plugin funciona perfeitamente em conjunto com:
56
+
57
+ * [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/).
58
+ * [WooCommerce Multilingual](https://wordpress.org/plugins/woocommerce-multilingual/).
59
+
60
+ = Dúvidas? =
61
+
62
+ Você pode esclarecer suas dúvidas usando:
63
+
64
+ * A nossa sessão de [FAQ](http://wordpress.org/plugins/woocommerce-pagseguro/faq/).
65
+ * Utilizando o nosso [fórum no Github](https://github.com/claudiosmweb/woocommerce-pagseguro).
66
+ * Criando um tópico no [fórum de ajuda do WordPress](http://wordpress.org/support/plugin/woocommerce-pagseguro).
67
+
68
+ = Coloborar =
69
+
70
+ Você pode contribuir com código-fonte em nossa página no [GitHub](https://github.com/claudiosmweb/woocommerce-pagseguro).
71
+
72
+ = Agradecimentos =
73
+
74
+ * [Leandro Matos](http://is-uz.com/) ajudou com o layout e os ícones do Checkout Transparente.
75
+
76
+ == Installation ==
77
+
78
+ * Upload plugin files to your plugins folder, or install using WordPress built-in Add New Plugin installer;
79
+ * Activate the plugin;
80
+ * Navigate to WooCommerce -> Settings -> Payment Gateways, choose PagSeguro and fill in your PagSeguro Email and Token.
81
+
82
+ ### Instalação e configuração em Português: ###
83
+
84
+ = Instalação do plugin: =
85
+
86
+ * Envie os arquivos do plugin para a pasta wp-content/plugins, ou instale usando o instalador de plugins do WordPress.
87
+ * Ative o plugin.
88
+
89
+ = Requerimentos: =
90
+
91
+ É necessário possuir uma conta no [PagSeguro](http://pagseguro.uol.com.br/) e ter instalado o [WooCommerce](http://wordpress.org/plugins/woocommerce/).
92
+
93
+ = Configurações no PagSeguro: =
94
+
95
+ No PagSeguro basta aceitar receber pagamentos apenas pela **API**.
96
+
97
+ Você deve ativar esta opção em "Integrações" > "[Pagamentos via API](https://pagseguro.uol.com.br/integracao/pagamentos-via-api.jhtml)".
98
+
99
+ Apenas com isso já é possível receber os pagamentos e fazer o retorno automático de dados.
100
+
101
+ = Configurações do Plugin: =
102
+
103
+ Com o plugin instalado acesse o admin do WordPress e entre em "WooCommerce" > "Configurações" > "Finalizar compra" > "PagSeguro".
104
+
105
+ Habilite o PagSeguro, adicione o seu e-mail e o token do PagSeguro. O token é utilizado para gerar os pagamentos e fazer o retorno de dados.
106
+
107
+ Você pode conseguir um token no PagSeguro em "Integrações" > "[Token de Segurança](https://pagseguro.uol.com.br/integracao/token-de-seguranca.jhtml)".
108
+
109
+ É possível escolher entre três opções de pagamento que são:
110
+
111
+ - **Checkout no PagSeguro (padrão):** O cliente e redirecionado para o site do PagSeguro
112
+ - **Checkout em Lighbox:** O cliente permance no seu site é aberto um Lightbox do PagSeguro onde o cliente fará o pagamento
113
+ - **Checkout Transparente:** O cliente faz o pagamento direto em seu site na página de finalizar pedido utilizando a API do PagSeguro.
114
+
115
+ Você ainda pode definir o comportamento da integração utilizando as opções:
116
+
117
+ - **Enviar apenas o total do pedido:** Permite enviar apenas o total do pedido no lugar da lista de itens, esta opção deve ser utilizada apenas quando o total do pedido no WooCommerce esta ficando diferente do total no PagSeguro.
118
+ - **Prefixo de pedido:** Esta opção é útil quando você esta utilizando a mesma conta do PagSeguro em várias lojas e com isso você pode diferenciar os pagamentos pelo prefixo.
119
+
120
+ = Checkout Transparente =
121
+
122
+ Para utilizar o checkout transparente é necessário utilizar o plugin [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/).
123
+
124
+ Com o **WooCommerce Extra Checkout Fields for Brazil** instalado e ativado você deve ir até "WooCommerce > Campos do Checkout" e configurar a opção "Exibir Tipo de Pessoa" como "Pessoa Fisíca apenas".
125
+
126
+ Isto é necessário porque é obrigatório o envio de CPF para o PagSeguro, além de que o PagSeguro aceita apenas CPF.
127
+
128
+ Note que é necessário aprovação do PagSeguro para utilizar o Checkout Transparente, saiba mais em "[Como receber pagamentos pelo PagSeguro](https://pagseguro.uol.com.br/receba-pagamentos.jhtml)".
129
+
130
+ Pronto, sua loja já pode receber pagamentos pelo PagSeguro.
131
+
132
+ == Frequently Asked Questions ==
133
+
134
+ = What is the plugin license? =
135
+
136
+ * This plugin is released under a GPL license.
137
+
138
+ = What is needed to use this plugin? =
139
+
140
+ * WooCommerce version 2.1 or latter installed and active.
141
+ * Only one account on [PagSeguro](http://pagseguro.uol.com.br/ "PagSeguro").
142
+
143
+ ### FAQ em Português: ###
144
+
145
+ = Qual é a licença do plugin? =
146
+
147
+ Este plugin esta licenciado como GPL.
148
+
149
+ = O que eu preciso para utilizar este plugin? =
150
+
151
+ * Ter instalado o plugin WooCommerce 2.1 ou superior.
152
+ * Possuir uma conta no PagSeguro.
153
+ * Gerar um token de segurança no PagSeguro.
154
+ * Ativar os pagamentos via API.
155
+ * Utilizar uma das duas opções de configuração no PagSeguro (veja elas no guia de [instalação do plugin](http://wordpress.org/plugins/woocommerce-pagseguro/installation/)).
156
+
157
+ = Como funciona o PagSeguro? =
158
+
159
+ * Saiba mais em [PagSeguro - Como funciona](https://pagseguro.uol.com.br/para_seu_negocio/como_funciona.jhtml).
160
+ * Ou acesse a [FAQ do PagSeguro](https://pagseguro.uol.com.br/atendimento/perguntas_frequentes.jhtml).
161
+
162
+ = PagSeguro recebe pagamentos de quais países? =
163
+
164
+ No momento o PagSeguro recebe pagamentos apenas do Brasil.
165
+
166
+ Configuramos o plugin para receber pagamentos apenas de usuários que selecionarem o Brasil nas informações de pagamento durante o checkout.
167
+
168
+ = Quais são os meios de pagamento que o plugin aceita? =
169
+
170
+ São aceitos todos os meios de pagamentos que o PagSeguro disponibiliza.
171
+ Entretanto você precisa ativa-los na sua conta no PagSeguro.
172
+
173
+ Confira os meios de pagamento em [PagSeguro - Meios de Pagamento e Parcelamento](https://pagseguro.uol.com.br/para_voce/meios_de_pagamento_e_parcelamento.jhtml#rmcl).
174
+
175
+ = Quais são as taxas de transações que o PagSeguro cobra? =
176
+
177
+ Para estas informações consulte: [PagSeguro - Taxas e Tarifas](https://pagseguro.uol.com.br/taxas_e_tarifas.jhtml).
178
+
179
+ = Quais são os limites de recebimento do PagSeguro? =
180
+
181
+ Consulte: [PagSeguro - Tabela de Limites](https://pagseguro.uol.com.br/account/limits.jhtml).
182
+
183
+ = Como que plugin faz integração com PagSeguro? =
184
+
185
+ Fazemos a integração baseada na documentação oficial do PagSeguro que pode ser encontrada em "[Guia de integração - PagSeguro](https://pagseguro.uol.com.br/v2/guia-de-integracao/visao-geral.html)" utilizando a última versão da API de pagamentos.
186
+
187
+ = Instalei o plugin, mas a opção de pagamento do PagSeguro some durante o checkout. O que fiz de errado? =
188
+
189
+ Você esqueceu de selecionar o Brasil durante o cadastro no checkout.
190
+ A opção de pagamento pelo PagSeguro funciona apenas com o Brasil.
191
+
192
+ = É possível enviar os dados de "Número", "Bairro" e "CPF" para o PagSeguro? =
193
+
194
+ Sim é possível, basta utilizar o plugin [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/).
195
+
196
+ = O pedido foi pago e ficou com o status de "processando" e não como "concluído", isto esta certo ? =
197
+
198
+ Sim, esta certo e significa que o plugin esta trabalhando como deveria.
199
+
200
+ Todo gateway de pagamentos no WooCommerce deve mudar o status do pedido para "processando" no momento que é confirmado o pagamento e nunca deve ser alterado sozinho para "concluído", pois o pedido deve ir apenas para o status "concluído" após ele ter sido entregue.
201
+
202
+ Para produtos baixáveis a configuração padrão do WooCommerce é permitir o acesso apenas quando o pedido tem o status "concluído", entretanto nas configurações do WooCommerce na aba *Produtos* é possível ativar a opção **"Conceder acesso para download do produto após o pagamento"** e assim liberar o download quando o status do pedido esta como "processando".
203
+
204
+ = Ao tentar finalizar a compra aparece a mensagem "PagSeguro: Um erro ocorreu ao processar o seu pagamento, por favor, tente novamente ou entre em contato para obter ajuda." o que fazer? =
205
+
206
+ Esta mensagem geralmente aparece por causa que não foi configurado um **Token válido**.
207
+ Gere um novo Token no PagSeguro em "Integrações" > "[Token de Segurança](https://pagseguro.uol.com.br/integracao/token-de-seguranca.jhtml)" e adicione ele nas configurações do plugin.
208
+
209
+ Outro erro comum é gerar um token e cadastrar nas configurações do plugin um e-mail que não é o proprietário do token, então tenha certeza que estes dados estão realmente corretos!
210
+
211
+ Note que caso você esteja utilizando a opção de **sandbox** é necessário usar um e-mail e token de teste que podem ser encontrados em "[PagSeguro Sandbox > Dados de Teste](https://sandbox.pagseguro.uol.com.br/comprador-de-testes.html)".
212
+
213
+ Se você tem certeza que o Token e Login estão corretos você deve acessar a página "WooCommerce > Status do Sistema" e verificar se **fsockopen** e **cURL** estão ativos. É necessário procurar ajuda do seu provedor de hospedagem caso você tenha o **fsockopen** e/ou o **cURL** desativados.
214
+
215
+ Para quem estiver utilizando o **Checkout Transparente** é obrigatório o uso do plugin [WooCommerce Extra Checkout Fields for Brazil](http://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/) para enviar o CPF ao PagSeguro, caso o contrário será impossível de finalizar o pedido, veja no [guia de instalação](http://wordpress.org/plugins/woocommerce-pagseguro/installation/) como fazer isso.
216
+
217
+ Por último é possível ativar a opção de **Log de depuração** nas configurações do plugin e tentar novamente fechar um pedido (você deve tentar fechar um pedido para que o log será gerado e o erro gravado nele).
218
+ Com o log é possível saber exatamente o que esta dando de errado com a sua instalação.
219
+
220
+ Caso você não entenda o conteúdo do log não tem problema, você pode me abrir um [tópico no fórum do plugin](https://wordpress.org/support/plugin/woocommerce-pagseguro#postform) com o link do log (utilize o [pastebin.com](http://pastebin.com) ou o [gist.github.com](http://gist.github.com) para salvar o conteúdo do log).
221
+
222
+ = O status do pedido não é alterado automaticamente? =
223
+
224
+ Sim, o status é alterado automaticamente usando a API de notificações de mudança de status do PagSeguro.
225
+
226
+ Caso os status dos seus pedidos não estiverem sendo alterados siga o tutorial do PagSeguro:
227
+
228
+ * [Não recebi o POST do retorno automático. O que devo fazer?](https://pagseguro.uol.com.br/atendimento/perguntas_frequentes/nao-recebi-o-post-com-retorno-automatico-o-que-devo-fazer.jhtml)
229
+
230
+ A seguir uma lista de ferramentas que podem estar bloqueando as notificações do PagSeguro:
231
+
232
+ * Site com CloudFlare, pois por padrão serão bloqueadas quaisquer comunicações de outros servidores com o seu. É possível resolver isso desbloqueando a lista de IPs do PagSeguro.
233
+ * Plugin de segurança como o "iThemes Security" com a opção para adicionar a lista do HackRepair.com no .htaccess do site. Acontece que o user-agent do PagSeguro esta no meio da lista e vai bloquear qualquer comunicação. Você pode remover isso da lista, basta encontrar onde bloquea o user-agent "jakarta" e deletar ou criar uma regra para aceitar os IPs do PagSeguro).
234
+ * `mod_security` habilitado, neste caso vai acontecer igual com o CloudFlare bloqueando qualquer comunicação de outros servidores com o seu. Como solução você pode desativar ou permitir os IPs do PagSeguro.
235
+
236
+ = Funciona com o Lightbox do PagSeguro? =
237
+
238
+ Sim, basta ativar esta nas opções do plugin.
239
+
240
+ = Funciona com o checkout transparente do PagSeguro? =
241
+
242
+ Sim, funciona. Você deve ativar nas opções do plugin.
243
+ Note que é necessário aprovação do PagSeguro para utilizar o Checkout Transparente, saiba mais em "[Como receber pagamentos pelo PagSeguro](https://pagseguro.uol.com.br/receba-pagamentos.jhtml)".
244
+
245
+ = Funciona com o Sandbox do PagSeguro? =
246
+
247
+ Sim, funciona e basta você ativar isso nas opções do plugin, além de configurar o seu token de desenvolvedor.
248
+
249
+ Para conseguir o token de desenvolver você deve acessar "[PagSeguro Sandbox > Dados de Teste](https://sandbox.pagseguro.uol.com.br/comprador-de-testes.html)".
250
+
251
+ = O total do pedido no WooCommerce é diferente do enviado para o PagSeguro, como eu resolvo isso? =
252
+
253
+ Caso você tenha este problema, basta marcar ativar a opção **Enviar apenas o total do pedido** na página de configurações do plugin.
254
+
255
+ = Quais URLs eu devo usar para configurar "Notificação de transação" e "Página de redirecionamento"? =
256
+
257
+ Não é necessário configurar qualquer URL para "Notificação de transação" ou para "Página de redirecionamento", o plugin já diz para o PagSeguro quais URLs serão utilizadas.
258
+
259
+ = Mais dúvidas relacionadas ao funcionamento do plugin? =
260
+
261
+ Por favor, caso você tenha algum problema com o funcionamento do plugin, [abra um tópico no fórum do plugin](https://wordpress.org/support/plugin/woocommerce-pagseguro#postform) com o link arquivo de log (ative ele nas opções do plugin e tente fazer uma compra, depois vá até WooCommerce > Status do Sistema, selecione o log do *pagseguro* e copie os dados, depois crie um link usando o [pastebin.com](http://pastebin.com) ou o [gist.github.com](http://gist.github.com)), desta forma fica mais rápido para fazer o diagnóstico.
262
+
263
+ == Screenshots ==
264
+
265
+ 1. Configurações do plugin.
266
+ 2. Método de pagamento na página de finalizar o pedido.
267
+ 3. Exemplo do Lightbox funcionando com o Sandbox do PagSeguro.
268
+ 4. Pagamento com cartão de crédito usando o Checkout Transparente.
269
+ 5. Pagamento com debito online usando o Checkout Transparente.
270
+ 6. Pagamento com boleto bancário usando o Checkout Transparente.
271
+
272
+ == Changelog ==
273
+
274
+ = 2.10.3 - 2015/08/19 =
275
+
276
+ * Melhoradas as mensagens de erro durante o checkout.
277
+
278
+ = 2.10.2 - 2015/08/08 =
279
+
280
+ * Corrigido erro na tradução pt_BR do plugin.
281
+
282
+ = 2.10.1 - 2015/08/08 =
283
+
284
+ * Corrigido os links dos alertas sobre opções obrigatórios não configuradas do plugin.
285
+
286
+ = 2.10.0 - 2015/08/08 =
287
+
288
+ * Adicionado suporte para WooCommerce 2.4.x.
289
+ * Removido suporte para WooCommerce 2.0.x.
290
+
291
+ = 2.9.0 - 2015/06/23 =
292
+
293
+ * Adicionado método para ignorar a opção "Manter Estoque (minutos)" do WooCommerce.
294
+
295
+ = 2.8.1 - 2015/02/07 =
296
+
297
+ * Melhorado o suporte do Checkout Transparente no WooCommerce 2.3.
298
+
299
+ = 2.8.0 - 2015/02/03 =
300
+
301
+ * Adicionado suporte para o WooCommerce 2.3.
302
+ * Adicionado suporte para WooCommerce Multilingual.
303
+ * Adicionado recurso para utilizar o endereço de entrega no Lightbox (antes funcionava apenas com checkout normal ou transparente).
304
+ * Adicionada alerta de erro para CPF invalido com checkout transparente.
305
+ * Correções na tradução do plugin.
306
+
307
+ = 2.7.4 - 2014/11/05 =
308
+
309
+ * Adicionado alerta quando o usuário não preenche o campo bairro no checkout transparente.
310
+
311
+ = 2.7.3 - 2014/10/26 =
312
+
313
+ * Adicionadas mensagens de erro para DDD e CEP inválidos.
314
+
315
+ = 2.7.2 - 2014/10/11 =
316
+
317
+ * Melhorado o salvamento dos detalhes do pedido que o PagSeguro retorna para a loja, como link de boleto, método de pagamento utilizando e outros.
318
+
319
+ = 2.7.1 - 2014/09/29 =
320
+
321
+ * Corrigido link dos dados de sandbox
322
+ * Adicionado suporte para _transaction_id do WooCommerce 2.2
323
+
324
+ = 2.7.0 - 2014/08/16 =
325
+
326
+ * Adicionado sistema de templates para personalizar os templates de checkout e outros. Para fazer isso basta copiar a pasta `templates/` deste plugin para dentro do seu tema, devendo ficar como `woocommerce/pagseguro/`.
327
+ * Corrigido o nome do arquivo principal do plugin.
328
+
329
+ = 2.6.2 - 2014/08/07 =
330
+
331
+ * Corrigido o script que escondes os botões "Pagar com PagSeguro" e "Cancelar pedido &amp; restaurar carrinho" quando o Lightbox é carregado.
332
+
333
+ = 2.6.1 - 2014/08/04 =
334
+
335
+ * Corrigido o valor individual de cada produto.
336
+
337
+ = 2.6.0 - 2014/08/02 =
338
+
339
+ * Melhoria na lista de itens do pedido que é enviado para o PagSeguro, agora é possível ver o total de taxas enviadas.
340
+ * Adicionada a opção "Enviar apenas o total do pedido" que envia apenas o total para o PagSeguro no lugar da lista de itens do pedido.
341
+ * Corrigida a exibição da opção "Prefixo de pedido" na página de opções do plugin.
342
+
343
+ = 2.5.1 - 2014/07/09 =
344
+
345
+ * Adicionada feature que permite usar o Checkout Transparente sem precisar digitar uma descrição para o método de pagamento.
346
+ * Correção do checkout com Lightbox.
347
+
348
+ = 2.5.0 - 2014/07/08 =
349
+
350
+ * Implementando o Checkout Transparente do PagSeguro.
351
+ * Melhorada todo o código de integração para tornar possível trabalhar bem o checkout padrão, Lightbox e Checkout Transparente.
352
+ * Melhoria nas mensagens de erro.
353
+
354
+ = 2.4.1 - 2014/06/12 =
355
+
356
+ * Corrigida a URL de notifição para versões 2.0.x do WooCommerce.
357
+
358
+ = 2.4.0 - 2014/06/10 =
359
+
360
+ * Correções nas mensagens do log para a criação de tokens de pagamento.
361
+ * Adicionada opção de ambiente sandbox.
362
+
363
+ = 2.3.1 - 2014/05/24 =
364
+
365
+ * Melhoria nos status do pedido, agora ao gerar um boleto o pedido é alterado para "aguardando".
366
+ * Modificado o botão "Finalizar pedido", com o WooCommerce 2.1 ou superior vai mostrar a mensagem "Realizar pagamento".
367
+
368
+ = 2.3.0 - 2014/04/02 =
369
+
370
+ * Adicionada opção para selecionar pagamento direto com redirecionamento ou pelo Lightbox do PagSeguro.
371
+
372
+ = 2.2.1 - 2013/12/06 =
373
+
374
+ * Melhoria na compatibilidade com o WooCommerce 2.1.
375
+
376
+ = 2.2.0 - 2013/12/04 =
377
+
378
+ * Corrigido padrões de código.
379
+ * Removida compatibilidade com versões 1.6.x ou inferiores do WooCommerce.
380
+ * Adicionada compatibilidade com WooCommerce 2.1 ou superior.
381
+
382
+ = 2.1.1 - 2013/09/03 =
383
+
384
+ * Adicionada mensagem sobre DDD errado nas mensagens de erro do PagSeguro.
385
+ * Correção da verificação do IPN.
386
+
387
+ = 2.1.0 - 2013/08/29 =
388
+
389
+ * Adicionada função para tratar as mensagens de erro do PagSeguro para CPF, CEP e número de telefone.
390
+
391
+ = 2.0.3 - 2013/08/22 =
392
+
393
+ * Correção da alteração de status pelo pela notificação de pagamento do PagSeguro.
394
+
395
+ = 2.0.2 - 2013/08/22 =
396
+
397
+ * Corrigido o erro causado com números de telefone sem DDD.
398
+
399
+ = 2.0.1 - 2013/08/19 =
400
+
401
+ * Removida a obrigatoriedade de enviar os campos de endereço.
402
+
403
+ = 2.0.0 - 2013/08/17 =
404
+
405
+ * Adicionadas as novas APIs de pagamentos e notificações do PagSeguro.
406
+ * Removidas as APIs antigas de pagamento e notificações do PagSeguro.
407
+ * Melhoria nos status de pagamento.
408
+ * Melhorias na notificações sobre compras em disputas ou que tiveram o pagamento devolvido.
409
+
410
+ = 1.6.1 - 2013/08/14 =
411
+
412
+ * Melhoria no JavaScript inline no formulário de checkout.
413
+
414
+ = 1.6.0 - 2013/07/26 =
415
+
416
+ * Adicionado o filtro `woocommerce_pagseguro_icon` para troca do ícone do método de pagamento.
417
+ * Melhoria no filtro `woocommerce_pagseguro_args`, agora ele aceita o objeto `WC_Order` no lugar do ID.
418
+ * Melhoria nas opções do plugin.
419
+ * Melhoria nas mensagens de status do pedido.
420
+
421
+ = 1.5.0 - 2013/06/24 =
422
+
423
+ * Adicionado link de `Configurações` na página de plugins.
424
+ * Melhorias no código.
425
+ * Adicionado suporte para WooCommerce 2.1.
426
+ * Adicionado o ID da compra no filtro `woocommerce_pagseguro_args`.
427
+
428
+ = 1.4.0 - 2013/04/02 =
429
+
430
+ * Correção do retorno automático de dados na versão 2.0.0 ou superior do WooCommerce.
431
+
432
+ = 1.3.4 - 2013/03/06 =
433
+
434
+ * Corrigida a compatibilidade com WooCommerce 2.0.0 ou mais recente.
435
+
436
+ = 1.3.3 - 2013/02/08 =
437
+
438
+ * Corrigido o hook responsavel por salvar as opções para a versão 2.0 RC do WooCommerce.
439
+
440
+ = 1.3.2 - 2013/02/08 =
441
+
442
+ * Plugin corrigido para a versão 2.0 do WooCommerce.
443
+
444
+ = 1.3.1 - 2012/12/08 =
445
+
446
+ * Melhoria no método que atualiza o status do pedido.
447
+ * Correção da quantidade de caracteres das descrição dos produtos no PagSeguro.
448
+
449
+ = 1.3.0 - 2012/11/30 =
450
+
451
+ * Adicionada opção para logs de erro.
452
+ * Adiciona opção para validar ou não endereço (quando ativo força cliente a informar os dados corretamente e ir direto para a página de pagamento do PagSeguro).
453
+
454
+ = 1.2.2 - 2012/11/19 =
455
+
456
+ * Corrigido problema com cupons de desconto (descontos no carrinho).
457
+
458
+ = 1.2.1 =
459
+
460
+ * Corrigido o problema de produto com a descrição/nome muito grande no PagSeguro.
461
+
462
+ = 1.2.0 =
463
+
464
+ * Removida a classe do retorno automático que usava cURL em favor da função wp_remote_post().
465
+ * Otimizado o retorno automático de dados.
466
+
467
+ = 1.1.1 =
468
+
469
+ * Tradução revisada.
470
+ * Melhorada a integração de retorno automático para o status de "Aguardando pagamento".
471
+
472
+ = 1.1.0 =
473
+
474
+ * Adicionado retorno automático de dados.
475
+ * Melhorado o sistema de notificações.
476
+ * Adicionada classe para validar o retorno automático de dados.
477
+ * Adicionado campo de token nas configurações do plugin (necessário para o retorno automático).
478
+
479
+ = 1.0.2 =
480
+
481
+ * Adicionada função para abater estoque automáticamente quando o cliente vai para o PagSeguro.
482
+
483
+ = 1.0.1 =
484
+
485
+ * Correção para impedir que o portal de pagamento seja habilitado se a conta de email do PagSeguro estiver em branco
486
+
487
+ = 1.0.0 =
488
+
489
+ * Versão incial do plugin.
490
+
491
+ == Upgrade Notice ==
492
+
493
+ = 2.10.3 =
494
+
495
+ * Melhoradas as mensagens de erro durante o checkout.
496
+
497
+ == License ==
498
+
499
+ WooCommerce PagSeguro is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
500
+
501
+ WooCommerce PagSeguro is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
502
+
503
+ You should have received a copy of the GNU General Public License along with WooCommerce PagSeguro. If not, see <http://www.gnu.org/licenses/>.
templates/emails/html-instructions.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * HTML email instructions.
4
+ *
5
+ * @author Claudio_Sanches
6
+ * @package WooCommerce_PagSeguro/Templates
7
+ * @version 2.7.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit; // Exit if accessed directly.
12
+ }
13
+ ?>
14
+
15
+ <h2><?php _e( 'Payment', 'woocommerce-pagseguro' ); ?></h2>
16
+
17
+ <?php if ( 2 == $type ) : ?>
18
+
19
+ <p class="order_details"><?php _e( 'Please use the link below to view your Banking Ticket, you can print and pay in your internet banking or in a lottery retailer:', 'woocommerce-pagseguro' ); ?><br /><a class="button" href="<?php echo esc_url( $link ); ?>" target="_blank"><?php _e( 'Pay the Banking Ticket', 'woocommerce-pagseguro' ); ?></a><br /><?php _e( 'After we receive the ticket payment confirmation, your order will be processed.', 'woocommerce-pagseguro' ); ?></p>
20
+
21
+ <?php elseif ( 3 == $type ) : ?>
22
+
23
+ <p class="order_details"><?php _e( 'Please use the link below to make the payment in your bankline:', 'woocommerce-pagseguro' ); ?><br /><a class="button" href="<?php echo esc_url( $link ); ?>" target="_blank"><?php _e( 'Pay at your bank', 'woocommerce-pagseguro' ); ?>.<br /><?php _e( 'After we receive the confirmation from the bank, your order will be processed.', 'woocommerce-pagseguro' ); ?></a></p>
24
+
25
+ <?php else : ?>
26
+
27
+ <p class="order_details"><?php echo sprintf( __( 'You just made the payment in %s using the %s.', 'woocommerce-pagseguro' ), '<strong>' . $installments . 'x</strong>', '<strong>' . $method . '</strong>' ); ?><br /><?php _e( 'As soon as the credit card operator confirm the payment, your order will be processed.', 'woocommerce-pagseguro' ); ?></p>
28
+
29
+ <?php
30
+ endif;
templates/emails/plain-instructions.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plain email instructions.
4
+ *
5
+ * @author Claudio_Sanches
6
+ * @package WooCommerce_PagSeguro/Templates
7
+ * @version 2.7.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit; // Exit if accessed directly.
12
+ }
13
+
14
+ _e( 'Payment', 'woocommerce-pagseguro' );
15
+
16
+ echo "\n\n";
17
+
18
+ if ( 2 == $type ) {
19
+
20
+ _e( 'Please use the link below to view your Banking Ticket, you can print and pay in your internet banking or in a lottery retailer:', 'woocommerce-pagseguro' );
21
+
22
+ echo "\n";
23
+
24
+ echo esc_url( $link );
25
+
26
+ echo "\n";
27
+
28
+ _e( 'After we receive the ticket payment confirmation, your order will be processed.', 'woocommerce-pagseguro' );
29
+
30
+ } elseif ( 3 == $type ) {
31
+
32
+ _e( 'Please use the link below to make the payment in your bankline:', 'woocommerce-pagseguro' );
33
+
34
+ echo "\n";
35
+
36
+ echo esc_url( $link );
37
+
38
+ echo "\n";
39
+
40
+ _e( 'After we receive the confirmation from the bank, your order will be processed.', 'woocommerce-pagseguro' );
41
+
42
+ } else {
43
+
44
+ echo sprintf( __( 'You just made the payment in %s using the %s.', 'woocommerce-pagseguro' ), $installments . 'x', $method );
45
+
46
+ echo "\n";
47
+
48
+ _e( 'As soon as the credit card operator confirm the payment, your order will be processed.', 'woocommerce-pagseguro' );
49
+
50
+ }
51
+
52
+ echo "\n\n****************************************************\n\n";
templates/lightbox-checkout.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lightbox checkout.
4
+ *
5
+ * @author Claudio_Sanches
6
+ * @package WooCommerce_PagSeguro/Templates
7
+ * @version 2.10.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit; // Exit if accessed directly.
12
+ }
13
+ ?>
14
+
15
+ <p id="browser-has-javascript" style="display: none;"><?php _e( 'Thank you for your order, please wait a few seconds to make the payment with PagSeguro.', 'woocommerce-pagseguro' ); ?></p>
16
+
17
+ <p id="browser-no-has-javascript"><?php _e( 'Thank you for your order, please click the button below to pay with PagSeguro.', 'woocommerce-pagseguro' ); ?></p>
18
+
19
+ <a class="button cancel" id="cancel-payment" href="<?php echo esc_url( $cancel_order_url ); ?>"><?php _e( 'Cancel order &amp; restore cart', 'woocommerce-pagseguro' ); ?></a> <a id="submit-payment" class="button alt" href="<?php echo esc_url( $payment_url ); ?>"><?php _e( 'Pay via PagSeguro', 'woocommerce-pagseguro' ); ?></a>
20
+
21
+ <script type="text/javascript" src="<?php echo esc_url( $lightbox_script_url ); ?>"></script>
templates/payment-instructions.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Payment instructions.
4
+ *
5
+ * @author Claudio_Sanches
6
+ * @package WooCommerce_PagSeguro/Templates
7
+ * @version 2.7.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit; // Exit if accessed directly.
12
+ }
13
+ ?>
14
+
15
+ <?php if ( 2 == $type ) : ?>
16
+
17
+ <div class="woocommerce-message">
18
+ <span><a class="button" href="<?php echo esc_url( $link ); ?>" target="_blank"><?php _e( 'Pay the Banking Ticket', 'woocommerce-pagseguro' ); ?></a><?php _e( 'Please click in the following button to view your Banking Ticket.', 'woocommerce-pagseguro' ); ?><br /><?php _e( 'You can print and pay in your internet banking or in a lottery retailer.', 'woocommerce-pagseguro' ); ?><br /><?php _e( 'After we receive the ticket payment confirmation, your order will be processed.', 'woocommerce-pagseguro' ); ?></span>
19
+ </div>
20
+
21
+ <?php elseif ( 3 == $type ) : ?>
22
+
23
+ <div class="woocommerce-message">
24
+ <span><a class="button" href="<?php echo esc_url( $link ); ?>" target="_blank"><?php _e( 'Pay at your bank', 'woocommerce-pagseguro' ); ?></a><?php _e( 'Please use the following button to make the payment in your bankline.', 'woocommerce-pagseguro' ); ?><br /><?php _e( 'After we receive the confirmation from the bank, your order will be processed.', 'woocommerce-pagseguro' ); ?></span>
25
+ </div>
26
+
27
+ <?php else : ?>
28
+
29
+ <div class="woocommerce-message">
30
+ <span><?php echo sprintf( __( 'You just made the payment in %s using the %s.', 'woocommerce-pagseguro' ), '<strong>' . $installments . 'x</strong>', '<strong>' . $method . '</strong>' ); ?><br /><?php _e( 'As soon as the credit card operator confirm the payment, your order will be processed.', 'woocommerce-pagseguro' ); ?></span>
31
+ </div>
32
+
33
+ <?php
34
+ endif;
templates/transparent-checkout-form.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transparent checkout form.
4
+ *
5
+ * @author Claudio_Sanches
6
+ * @package WooCommerce_PagSeguro/Templates
7
+ * @version 2.10.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit; // Exit if accessed directly.
12
+ }
13
+ ?>
14
+
15
+ <fieldset id="pagseguro-payment-form">
16
+ <input type="hidden" id="pagseguro-cart-total" value="<?php echo esc_attr( number_format( $cart_total, 2, '.', '' ) ); ?>" />
17
+
18
+ <ul id="pagseguro-payment-methods">
19
+ <?php if ( 'yes' == $tc_credit ) : ?>
20
+ <li><label><input id="pagseguro-payment-method-credit-card" type="radio" name="pagseguro_payment_method" value="credit-card" <?php checked( true, ( 'yes' == $tc_credit ), true ); ?> /> <?php _e( 'Credit Card', 'woocommerce-pagseguro' ); ?></label></li>
21
+ <?php endif; ?>
22
+
23
+ <?php if ( 'yes' == $tc_transfer ) : ?>
24
+ <li><label><input id="pagseguro-payment-method-bank-transfer" type="radio" name="pagseguro_payment_method" value="bank-transfer" <?php checked( true, ( 'no' == $tc_credit && 'yes' == $tc_transfer ), true ); ?> /> <?php _e( 'Bank Transfer', 'woocommerce-pagseguro' ); ?></label></li>
25
+ <?php endif; ?>
26
+
27
+ <?php if ( 'yes' == $tc_ticket ) : ?>
28
+ <li><label><input id="pagseguro-payment-method-banking-ticket" type="radio" name="pagseguro_payment_method" value="banking-ticket" <?php checked( true, ( 'no' == $tc_credit && 'no' == $tc_transfer && 'yes' == $tc_ticket ), true ); ?> /> <?php _e( 'Banking Ticket', 'woocommerce-pagseguro' ); ?></label></li>
29
+ <?php endif; ?>
30
+ </ul>
31
+ <div class="clear"></div>
32
+
33
+ <?php if ( 'yes' == $tc_credit ) : ?>
34
+ <div id="pagseguro-credit-card-form" class="pagseguro-method-form">
35
+ <p class="form-row form-row-first">
36
+ <label for="pagseguro-card-holder-name"><?php _e( 'Card Holder Name', 'woocommerce-pagseguro' ); ?> <small>(<?php _e( 'as recorded on the card', 'woocommerce-pagseguro' ); ?>)</small> <span class="required">*</span></label>
37
+ <input id="pagseguro-card-holder-name" name="pagseguro_card_holder_name" class="input-text" type="text" autocomplete="off" style="font-size: 1.5em; padding: 8px;" />
38
+ </p>
39
+ <p class="form-row form-row-last">
40
+ <label for="pagseguro-card-number"><?php _e( 'Card Number', 'woocommerce-pagseguro' ); ?> <span class="required">*</span></label>
41
+ <input id="pagseguro-card-number" class="input-text wc-credit-card-form-card-number" type="text" maxlength="20" autocomplete="off" placeholder="&bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull;" style="font-size: 1.5em; padding: 8px;" />
42
+ </p>
43
+ <div class="clear"></div>
44
+ <p class="form-row form-row-first">
45
+ <label for="pagseguro-card-expiry"><?php _e( 'Expiry (MM/YYYY)', 'woocommerce-pagseguro' ); ?> <span class="required">*</span></label>
46
+ <input id="pagseguro-card-expiry" class="input-text wc-credit-card-form-card-expiry" type="text" autocomplete="off" placeholder="<?php _e( 'MM / YYYY', 'woocommerce-pagseguro' ); ?>" style="font-size: 1.5em; padding: 8px;" />
47
+ </p>
48
+ <p class="form-row form-row-last">
49
+ <label for="pagseguro-card-cvc"><?php _e( 'Security Code', 'woocommerce-pagseguro' ); ?> <span class="required">*</span></label>
50
+ <input id="pagseguro-card-cvc" class="input-text wc-credit-card-form-card-cvc" type="text" autocomplete="off" placeholder="<?php _e( 'CVC', 'woocommerce-pagseguro' ); ?>" style="font-size: 1.5em; padding: 8px;" />
51
+ </p>
52
+ <div class="clear"></div>
53
+ <p class="form-row form-row-first">
54
+ <label for="pagseguro-card-installments"><?php _e( 'Installments', 'woocommerce-pagseguro' ); ?> <small>(<?php _e( 'the minimum value of the installment is R$ 5,00', 'woocommerce-pagseguro' ); ?>)</small> <span class="required">*</span></label>
55
+ <select id="pagseguro-card-installments" name="pagseguro_card_installments" style="font-size: 1.5em; padding: 4px; width: 100%;" disabled="disabled">
56
+ <option value="0">--</option>
57
+ </select>
58
+ </p>
59
+ <p class="form-row form-row-last">
60
+ <label for="pagseguro-card-holder-cpf"><?php _e( 'Card Holder CPF', 'woocommerce-pagseguro' ); ?> <span class="required">*</span></label>
61
+ <input id="pagseguro-card-holder-cpf" name="pagseguro_card_holder_cpf" class="input-text wecfb-cpf-field" type="text" autocomplete="off" style="font-size: 1.5em; padding: 8px;" />
62
+ </p>
63
+ <div class="clear"></div>
64
+ <p class="form-row form-row-first">
65
+ <label for="pagseguro-card-holder-birth-date"><?php _e( 'Card Holder Birth Date', 'woocommerce-pagseguro' ); ?> <span class="required">*</span></label>
66
+ <input id="pagseguro-card-holder-birth-date" name="pagseguro_card_holder_birth_date" class="input-text" type="text" autocomplete="off" placeholder="<?php _e( 'DD / MM / YYYY', 'woocommerce-pagseguro' ); ?>" style="font-size: 1.5em; padding: 8px;" />
67
+ </p>
68
+ <p class="form-row form-row-last">
69
+ <label for="pagseguro-card-holder-phone"><?php _e( 'Card Holder Phone', 'woocommerce-pagseguro' ); ?> <span class="required">*</span></label>
70
+ <input id="pagseguro-card-holder-phone" name="pagseguro_card_holder_phone" class="input-text" type="text" autocomplete="off" placeholder="<?php _e( '(xx) xxxx-xxxx', 'woocommerce-pagseguro' ); ?>" style="font-size: 1.5em; padding: 8px;" />
71
+ </p>
72
+ <div class="clear"></div>
73
+ </div>
74
+ <?php endif; ?>
75
+
76
+ <?php if ( 'yes' == $tc_transfer ) : ?>
77
+ <div id="pagseguro-bank-transfer-form" class="pagseguro-method-form">
78
+ <p><?php _e( 'Select your bank:', 'woocommerce-pagseguro' ); ?></p>
79
+ <ul>
80
+ <li><label><input type="radio" name="pagseguro_bank_transfer" value="bradesco" /><i id="pagseguro-icon-bradesco"></i><span><?php _e( 'Banco Bradesco', 'woocommerce-pagseguro' ); ?></span></label></li>
81
+ <li><label><input type="radio" name="pagseguro_bank_transfer" value="itau" /><i id="pagseguro-icon-itau"></i><span><?php _e( 'Banco Ita&uacute;', 'woocommerce-pagseguro' ); ?></span></label></li>
82
+ <li><label><input type="radio" name="pagseguro_bank_transfer" value="bancodobrasil" /><i id="pagseguro-icon-bancodobrasil"></i><span><?php _e( 'Banco do Brasil', 'woocommerce-pagseguro' ); ?></span></label></li>
83
+ <li><label><input type="radio" name="pagseguro_bank_transfer" value="banrisul" /><i id="pagseguro-icon-banrisul"></i><span><?php _e( 'Banco Banrisul', 'woocommerce-pagseguro' ); ?></span></label></li>
84
+ <li><label><input type="radio" name="pagseguro_bank_transfer" value="hsbc" /><i id="pagseguro-icon-hsbc"></i><span><?php _e( 'Banco HSBC', 'woocommerce-pagseguro' ); ?></span></label></li>
85
+ </ul>
86
+ <p><?php _e( '* After clicking "Proceed to payment" you will have access to the link that will take you to your bank\'s website, so you can make the payment in total security.', 'woocommerce-pagseguro' ); ?></p>
87
+ <div class="clear"></div>
88
+ </div>
89
+ <?php endif; ?>
90
+
91
+ <?php if ( 'yes' == $tc_ticket ) : ?>
92
+ <div id="pagseguro-banking-ticket-form" class="pagseguro-method-form">
93
+ <p>
94
+ <i id="pagseguro-icon-ticket"></i>
95
+ <?php _e( 'The order will be confirmed only after the payment approval.', 'woocommerce-pagseguro' ); ?>
96
+ <?php if ( 'yes' === $tc_ticket_message ) : ?>
97
+ <br />
98
+ <strong><?php _e( 'Tax', 'woocommerce-pagseguro' ); ?>:</strong> <?php _e( 'R$ 1,00 (rate applied to cover management risk costs of the payment method).', 'woocommerce-pagseguro' ); ?>
99
+ <?php endif; ?>
100
+ </p>
101
+ <p><?php _e( '* After clicking "Proceed to payment" you will have access to banking ticket which you can print and pay in your internet banking or in a lottery retailer.', 'woocommerce-pagseguro' ); ?></p>
102
+ <div class="clear"></div>
103
+ </div>
104
+ <?php endif; ?>
105
+
106
+ </fieldset>
wc-pagseguro.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ // Update the main file.
7
+ $active_plugins = get_option( 'active_plugins', array() );
8
+
9
+ foreach ( $active_plugins as $key => $active_plugin ) {
10
+ if ( strstr( $active_plugin, '/wc-pagseguro.php' ) ) {
11
+ $active_plugins[ $key ] = str_replace( '/wc-pagseguro.php', '/woocommerce-pagseguro.php', $active_plugin );
12
+ }
13
+ }
14
+
15
+ update_option( 'active_plugins', $active_plugins );
woocommerce-pagseguro.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: WooCommerce PagSeguro
4
+ * Plugin URI: http://github.com/claudiosmweb/woocommerce-pagseguro
5
+ * Description: Gateway de pagamento PagSeguro para WooCommerce.
6
+ * Author: Claudio Sanches, Gabriel Reguly
7
+ * Author URI: http://claudiosmweb.com/
8
+ * Version: 2.10.3
9
+ * License: GPLv2 or later
10
+ * Text Domain: woocommerce-pagseguro
11
+ * Domain Path: languages/
12
+ */
13
+
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ exit; // Exit if accessed directly.
16
+ }
17
+
18
+ if ( ! class_exists( 'WC_PagSeguro' ) ) :
19
+
20
+ /**
21
+ * WooCommerce PagSeguro main class.
22
+ */
23
+ class WC_PagSeguro {
24
+
25
+ /**
26
+ * Plugin version.
27
+ *
28
+ * @var string
29
+ */
30
+ const VERSION = '2.10.3';
31
+
32
+ /**
33
+ * Instance of this class.
34
+ *
35
+ * @var object
36
+ */
37
+ protected static $instance = null;
38
+
39
+ /**
40
+ * Initialize the plugin public actions.
41
+ */
42
+ private function __construct() {
43
+ // Load plugin text domain
44
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
45
+
46
+ // Checks with WooCommerce is installed.
47
+ if ( class_exists( 'WC_Payment_Gateway' ) ) {
48
+ $this->includes();
49
+
50
+ add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway' ) );
51
+ add_filter( 'woocommerce_available_payment_gateways', array( $this, 'hides_when_is_outside_brazil' ) );
52
+ add_filter( 'woocommerce_cancel_unpaid_order', array( $this, 'stop_cancel_unpaid_orders' ), 10, 2 );
53
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
54
+ } else {
55
+ add_action( 'admin_notices', array( $this, 'woocommerce_missing_notice' ) );
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Return an instance of this class.
61
+ *
62
+ * @return object A single instance of this class.
63
+ */
64
+ public static function get_instance() {
65
+ // If the single instance hasn't been set, set it now.
66
+ if ( null == self::$instance ) {
67
+ self::$instance = new self;
68
+ }
69
+
70
+ return self::$instance;
71
+ }
72
+
73
+ /**
74
+ * Get templates path.
75
+ *
76
+ * @return string
77
+ */
78
+ public static function get_templates_path() {
79
+ return plugin_dir_path( __FILE__ ) . 'templates/';
80
+ }
81
+
82
+ /**
83
+ * Load the plugin text domain for translation.
84
+ */
85
+ public function load_plugin_textdomain() {
86
+ load_plugin_textdomain( 'woocommerce-pagseguro', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
87
+ }
88
+
89
+ /**
90
+ * Action links.
91
+ *
92
+ * @param array $links
93
+ *
94
+ * @return array
95
+ */
96
+ public function plugin_action_links( $links ) {
97
+ $plugin_links = array();
98
+
99
+ $plugin_links[] = '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout&section=wc_pagseguro_gateway' ) ) . '">' . __( 'Settings', 'woocommerce-pagseguro' ) . '</a>';
100
+
101
+ return array_merge( $plugin_links, $links );
102
+ }
103
+
104
+ /**
105
+ * Includes.
106
+ */
107
+ private function includes() {
108
+ include_once 'includes/class-wc-pagseguro-xml.php';
109
+ include_once 'includes/class-wc-pagseguro-api.php';
110
+ include_once 'includes/class-wc-pagseguro-gateway.php';
111
+ }
112
+
113
+ /**
114
+ * Add the gateway to WooCommerce.
115
+ *
116
+ * @param array $methods WooCommerce payment methods.
117
+ *
118
+ * @return array Payment methods with PagSeguro.
119
+ */
120
+ public function add_gateway( $methods ) {
121
+ $methods[] = 'WC_PagSeguro_Gateway';
122
+
123
+ return $methods;
124
+ }
125
+
126
+ /**
127
+ * Hides the PagSeguro with payment method with the customer lives outside Brazil.
128
+ *
129
+ * @param array $available_gateways Default Available Gateways.
130
+ *
131
+ * @return array New Available Gateways.
132
+ */
133
+ public function hides_when_is_outside_brazil( $available_gateways ) {
134
+
135
+ // Remove PagSeguro gateway.
136
+ if ( isset( $_REQUEST['country'] ) && 'BR' != $_REQUEST['country'] ) {
137
+ unset( $available_gateways['pagseguro'] );
138
+ }
139
+
140
+ return $available_gateways;
141
+ }
142
+
143
+ /**
144
+ * Stop cancel unpaid PagSeguro orders.
145
+ *
146
+ * @param bool $cancel
147
+ * @param WC_Order $order
148
+ *
149
+ * @return bool
150
+ */
151
+ public function stop_cancel_unpaid_orders( $cancel, $order ) {
152
+ if ( 'pagseguro' === $order->payment_method ) {
153
+ return false;
154
+ }
155
+
156
+ return $cancel;
157
+ }
158
+
159
+ /**
160
+ * WooCommerce fallback notice.
161
+ *
162
+ * @return string
163
+ */
164
+ public function woocommerce_missing_notice() {
165
+ echo '<div class="error"><p>' . sprintf( __( 'WooCommerce PagSeguro Gateway depends on the last version of %s to work!', 'woocommerce-pagseguro' ), '<a href="http://wordpress.org/plugins/woocommerce/">' . __( 'WooCommerce', 'woocommerce-pagseguro' ) . '</a>' ) . '</p></div>';
166
+ }
167
+ }
168
+
169
+ add_action( 'plugins_loaded', array( 'WC_PagSeguro', 'get_instance' ) );
170
+
171
+ endif;