WooCommerce PayPal Express Checkout Payment Gateway - Version 2.0.0

Version Description

  • 2020-05-25 =
  • New - Upgrade to the latest PayPal Checkout Javascript SDK. PR#668
  • Add - New setting found under Button Styles for choosing a Smart Payment Button label. PR#666
  • Add - Support for more locales. PR#658
  • Fix - Display Smart Payment Buttons on Product pages built from a shortcode. PR#665
  • Fix - Send the product SKU to PayPal so it's displayed in the order/transaction details and reports on PayPal. PR#664
  • Fix - Show an error when saving incomplete/missing API credentials. PR#712
  • Fix - Remove PHP warnings in later versions of PHP when a PayPal Session doesn't exist. PR#727
  • Fix - Error when processing refunds (Already Refunded. No Amount to Refund). PR#710
  • Fix - Required state field errors on the "Confirm your PayPal Order" page when returning from PayPal. PR#725
  • Fix - Display WC Add To Cart validation errors on the product page when clicking the PayPal Smart Payment Buttons. PR#707
  • Update - Smart Payment Buttons are enabled by default and settings to toggle these on/off have been removed and replaced with a filter. PR#660
  • Update - Deprecate unused/incomplete function WC_Gateway_PPEC_Client::update_billing_agreement(). PR#602
  • Update - Move inline javascript found in settings-ppec.php to ppec-settings.js. PR#676
  • Update - Move Support and Documentation links from the plugin actions to plugin meta section on the Plugin activation/deactivation page. PR#735
  • Update - WooCommerce 4.1 and WordPress 5.4 compatibility. PR#732
Download this release

Release Info

Developer woothemes
Plugin Icon 128x128 WooCommerce PayPal Express Checkout Payment Gateway
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.6.21 to 2.0.0

assets/js/dist/fetch-polyfill.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.WHATWGFetch={})}(this,function(a){"use strict";var e="URLSearchParams"in self,r="Symbol"in self&&"iterator"in Symbol,h="FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in self,n="ArrayBuffer"in self;if(n)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(t){return t&&-1<i.indexOf(Object.prototype.toString.call(t))};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function t(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach(function(t,e){this.append(e,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(r){return new Promise(function(t,e){r.onload=function(){t(r.result)},r.onerror=function(){e(r.error)}})}function y(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function l(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){(this._bodyInit=t)?"string"==typeof t?this._bodyText=t:h&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():n&&h&&function(t){return t&&DataView.prototype.isPrototypeOf(t)}(t)?(this._bodyArrayBuffer=l(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n&&(ArrayBuffer.prototype.isPrototypeOf(t)||s(t))?this._bodyArrayBuffer=l(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},h&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,r=p(e);return e.readAsText(t),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),o=0;o<e.length;o++)r[o]=String.fromCharCode(e[o]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=u(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},d.prototype.delete=function(t){delete this.map[u(t)]},d.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},d.prototype.set=function(t,e){this.map[u(t)]=f(e)},d.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},d.prototype.keys=function(){var r=[];return this.forEach(function(t,e){r.push(e)}),t(r)},d.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),t(e)},d.prototype.entries=function(){var r=[];return this.forEach(function(t,e){r.push([e,t])}),t(r)},r&&(d.prototype[Symbol.iterator]=d.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=function(t){var e=t.toUpperCase();return-1<m.indexOf(e)?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function v(t){var n=new FormData;return t.trim().split("&").forEach(function(t){if(t){var e=t.split("="),r=e.shift().replace(/\+/g," "),o=e.join("=").replace(/\+/g," ");n.append(decodeURIComponent(r),decodeURIComponent(o))}}),n}function E(t,e){e=e||{},this.type="default",this.status=void 0===e.status?200:e.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},b.call(w.prototype),b.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var A=[301,302,303,307,308];E.redirect=function(t,e){if(-1===A.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},a.DOMException=self.DOMException;try{new a.DOMException}catch(t){a.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function _(i,s){return new Promise(function(r,t){var e=new w(i,s);if(e.signal&&e.signal.aborted)return t(new a.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function n(){o.abort()}o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:function(t){var n=new d;return t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var e=t.split(":"),r=e.shift().trim();if(r){var o=e.join(":").trim();n.append(r,o)}}),n}(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;r(new E(e,t))},o.onerror=function(){t(new TypeError("Network request failed"))},o.ontimeout=function(){t(new TypeError("Network request failed"))},o.onabort=function(){t(new a.DOMException("Aborted","AbortError"))},o.open(e.method,e.url,!0),"include"===e.credentials?o.withCredentials=!0:"omit"===e.credentials&&(o.withCredentials=!1),"responseType"in o&&h&&(o.responseType="blob"),e.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),e.signal&&(e.signal.addEventListener("abort",n),o.onreadystatechange=function(){4===o.readyState&&e.signal.removeEventListener("abort",n)}),o.send(void 0===e._bodyInit?null:e._bodyInit)})}_.polyfill=!0,self.fetch||(self.fetch=_,self.Headers=d,self.Request=w,self.Response=E),a.Headers=d,a.Request=w,a.Response=E,a.fetch=_,Object.defineProperty(a,"__esModule",{value:!0})});
assets/js/dist/promise-polyfill.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";function e(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}function n(e){return!(!e||"undefined"==typeof e.length)}function t(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],c(e,this)}function r(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){var o;try{o=t(e._value)}catch(r){return void f(n.promise,r)}i(n.promise,o)}else(1===e._state?i:f)(n.promise,e._value)})):e._deferreds.push(n)}function i(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if(n instanceof o)return e._state=3,e._value=n,void u(e);if("function"==typeof t)return void c(function(e,n){return function(){e.apply(n,arguments)}}(t,n),e)}e._state=1,e._value=n,u(e)}catch(r){f(e,r)}}function f(e,n){e._state=2,e._value=n,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;t>n;n++)r(e,e._deferreds[n]);e._deferreds=null}function c(e,n){var t=!1;try{e(function(e){t||(t=!0,i(n,e))},function(e){t||(t=!0,f(n,e))})}catch(o){if(t)return;t=!0,f(n,o)}}var a=setTimeout;o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,n){var o=new this.constructor(t);return r(this,new function(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}(e,n,o)),o},o.prototype["finally"]=e,o.all=function(e){return new o(function(t,o){function r(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(n){r(e,n)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))return o(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(n){n(e)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(e){return new o(function(t,r){if(!n(e))return r(new TypeError("Promise.race accepts an array"));for(var i=0,f=e.length;f>i;i++)o.resolve(e[i]).then(t,r)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=o});
assets/js/wc-gateway-ppec-generate-cart.js CHANGED
@@ -14,20 +14,29 @@
14
 
15
  $( '#woo_pp_ec_button_product' )
16
  .on( 'enable', function() {
17
- $( '#woo_pp_ec_button_product' ).css( {
18
- 'cursor': '',
19
- '-webkit-filter': '', // Safari 6.0 - 9.0
20
- 'filter': '',
21
- } );
22
- $( '#woo_pp_ec_button_product > *' ).css( 'pointer-events', '' );
 
 
 
23
  } )
24
  .on( 'disable', function() {
25
- $( '#woo_pp_ec_button_product' ).css( {
26
- 'cursor': 'not-allowed',
27
- '-webkit-filter': 'grayscale( 100% )', // Safari 6.0 - 9.0
28
- 'filter': 'grayscale( 100% )',
29
- } );
30
- $( '#woo_pp_ec_button_product > *' ).css( 'pointer-events', 'none' );
 
 
 
 
 
 
31
  } );
32
 
33
  // True if the product is simple or the user selected a valid variation. False on variable product without a valid variation selected
14
 
15
  $( '#woo_pp_ec_button_product' )
16
  .on( 'enable', function() {
17
+ $( '#woo_pp_ec_button_product' )
18
+ .css( {
19
+ 'cursor': '',
20
+ '-webkit-filter': '', // Safari 6.0 - 9.0
21
+ 'filter': '',
22
+ } )
23
+ .off( 'mouseup' )
24
+ .find( '> *' )
25
+ .css( 'pointer-events', '' );
26
  } )
27
  .on( 'disable', function() {
28
+ $( '#woo_pp_ec_button_product' )
29
+ .css( {
30
+ 'cursor': 'not-allowed',
31
+ '-webkit-filter': 'grayscale( 100% )', // Safari 6.0 - 9.0
32
+ 'filter': 'grayscale( 100% )',
33
+ } )
34
+ .on( 'mouseup', function( event ) {
35
+ event.stopImmediatePropagation();
36
+ form.find( ':submit' ).click();
37
+ } )
38
+ .find( '> *' )
39
+ .css( 'pointer-events', 'none' );
40
  } );
41
 
42
  // True if the product is simple or the user selected a valid variation. False on variable product without a valid variation selected
assets/js/wc-gateway-ppec-settings.js CHANGED
@@ -1,4 +1,4 @@
1
- ;(function ( $, window, document ) {
2
  'use strict';
3
 
4
  var uploadField = {
@@ -26,6 +26,9 @@
26
  $( 'body' ).trigger( 'wc_ppec_cert_changed', [ 'live' ] );
27
  $( '#woocommerce_ppec_paypal_sandbox_api_signature' ).trigger( 'change' );
28
  $( '#woocommerce_ppec_paypal_api_signature' ).trigger( 'change' );
 
 
 
29
  },
30
 
31
  onClickUploadButton: function( event ) {
@@ -140,7 +143,22 @@
140
  } else {
141
  $( signature_selector ).closest( 'tr' ).fadeIn();
142
  }
143
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  };
145
 
146
  function getAttachmentUrl( attachment ) {
@@ -158,4 +176,202 @@
158
  }
159
 
160
  $( run );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }( jQuery ) );
1
+ ;(function ( $ ) {
2
  'use strict';
3
 
4
  var uploadField = {
26
  $( 'body' ).trigger( 'wc_ppec_cert_changed', [ 'live' ] );
27
  $( '#woocommerce_ppec_paypal_sandbox_api_signature' ).trigger( 'change' );
28
  $( '#woocommerce_ppec_paypal_api_signature' ).trigger( 'change' );
29
+
30
+ $( 'input[type=text]' ).on( 'keypress', this.maybeSubmitSettings );
31
+ $( 'input[type=password]' ).on( 'keypress', this.maybeSubmitSettings );
32
  },
33
 
34
  onClickUploadButton: function( event ) {
143
  } else {
144
  $( signature_selector ).closest( 'tr' ).fadeIn();
145
  }
146
+ },
147
+
148
+ /**
149
+ * Saves the PayPal Checkout settings when the enter key is pressed inside a text field.
150
+ *
151
+ * This is the default WC behaviour, however, the image upload buttons were being 'clicked' instead.
152
+ *
153
+ * @param event
154
+ */
155
+ maybeSubmitSettings: function( event ) {
156
+ // If the enter key is pressed.
157
+ if ( 13 === event.which ) {
158
+ event.preventDefault();
159
+ $( ".woocommerce-save-button[name='save']" ).click();
160
+ }
161
+ },
162
  };
163
 
164
  function getAttachmentUrl( attachment ) {
176
  }
177
 
178
  $( run );
179
+
180
+ // Handle gateway settings.
181
+ $( function() {
182
+ var ppec_mark_fields = '#woocommerce_ppec_paypal_title, #woocommerce_ppec_paypal_description';
183
+ var ppec_live_fields = '#woocommerce_ppec_paypal_api_username, #woocommerce_ppec_paypal_api_password, #woocommerce_ppec_paypal_api_signature, #woocommerce_ppec_paypal_api_certificate, #woocommerce_ppec_paypal_api_subject';
184
+ var ppec_sandbox_fields = '#woocommerce_ppec_paypal_sandbox_api_username, #woocommerce_ppec_paypal_sandbox_api_password, #woocommerce_ppec_paypal_sandbox_api_signature, #woocommerce_ppec_paypal_sandbox_api_certificate, #woocommerce_ppec_paypal_sandbox_api_subject';
185
+
186
+ var enable_toggle = $( 'a.ppec-toggle-settings' ).length > 0;
187
+ var enable_sandbox_toggle = $( 'a.ppec-toggle-sandbox-settings' ).length > 0;
188
+
189
+ // as of v1.7.0 this option is enabled by default, but can be modified using a filter. Hiding the checkbox will let the settings page hide/show the correct settings depending on whether spb is enabled or disabled
190
+ $( '#woocommerce_ppec_paypal_use_spb' ).closest( 'tr' ).hide();
191
+
192
+ $( '#woocommerce_ppec_paypal_environment' ).change(function(){
193
+ $( ppec_sandbox_fields + ',' + ppec_live_fields ).closest( 'tr' ).hide();
194
+
195
+ if ( 'live' === $( this ).val() ) {
196
+ $( '#woocommerce_ppec_paypal_api_credentials, #woocommerce_ppec_paypal_api_credentials + p' ).show();
197
+ $( '#woocommerce_ppec_paypal_sandbox_api_credentials, #woocommerce_ppec_paypal_sandbox_api_credentials + p' ).hide();
198
+
199
+ if ( ! enable_toggle ) {
200
+ $( ppec_live_fields ).closest( 'tr' ).show();
201
+ }
202
+ } else {
203
+ $( '#woocommerce_ppec_paypal_api_credentials, #woocommerce_ppec_paypal_api_credentials + p' ).hide();
204
+ $( '#woocommerce_ppec_paypal_sandbox_api_credentials, #woocommerce_ppec_paypal_sandbox_api_credentials + p' ).show();
205
+
206
+ if ( ! enable_sandbox_toggle ) {
207
+ $( ppec_sandbox_fields ).closest( 'tr' ).show();
208
+ }
209
+ }
210
+ }).change();
211
+
212
+ $( '#woocommerce_ppec_paypal_enabled' ).change(function(){
213
+ if ( $( this ).is( ':checked' ) ) {
214
+ $( ppec_mark_fields ).closest( 'tr' ).show();
215
+ } else {
216
+ $( ppec_mark_fields ).closest( 'tr' ).hide();
217
+ }
218
+ }).change();
219
+
220
+ $( '#woocommerce_ppec_paypal_paymentaction' ).change(function(){
221
+ if ( 'sale' === $( this ).val() ) {
222
+ $( '#woocommerce_ppec_paypal_instant_payments' ).closest( 'tr' ).show();
223
+ } else {
224
+ $( '#woocommerce_ppec_paypal_instant_payments' ).closest( 'tr' ).hide();
225
+ }
226
+ }).change();
227
+
228
+ if ( enable_toggle ) {
229
+ $( document ).off( 'click', '.ppec-toggle-settings' );
230
+ $( document ).on( 'click', '.ppec-toggle-settings', function( e ) {
231
+ $( ppec_live_fields ).closest( 'tr' ).toggle( 'fast' );
232
+ e.preventDefault();
233
+ } );
234
+ }
235
+ if ( enable_sandbox_toggle ) {
236
+ $( document ).off( 'click', '.ppec-toggle-sandbox-settings' );
237
+ $( document ).on( 'click', '.ppec-toggle-sandbox-settings', function( e ) {
238
+ $( ppec_sandbox_fields ).closest( 'tr' ).toggle( 'fast' );
239
+ e.preventDefault();
240
+ } );
241
+ }
242
+
243
+ $( '.woocommerce_ppec_paypal_button_layout' ).change( function( event ) {
244
+ if ( ! $( '#woocommerce_ppec_paypal_use_spb' ).is( ':checked' ) ) {
245
+ return;
246
+ }
247
+
248
+ // Show settings that pertain to selected layout in same section
249
+ var isVertical = 'vertical' === $( event.target ).val();
250
+ var table = $( event.target ).closest( 'table' );
251
+ table.find( '.woocommerce_ppec_paypal_vertical' ).closest( 'tr' ).toggle( isVertical );
252
+ table.find( '.woocommerce_ppec_paypal_horizontal' ).closest( 'tr' ).toggle( ! isVertical );
253
+
254
+ // Disable 'small' button size option in vertical layout only
255
+ var button_size = table.find( '.woocommerce_ppec_paypal_button_size' );
256
+ var button_size_option = button_size.find( 'option[value=\"small\"]' );
257
+ if ( button_size_option.prop( 'disabled' ) !== isVertical ) {
258
+ button_size.removeClass( 'enhanced' );
259
+ button_size_option.prop( 'disabled', isVertical );
260
+ $( document.body ).trigger( 'wc-enhanced-select-init' );
261
+ ! button_size.val() && button_size.val( 'responsive' ).change();
262
+ }
263
+ } ).change();
264
+
265
+ // Hide default layout and size settings if they'll be overridden anyway.
266
+ function showHideDefaultButtonSettings() {
267
+ var display =
268
+ $( '#woocommerce_ppec_paypal_cart_checkout_enabled' ).is( ':checked' ) ||
269
+ ( $( '#woocommerce_ppec_paypal_checkout_on_single_product_enabled' ).is( ':checked' ) && ! $( '#woocommerce_ppec_paypal_single_product_settings_toggle' ).is( ':checked' ) ) ||
270
+ ( $( '#woocommerce_ppec_paypal_mark_enabled' ).is( ':checked' ) && ! $( '#woocommerce_ppec_paypal_mark_settings_toggle' ).is( ':checked' ) );
271
+
272
+ $( '#woocommerce_ppec_paypal_button_layout, #woocommerce_ppec_paypal_button_size, #woocommerce_ppec_paypal_hide_funding_methods, #woocommerce_ppec_paypal_credit_enabled' ).closest( 'tr' ).toggle( display );
273
+ display && $( '#woocommerce_ppec_paypal_button_layout' ).change();
274
+ }
275
+
276
+ // Toggle mini-cart section based on whether checkout on cart page is enabled
277
+ $( '#woocommerce_ppec_paypal_cart_checkout_enabled' ).change( function( event ) {
278
+ if ( ! $( '#woocommerce_ppec_paypal_use_spb' ).is( ':checked' ) ) {
279
+ return;
280
+ }
281
+
282
+ var checked = $( event.target ).is( ':checked' );
283
+ $( '#woocommerce_ppec_paypal_mini_cart_settings_toggle, .woocommerce_ppec_paypal_mini_cart' )
284
+ .closest( 'tr' )
285
+ .add( '#woocommerce_ppec_paypal_mini_cart_settings' ) // Select title.
286
+ .next( 'p' ) // Select description if present.
287
+ .addBack()
288
+ .toggle( checked );
289
+ checked && $( '#woocommerce_ppec_paypal_mini_cart_settings_toggle' ).change();
290
+ showHideDefaultButtonSettings();
291
+ } ).change();
292
+
293
+ $( '#woocommerce_ppec_paypal_mini_cart_settings_toggle' ).change( function( event ) {
294
+ // Only show settings specific to mini-cart if configured to override global settings.
295
+ var checked = $( event.target ).is( ':checked' );
296
+ $( '.woocommerce_ppec_paypal_mini_cart' ).closest( 'tr' ).toggle( checked );
297
+ checked && $( '#woocommerce_ppec_paypal_mini_cart_button_layout' ).change();
298
+ showHideDefaultButtonSettings();
299
+ } ).change();
300
+
301
+ $( '#woocommerce_ppec_paypal_checkout_on_single_product_enabled, #woocommerce_ppec_paypal_single_product_settings_toggle' ).change( function( event ) {
302
+ if ( ! $( '#woocommerce_ppec_paypal_use_spb' ).is( ':checked' ) ) {
303
+ return;
304
+ }
305
+
306
+ if ( ! $( '#woocommerce_ppec_paypal_checkout_on_single_product_enabled' ).is( ':checked' ) ) {
307
+ // If product page button is disabled, hide remaining settings in section.
308
+ $( '#woocommerce_ppec_paypal_single_product_settings_toggle, .woocommerce_ppec_paypal_single_product' ).closest( 'tr' ).hide();
309
+ } else if ( ! $( '#woocommerce_ppec_paypal_single_product_settings_toggle' ).is( ':checked' ) ) {
310
+ // If product page button is enabled but not configured to override global settings, hide remaining settings in section.
311
+ $( '#woocommerce_ppec_paypal_single_product_settings_toggle' ).closest( 'tr' ).show();
312
+ $( '.woocommerce_ppec_paypal_single_product' ).closest( 'tr' ).hide();
313
+ } else {
314
+ // Show all settings in section.
315
+ $( '#woocommerce_ppec_paypal_single_product_settings_toggle, .woocommerce_ppec_paypal_single_product' ).closest( 'tr' ).show();
316
+ $( '#woocommerce_ppec_paypal_single_product_button_layout' ).change();
317
+ }
318
+ showHideDefaultButtonSettings();
319
+ } ).change();
320
+
321
+ $( '#woocommerce_ppec_paypal_mark_enabled, #woocommerce_ppec_paypal_mark_settings_toggle' ).change( function() {
322
+ if ( ! $( '#woocommerce_ppec_paypal_use_spb' ).is( ':checked' ) ) {
323
+ return;
324
+ }
325
+
326
+ if ( ! $( '#woocommerce_ppec_paypal_mark_enabled' ).is( ':checked' ) ) {
327
+ // If checkout page button is disabled, hide remaining settings in section.
328
+ $( '#woocommerce_ppec_paypal_mark_settings_toggle, .woocommerce_ppec_paypal_mark' ).closest( 'tr' ).hide();
329
+ } else if ( ! $( '#woocommerce_ppec_paypal_mark_settings_toggle' ).is( ':checked' ) ) {
330
+ // If checkout page button is enabled but not configured to override global settings, hide remaining settings in section.
331
+ $( '#woocommerce_ppec_paypal_mark_settings_toggle' ).closest( 'tr' ).show();
332
+ $( '.woocommerce_ppec_paypal_mark' ).closest( 'tr' ).hide();
333
+ } else {
334
+ // Show all settings in section.
335
+ $( '#woocommerce_ppec_paypal_mark_settings_toggle, .woocommerce_ppec_paypal_mark' ).closest( 'tr' ).show();
336
+ $( '#woocommerce_ppec_paypal_mark_button_layout' ).change();
337
+ }
338
+ showHideDefaultButtonSettings();
339
+ } ).change();
340
+
341
+ // Make sure handlers are only attached once if script is loaded multiple times.
342
+ $( '#woocommerce_ppec_paypal_use_spb' ).off( 'change' );
343
+
344
+ $( '#woocommerce_ppec_paypal_use_spb' ).change( function( event ) {
345
+ var checked = $( event.target ).is( ':checked' );
346
+
347
+ // Show settings specific to Smart Payment Buttons only if enabled.
348
+ $( '.woocommerce_ppec_paypal_spb' ).not( 'h3 ').closest( 'tr' ).toggle( checked );
349
+ $( '.woocommerce_ppec_paypal_spb' ).filter( 'h3' ).next( 'p' ).addBack().toggle( checked );
350
+
351
+ if ( checked ) {
352
+ // Trigger all logic that controls visibility of other settings.
353
+ $( '.woocommerce_ppec_paypal_visibility_toggle' ).change();
354
+ } else {
355
+ // If non-SPB mode is enabled, show all settings that may have been hidden.
356
+ $( '#woocommerce_ppec_paypal_button_size, #woocommerce_ppec_paypal_credit_enabled' ).closest( 'tr' ).show();
357
+ }
358
+
359
+ // Hide 'Responsive' button size option in SPB mode, and make sure to show 'Small' option.
360
+ var button_size = $( '#woocommerce_ppec_paypal_button_size' ).removeClass( 'enhanced' );
361
+ button_size.find( 'option[value=\"responsive\"]' ).prop( 'disabled', ! checked );
362
+ ! checked && button_size.find( 'option[value=\"small\"]' ).prop( 'disabled', false );
363
+ $( document.body ).trigger( 'wc-enhanced-select-init' );
364
+ } ).change();
365
+
366
+ // Reset button size values to default when switching modes.
367
+ $( '#woocommerce_ppec_paypal_use_spb' ).change( function( event ) {
368
+ if ( $( event.target ).is( ':checked' ) ) {
369
+ // In SPB mode, set to recommended 'Responsive' value so it is not missed.
370
+ $( '#woocommerce_ppec_paypal_button_size' ).val( 'responsive' ).change();
371
+ } else if ( ! $( '#woocommerce_ppec_paypal_button_size' ).val() ) {
372
+ // Set back to original default for non-SPB mode.
373
+ $( '#woocommerce_ppec_paypal_button_size' ).val( 'large' ).change();
374
+ }
375
+ } );
376
+ } );
377
  }( jQuery ) );
assets/js/wc-gateway-ppec-smart-payment-buttons.js CHANGED
@@ -35,7 +35,7 @@
35
  $( document.body ).trigger( 'checkout_error' );
36
  }
37
 
38
- // Map funding method settings to enumerated options provided by PayPal.
39
  var getFundingMethods = function( methods ) {
40
  if ( ! methods ) {
41
  return undefined;
@@ -43,7 +43,7 @@
43
 
44
  var paypal_funding_methods = [];
45
  for ( var i = 0; i < methods.length; i++ ) {
46
- var method = paypal.FUNDING[ methods[ i ] ];
47
  if ( method ) {
48
  paypal_funding_methods.push( method );
49
  }
@@ -55,19 +55,21 @@
55
  var prefix = isMiniCart ? 'mini_cart_' : '';
56
  var button_size = wc_ppec_context[ prefix + 'button_size' ];
57
  var button_layout = wc_ppec_context[ prefix + 'button_layout' ];
58
- var button_label = wc_ppec_context[ prefix + 'button_label' ];
59
  var allowed = wc_ppec_context[ prefix + 'allowed_methods' ];
60
  var disallowed = wc_ppec_context[ prefix + 'disallowed_methods' ];
61
 
62
  var selector = isMiniCart ? '#woo_pp_ec_button_mini_cart' : '#woo_pp_ec_button_' + wc_ppec_context.page;
63
  var fromCheckout = 'checkout' === wc_ppec_context.page && ! isMiniCart;
 
 
64
 
65
  // Don't render if selector doesn't exist or is already rendered in DOM.
66
  if ( ! $( selector ).length || $( selector ).children().length ) {
67
  return;
68
  }
69
 
70
- paypal.Button.render( {
71
  env: wc_ppec_context.environment,
72
  locale: wc_ppec_context.locale,
73
  commit: fromCheckout,
@@ -80,9 +82,9 @@
80
  style: {
81
  color: wc_ppec_context.button_color,
82
  shape: wc_ppec_context.button_shape,
 
83
  layout: button_layout,
84
  size: button_size,
85
- label: button_label,
86
  branding: true,
87
  tagline: false,
88
  },
@@ -98,7 +100,7 @@
98
  // Clear any errors from previous attempt.
99
  $( '.woocommerce-error', selector ).remove();
100
 
101
- return new paypal.Promise( function( resolve, reject ) {
102
  // First, generate cart if triggered from single product.
103
  if ( 'product' === wc_ppec_context.page && ! isMiniCart ) {
104
  window.wc_ppec_generate_cart( resolve );
@@ -116,11 +118,7 @@
116
  )
117
  .serialize();
118
 
119
- return paypal.request( {
120
- method: 'post',
121
- url: wc_ppec_context.start_checkout_url,
122
- body: data,
123
- } ).then( function( response ) {
124
  if ( ! response.success ) {
125
  // Error messages may be preformatted in which case response structure will differ
126
  var messages = response.data ? response.data.messages : response.messages;
@@ -135,7 +133,25 @@
135
  return null;
136
  }
137
  return response.data.token;
138
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  } );
140
  },
141
 
@@ -143,16 +159,76 @@
143
  if ( fromCheckout ) {
144
  // Pass data necessary for authorizing payment to back-end.
145
  $( 'form.checkout' )
146
- .append( $( '<input type="hidden" name="paymentToken" /> ' ).attr( 'value', data.paymentToken ) )
147
  .append( $( '<input type="hidden" name="payerID" /> ' ).attr( 'value', data.payerID ) )
148
  .submit();
149
  } else {
150
  // Navigate to order confirmation URL specified in original request to PayPal from back-end.
 
 
 
 
 
151
  return actions.redirect();
152
  }
153
  },
154
 
155
- }, selector );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  };
157
 
158
  // Render cart, single product, or checkout buttons.
35
  $( document.body ).trigger( 'checkout_error' );
36
  }
37
 
38
+ // Map funding method settings to enumerated options provided by PayPal (checkout.js).
39
  var getFundingMethods = function( methods ) {
40
  if ( ! methods ) {
41
  return undefined;
43
 
44
  var paypal_funding_methods = [];
45
  for ( var i = 0; i < methods.length; i++ ) {
46
+ var method = paypal.FUNDING[ methods[ i ].toUpperCase() ];
47
  if ( method ) {
48
  paypal_funding_methods.push( method );
49
  }
55
  var prefix = isMiniCart ? 'mini_cart_' : '';
56
  var button_size = wc_ppec_context[ prefix + 'button_size' ];
57
  var button_layout = wc_ppec_context[ prefix + 'button_layout' ];
58
+ var button_label = ( 'undefined' !== wc_ppec_context[ prefix + 'button_label' ] ) ? wc_ppec_context[ prefix + 'button_label' ] : wc_ppec_context['button_label'];
59
  var allowed = wc_ppec_context[ prefix + 'allowed_methods' ];
60
  var disallowed = wc_ppec_context[ prefix + 'disallowed_methods' ];
61
 
62
  var selector = isMiniCart ? '#woo_pp_ec_button_mini_cart' : '#woo_pp_ec_button_' + wc_ppec_context.page;
63
  var fromCheckout = 'checkout' === wc_ppec_context.page && ! isMiniCart;
64
+ const return_url = wc_ppec_context['return_url'];
65
+ const cancel_url = wc_ppec_context['cancel_url'];
66
 
67
  // Don't render if selector doesn't exist or is already rendered in DOM.
68
  if ( ! $( selector ).length || $( selector ).children().length ) {
69
  return;
70
  }
71
 
72
+ var button_args = {
73
  env: wc_ppec_context.environment,
74
  locale: wc_ppec_context.locale,
75
  commit: fromCheckout,
82
  style: {
83
  color: wc_ppec_context.button_color,
84
  shape: wc_ppec_context.button_shape,
85
+ label: button_label,
86
  layout: button_layout,
87
  size: button_size,
 
88
  branding: true,
89
  tagline: false,
90
  },
100
  // Clear any errors from previous attempt.
101
  $( '.woocommerce-error', selector ).remove();
102
 
103
+ return new Promise( function( resolve, reject ) {
104
  // First, generate cart if triggered from single product.
105
  if ( 'product' === wc_ppec_context.page && ! isMiniCart ) {
106
  window.wc_ppec_generate_cart( resolve );
118
  )
119
  .serialize();
120
 
121
+ var request_callback = function( response ) {
 
 
 
 
122
  if ( ! response.success ) {
123
  // Error messages may be preformatted in which case response structure will differ
124
  var messages = response.data ? response.data.messages : response.messages;
133
  return null;
134
  }
135
  return response.data.token;
136
+ };
137
+
138
+ if ( ! wc_ppec_context.use_checkout_js ) {
139
+ return fetch( wc_ppec_context.start_checkout_url, {
140
+ method: 'post',
141
+ headers: {
142
+ 'Content-Type': 'application/x-www-form-urlencoded',
143
+ },
144
+ body: data,
145
+ } ).then( function ( response ) {
146
+ return response.json();
147
+ } ).then( request_callback );
148
+ } else {
149
+ return paypal.request( {
150
+ method: 'post',
151
+ url: wc_ppec_context.start_checkout_url,
152
+ body: data,
153
+ } ).then( request_callback );
154
+ }
155
  } );
156
  },
157
 
159
  if ( fromCheckout ) {
160
  // Pass data necessary for authorizing payment to back-end.
161
  $( 'form.checkout' )
162
+ .append( $( '<input type="hidden" name="paymentToken" /> ' ).attr( 'value', ! wc_ppec_context.use_checkout_js ? data.orderID : data.paymentToken ) )
163
  .append( $( '<input type="hidden" name="payerID" /> ' ).attr( 'value', data.payerID ) )
164
  .submit();
165
  } else {
166
  // Navigate to order confirmation URL specified in original request to PayPal from back-end.
167
+ if ( ! wc_ppec_context.use_checkout_js ) {
168
+ const query_args = '?woo-paypal-return=true&token=' + data.orderID + '&PayerID=' + data.payerID;
169
+ return actions.redirect( return_url + query_args );
170
+ }
171
+
172
  return actions.redirect();
173
  }
174
  },
175
 
176
+ onCancel: function( data, actions ) {
177
+ if ( 'orderID' in data ) {
178
+ const query_args = '?woo-paypal-cancel=true&token=' + data.orderID;
179
+ return actions.redirect( cancel_url + query_args );
180
+ }
181
+ },
182
+
183
+ onError: function() {
184
+ jQuery( selector ).empty();
185
+ render();
186
+ },
187
+ };
188
+
189
+ if ( ! wc_ppec_context.use_checkout_js ) {
190
+ // 'payment()' and 'onAuthorize()' callbacks from checkout.js are now 'createOrder()' and 'onApprove()'.
191
+ Object.defineProperty( button_args, 'createOrder', Object.getOwnPropertyDescriptor( button_args, 'payment' ) );
192
+ Object.defineProperty( button_args, 'onApprove', Object.getOwnPropertyDescriptor( button_args, 'onAuthorize' ) );
193
+
194
+ // 'style.size' is no longer supported in the JS SDK. See https://developer.paypal.com/docs/checkout/integration-features/customize-button/#size.
195
+ delete button_args['style']['size'];
196
+
197
+ // Drop other args no longer needed in the JS SDK.
198
+ var args_to_remove = [ 'env', 'locale', 'commit', 'funding', 'payment', 'onAuthorize' ];
199
+ args_to_remove.forEach( function( arg ) {
200
+ delete button_args[ arg ]
201
+ });
202
+
203
+ var disabledFundingSources = getFundingMethods( disallowed );
204
+ if ( 'undefined' === typeof( disabledFundingSources ) || ! disabledFundingSources || 0 === disabledFundingSources.length ) {
205
+ paypal.Buttons( button_args ).render( selector );
206
+ } else {
207
+ // Render context specific buttons.
208
+ paypal.getFundingSources().forEach( function( fundingSource ) {
209
+ if ( -1 !== disabledFundingSources.indexOf( fundingSource ) ) {
210
+ return;
211
+ }
212
+
213
+ var buttonSettings = {
214
+ createOrder: button_args.createOrder,
215
+ onApprove: button_args.onApprove,
216
+ onError: button_args.onError,
217
+ onCancel: button_args.onCancel,
218
+ fundingSource: fundingSource,
219
+ style: ( paypal.FUNDING.PAYPAL === fundingSource ) ? button_args.style : {}
220
+ };
221
+
222
+ var button = paypal.Buttons( buttonSettings );
223
+
224
+ if ( button.isEligible() ) {
225
+ button.render( selector );
226
+ }
227
+ } );
228
+ }
229
+ } else {
230
+ paypal.Button.render( button_args, selector );
231
+ }
232
  };
233
 
234
  // Render cart, single product, or checkout buttons.
changelog.txt CHANGED
@@ -1,5 +1,22 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.6.21 - 2020-04-14 =
4
  * Fix - Ensure Puerto Rico and supported Locales are eligible for PayPal Credit. PR#693
5
  * Fix - Support purchasing subscriptions with $0 initial payment - free trials, synced etc. PR#698
1
  *** Changelog ***
2
 
3
+ = 2.0.0 - 2020-05-25 =
4
+ * New - Upgrade to the latest PayPal Checkout Javascript SDK. PR#668
5
+ * Add - New setting found under Button Styles for choosing a Smart Payment Button label. PR#666
6
+ * Add - Support for more locales. PR#658
7
+ * Fix - Display Smart Payment Buttons on Product pages built from a shortcode. PR#665
8
+ * Fix - Send the product SKU to PayPal so it's displayed in the order/transaction details and reports on PayPal. PR#664
9
+ * Fix - Show an error when saving incomplete/missing API credentials. PR#712
10
+ * Fix - Remove PHP warnings in later versions of PHP when a PayPal Session doesn't exist. PR#727
11
+ * Fix - Error when processing refunds (Already Refunded. No Amount to Refund). PR#710
12
+ * Fix - Required state field errors on the "Confirm your PayPal Order" page when returning from PayPal. PR#725
13
+ * Fix - Display WC Add To Cart validation errors on the product page when clicking the PayPal Smart Payment Buttons. PR#707
14
+ * Update - Smart Payment Buttons are enabled by default and settings to toggle these on/off have been removed and replaced with a filter. PR#660
15
+ * Update - Deprecate unused/incomplete function `WC_Gateway_PPEC_Client::update_billing_agreement()`. PR#602
16
+ * Update - Move inline javascript found in `settings-ppec.php` to `ppec-settings.js`. PR#676
17
+ * Update - Move Support and Documentation links from the plugin actions to plugin meta section on the Plugin activation/deactivation page. PR#735
18
+ * Update - WooCommerce 4.1 and WordPress 5.4 compatibility. PR#732
19
+
20
  = 1.6.21 - 2020-04-14 =
21
  * Fix - Ensure Puerto Rico and supported Locales are eligible for PayPal Credit. PR#693
22
  * Fix - Support purchasing subscriptions with $0 initial payment - free trials, synced etc. PR#698
includes/abstracts/abstract-wc-gateway-ppec.php CHANGED
@@ -18,15 +18,14 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
18
  $this->method_title = __( 'PayPal Checkout', 'woocommerce-gateway-paypal-express-checkout' );
19
  $this->method_description = __( 'Allow customers to conveniently checkout directly with PayPal.', 'woocommerce-gateway-paypal-express-checkout' );
20
 
21
- if ( empty( $_GET['woo-paypal-return'] ) && 'yes' !== $this->get_option( 'use_spb' ) ) {
22
- $this->order_button_text = __( 'Continue to payment', 'woocommerce-gateway-paypal-express-checkout' );
23
- }
24
-
25
  wc_gateway_ppec()->ips->maybe_received_credentials();
26
 
27
  $this->init_form_fields();
28
  $this->init_settings();
29
 
 
 
 
30
  $this->title = $this->method_title;
31
  $this->description = '';
32
  $this->enabled = $this->get_option( 'enabled', 'yes' );
@@ -56,6 +55,10 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
56
  $this->subtotal_mismatch_behavior = $this->get_option( 'subtotal_mismatch_behavior', 'add' );
57
  $this->use_ppc = false;
58
 
 
 
 
 
59
  add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
60
 
61
  // Change gateway name if session is active
@@ -275,87 +278,93 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
275
  $settings = wc_gateway_ppec()->settings->load( true );
276
  $creds = $settings->get_active_api_credentials();
277
 
278
- $username = $creds->get_username();
279
- $password = $creds->get_password();
 
 
280
 
281
- if ( ! empty( $username ) ) {
 
 
 
282
 
283
- if ( empty( $password ) ) {
284
- WC_Admin_Settings::add_error( __( 'Error: You must enter API password.', 'woocommerce-gateway-paypal-express-checkout' ) );
285
- return false;
286
- }
287
 
288
- if ( is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Signature' ) && $creds->get_signature() ) {
 
 
289
 
290
- try {
 
 
291
 
 
 
 
 
292
  $payer_id = wc_gateway_ppec()->client->test_api_credentials( $creds, $settings->get_environment() );
293
 
294
  if ( ! $payer_id ) {
295
- WC_Admin_Settings::add_error( __( 'Error: The API credentials you provided are not valid. Please double-check that you entered them correctly and try again.', 'woocommerce-gateway-paypal-express-checkout' ) );
296
- return false;
297
  }
298
  } catch ( PayPal_API_Exception $ex ) {
299
 
300
- WC_Admin_Settings::add_error( __( 'An error occurred while trying to validate your API credentials. Unable to verify that your API credentials are correct.', 'woocommerce-gateway-paypal-express-checkout' ) );
301
  }
302
- } elseif ( is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Certificate' ) && $creds->get_certificate() ) {
303
 
304
  $cert = @openssl_x509_read( $creds->get_certificate() ); // @codingStandardsIgnoreLine
305
 
306
  if ( false === $cert ) {
307
- WC_Admin_Settings::add_error( __( 'Error: The API certificate is not valid.', 'woocommerce-gateway-paypal-express-checkout' ) );
308
- return false;
309
  }
310
 
311
  $cert_info = openssl_x509_parse( $cert );
312
  $valid_until = $cert_info['validTo_time_t'];
313
 
314
  if ( $valid_until < time() ) {
315
- WC_Admin_Settings::add_error( __( 'Error: The API certificate has expired.', 'woocommerce-gateway-paypal-express-checkout' ) );
316
- return false;
317
- }
318
-
319
- if ( $cert_info['subject']['CN'] != $creds->get_username() ) {
320
- WC_Admin_Settings::add_error( __( 'Error: The API username does not match the name in the API certificate. Make sure that you have the correct API certificate.', 'woocommerce-gateway-paypal-express-checkout' ) );
321
- return false;
322
  }
323
 
324
  try {
325
-
326
  $payer_id = wc_gateway_ppec()->client->test_api_credentials( $creds, $settings->get_environment() );
327
 
328
  if ( ! $payer_id ) {
329
- WC_Admin_Settings::add_error( __( 'Error: The API credentials you provided are not valid. Please double-check that you entered them correctly and try again.', 'woocommerce-gateway-paypal-express-checkout' ) );
330
- return false;
331
  }
332
  } catch ( PayPal_API_Exception $ex ) {
333
- WC_Admin_Settings::add_error( __( 'An error occurred while trying to validate your API credentials. Unable to verify that your API credentials are correct.', 'woocommerce-gateway-paypal-express-checkout' ) );
334
  }
335
-
336
- } else {
337
-
338
- WC_Admin_Settings::add_error( __( 'Error: You must provide API signature or certificate.', 'woocommerce-gateway-paypal-express-checkout' ) );
339
- return false;
340
  }
 
341
 
342
- $settings_array = (array) get_option( 'woocommerce_ppec_paypal_settings', array() );
343
 
344
- if ( 'yes' === $settings_array['require_billing'] ) {
 
 
 
 
 
345
  $is_account_enabled_for_billing_address = false;
 
346
 
347
- try {
348
- $is_account_enabled_for_billing_address = wc_gateway_ppec()->client->test_for_billing_address_enabled( $creds, $settings->get_environment() );
349
- } catch ( PayPal_API_Exception $ex ) {
350
- $is_account_enabled_for_billing_address = false;
351
- }
 
352
 
353
- if ( ! $is_account_enabled_for_billing_address ) {
354
- $settings_array['require_billing'] = 'no';
355
- update_option( 'woocommerce_ppec_paypal_settings', $settings_array );
356
- WC_Admin_Settings::add_error( __( 'The "require billing address" option is not enabled by your account and has been disabled.', 'woocommerce-gateway-paypal-express-checkout' ) );
357
- }
358
  }
 
359
  }
360
  }
361
 
@@ -383,6 +392,10 @@ abstract class WC_Gateway_PPEC extends WC_Payment_Gateway {
383
  $txn_data = $old_wc ? get_post_meta( $order_id, '_woo_pp_txnData', true ) : $order->get_meta( '_woo_pp_txnData', true );
384
  $order_currency = $old_wc ? $order->order_currency : $order->get_currency();
385
 
 
 
 
 
386
  foreach ( $txn_data['refundable_txns'] as $key => $value ) {
387
  $refundable_amount = $value['amount'] - $value['refunded_amount'];
388
 
18
  $this->method_title = __( 'PayPal Checkout', 'woocommerce-gateway-paypal-express-checkout' );
19
  $this->method_description = __( 'Allow customers to conveniently checkout directly with PayPal.', 'woocommerce-gateway-paypal-express-checkout' );
20
 
 
 
 
 
21
  wc_gateway_ppec()->ips->maybe_received_credentials();
22
 
23
  $this->init_form_fields();
24
  $this->init_settings();
25
 
26
+ // With 1.7.0, override the use_spb option pulled from the DB to the value set in WC_Gateway_PPEC_Settings
27
+ $this->settings['use_spb'] = wc_gateway_ppec()->settings->use_spb;
28
+
29
  $this->title = $this->method_title;
30
  $this->description = '';
31
  $this->enabled = $this->get_option( 'enabled', 'yes' );
55
  $this->subtotal_mismatch_behavior = $this->get_option( 'subtotal_mismatch_behavior', 'add' );
56
  $this->use_ppc = false;
57
 
58
+ if ( empty( $_GET['woo-paypal-return'] ) && 'yes' !== $this->get_option( 'use_spb', 'yes' ) ) {
59
+ $this->order_button_text = __( 'Continue to payment', 'woocommerce-gateway-paypal-express-checkout' );
60
+ }
61
+
62
  add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
63
 
64
  // Change gateway name if session is active
278
  $settings = wc_gateway_ppec()->settings->load( true );
279
  $creds = $settings->get_active_api_credentials();
280
 
281
+ $has_username = (bool) $creds->get_username();
282
+ $has_password = (bool) $creds->get_password();
283
+ $has_credential = is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Signature' ) ? (bool) $creds->get_signature() : (bool) $creds->get_certificate();
284
+ $errors = array();
285
 
286
+ // Attempt to validate the credentials if any one of them has been set.
287
+ if ( ! $has_username && ! $has_password && ! $has_credential ) {
288
+ return;
289
+ }
290
 
291
+ if ( ! $has_username ) {
292
+ $errors[] = __( 'Error: You must enter API username.', 'woocommerce-gateway-paypal-express-checkout' );
293
+ }
 
294
 
295
+ if ( ! $has_password ) {
296
+ $errors[] = __( 'Error: You must enter API password.', 'woocommerce-gateway-paypal-express-checkout' );
297
+ }
298
 
299
+ if ( ! $has_credential ) {
300
+ $errors[] = __( 'Error: You must provide API signature or certificate.', 'woocommerce-gateway-paypal-express-checkout' );
301
+ }
302
 
303
+ // Only attempt to validate the credential (signature or cert), if all fields are set.
304
+ if ( $has_username && $has_password && $has_credential ) {
305
+ if ( is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Signature' ) ) {
306
+ try {
307
  $payer_id = wc_gateway_ppec()->client->test_api_credentials( $creds, $settings->get_environment() );
308
 
309
  if ( ! $payer_id ) {
310
+ $errors[] = __( 'Error: The API credentials you provided are not valid. Please double-check that you entered them correctly and try again.', 'woocommerce-gateway-paypal-express-checkout' );
 
311
  }
312
  } catch ( PayPal_API_Exception $ex ) {
313
 
314
+ $errors[] = __( 'An error occurred while trying to validate your API credentials. Unable to verify that your API credentials are correct.', 'woocommerce-gateway-paypal-express-checkout' );
315
  }
316
+ } elseif ( is_a( $creds, 'WC_Gateway_PPEC_Client_Credential_Certificate' ) ) {
317
 
318
  $cert = @openssl_x509_read( $creds->get_certificate() ); // @codingStandardsIgnoreLine
319
 
320
  if ( false === $cert ) {
321
+ $errors[] = __( 'Error: The API certificate is not valid.', 'woocommerce-gateway-paypal-express-checkout' );
 
322
  }
323
 
324
  $cert_info = openssl_x509_parse( $cert );
325
  $valid_until = $cert_info['validTo_time_t'];
326
 
327
  if ( $valid_until < time() ) {
328
+ $errors[] = __( 'Error: The API certificate has expired.', 'woocommerce-gateway-paypal-express-checkout' );
329
+ } elseif ( $cert_info['subject']['CN'] !== $creds->get_username() ) {
330
+ $errors[] = __( 'Error: The API username does not match the name in the API certificate. Make sure that you have the correct API certificate.', 'woocommerce-gateway-paypal-express-checkout' );
 
 
 
 
331
  }
332
 
333
  try {
 
334
  $payer_id = wc_gateway_ppec()->client->test_api_credentials( $creds, $settings->get_environment() );
335
 
336
  if ( ! $payer_id ) {
337
+ $errors[] = __( 'Error: The API credentials you provided are not valid. Please double-check that you entered them correctly and try again.', 'woocommerce-gateway-paypal-express-checkout' );
 
338
  }
339
  } catch ( PayPal_API_Exception $ex ) {
340
+ $errors[] = __( 'An error occurred while trying to validate your API credentials. Unable to verify that your API credentials are correct.', 'woocommerce-gateway-paypal-express-checkout' );
341
  }
 
 
 
 
 
342
  }
343
+ }
344
 
345
+ $settings_array = (array) get_option( 'woocommerce_ppec_paypal_settings', array() );
346
 
347
+ if ( 'yes' === $settings_array['require_billing'] ) {
348
+ $is_account_enabled_for_billing_address = false;
349
+
350
+ try {
351
+ $is_account_enabled_for_billing_address = wc_gateway_ppec()->client->test_for_billing_address_enabled( $creds, $settings->get_environment() );
352
+ } catch ( PayPal_API_Exception $ex ) {
353
  $is_account_enabled_for_billing_address = false;
354
+ }
355
 
356
+ if ( ! $is_account_enabled_for_billing_address ) {
357
+ $settings_array['require_billing'] = 'no';
358
+ update_option( 'woocommerce_ppec_paypal_settings', $settings_array );
359
+ $errors[] = __( 'The "require billing address" option is not enabled by your account and has been disabled.', 'woocommerce-gateway-paypal-express-checkout' );
360
+ }
361
+ }
362
 
363
+ if ( ! empty( $errors ) ) {
364
+ foreach ( $errors as $message ) {
365
+ WC_Admin_Settings::add_error( $message );
 
 
366
  }
367
+ return false;
368
  }
369
  }
370
 
392
  $txn_data = $old_wc ? get_post_meta( $order_id, '_woo_pp_txnData', true ) : $order->get_meta( '_woo_pp_txnData', true );
393
  $order_currency = $old_wc ? $order->order_currency : $order->get_currency();
394
 
395
+ if( ! isset($txn_data['refundable_txns'] ) ) {
396
+ return new WP_Error( 'paypal_refund_error', __( 'Refund Error: Sorry! This is not a refundable transaction.', 'woocommerce-gateway-paypal-express-checkout' ) );
397
+ }
398
+
399
  foreach ( $txn_data['refundable_txns'] as $key => $value ) {
400
  $refundable_amount = $value['amount'] - $value['refunded_amount'];
401
 
includes/class-wc-gateway-ppec-cart-handler.php CHANGED
@@ -38,6 +38,11 @@ class WC_Gateway_PPEC_Cart_Handler {
38
 
39
  add_action( 'wc_ajax_wc_ppec_update_shipping_costs', array( $this, 'wc_ajax_update_shipping_costs' ) );
40
  add_action( 'wc_ajax_wc_ppec_start_checkout', array( $this, 'wc_ajax_start_checkout' ) );
 
 
 
 
 
41
  }
42
 
43
  /**
@@ -411,7 +416,6 @@ class WC_Gateway_PPEC_Cart_Handler {
411
  /**
412
  * Convert from settings to values expected by PayPal Button API:
413
  * - 'small' button size only allowed if layout is 'vertical'.
414
- * - 'label' only allowed if layout is 'vertical'.
415
  * - 'disallowed' funding methods if layout is 'vertical'.
416
  * - 'allowed' funding methods if layout is 'horizontal'.
417
  * - Only allow PayPal Credit if supported.
@@ -427,12 +431,12 @@ class WC_Gateway_PPEC_Cart_Handler {
427
  $data = array(
428
  'button_layout' => $settings->{ $prefix . 'button_layout' },
429
  'button_size' => $settings->{ $prefix . 'button_size' },
 
430
  'hide_funding_methods' => $settings->{ $prefix . 'hide_funding_methods' },
431
  'credit_enabled' => $settings->{ $prefix . 'credit_enabled' },
432
  );
433
 
434
  $button_layout = $data['button_layout'];
435
- $data['button_label'] = 'horizontal' === $button_layout ? 'buynow' : null;
436
  $data['button_size'] = 'vertical' === $button_layout && 'small' === $data['button_size']
437
  ? 'medium'
438
  : $data['button_size'];
@@ -449,7 +453,8 @@ class WC_Gateway_PPEC_Cart_Handler {
449
  if ( 'vertical' === $button_layout ) {
450
  $data['disallowed_methods'] = $data['hide_funding_methods'];
451
  } else {
452
- $data['allowed_methods'] = 'yes' === $data['credit_enabled'] ? array( 'CREDIT' ) : array();
 
453
  }
454
  unset( $data['hide_funding_methods'], $data['credit_enabled'] );
455
 
@@ -460,6 +465,8 @@ class WC_Gateway_PPEC_Cart_Handler {
460
  * Frontend scripts
461
  */
462
  public function enqueue_scripts() {
 
 
463
  $settings = wc_gateway_ppec()->settings;
464
  $client = wc_gateway_ppec()->client;
465
 
@@ -486,20 +493,23 @@ class WC_Gateway_PPEC_Cart_Handler {
486
  );
487
 
488
  } elseif ( 'yes' === $settings->use_spb ) {
489
- wp_register_script( 'paypal-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true );
490
- wp_register_script( 'wc-gateway-ppec-smart-payment-buttons', wc_gateway_ppec()->plugin_url . 'assets/js/wc-gateway-ppec-smart-payment-buttons.js', array( 'jquery', 'paypal-checkout-js' ), wc_gateway_ppec()->version, true );
491
-
492
- $data = array(
493
  'environment' => 'sandbox' === $settings->get_environment() ? 'sandbox' : 'production',
494
  'locale' => $settings->get_paypal_locale(),
495
  'page' => $page,
496
  'button_color' => $settings->button_color,
497
  'button_shape' => $settings->button_shape,
 
498
  'start_checkout_nonce' => wp_create_nonce( '_wc_ppec_start_checkout_nonce' ),
499
  'start_checkout_url' => WC_AJAX::get_endpoint( 'wc_ppec_start_checkout' ),
 
 
 
500
  );
501
 
502
- if ( ! is_null( $page ) ) {
503
  if ( 'product' === $page && 'yes' === $settings->single_product_settings_toggle ) {
504
  $button_settings = $this->get_button_settings( $settings, 'single_product' );
505
  } elseif ( 'checkout' === $page && 'yes' === $settings->mark_settings_toggle ) {
@@ -513,12 +523,39 @@ class WC_Gateway_PPEC_Cart_Handler {
513
 
514
  $settings_toggle = 'yes' === $settings->mini_cart_settings_toggle;
515
  $mini_cart_data = $this->get_button_settings( $settings, $settings_toggle ? 'mini_cart' : '' );
 
516
  foreach( $mini_cart_data as $key => $value ) {
517
  unset( $mini_cart_data[ $key ] );
518
  $mini_cart_data[ 'mini_cart_' . $key ] = $value;
519
  }
 
520
  $data = array_merge( $data, $mini_cart_data );
 
 
 
 
 
 
 
 
 
 
 
 
 
521
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  wp_localize_script( 'wc-gateway-ppec-smart-payment-buttons', 'wc_ppec_context', $data );
523
  }
524
  }
@@ -540,6 +577,51 @@ class WC_Gateway_PPEC_Cart_Handler {
540
  }
541
  }
542
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
543
  /**
544
  * @deprecated
545
  */
38
 
39
  add_action( 'wc_ajax_wc_ppec_update_shipping_costs', array( $this, 'wc_ajax_update_shipping_costs' ) );
40
  add_action( 'wc_ajax_wc_ppec_start_checkout', array( $this, 'wc_ajax_start_checkout' ) );
41
+
42
+ // Load callbacks specific to Subscriptions integration.
43
+ if ( class_exists( 'WC_Subscriptions_Order' ) ) {
44
+ add_filter( 'woocommerce_paypal_express_checkout_payment_button_data', array( $this, 'hide_card_payment_buttons_for_subscriptions' ), 10, 2 );
45
+ }
46
  }
47
 
48
  /**
416
  /**
417
  * Convert from settings to values expected by PayPal Button API:
418
  * - 'small' button size only allowed if layout is 'vertical'.
 
419
  * - 'disallowed' funding methods if layout is 'vertical'.
420
  * - 'allowed' funding methods if layout is 'horizontal'.
421
  * - Only allow PayPal Credit if supported.
431
  $data = array(
432
  'button_layout' => $settings->{ $prefix . 'button_layout' },
433
  'button_size' => $settings->{ $prefix . 'button_size' },
434
+ 'button_label' => $settings->{ $prefix . 'button_label' },
435
  'hide_funding_methods' => $settings->{ $prefix . 'hide_funding_methods' },
436
  'credit_enabled' => $settings->{ $prefix . 'credit_enabled' },
437
  );
438
 
439
  $button_layout = $data['button_layout'];
 
440
  $data['button_size'] = 'vertical' === $button_layout && 'small' === $data['button_size']
441
  ? 'medium'
442
  : $data['button_size'];
453
  if ( 'vertical' === $button_layout ) {
454
  $data['disallowed_methods'] = $data['hide_funding_methods'];
455
  } else {
456
+ $data['allowed_methods'] = 'yes' === $data['credit_enabled'] ? array( 'CREDIT' ) : array();
457
+ $data['disallowed_methods'] = 'yes' !== $data['credit_enabled'] ? array( 'CREDIT' ) : array();
458
  }
459
  unset( $data['hide_funding_methods'], $data['credit_enabled'] );
460
 
465
  * Frontend scripts
466
  */
467
  public function enqueue_scripts() {
468
+ global $is_IE;
469
+
470
  $settings = wc_gateway_ppec()->settings;
471
  $client = wc_gateway_ppec()->client;
472
 
493
  );
494
 
495
  } elseif ( 'yes' === $settings->use_spb ) {
496
+ $spb_script_dependencies = array( 'jquery', 'paypal-checkout-js' );
497
+ $data = array(
498
+ 'use_checkout_js' => $settings->use_legacy_checkout_js(),
 
499
  'environment' => 'sandbox' === $settings->get_environment() ? 'sandbox' : 'production',
500
  'locale' => $settings->get_paypal_locale(),
501
  'page' => $page,
502
  'button_color' => $settings->button_color,
503
  'button_shape' => $settings->button_shape,
504
+ 'button_label' => $settings->button_label,
505
  'start_checkout_nonce' => wp_create_nonce( '_wc_ppec_start_checkout_nonce' ),
506
  'start_checkout_url' => WC_AJAX::get_endpoint( 'wc_ppec_start_checkout' ),
507
+ 'return_url' => wc_get_checkout_url(),
508
+ 'cancel_url' => wc_get_cart_url(),
509
+ 'generic_error_msg' => wp_kses( __( 'An error occurred while processing your PayPal payment. Please contact the store owner for assistance.', 'woocommerce-gateway-paypal-express-checkout' ), array() ),
510
  );
511
 
512
+ if ( ! is_null( $page ) ) {
513
  if ( 'product' === $page && 'yes' === $settings->single_product_settings_toggle ) {
514
  $button_settings = $this->get_button_settings( $settings, 'single_product' );
515
  } elseif ( 'checkout' === $page && 'yes' === $settings->mark_settings_toggle ) {
523
 
524
  $settings_toggle = 'yes' === $settings->mini_cart_settings_toggle;
525
  $mini_cart_data = $this->get_button_settings( $settings, $settings_toggle ? 'mini_cart' : '' );
526
+
527
  foreach( $mini_cart_data as $key => $value ) {
528
  unset( $mini_cart_data[ $key ] );
529
  $mini_cart_data[ 'mini_cart_' . $key ] = $value;
530
  }
531
+
532
  $data = array_merge( $data, $mini_cart_data );
533
+ $data = apply_filters( 'woocommerce_paypal_express_checkout_payment_button_data', $data, $page );
534
+
535
+ if ( ! $settings->use_legacy_checkout_js() ) {
536
+ $script_args = array(
537
+ 'client-id' => $settings->get_active_rest_client_id(),
538
+ 'merchant-id' => $client->get_payer_id(),
539
+ 'locale' => $settings->get_paypal_locale(),
540
+ 'components' => 'buttons,funding-eligibility',
541
+ 'commit' => 'checkout' === $page ? 'true' : 'false',
542
+ 'currency' => get_woocommerce_currency(),
543
+ );
544
+
545
+ wp_register_script( 'paypal-checkout-js', add_query_arg( $script_args, 'https://www.paypal.com/sdk/js' ), array(), null, true );
546
 
547
+ // register the fetch/promise polyfills files so the new PayPal Checkout SDK works with IE
548
+ if ( $is_IE ) {
549
+ wp_register_script( 'wc-gateway-ppec-promise-polyfill', wc_gateway_ppec()->plugin_url . 'assets/js/dist/promise-polyfill.min.js', array(), null, true );
550
+ wp_register_script( 'wc-gateway-ppec-fetch-polyfill', wc_gateway_ppec()->plugin_url . 'assets/js/dist/fetch-polyfill.min.js', array(), null, true );
551
+
552
+ $spb_script_dependencies = array_merge( $spb_script_dependencies, array( 'wc-gateway-ppec-fetch-polyfill', 'wc-gateway-ppec-promise-polyfill' ) );
553
+ }
554
+ } else {
555
+ wp_register_script( 'paypal-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true );
556
+ }
557
+
558
+ wp_register_script( 'wc-gateway-ppec-smart-payment-buttons', wc_gateway_ppec()->plugin_url . 'assets/js/wc-gateway-ppec-smart-payment-buttons.js', $spb_script_dependencies, wc_gateway_ppec()->version, true );
559
  wp_localize_script( 'wc-gateway-ppec-smart-payment-buttons', 'wc_ppec_context', $data );
560
  }
561
  }
577
  }
578
  }
579
 
580
+
581
+ /**
582
+ * Removes card payment method buttons from carts or pages which require a billing agreement.
583
+ *
584
+ * When the payment requires a billing agreement, we need a PayPal account and so require the customer to login. This means
585
+ * card payment buttons cannot be used to make these purchases.
586
+ *
587
+ * @since 1.7.0
588
+ *
589
+ * @param array $payment_button_data PayPal Smart Payment Button settings.
590
+ * @param string|null $page The specific page the customer is viewing. Can be 'product', 'cart' or 'checkout'. Otherwise null.
591
+ * @return array $payment_button_data
592
+ */
593
+ public function hide_card_payment_buttons_for_subscriptions( $payment_button_data, $page ) {
594
+ if ( ! class_exists( 'WC_Subscriptions_Product' ) ) {
595
+ return $payment_button_data;
596
+ }
597
+
598
+ $needs_billing_agreement = wc_gateway_ppec()->checkout->needs_billing_agreement_creation( array() );
599
+
600
+ // Mini-cart handling. By default an empty string is passed if no methods are disallowed, therefore we need to check for non array formats too.
601
+ if ( $needs_billing_agreement && ( ! is_array( $payment_button_data['mini_cart_disallowed_methods'] ) || ! in_array( 'CARD', $payment_button_data['mini_cart_disallowed_methods'] ) ) ) {
602
+ $payment_button_data['mini_cart_disallowed_methods'] = ! is_array( $payment_button_data['mini_cart_disallowed_methods'] ) ? array() : $payment_button_data['mini_cart_disallowed_methods'];
603
+ $payment_button_data['mini_cart_disallowed_methods'][] = 'CARD';
604
+ }
605
+
606
+ // Specific Page handling.
607
+ if ( ! $page ) {
608
+ return $payment_button_data;
609
+ }
610
+
611
+ // Add special handling for the product page where we need to use the product to test eligibility.
612
+ if ( 'product' === $page ) {
613
+ $needs_billing_agreement = WC_Subscriptions_Product::is_subscription( $GLOBALS['post']->ID );
614
+ }
615
+
616
+ // By default an empty string is passed if no methods are disallowed, therefore we need to check for non array formats too.
617
+ if ( $needs_billing_agreement && ( ! isset( $payment_button_data['disallowed_methods'] ) || ! is_array( $payment_button_data['disallowed_methods'] ) || ! in_array( 'CARD', $payment_button_data['disallowed_methods'] ) ) ) {
618
+ $payment_button_data['disallowed_methods'] = ( ! isset( $payment_button_data['disallowed_methods'] ) || ! is_array( $payment_button_data['disallowed_methods'] ) ) ? array() : $payment_button_data['disallowed_methods'];
619
+ $payment_button_data['disallowed_methods'][] = 'CARD';
620
+ }
621
+
622
+ return $payment_button_data;
623
+ }
624
+
625
  /**
626
  * @deprecated
627
  */
includes/class-wc-gateway-ppec-checkout-handler.php CHANGED
@@ -126,6 +126,11 @@ class WC_Gateway_PPEC_Checkout_Handler {
126
  return $fields;
127
  }
128
 
 
 
 
 
 
129
  if ( ! apply_filters( 'woocommerce_paypal_express_checkout_address_not_required', ! WC_Gateway_PPEC_Plugin::needs_shipping() ) ) {
130
  return $fields;
131
  }
@@ -139,11 +144,6 @@ class WC_Gateway_PPEC_Checkout_Handler {
139
  }
140
  }
141
 
142
- // Regardless of shipping, PP doesn't have the county required (e.g. using Ireland without a county is acceptable)
143
- if ( array_key_exists( 'state', $fields ) ) {
144
- $fields['state']['required'] = false;
145
- }
146
-
147
  return $fields;
148
 
149
  }
@@ -897,7 +897,6 @@ class WC_Gateway_PPEC_Checkout_Handler {
897
  * Complete a payment that has been authorized via PPEC.
898
  */
899
  public function do_payment( $order, $token, $payer_id ) {
900
- $settings = wc_gateway_ppec()->settings;
901
  $session_data = WC()->session->get( 'paypal', null );
902
 
903
  if ( ! $order || null === $session_data || $this->session_has_expired( $token ) || empty( $payer_id ) ) {
@@ -919,38 +918,7 @@ class WC_Gateway_PPEC_Checkout_Handler {
919
  $payment_details = new PayPal_Payment_Details();
920
  $payment_details->loadFromDoECResponse( $response );
921
 
922
- $meta = $old_wc ? get_post_meta( $order_id, '_woo_pp_txnData', true ) : $order->get_meta( '_woo_pp_txnData', true );
923
- if ( ! empty( $meta ) ) {
924
- $txnData = $meta;
925
- } else {
926
- $txnData = array( 'refundable_txns' => array() );
927
- }
928
-
929
- $paymentAction = $settings->get_paymentaction();
930
-
931
- $txn = array(
932
- 'txnID' => $payment_details->payments[0]->transaction_id,
933
- 'amount' => $order->get_total(),
934
- 'refunded_amount' => 0
935
- );
936
- if ( 'Completed' == $payment_details->payments[0]->payment_status ) {
937
- $txn['status'] = 'Completed';
938
- } else {
939
- $txn['status'] = $payment_details->payments[0]->payment_status . '_' . $payment_details->payments[0]->pending_reason;
940
- }
941
- $txnData['refundable_txns'][] = $txn;
942
-
943
- if ( 'authorization' == $paymentAction ) {
944
- $txnData['auth_status'] = 'NotCompleted';
945
- }
946
-
947
- $txnData['txn_type'] = $paymentAction;
948
-
949
- if ( $old_wc ) {
950
- update_post_meta( $order_id, '_woo_pp_txnData', $txnData );
951
- } else {
952
- $order->update_meta_data( '_woo_pp_txnData', $txnData );
953
- }
954
 
955
  // Payment was taken so clear session
956
  $this->maybe_clear_session_data();
126
  return $fields;
127
  }
128
 
129
+ // Regardless of shipping, PP doesn't have the county required (e.g. using Ireland without a county is acceptable)
130
+ if ( array_key_exists( 'state', $fields ) ) {
131
+ $fields['state']['required'] = false;
132
+ }
133
+
134
  if ( ! apply_filters( 'woocommerce_paypal_express_checkout_address_not_required', ! WC_Gateway_PPEC_Plugin::needs_shipping() ) ) {
135
  return $fields;
136
  }
144
  }
145
  }
146
 
 
 
 
 
 
147
  return $fields;
148
 
149
  }
897
  * Complete a payment that has been authorized via PPEC.
898
  */
899
  public function do_payment( $order, $token, $payer_id ) {
 
900
  $session_data = WC()->session->get( 'paypal', null );
901
 
902
  if ( ! $order || null === $session_data || $this->session_has_expired( $token ) || empty( $payer_id ) ) {
918
  $payment_details = new PayPal_Payment_Details();
919
  $payment_details->loadFromDoECResponse( $response );
920
 
921
+ wc_gateway_ppec_save_transaction_data( $order, $response, 'PAYMENTINFO_0_' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
 
923
  // Payment was taken so clear session
924
  $this->maybe_clear_session_data();
includes/class-wc-gateway-ppec-client.php CHANGED
@@ -334,6 +334,10 @@ class WC_Gateway_PPEC_Client {
334
  'L_PAYMENTREQUEST_0_AMT' . $count => $values['amount'],
335
  );
336
 
 
 
 
 
337
  $params = array_merge( $params, $line_item_params );
338
  $count++;
339
  }
@@ -493,19 +497,20 @@ class WC_Gateway_PPEC_Client {
493
  $amount = round( $values['line_subtotal'] / $values['quantity'] , $decimals );
494
 
495
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
496
- $name = $values['data']->post->post_title;
497
  $description = $values['data']->post->post_content;
498
  } else {
499
- $product = $values['data'];
500
- $name = $product->get_name();
501
  $description = $product->get_description();
502
  }
503
 
504
- $item = array(
505
  'name' => $name,
506
  'description' => $description,
507
  'quantity' => $values['quantity'],
508
  'amount' => $amount,
 
509
  );
510
 
511
  $items[] = $item;
@@ -811,26 +816,25 @@ class WC_Gateway_PPEC_Client {
811
  $order = wc_get_order( $order );
812
 
813
  $items = array();
814
- foreach ( $order->get_items( array( 'line_item', 'fee' ) ) as $cart_item_key => $values ) {
815
 
816
-
817
- if( 'fee' === $values['type']) {
818
  $item = array(
819
- 'name' => $values['name'],
820
  'quantity' => 1,
821
- 'amount' => round( $values['line_total'], $decimals),
822
  );
823
  } else {
824
- $amount = round( $values['line_subtotal'] / $values['qty'] , $decimals );
825
- $item = array(
826
- 'name' => $values['name'],
827
- 'quantity' => $values['qty'],
 
828
  'amount' => $amount,
 
829
  );
830
-
831
  }
832
 
833
-
834
  $items[] = $item;
835
  }
836
 
@@ -964,6 +968,10 @@ class WC_Gateway_PPEC_Client {
964
  'L_PAYMENTREQUEST_0_AMT' . $count => $values['amount'],
965
  );
966
 
 
 
 
 
967
  $params = array_merge( $params, $line_item_params );
968
  $count++;
969
  }
@@ -993,23 +1001,6 @@ class WC_Gateway_PPEC_Client {
993
  return $this->_request( $params );
994
  }
995
 
996
- /**
997
- * Updates or deletes a billing agreement.
998
- *
999
- * @see https://developer.paypal.com/docs/classic/api/merchant/BAUpdate_API_Operation_NVP/
1000
- *
1001
- * @since 1.2.0
1002
- *
1003
- * @param string $billing_agreement_id Billing agreement ID
1004
- */
1005
- public function update_billing_agreement( $billing_agreement_id ) {
1006
- $params = array(
1007
- 'METHOD' => 'BillAgreementUpdate',
1008
- 'VERSION' => self::API_VERSION,
1009
- 'REFERENCEID' => $billing_agreement_id,
1010
- );
1011
- }
1012
-
1013
  /**
1014
  * Processes a payment from a buyer's account, which is identified by a
1015
  * previous transaction
@@ -1087,10 +1078,11 @@ class WC_Gateway_PPEC_Client {
1087
  $count = 0;
1088
  foreach ( $details['items'] as $line_item_key => $values ) {
1089
  $line_item_params = array(
1090
- 'L_NAME' . $count => $values['name'],
1091
- 'L_DESC' . $count => ! empty( $values['description'] ) ? strip_tags( $values['description'] ) : '',
1092
- 'L_QTY' . $count => $values['quantity'],
1093
- 'L_AMT' . $count => $values['amount'],
 
1094
  );
1095
 
1096
  $params = array_merge( $params, $line_item_params );
@@ -1234,4 +1226,25 @@ class WC_Gateway_PPEC_Client {
1234
  in_array( $response['ACK'], array( 'Success', 'SuccessWithWarning' ) )
1235
  );
1236
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1237
  }
334
  'L_PAYMENTREQUEST_0_AMT' . $count => $values['amount'],
335
  );
336
 
337
+ if ( isset( $values['sku'] ) ) {
338
+ $line_item_params[ 'L_PAYMENTREQUEST_0_NUMBER' . $count ] = $values['sku'];
339
+ }
340
+
341
  $params = array_merge( $params, $line_item_params );
342
  $count++;
343
  }
497
  $amount = round( $values['line_subtotal'] / $values['quantity'] , $decimals );
498
 
499
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
500
+ $name = $values['data']->post->post_title;
501
  $description = $values['data']->post->post_content;
502
  } else {
503
+ $product = $values['data'];
504
+ $name = $product->get_name();
505
  $description = $product->get_description();
506
  }
507
 
508
+ $item = array(
509
  'name' => $name,
510
  'description' => $description,
511
  'quantity' => $values['quantity'],
512
  'amount' => $amount,
513
+ 'sku' => $values['data']->get_sku(),
514
  );
515
 
516
  $items[] = $item;
816
  $order = wc_get_order( $order );
817
 
818
  $items = array();
819
+ foreach ( $order->get_items( array( 'line_item', 'fee' ) ) as $cart_item_key => $order_item ) {
820
 
821
+ if( 'fee' === $order_item['type']) {
 
822
  $item = array(
823
+ 'name' => $order_item['name'],
824
  'quantity' => 1,
825
+ 'amount' => round( $order_item['line_total'], $decimals ),
826
  );
827
  } else {
828
+ $amount = round( $order_item['line_subtotal'] / $order_item['qty'] , $decimals );
829
+ $product = version_compare( WC_VERSION, '3.0', '<' ) ? $order->get_product_from_item( $order_item ) : $order_item->get_product();
830
+ $item = array(
831
+ 'name' => $order_item['name'],
832
+ 'quantity' => $order_item['qty'],
833
  'amount' => $amount,
834
+ 'sku' => $product->get_sku(),
835
  );
 
836
  }
837
 
 
838
  $items[] = $item;
839
  }
840
 
968
  'L_PAYMENTREQUEST_0_AMT' . $count => $values['amount'],
969
  );
970
 
971
+ if ( isset( $values['sku'] ) ) {
972
+ $line_item_params[ 'L_PAYMENTREQUEST_0_NUMBER' . $count ] = $values['sku'];
973
+ }
974
+
975
  $params = array_merge( $params, $line_item_params );
976
  $count++;
977
  }
1001
  return $this->_request( $params );
1002
  }
1003
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1004
  /**
1005
  * Processes a payment from a buyer's account, which is identified by a
1006
  * previous transaction
1078
  $count = 0;
1079
  foreach ( $details['items'] as $line_item_key => $values ) {
1080
  $line_item_params = array(
1081
+ 'L_NAME' . $count => $values['name'],
1082
+ 'L_DESC' . $count => ! empty( $values['description'] ) ? strip_tags( $values['description'] ) : '',
1083
+ 'L_QTY' . $count => $values['quantity'],
1084
+ 'L_AMT' . $count => $values['amount'],
1085
+ 'L_NUMBER' . $count => $values['sku'],
1086
  );
1087
 
1088
  $params = array_merge( $params, $line_item_params );
1226
  in_array( $response['ACK'], array( 'Success', 'SuccessWithWarning' ) )
1227
  );
1228
  }
1229
+
1230
+ /** Deprecated Functions */
1231
+
1232
+ /**
1233
+ * Updates or deletes a billing agreement.
1234
+ *
1235
+ * @see https://developer.paypal.com/docs/classic/api/merchant/BAUpdate_API_Operation_NVP/
1236
+ *
1237
+ * @since 1.2.0
1238
+ * @deprecated 1.7.0
1239
+ *
1240
+ * @param string $billing_agreement_id Billing agreement ID
1241
+ */
1242
+ public function update_billing_agreement( $billing_agreement_id ) {
1243
+ _deprecated_function( __METHOD__, '1.7.0' );
1244
+ $params = array(
1245
+ 'METHOD' => 'BillAgreementUpdate',
1246
+ 'VERSION' => self::API_VERSION,
1247
+ 'REFERENCEID' => $billing_agreement_id,
1248
+ );
1249
+ }
1250
  }
includes/class-wc-gateway-ppec-plugin.php CHANGED
@@ -148,6 +148,7 @@ class WC_Gateway_PPEC_Plugin {
148
  add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
149
 
150
  add_filter( 'plugin_action_links_' . plugin_basename( $this->file ), array( $this, 'plugin_action_links' ) );
 
151
  add_action( 'wp_ajax_ppec_dismiss_notice_message', array( $this, 'ajax_dismiss_notice' ) );
152
  }
153
 
@@ -226,28 +227,6 @@ class WC_Gateway_PPEC_Plugin {
226
  }
227
  }
228
 
229
- public function show_spb_notice() {
230
- // Should only show when PPEC is enabled but not in SPB mode.
231
- if ( 'yes' !== $this->settings->enabled || 'yes' === $this->settings->use_spb ) {
232
- return;
233
- }
234
-
235
- // Should only show on WooCommerce screens, the main dashboard, and on the plugins screen (as in WC_Admin_Notices).
236
- $screen = get_current_screen();
237
- $screen_id = $screen ? $screen->id : '';
238
- if ( ! in_array( $screen_id, wc_get_screen_ids(), true ) && 'dashboard' !== $screen_id && 'plugins' !== $screen_id ) {
239
- return;
240
- }
241
-
242
- $setting_link = $this->get_admin_setting_link();
243
- $message = sprintf( __( '<p>PayPal Checkout with new <strong>Smart Payment Buttons™</strong> gives your customers the power to pay the way they want without leaving your site.</p><p>The <strong>existing buttons will be removed</strong> in the <strong>next release</strong>. Please upgrade to Smart Payment Buttons on the <a href="%s">PayPal Checkout settings page</a>.</p>', 'woocommerce-gateway-paypal-express-checkout' ), esc_url( $setting_link ) );
244
- ?>
245
- <div class="notice notice-error">
246
- <?php echo wp_kses( $message, array( 'a' => array( 'href' => array() ), 'strong' => array(), 'p' => array() ) ); ?>
247
- </div>
248
- <?php
249
- }
250
-
251
  /**
252
  * AJAX handler for dismiss notice action.
253
  *
@@ -326,7 +305,6 @@ class WC_Gateway_PPEC_Plugin {
326
  protected function _run() {
327
  require_once( $this->includes_path . 'functions.php' );
328
  $this->_load_handlers();
329
- add_action( 'admin_notices', array( $this, 'show_spb_notice' ) );
330
  }
331
 
332
  /**
@@ -450,11 +428,30 @@ class WC_Gateway_PPEC_Plugin {
450
  $plugin_links[] = '<a href="' . esc_url( $setting_url ) . '">' . esc_html__( 'Settings', 'woocommerce-gateway-paypal-express-checkout' ) . '</a>';
451
  }
452
 
453
- $plugin_links[] = '<a href="https://docs.woocommerce.com/document/paypal-express-checkout/">' . esc_html__( 'Docs', 'woocommerce-gateway-paypal-express-checkout' ) . '</a>';
454
-
455
  return array_merge( $plugin_links, $links );
456
  }
457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  /**
459
  * Check if shipping is needed for PayPal. This only checks for virtual products (#286),
460
  * but skips the check if there are no shipping methods enabled (#249).
@@ -478,4 +475,36 @@ class WC_Gateway_PPEC_Plugin {
478
 
479
  return apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping );
480
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  }
148
  add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
149
 
150
  add_filter( 'plugin_action_links_' . plugin_basename( $this->file ), array( $this, 'plugin_action_links' ) );
151
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
152
  add_action( 'wp_ajax_ppec_dismiss_notice_message', array( $this, 'ajax_dismiss_notice' ) );
153
  }
154
 
227
  }
228
  }
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  /**
231
  * AJAX handler for dismiss notice action.
232
  *
305
  protected function _run() {
306
  require_once( $this->includes_path . 'functions.php' );
307
  $this->_load_handlers();
 
308
  }
309
 
310
  /**
428
  $plugin_links[] = '<a href="' . esc_url( $setting_url ) . '">' . esc_html__( 'Settings', 'woocommerce-gateway-paypal-express-checkout' ) . '</a>';
429
  }
430
 
 
 
431
  return array_merge( $plugin_links, $links );
432
  }
433
 
434
+ /**
435
+ * Plugin page links to support and documentation
436
+ *
437
+ * @since 2.0
438
+ * @param array $links List of plugin links.
439
+ * @param string $file Current file.
440
+ * @return array
441
+ */
442
+ public function plugin_row_meta( $links, $file ) {
443
+ $row_meta = array();
444
+
445
+ if ( false !== strpos( $file, plugin_basename( dirname( __DIR__ ) ) ) ) {
446
+ $row_meta = array(
447
+ 'docs' => sprintf( '<a href="%s" title="%s">%s</a>', esc_url( 'https://docs.woocommerce.com/document/paypal-express-checkout/' ), esc_attr__( 'View Documentation', 'woocommerce-gateway-paypal-express-checkout' ), esc_html__( 'Docs', 'woocommerce-gateway-paypal-express-checkout' ) ),
448
+ 'support' => sprintf( '<a href="%s" title="%s">%s</a>', esc_url( 'https://woocommerce.com/my-account/create-a-ticket?select=woocommerce-gateway-paypal-checkout' ), esc_attr__( 'Open a support request at WooCommerce.com', 'woocommerce-gateway-paypal-express-checkout' ), esc_html__( 'Support', 'woocommerce-gateway-paypal-express-checkout' ) ),
449
+ );
450
+ }
451
+
452
+ return array_merge( $links, $row_meta );
453
+ }
454
+
455
  /**
456
  * Check if shipping is needed for PayPal. This only checks for virtual products (#286),
457
  * but skips the check if there are no shipping methods enabled (#249).
475
 
476
  return apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping );
477
  }
478
+
479
+ /* Deprecated Functions */
480
+
481
+ /**
482
+ * Shows an admin notice notifying store managers that support for non-spb
483
+ * on the checkout is being removed in 1.7.0
484
+ *
485
+ * @deprecated 1.7.0
486
+ */
487
+ public function show_spb_notice() {
488
+ _deprecated_function( __METHOD__, '1.7.0' );
489
+
490
+ // Should only show when PPEC is enabled but not in SPB mode.
491
+ if ( 'yes' !== $this->settings->enabled || 'yes' === $this->settings->use_spb ) {
492
+ return;
493
+ }
494
+
495
+ // Should only show on WooCommerce screens, the main dashboard, and on the plugins screen (as in WC_Admin_Notices).
496
+ $screen = get_current_screen();
497
+ $screen_id = $screen ? $screen->id : '';
498
+ if ( ! in_array( $screen_id, wc_get_screen_ids(), true ) && 'dashboard' !== $screen_id && 'plugins' !== $screen_id ) {
499
+ return;
500
+ }
501
+
502
+ $setting_link = $this->get_admin_setting_link();
503
+ $message = sprintf( __( '<p>PayPal Checkout with new <strong>Smart Payment Buttons™</strong> gives your customers the power to pay the way they want without leaving your site.</p><p>The <strong>existing buttons will be removed</strong> in the <strong>next release</strong>. Please upgrade to Smart Payment Buttons on the <a href="%s">PayPal Checkout settings page</a>.</p>', 'woocommerce-gateway-paypal-express-checkout' ), esc_url( $setting_link ) );
504
+ ?>
505
+ <div class="notice notice-error">
506
+ <?php echo wp_kses( $message, array( 'a' => array( 'href' => array() ), 'strong' => array(), 'p' => array() ) ); ?>
507
+ </div>
508
+ <?php
509
+ }
510
  }
includes/class-wc-gateway-ppec-session-data.php CHANGED
@@ -84,6 +84,7 @@ class WC_Gateway_PPEC_Session_Data {
84
  'order_id' => false,
85
  'expires_in' => 10800,
86
  'use_paypal_credit' => false,
 
87
  ) );
88
 
89
  $this->token = $args['token'];
84
  'order_id' => false,
85
  'expires_in' => 10800,
86
  'use_paypal_credit' => false,
87
+ 'cancel_url' => '',
88
  ) );
89
 
90
  $this->token = $args['token'];
includes/class-wc-gateway-ppec-settings.php CHANGED
@@ -22,30 +22,82 @@ class WC_Gateway_PPEC_Settings {
22
  * @var array
23
  */
24
  protected $_supported_locales = array(
 
 
25
  'da_DK',
26
  'de_DE',
 
27
  'en_AU',
 
28
  'en_GB',
29
  'en_US',
 
 
30
  'es_ES',
 
 
31
  'fr_CA',
32
  'fr_FR',
 
33
  'he_IL',
 
34
  'id_ID',
35
  'it_IT',
36
  'ja_JP',
 
37
  'nl_NL',
38
  'no_NO',
39
  'pl_PL',
40
  'pt_BR',
41
  'pt_PT',
42
  'ru_RU',
 
43
  'sv_SE',
44
  'th_TH',
45
- 'tr_TR',
46
  'zh_CN',
47
  'zh_HK',
48
  'zh_TW',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  );
50
 
51
  /**
@@ -89,8 +141,9 @@ class WC_Gateway_PPEC_Settings {
89
  if ( $this->_is_setting_loaded && ! $force_reload ) {
90
  return $this;
91
  }
92
- $this->_settings = (array) get_option( 'woocommerce_ppec_paypal_settings', array() );
93
- $this->_is_setting_loaded = true;
 
94
  return $this;
95
  }
96
 
@@ -148,6 +201,26 @@ class WC_Gateway_PPEC_Settings {
148
  return 'live' === $this->get_environment() ? $this->get_live_api_credentials() : $this->get_sandbox_api_credentials();
149
  }
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  /**
152
  * Get PayPal redirect URL.
153
  *
@@ -314,8 +387,13 @@ class WC_Gateway_PPEC_Settings {
314
  } else {
315
  $locale = 'en_US';
316
  }
317
- } else if ( ! in_array( $locale, $this->_supported_locales ) ) {
318
- $locale = 'en_US';
 
 
 
 
 
319
  }
320
 
321
  return apply_filters( 'woocommerce_paypal_express_checkout_paypal_locale', $locale );
@@ -385,4 +463,16 @@ class WC_Gateway_PPEC_Settings {
385
  public function get_number_of_decimal_digits() {
386
  return $this->is_currency_supports_zero_decimal() ? 0 : 2;
387
  }
 
 
 
 
 
 
 
 
 
 
 
 
388
  }
22
  * @var array
23
  */
24
  protected $_supported_locales = array(
25
+ 'ar_EG',
26
+ 'cs_CZ',
27
  'da_DK',
28
  'de_DE',
29
+ 'el_GR',
30
  'en_AU',
31
+ 'en_IN',
32
  'en_GB',
33
  'en_US',
34
+ 'en_CA',
35
+ 'en_NZ',
36
  'es_ES',
37
+ 'es_XC',
38
+ 'fi_FI',
39
  'fr_CA',
40
  'fr_FR',
41
+ 'fr_XC',
42
  'he_IL',
43
+ 'hu_HU',
44
  'id_ID',
45
  'it_IT',
46
  'ja_JP',
47
+ 'ko_KR',
48
  'nl_NL',
49
  'no_NO',
50
  'pl_PL',
51
  'pt_BR',
52
  'pt_PT',
53
  'ru_RU',
54
+ 'sk_SK',
55
  'sv_SE',
56
  'th_TH',
 
57
  'zh_CN',
58
  'zh_HK',
59
  'zh_TW',
60
+ 'zh_XC',
61
+ );
62
+
63
+ /**
64
+ * Mapping between WP locale codes and PayPal locale codes
65
+ *
66
+ * @var array
67
+ */
68
+ protected $_locales_mapping = array(
69
+ 'ar' => 'ar_EG',
70
+ 'arq' => 'ar_EG',
71
+ 'ary' => 'ar_EG',
72
+ 'de_AT' => 'de_DE',
73
+ 'de_CH' => 'de_DE',
74
+ 'de_CH_informal' => 'de_DE',
75
+ 'de_DE_formal' => 'de_DE',
76
+ 'el' => 'el_GR',
77
+ 'es_AR' => 'es_ES',
78
+ 'es_CL' => 'es_ES',
79
+ 'es_CO' => 'es_ES',
80
+ 'es_CR' => 'es_ES',
81
+ 'es_DO' => 'es_ES',
82
+ 'es_GT' => 'es_ES',
83
+ 'es_HN' => 'es_ES',
84
+ 'es_MX' => 'es_ES',
85
+ 'es_PE' => 'es_ES',
86
+ 'es_PR' => 'es_ES',
87
+ 'es_ES' => 'es_ES',
88
+ 'es_UY' => 'es_ES',
89
+ 'es_VE' => 'es_ES',
90
+ 'fi' => 'fi_FI',
91
+ 'fr_BE' => 'fr_FR',
92
+ 'ja' => 'ja_JP',
93
+ 'nb_NO' => 'no_NO',
94
+ 'nn_NO' => 'no_NO',
95
+ 'nl_BE' => 'nl_NL',
96
+ 'nl_NL_formal' => 'nl_NL',
97
+ 'pt_AO' => 'pt_PT',
98
+ 'pt_PT_ao90' => 'pt_PT',
99
+ 'th' => 'th_TH',
100
+ 'zh_SG' => 'zh_CN',
101
  );
102
 
103
  /**
141
  if ( $this->_is_setting_loaded && ! $force_reload ) {
142
  return $this;
143
  }
144
+ $this->_settings = (array) get_option( 'woocommerce_ppec_paypal_settings', array() );
145
+ $this->_settings['use_spb'] = ! apply_filters( 'woocommerce_paypal_express_checkout_disable_smart_payment_buttons', false, $this ) ? 'yes' : 'no';
146
+ $this->_is_setting_loaded = true;
147
  return $this;
148
  }
149
 
201
  return 'live' === $this->get_environment() ? $this->get_live_api_credentials() : $this->get_sandbox_api_credentials();
202
  }
203
 
204
+ /**
205
+ * Get the REST Client ID for a live environment.
206
+ *
207
+ * @since 2.0
208
+ * @return string
209
+ */
210
+ public function get_live_rest_client_id() {
211
+ return 'AQbghYd-7mRPyimEriYScIgTnYUsLnr5wVnPnmfPaSzwKrUe3qNzfEc5hXr9Ucf_JG_HFAZpJMJYXMuk';
212
+ }
213
+
214
+ /**
215
+ * Get the REST Client ID for current environment.
216
+ *
217
+ * @since 2.0
218
+ * @return string
219
+ */
220
+ public function get_active_rest_client_id() {
221
+ return 'live' === $this->get_environment() ? $this->get_live_rest_client_id() : 'sb';
222
+ }
223
+
224
  /**
225
  * Get PayPal redirect URL.
226
  *
387
  } else {
388
  $locale = 'en_US';
389
  }
390
+ } elseif ( ! in_array( $locale, $this->_supported_locales ) ) {
391
+ // Mapping some WP locales to PayPal locales
392
+ if ( isset( $this->_locales_mapping[ $locale ] ) ) {
393
+ $locale = $this->_locales_mapping[ $locale ];
394
+ } else {
395
+ $locale = 'en_US';
396
+ }
397
  }
398
 
399
  return apply_filters( 'woocommerce_paypal_express_checkout_paypal_locale', $locale );
463
  public function get_number_of_decimal_digits() {
464
  return $this->is_currency_supports_zero_decimal() ? 0 : 2;
465
  }
466
+
467
+ /**
468
+ * Whether to use checkout.js or the latest available SDK.
469
+ *
470
+ * @since 1.7.0
471
+ *
472
+ * @return bool
473
+ */
474
+ public function use_legacy_checkout_js() {
475
+ return (bool) apply_filters( 'woocommerce_paypal_express_checkout_use_legacy_checkout_js', false );
476
+ }
477
+
478
  }
includes/class-wc-gateway-ppec-with-paypal-addons.php CHANGED
@@ -196,6 +196,8 @@ class WC_Gateway_PPEC_With_PayPal_Addons extends WC_Gateway_PPEC_With_PayPal {
196
  throw new Exception( __( 'PayPal API error', 'woocommerce-gateway-paypal-express-checkout' ) );
197
  }
198
 
 
 
199
  $status = ! empty( $response['PAYMENTSTATUS'] ) ? $response['PAYMENTSTATUS'] : '';
200
 
201
  switch ( $status ) {
196
  throw new Exception( __( 'PayPal API error', 'woocommerce-gateway-paypal-express-checkout' ) );
197
  }
198
 
199
+ wc_gateway_ppec_save_transaction_data( $order, $response );
200
+
201
  $status = ! empty( $response['PAYMENTSTATUS'] ) ? $response['PAYMENTSTATUS'] : '';
202
 
203
  switch ( $status ) {
includes/class-wc-gateway-ppec-with-spb-addons.php CHANGED
@@ -46,7 +46,7 @@ class WC_Gateway_PPEC_With_SPB_Addons extends WC_Gateway_PPEC_With_PayPal_Addons
46
  */
47
  public function process_payment( $order_id ) {
48
  if ( isset( $_POST['payerID'] ) && isset( $_POST['paymentToken'] ) ) {
49
- $session = WC()->session->get( 'paypal' );
50
 
51
  $session->checkout_completed = true;
52
  $session->payer_id = $_POST['payerID'];
46
  */
47
  public function process_payment( $order_id ) {
48
  if ( isset( $_POST['payerID'] ) && isset( $_POST['paymentToken'] ) ) {
49
+ $session = WC()->session->get( 'paypal', new stdClass() );
50
 
51
  $session->checkout_completed = true;
52
  $session->payer_id = $_POST['payerID'];
includes/class-wc-gateway-ppec-with-spb.php CHANGED
@@ -46,7 +46,7 @@ class WC_Gateway_PPEC_With_SPB extends WC_Gateway_PPEC_With_PayPal {
46
  */
47
  public function process_payment( $order_id ) {
48
  if ( isset( $_POST['payerID'] ) && isset( $_POST['paymentToken'] ) ) {
49
- $session = WC()->session->get( 'paypal' );
50
 
51
  $session->checkout_completed = true;
52
  $session->payer_id = $_POST['payerID'];
46
  */
47
  public function process_payment( $order_id ) {
48
  if ( isset( $_POST['payerID'] ) && isset( $_POST['paymentToken'] ) ) {
49
+ $session = WC()->session->get( 'paypal', new stdClass() );
50
 
51
  $session->checkout_completed = true;
52
  $session->payer_id = $_POST['payerID'];
includes/functions.php CHANGED
@@ -165,3 +165,56 @@ function wc_gateway_ppec_is_US_based_store() {
165
  $base_location = wc_get_base_location();
166
  return in_array( $base_location['country'], array( 'US', 'PR', 'GU', 'VI', 'AS', 'MP' ), true );
167
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  $base_location = wc_get_base_location();
166
  return in_array( $base_location['country'], array( 'US', 'PR', 'GU', 'VI', 'AS', 'MP' ), true );
167
  }
168
+
169
+ /**
170
+ * Saves the transaction details from the transaction response into a post meta.
171
+ *
172
+ * @since 2.0
173
+ *
174
+ * @param object $order Order for which the transaction was made
175
+ * @param object $transaction_response Response from a transaction, which contains the transaction details
176
+ * @param object $prefix A prefix string which is empty for Reference Transactions and is 'PAYMENTINFO_0_' for Express Checkout
177
+ * @return void
178
+ */
179
+ function wc_gateway_ppec_save_transaction_data( $order, $transaction_response, $prefix = '' ) {
180
+
181
+ $settings = wc_gateway_ppec()->settings;
182
+ $old_wc = version_compare( WC_VERSION, '3.0', '<' );
183
+ $order_id = $old_wc ? $order->id : $order->get_id();
184
+ $meta = $old_wc ? get_post_meta( $order_id, '_woo_pp_txnData', true ) : $order->get_meta( '_woo_pp_txnData', true );
185
+
186
+ if ( ! empty( $meta ) ) {
187
+ $txnData = $meta;
188
+ } else {
189
+ $txnData = array( 'refundable_txns' => array() );
190
+ }
191
+
192
+ $txn = array(
193
+ 'txnID' => $transaction_response[$prefix . 'TRANSACTIONID'],
194
+ 'amount' => $transaction_response[$prefix . 'AMT'],
195
+ 'refunded_amount' => 0
196
+ );
197
+
198
+ $status = ! empty( $transaction_response[$prefix . 'PAYMENTSTATUS'] ) ? $transaction_response[$prefix . 'PAYMENTSTATUS'] : '';
199
+
200
+ if ( 'Completed' == $status ) {
201
+ $txn['status'] = 'Completed';
202
+ } else {
203
+ $txn['status'] = $status . '_' . $transaction_response[$prefix . 'REASONCODE'];
204
+ }
205
+ $txnData['refundable_txns'][] = $txn;
206
+
207
+ $paymentAction = $settings->get_paymentaction();
208
+
209
+ if ( 'authorization' == $paymentAction ) {
210
+ $txnData['auth_status'] = 'NotCompleted';
211
+ }
212
+
213
+ $txnData['txn_type'] = $paymentAction;
214
+
215
+ if ( $old_wc ) {
216
+ update_post_meta( $order_id, '_woo_pp_txnData', $txnData );
217
+ } else {
218
+ $order->update_meta_data( '_woo_pp_txnData', $txnData );
219
+ }
220
+ }
includes/settings/settings-ppec.php CHANGED
@@ -4,11 +4,13 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
 
7
- $api_username = $this->get_option( 'api_username' );
8
- $sandbox_api_username = $this->get_option( 'sandbox_api_username' );
 
 
9
 
10
- $needs_creds = empty( $api_username );
11
- $needs_sandbox_creds = empty( $sandbox_api_username );
12
  $enable_ips = wc_gateway_ppec()->ips->is_supported();
13
 
14
  if ( $enable_ips && $needs_creds ) {
@@ -55,210 +57,13 @@ if ( $enable_ips && $needs_sandbox_creds ) {
55
  );
56
  }
57
 
58
- $credit_enabled_label = __( 'Enable PayPal Credit', 'woocommerce-gateway-paypal-express-checkout' );
59
  if ( ! wc_gateway_ppec_is_credit_supported() ) {
60
  $credit_enabled_label .= '<p><em>' . __( 'This option is disabled. Currently PayPal Credit only available for U.S. merchants using USD currency.', 'woocommerce-gateway-paypal-express-checkout' ) . '</em></p>';
61
  }
62
 
63
  $credit_enabled_description = __( 'This enables PayPal Credit, which displays a PayPal Credit button next to the primary PayPal Checkout button. PayPal Checkout lets you give customers access to financing through PayPal Credit® - at no additional cost to you. You get paid up front, even though customers have more time to pay. A pre-integrated payment button shows up next to the PayPal Button, and lets customers pay quickly with PayPal Credit®. (Should be unchecked for stores involved in Real Money Gaming.)', 'woocommerce-gateway-paypal-express-checkout' );
64
 
65
- wc_enqueue_js( "
66
- jQuery( function( $ ) {
67
- var ppec_mark_fields = '#woocommerce_ppec_paypal_title, #woocommerce_ppec_paypal_description';
68
- var ppec_live_fields = '#woocommerce_ppec_paypal_api_username, #woocommerce_ppec_paypal_api_password, #woocommerce_ppec_paypal_api_signature, #woocommerce_ppec_paypal_api_certificate, #woocommerce_ppec_paypal_api_subject';
69
- var ppec_sandbox_fields = '#woocommerce_ppec_paypal_sandbox_api_username, #woocommerce_ppec_paypal_sandbox_api_password, #woocommerce_ppec_paypal_sandbox_api_signature, #woocommerce_ppec_paypal_sandbox_api_certificate, #woocommerce_ppec_paypal_sandbox_api_subject';
70
-
71
- var enable_toggle = $( 'a.ppec-toggle-settings' ).length > 0;
72
- var enable_sandbox_toggle = $( 'a.ppec-toggle-sandbox-settings' ).length > 0;
73
-
74
- $( '#woocommerce_ppec_paypal_environment' ).change(function(){
75
- $( '#woocommerce_ppec_paypal_api_credentials + p + table, #woocommerce_ppec_paypal_sandbox_api_credentials + p + table' ).hide();
76
-
77
- if ( 'live' === $( this ).val() ) {
78
- $( '#woocommerce_ppec_paypal_api_credentials, #woocommerce_ppec_paypal_api_credentials + p' ).show();
79
- $( '#woocommerce_ppec_paypal_sandbox_api_credentials, #woocommerce_ppec_paypal_sandbox_api_credentials + p' ).hide();
80
-
81
- if ( ! enable_toggle ) {
82
- $( '#woocommerce_ppec_paypal_api_credentials + p + table' ).show();
83
- }
84
- } else {
85
- $( '#woocommerce_ppec_paypal_api_credentials, #woocommerce_ppec_paypal_api_credentials + p' ).hide();
86
- $( '#woocommerce_ppec_paypal_sandbox_api_credentials, #woocommerce_ppec_paypal_sandbox_api_credentials + p' ).show();
87
-
88
- if ( ! enable_sandbox_toggle ) {
89
- $( '#woocommerce_ppec_paypal_sandbox_api_credentials + p + table' ).show();
90
- }
91
- }
92
- }).change();
93
-
94
- $( '#woocommerce_ppec_paypal_enabled' ).change(function(){
95
- if ( $( this ).is( ':checked' ) ) {
96
- $( ppec_mark_fields ).closest( 'tr' ).show();
97
- } else {
98
- $( ppec_mark_fields ).closest( 'tr' ).hide();
99
- }
100
- }).change();
101
-
102
- $( '#woocommerce_ppec_paypal_paymentaction' ).change(function(){
103
- if ( 'sale' === $( this ).val() ) {
104
- $( '#woocommerce_ppec_paypal_instant_payments' ).closest( 'tr' ).show();
105
- } else {
106
- $( '#woocommerce_ppec_paypal_instant_payments' ).closest( 'tr' ).hide();
107
- }
108
- }).change();
109
-
110
- if ( enable_toggle ) {
111
- $( document ).off( 'click', '.ppec-toggle-settings' );
112
- $( document ).on( 'click', '.ppec-toggle-settings', function( e ) {
113
- $( '#woocommerce_ppec_paypal_api_credentials + p + table' ).toggle( 'fast' );
114
- e.preventDefault();
115
- } );
116
- }
117
- if ( enable_sandbox_toggle ) {
118
- $( document ).off( 'click', '.ppec-toggle-sandbox-settings' );
119
- $( document ).on( 'click', '.ppec-toggle-sandbox-settings', function( e ) {
120
- $( '#woocommerce_ppec_paypal_sandbox_api_credentials + p + table' ).toggle( 'fast' );
121
- e.preventDefault();
122
- } );
123
- }
124
-
125
- $( '.woocommerce_ppec_paypal_button_layout' ).change( function( event ) {
126
- if ( ! $( '#woocommerce_ppec_paypal_use_spb' ).is( ':checked' ) ) {
127
- return;
128
- }
129
-
130
- // Show settings that pertain to selected layout in same section
131
- var isVertical = 'vertical' === $( event.target ).val();
132
- var table = $( event.target ).closest( 'table' );
133
- table.find( '.woocommerce_ppec_paypal_vertical' ).closest( 'tr' ).toggle( isVertical );
134
- table.find( '.woocommerce_ppec_paypal_horizontal' ).closest( 'tr' ).toggle( ! isVertical );
135
-
136
- // Disable 'small' button size option in vertical layout only
137
- var button_size = table.find( '.woocommerce_ppec_paypal_button_size' );
138
- var button_size_option = button_size.find( 'option[value=\"small\"]' );
139
- if ( button_size_option.prop( 'disabled' ) !== isVertical ) {
140
- button_size.removeClass( 'enhanced' );
141
- button_size_option.prop( 'disabled', isVertical );
142
- $( document.body ).trigger( 'wc-enhanced-select-init' );
143
- ! button_size.val() && button_size.val( 'responsive' ).change();
144
- }
145
- } ).change();
146
-
147
- // Hide default layout and size settings if they'll be overridden anyway.
148
- function showHideDefaultButtonSettings() {
149
- var display =
150
- $( '#woocommerce_ppec_paypal_cart_checkout_enabled' ).is( ':checked' ) ||
151
- ( $( '#woocommerce_ppec_paypal_checkout_on_single_product_enabled' ).is( ':checked' ) && ! $( '#woocommerce_ppec_paypal_single_product_settings_toggle' ).is( ':checked' ) ) ||
152
- ( $( '#woocommerce_ppec_paypal_mark_enabled' ).is( ':checked' ) && ! $( '#woocommerce_ppec_paypal_mark_settings_toggle' ).is( ':checked' ) );
153
-
154
- $( '#woocommerce_ppec_paypal_button_layout, #woocommerce_ppec_paypal_button_size, #woocommerce_ppec_paypal_hide_funding_methods, #woocommerce_ppec_paypal_credit_enabled' ).closest( 'tr' ).toggle( display );
155
- display && $( '#woocommerce_ppec_paypal_button_layout' ).change();
156
- }
157
-
158
- // Toggle mini-cart section based on whether checkout on cart page is enabled
159
- $( '#woocommerce_ppec_paypal_cart_checkout_enabled' ).change( function( event ) {
160
- if ( ! $( '#woocommerce_ppec_paypal_use_spb' ).is( ':checked' ) ) {
161
- return;
162
- }
163
-
164
- var checked = $( event.target ).is( ':checked' );
165
- $( '#woocommerce_ppec_paypal_mini_cart_settings_toggle, .woocommerce_ppec_paypal_mini_cart' )
166
- .closest( 'tr' )
167
- .add( '#woocommerce_ppec_paypal_mini_cart_settings' ) // Select title.
168
- .next( 'p' ) // Select description if present.
169
- .addBack()
170
- .toggle( checked );
171
- checked && $( '#woocommerce_ppec_paypal_mini_cart_settings_toggle' ).change();
172
- showHideDefaultButtonSettings();
173
- } ).change();
174
-
175
- $( '#woocommerce_ppec_paypal_mini_cart_settings_toggle' ).change( function( event ) {
176
- // Only show settings specific to mini-cart if configured to override global settings.
177
- var checked = $( event.target ).is( ':checked' );
178
- $( '.woocommerce_ppec_paypal_mini_cart' ).closest( 'tr' ).toggle( checked );
179
- checked && $( '#woocommerce_ppec_paypal_mini_cart_button_layout' ).change();
180
- showHideDefaultButtonSettings();
181
- } ).change();
182
-
183
- $( '#woocommerce_ppec_paypal_checkout_on_single_product_enabled, #woocommerce_ppec_paypal_single_product_settings_toggle' ).change( function( event ) {
184
- if ( ! $( '#woocommerce_ppec_paypal_use_spb' ).is( ':checked' ) ) {
185
- return;
186
- }
187
-
188
- if ( ! $( '#woocommerce_ppec_paypal_checkout_on_single_product_enabled' ).is( ':checked' ) ) {
189
- // If product page button is disabled, hide remaining settings in section.
190
- $( '#woocommerce_ppec_paypal_single_product_settings_toggle, .woocommerce_ppec_paypal_single_product' ).closest( 'tr' ).hide();
191
- } else if ( ! $( '#woocommerce_ppec_paypal_single_product_settings_toggle' ).is( ':checked' ) ) {
192
- // If product page button is enabled but not configured to override global settings, hide remaining settings in section.
193
- $( '#woocommerce_ppec_paypal_single_product_settings_toggle' ).closest( 'tr' ).show();
194
- $( '.woocommerce_ppec_paypal_single_product' ).closest( 'tr' ).hide();
195
- } else {
196
- // Show all settings in section.
197
- $( '#woocommerce_ppec_paypal_single_product_settings_toggle, .woocommerce_ppec_paypal_single_product' ).closest( 'tr' ).show();
198
- $( '#woocommerce_ppec_paypal_single_product_button_layout' ).change();
199
- }
200
- showHideDefaultButtonSettings();
201
- } ).change();
202
-
203
- $( '#woocommerce_ppec_paypal_mark_enabled, #woocommerce_ppec_paypal_mark_settings_toggle' ).change( function() {
204
- if ( ! $( '#woocommerce_ppec_paypal_use_spb' ).is( ':checked' ) ) {
205
- return;
206
- }
207
-
208
- if ( ! $( '#woocommerce_ppec_paypal_mark_enabled' ).is( ':checked' ) ) {
209
- // If checkout page button is disabled, hide remaining settings in section.
210
- $( '#woocommerce_ppec_paypal_mark_settings_toggle, .woocommerce_ppec_paypal_mark' ).closest( 'tr' ).hide();
211
- } else if ( ! $( '#woocommerce_ppec_paypal_mark_settings_toggle' ).is( ':checked' ) ) {
212
- // If checkout page button is enabled but not configured to override global settings, hide remaining settings in section.
213
- $( '#woocommerce_ppec_paypal_mark_settings_toggle' ).closest( 'tr' ).show();
214
- $( '.woocommerce_ppec_paypal_mark' ).closest( 'tr' ).hide();
215
- } else {
216
- // Show all settings in section.
217
- $( '#woocommerce_ppec_paypal_mark_settings_toggle, .woocommerce_ppec_paypal_mark' ).closest( 'tr' ).show();
218
- $( '#woocommerce_ppec_paypal_mark_button_layout' ).change();
219
- }
220
- showHideDefaultButtonSettings();
221
- } ).change();
222
-
223
- // Make sure handlers are only attached once if script is loaded multiple times.
224
- $( '#woocommerce_ppec_paypal_use_spb' ).off( 'change' );
225
-
226
- $( '#woocommerce_ppec_paypal_use_spb' ).change( function( event ) {
227
- var checked = $( event.target ).is( ':checked' );
228
-
229
- // Show settings specific to Smart Payment Buttons only if enabled.
230
- $( '.woocommerce_ppec_paypal_spb' ).not( 'h3 ').closest( 'tr' ).toggle( checked );
231
- $( '.woocommerce_ppec_paypal_spb' ).filter( 'h3' ).next( 'p' ).addBack().toggle( checked );
232
-
233
- if ( checked ) {
234
- // Trigger all logic that controls visibility of other settings.
235
- $( '.woocommerce_ppec_paypal_visibility_toggle' ).change();
236
- } else {
237
- // If non-SPB mode is enabled, show all settings that may have been hidden.
238
- $( '#woocommerce_ppec_paypal_button_size, #woocommerce_ppec_paypal_credit_enabled' ).closest( 'tr' ).show();
239
- }
240
-
241
- // Hide 'Responsive' button size option in SPB mode, and make sure to show 'Small' option.
242
- var button_size = $( '#woocommerce_ppec_paypal_button_size' ).removeClass( 'enhanced' );
243
- button_size.find( 'option[value=\"responsive\"]' ).prop( 'disabled', ! checked );
244
- ! checked && button_size.find( 'option[value=\"small\"]' ).prop( 'disabled', false );
245
- $( document.body ).trigger( 'wc-enhanced-select-init' );
246
- } ).change();
247
-
248
- // Reset button size values to default when switching modes.
249
- $( '#woocommerce_ppec_paypal_use_spb' ).change( function( event ) {
250
- if ( $( event.target ).is( ':checked' ) ) {
251
- // In SPB mode, set to recommended 'Responsive' value so it is not missed.
252
- $( '#woocommerce_ppec_paypal_button_size' ).val( 'responsive' ).change();
253
- } else if ( ! $( '#woocommerce_ppec_paypal_button_size' ).val() ) {
254
- // Set back to original default for non-SPB mode.
255
- $( '#woocommerce_ppec_paypal_button_size' ).val( 'large' ).change();
256
- }
257
- } );
258
-
259
- });
260
- " );
261
-
262
  /**
263
  * Settings for PayPal Gateway.
264
  */
@@ -346,7 +151,6 @@ $settings = array(
346
  'desc_tip' => true,
347
  'placeholder' => __( 'Optional', 'woocommerce-gateway-paypal-express-checkout' ),
348
  ),
349
-
350
  'sandbox_api_credentials' => array(
351
  'title' => __( 'Sandbox API Credentials', 'woocommerce-gateway-paypal-express-checkout' ),
352
  'type' => 'title',
@@ -388,7 +192,6 @@ $settings = array(
388
  'desc_tip' => true,
389
  'placeholder' => __( 'Optional', 'woocommerce-gateway-paypal-express-checkout' ),
390
  ),
391
-
392
  'paypal_hosted_settings' => array(
393
  'title' => __( 'PayPal-hosted Checkout Settings', 'woocommerce-gateway-paypal-express-checkout' ),
394
  'type' => 'title',
@@ -543,6 +346,20 @@ $settings = array(
543
  'rect' => __( 'Rectangle', 'woocommerce-gateway-paypal-express-checkout' ),
544
  ),
545
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  );
547
 
548
  /**
@@ -575,21 +392,44 @@ $per_context_settings = array(
575
  'large' => __( 'Large', 'woocommerce-gateway-paypal-express-checkout' ),
576
  ),
577
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
578
  'hide_funding_methods' => array(
579
  'title' => 'Hide Funding Method(s)',
580
  'type' => 'multiselect',
581
- 'class' => 'wc-enhanced-select woocommerce_ppec_paypal_spb woocommerce_ppec_paypal_vertical',
582
  'default' => array( 'CARD' ),
583
  'desc_tip' => true,
584
  'description' => __( 'Hides the specified funding methods.', 'woocommerce-gateway-paypal-express-checkout' ),
585
  'options' => array(
586
- 'CREDIT' => __( 'PayPal Credit', 'woocommerce-gateway-paypal-express-checkout' ),
587
- 'ELV' => __( 'ELV', 'woocommerce-gateway-paypal-express-checkout' ),
588
- 'CARD' => __( 'Credit Card', 'woocommerce-gateway-paypal-express-checkout' ),
 
 
 
 
 
 
 
 
 
589
  ),
590
  ),
591
  'credit_enabled' => array(
592
- 'title' => __( 'Enable PayPal Credit', 'woocommerce-gateway-paypal-express-checkout' ),
593
  'type' => 'checkbox',
594
  'label' => $credit_enabled_label,
595
  'disabled' => ! wc_gateway_ppec_is_credit_supported(),
4
  exit;
5
  }
6
 
7
+ $live_credentials = wc_gateway_ppec()->settings->get_live_api_credentials();
8
+ $sandbox_credentials = wc_gateway_ppec()->settings->get_sandbox_api_credentials();
9
+ $has_live_credential = is_a( $live_credentials, 'WC_Gateway_PPEC_Client_Credential_Signature' ) ? (bool) $live_credentials->get_signature() : (bool) $live_credentials->get_certificate();
10
+ $has_sandbox_credential = is_a( $sandbox_credentials, 'WC_Gateway_PPEC_Client_Credential_Signature' ) ? (bool) $sandbox_credentials->get_signature() : (bool) $sandbox_credentials->get_certificate();
11
 
12
+ $needs_creds = ! $has_live_credential && ! (bool) $live_credentials->get_username() && ! (bool) $live_credentials->get_password();
13
+ $needs_sandbox_creds = ! $has_sandbox_credential && ! (bool) $sandbox_credentials->get_username() && ! (bool) $sandbox_credentials->get_password();
14
  $enable_ips = wc_gateway_ppec()->ips->is_supported();
15
 
16
  if ( $enable_ips && $needs_creds ) {
57
  );
58
  }
59
 
60
+ $credit_enabled_label = __( 'Enable PayPal Credit to eligible customers', 'woocommerce-gateway-paypal-express-checkout' );
61
  if ( ! wc_gateway_ppec_is_credit_supported() ) {
62
  $credit_enabled_label .= '<p><em>' . __( 'This option is disabled. Currently PayPal Credit only available for U.S. merchants using USD currency.', 'woocommerce-gateway-paypal-express-checkout' ) . '</em></p>';
63
  }
64
 
65
  $credit_enabled_description = __( 'This enables PayPal Credit, which displays a PayPal Credit button next to the primary PayPal Checkout button. PayPal Checkout lets you give customers access to financing through PayPal Credit® - at no additional cost to you. You get paid up front, even though customers have more time to pay. A pre-integrated payment button shows up next to the PayPal Button, and lets customers pay quickly with PayPal Credit®. (Should be unchecked for stores involved in Real Money Gaming.)', 'woocommerce-gateway-paypal-express-checkout' );
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Settings for PayPal Gateway.
69
  */
151
  'desc_tip' => true,
152
  'placeholder' => __( 'Optional', 'woocommerce-gateway-paypal-express-checkout' ),
153
  ),
 
154
  'sandbox_api_credentials' => array(
155
  'title' => __( 'Sandbox API Credentials', 'woocommerce-gateway-paypal-express-checkout' ),
156
  'type' => 'title',
192
  'desc_tip' => true,
193
  'placeholder' => __( 'Optional', 'woocommerce-gateway-paypal-express-checkout' ),
194
  ),
 
195
  'paypal_hosted_settings' => array(
196
  'title' => __( 'PayPal-hosted Checkout Settings', 'woocommerce-gateway-paypal-express-checkout' ),
197
  'type' => 'title',
346
  'rect' => __( 'Rectangle', 'woocommerce-gateway-paypal-express-checkout' ),
347
  ),
348
  ),
349
+ 'button_label' => array(
350
+ 'title' => __( 'Button Label', 'woocommerce-gateway-paypal-express-checkout' ),
351
+ 'type' => 'select',
352
+ 'class' => 'wc-enhanced-select woocommerce_ppec_paypal_spb',
353
+ 'default' => 'paypal',
354
+ 'desc_tip' => true,
355
+ 'description' => __( 'This controls the label on the primary button.', 'woocommerce-gateway-paypal-express-checkout' ),
356
+ 'options' => array(
357
+ 'paypal' => __( 'PayPal', 'woocommerce-gateway-paypal-express-checkout' ),
358
+ 'checkout' => __( 'PayPal Checkout', 'woocommerce-gateway-paypal-express-checkout' ),
359
+ 'buynow' => __( 'PayPal Buy Now', 'woocommerce-gateway-paypal-express-checkout' ),
360
+ 'pay' => __( 'Pay with PayPal', 'woocommerce-gateway-paypal-express-checkout' ),
361
+ ),
362
+ ),
363
  );
364
 
365
  /**
392
  'large' => __( 'Large', 'woocommerce-gateway-paypal-express-checkout' ),
393
  ),
394
  ),
395
+ 'button_label' => array(
396
+ 'title' => __( 'Button Label', 'woocommerce-gateway-paypal-express-checkout' ),
397
+ 'type' => 'select',
398
+ 'class' => 'wc-enhanced-select woocommerce_ppec_paypal_spb',
399
+ 'default' => 'paypal',
400
+ 'desc_tip' => true,
401
+ 'description' => __( 'PayPal offers different labels on the "PayPal Checkout" buttons, allowing you to select a suitable label.)', 'woocommerce-gateway-paypal-express-checkout' ),
402
+ 'options' => array(
403
+ 'paypal' => __( 'PayPal', 'woocommerce-gateway-paypal-express-checkout' ),
404
+ 'checkout' => __( 'PayPal Checkout', 'woocommerce-gateway-paypal-express-checkout' ),
405
+ 'buynow' => __( 'PayPal Buy Now', 'woocommerce-gateway-paypal-express-checkout' ),
406
+ 'pay' => __( 'Pay with PayPal', 'woocommerce-gateway-paypal-express-checkout' ),
407
+ ),
408
+ ),
409
  'hide_funding_methods' => array(
410
  'title' => 'Hide Funding Method(s)',
411
  'type' => 'multiselect',
412
+ 'class' => 'wc-enhanced-select woocommerce_ppec_paypal_spb woocommerce_ppec_funding_methods_select woocommerce_ppec_paypal_vertical',
413
  'default' => array( 'CARD' ),
414
  'desc_tip' => true,
415
  'description' => __( 'Hides the specified funding methods.', 'woocommerce-gateway-paypal-express-checkout' ),
416
  'options' => array(
417
+ 'CREDIT' => __( 'PayPal Credit', 'woocommerce-gateway-paypal-express-checkout' ),
418
+ 'ELV' => __( 'ELV', 'woocommerce-gateway-paypal-express-checkout' ),
419
+ 'CARD' => __( 'Credit or debit cards', 'woocommerce-gateway-paypal-express-checkout' ),
420
+ 'VENMO' => __( 'Venmo', 'woocommerce-gateway-paypal-express-checkout' ),
421
+ 'SEPA' => __( 'SEPA-Lastschrift', 'woocommerce-gateway-paypal-express-checkout' ),
422
+ 'BANCONTACT' => __( 'Bancontact', 'woocommerce-gateway-paypal-express-checkout' ),
423
+ 'EPS' => __( 'eps', 'woocommerce-gateway-paypal-express-checkout' ),
424
+ 'GIROPAY' => __( 'giropay', 'woocommerce-gateway-paypal-express-checkout' ),
425
+ 'IDEAL' => __( 'iDEAL', 'woocommerce-gateway-paypal-express-checkout' ),
426
+ 'MYBANK' => __( 'MyBank', 'woocommerce-gateway-paypal-express-checkout' ),
427
+ 'P24' => __( 'Przelewy24', 'woocommerce-gateway-paypal-express-checkout' ),
428
+ 'SOFORT' => __( 'Sofort', 'woocommerce-gateway-paypal-express-checkout' ),
429
  ),
430
  ),
431
  'credit_enabled' => array(
432
+ 'title' => __( 'Enable PayPal Credit to eligible customers', 'woocommerce-gateway-paypal-express-checkout' ),
433
  'type' => 'checkbox',
434
  'label' => $credit_enabled_label,
435
  'disabled' => ! wc_gateway_ppec_is_credit_supported(),
languages/woocommerce-gateway-paypal-express-checkout.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the WooCommerce PayPal Checkout Gateway plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce PayPal Checkout Gateway 1.6.21\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-gateway-paypal-express-checkout\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-04-14T16:21:37+10:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woocommerce-gateway-paypal-express-checkout\n"
@@ -36,6 +36,8 @@ msgstr ""
36
 
37
  #: includes/abstracts/abstract-wc-gateway-ppec.php:18
38
  #: includes/class-wc-gateway-ppec-privacy.php:12
 
 
39
  msgid "PayPal Checkout"
40
  msgstr ""
41
 
@@ -43,108 +45,119 @@ msgstr ""
43
  msgid "Allow customers to conveniently checkout directly with PayPal."
44
  msgstr ""
45
 
46
- #: includes/abstracts/abstract-wc-gateway-ppec.php:22
47
  msgid "Continue to payment"
48
  msgstr ""
49
 
50
- #: includes/abstracts/abstract-wc-gateway-ppec.php:166
51
  msgid "Sorry, an error occurred while trying to process your payment. Please try again."
52
  msgstr ""
53
 
54
- #: includes/abstracts/abstract-wc-gateway-ppec.php:199
55
  msgid "No API certificate on file."
56
  msgstr ""
57
 
58
- #: includes/abstracts/abstract-wc-gateway-ppec.php:208
59
  msgid "expires on %s (%s)"
60
  msgstr ""
61
 
62
- #: includes/abstracts/abstract-wc-gateway-ppec.php:212
63
  msgid "expired on %s (%s)"
64
  msgstr ""
65
 
66
- #: includes/abstracts/abstract-wc-gateway-ppec.php:222
67
  msgid "Certificate belongs to API username %1$s; %2$s."
68
  msgstr ""
69
 
70
- #: includes/abstracts/abstract-wc-gateway-ppec.php:224
71
  msgid "The certificate on file is not valid."
72
  msgstr ""
73
 
74
- #: includes/abstracts/abstract-wc-gateway-ppec.php:284
 
 
 
 
75
  msgid "Error: You must enter API password."
76
  msgstr ""
77
 
78
- #: includes/abstracts/abstract-wc-gateway-ppec.php:295
79
- #: includes/abstracts/abstract-wc-gateway-ppec.php:329
 
 
 
 
80
  msgid "Error: The API credentials you provided are not valid. Please double-check that you entered them correctly and try again."
81
  msgstr ""
82
 
83
- #: includes/abstracts/abstract-wc-gateway-ppec.php:300
84
- #: includes/abstracts/abstract-wc-gateway-ppec.php:333
85
- msgid "An error occurred while trying to validate your API credentials. Unable to verify that your API credentials are correct."
86
  msgstr ""
87
 
88
- #: includes/abstracts/abstract-wc-gateway-ppec.php:307
89
  msgid "Error: The API certificate is not valid."
90
  msgstr ""
91
 
92
- #: includes/abstracts/abstract-wc-gateway-ppec.php:315
93
  msgid "Error: The API certificate has expired."
94
  msgstr ""
95
 
96
- #: includes/abstracts/abstract-wc-gateway-ppec.php:320
97
- msgid "Error: The API username does not match the name in the API certificate. Make sure that you have the correct API certificate."
98
  msgstr ""
99
 
100
- #: includes/abstracts/abstract-wc-gateway-ppec.php:338
101
- msgid "Error: You must provide API signature or certificate."
102
  msgstr ""
103
 
104
- #: includes/abstracts/abstract-wc-gateway-ppec.php:356
105
  msgid "The \"require billing address\" option is not enabled by your account and has been disabled."
106
  msgstr ""
107
 
108
- #: includes/abstracts/abstract-wc-gateway-ppec.php:375
109
  msgid "Refund Error: You need to specify a refund amount."
110
  msgstr ""
111
 
112
- #: includes/abstracts/abstract-wc-gateway-ppec.php:395
113
- #: includes/abstracts/abstract-wc-gateway-ppec.php:418
114
- #: includes/abstracts/abstract-wc-gateway-ppec.php:468
 
 
 
 
115
  msgid "PayPal refund completed; transaction ID = %s"
116
  msgstr ""
117
 
118
- #: includes/abstracts/abstract-wc-gateway-ppec.php:442
119
  msgid "Refund Error: All transactions have been fully refunded. There is no amount left to refund"
120
  msgstr ""
121
 
122
- #: includes/abstracts/abstract-wc-gateway-ppec.php:444
123
  msgid "Refund Error: The requested refund amount is too large. The refund amount must be less than or equal to %s."
124
  msgstr ""
125
 
126
- #: includes/abstracts/abstract-wc-gateway-ppec.php:559
127
  msgid "Already using URL as image: %s"
128
  msgstr ""
129
 
130
- #: includes/abstracts/abstract-wc-gateway-ppec.php:567
131
  msgid "Select a image to upload"
132
  msgstr ""
133
 
134
- #: includes/abstracts/abstract-wc-gateway-ppec.php:568
135
  msgid "Use this image"
136
  msgstr ""
137
 
138
- #: includes/abstracts/abstract-wc-gateway-ppec.php:569
139
- #: includes/abstracts/abstract-wc-gateway-ppec.php:572
140
  msgid "Add image"
141
  msgstr ""
142
 
143
- #: includes/abstracts/abstract-wc-gateway-ppec.php:580
144
  msgid "Remove image"
145
  msgstr ""
146
 
147
- #: includes/abstracts/abstract-wc-gateway-ppec.php:619
148
  msgid "Remove"
149
  msgstr ""
150
 
@@ -285,26 +298,30 @@ msgstr ""
285
  msgid "An error (%s) occurred while processing your PayPal payment. Please contact the store owner for assistance."
286
  msgstr ""
287
 
288
- #: includes/class-wc-gateway-ppec-cart-handler.php:65
289
- #: includes/class-wc-gateway-ppec-cart-handler.php:135
290
- #: includes/class-wc-gateway-ppec-cart-handler.php:156
291
  msgid "Cheatin&#8217; huh?"
292
  msgstr ""
293
 
294
- #: includes/class-wc-gateway-ppec-cart-handler.php:314
295
- #: includes/class-wc-gateway-ppec-cart-handler.php:359
296
- #: includes/class-wc-gateway-ppec-cart-handler.php:394
297
  msgid "Check out with PayPal"
298
  msgstr ""
299
 
300
- #: includes/class-wc-gateway-ppec-cart-handler.php:349
301
  msgid "&mdash; or &mdash;"
302
  msgstr ""
303
 
304
- #: includes/class-wc-gateway-ppec-cart-handler.php:364
305
  msgid "Pay with PayPal Credit"
306
  msgstr ""
307
 
 
 
 
 
308
  #: includes/class-wc-gateway-ppec-checkout-handler.php:77
309
  msgid "Confirm your PayPal order"
310
  msgstr ""
@@ -343,7 +360,7 @@ msgstr ""
343
 
344
  #: includes/class-wc-gateway-ppec-checkout-handler.php:444
345
  #: includes/class-wc-gateway-ppec-checkout-handler.php:498
346
- #: includes/class-wc-gateway-ppec-checkout-handler.php:1156
347
  msgid "Your PayPal checkout session has expired. Please check out again."
348
  msgstr ""
349
 
@@ -359,29 +376,29 @@ msgstr ""
359
  msgid "You have cancelled Checkout with PayPal. Please try to process your order again."
360
  msgstr ""
361
 
362
- #: includes/class-wc-gateway-ppec-checkout-handler.php:983
363
  #: includes/class-wc-gateway-ppec-ipn-handler.php:190
364
  msgid "Payment authorized. Change payment status to processing or complete to capture funds."
365
  msgstr ""
366
 
367
- #: includes/class-wc-gateway-ppec-checkout-handler.php:985
368
  #: includes/class-wc-gateway-ppec-ipn-handler.php:192
369
  msgid "Payment pending (%s)."
370
  msgstr ""
371
 
372
- #: includes/class-wc-gateway-ppec-checkout-handler.php:1167
373
  msgid "The payment method was updated for this subscription."
374
  msgstr ""
375
 
376
- #: includes/class-wc-gateway-ppec-checkout-handler.php:1172
377
  msgid "The payment method was updated for all your current subscriptions."
378
  msgstr ""
379
 
380
- #: includes/class-wc-gateway-ppec-checkout-handler.php:1181
381
  msgid "There was a problem updating your payment method. Please try again later or use a different payment method."
382
  msgstr ""
383
 
384
- #: includes/class-wc-gateway-ppec-checkout-handler.php:1204
385
  msgid "You have cancelled Checkout with PayPal. The payment method was not updated."
386
  msgstr ""
387
 
@@ -501,42 +518,54 @@ msgstr ""
501
  msgid "Success! Your PayPal account has been set up successfully."
502
  msgstr ""
503
 
504
- #: includes/class-wc-gateway-ppec-plugin.php:157
505
  msgid "%s in WooCommerce Gateway PayPal Checkout plugin can only be called once"
506
  msgstr ""
507
 
508
- #: includes/class-wc-gateway-ppec-plugin.php:243
509
- msgid "<p>PayPal Checkout with new <strong>Smart Payment Buttons™</strong> gives your customers the power to pay the way they want without leaving your site.</p><p>The <strong>existing buttons will be removed</strong> in the <strong>next release</strong>. Please upgrade to Smart Payment Buttons on the <a href=\"%s\">PayPal Checkout settings page</a>.</p>"
510
- msgstr ""
511
-
512
- #: includes/class-wc-gateway-ppec-plugin.php:281
513
  msgid "WooCommerce Gateway PayPal Checkout requires WooCommerce to be activated"
514
  msgstr ""
515
 
516
- #: includes/class-wc-gateway-ppec-plugin.php:285
517
  msgid "WooCommerce Gateway PayPal Checkout requires WooCommerce version 2.5 or greater"
518
  msgstr ""
519
 
520
- #: includes/class-wc-gateway-ppec-plugin.php:289
521
  msgid "WooCommerce Gateway PayPal Checkout requires cURL to be installed on your server"
522
  msgstr ""
523
 
524
- #: includes/class-wc-gateway-ppec-plugin.php:292
525
  msgid "WooCommerce Gateway PayPal Checkout requires OpenSSL >= 1.0.1 to be installed on your server"
526
  msgstr ""
527
 
528
- #: includes/class-wc-gateway-ppec-plugin.php:319
529
  msgid "PayPal Checkout is almost ready. To get started, <a href=\"%s\">connect your PayPal account</a>."
530
  msgstr ""
531
 
532
- #: includes/class-wc-gateway-ppec-plugin.php:450
533
  msgid "Settings"
534
  msgstr ""
535
 
536
- #: includes/class-wc-gateway-ppec-plugin.php:453
 
 
 
 
537
  msgid "Docs"
538
  msgstr ""
539
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  #: includes/class-wc-gateway-ppec-privacy.php:14
541
  msgid "WooCommerce PPEC Order Data"
542
  msgstr ""
@@ -584,20 +613,20 @@ msgid "PayPal API error"
584
  msgstr ""
585
 
586
  #. translators: placeholder is pending reason from PayPal API.
587
- #: includes/class-wc-gateway-ppec-with-paypal-addons.php:204
588
  msgid "PayPal transaction held: %s"
589
  msgstr ""
590
 
591
- #: includes/class-wc-gateway-ppec-with-paypal-addons.php:215
592
  msgid "PayPal payment approved (ID: %s)"
593
  msgstr ""
594
 
595
- #: includes/class-wc-gateway-ppec-with-paypal-addons.php:219
596
  msgid "PayPal payment declined"
597
  msgstr ""
598
 
599
  #: includes/class-wc-gateway-ppec-with-paypal-credit.php:15
600
- #: includes/settings/settings-ppec.php:586
601
  msgid "PayPal Credit"
602
  msgstr ""
603
 
@@ -615,512 +644,573 @@ msgstr ""
615
  msgid "The buyer's session information could not be found."
616
  msgstr ""
617
 
618
- #: includes/settings/settings-ppec.php:15
619
  msgid "Setup or link an existing PayPal account"
620
  msgstr ""
621
 
622
- #: includes/settings/settings-ppec.php:16
623
  msgid "%s or <a href=\"#\" class=\"ppec-toggle-settings\">click here to toggle manual API credential input</a>."
624
  msgstr ""
625
 
626
  #. Translators: Placeholders are opening an closing link HTML tags.
627
- #: includes/settings/settings-ppec.php:29
628
  msgid "To reset current credentials and use another account %1$sclick here%2$s. %3$sLearn more about your API Credentials%2$s."
629
  msgstr ""
630
 
631
  #. Translators: Placeholders are opening an closing link HTML tags.
632
  #. Translators: Placeholders are opening and closing link HTML tags.
633
- #: includes/settings/settings-ppec.php:30
634
- #: includes/settings/settings-ppec.php:52
635
  msgid "Reset current credentials"
636
  msgstr ""
637
 
638
- #: includes/settings/settings-ppec.php:32
639
- #: includes/settings/settings-ppec.php:54
640
  msgid "Learn more"
641
  msgstr ""
642
 
643
- #: includes/settings/settings-ppec.php:37
644
  msgid "Setup or link an existing PayPal Sandbox account"
645
  msgstr ""
646
 
647
- #: includes/settings/settings-ppec.php:38
648
  msgid "%s or <a href=\"#\" class=\"ppec-toggle-sandbox-settings\">click here to toggle manual API credential input</a>."
649
  msgstr ""
650
 
651
  #. Translators: Placeholders are opening and closing link HTML tags.
652
- #: includes/settings/settings-ppec.php:51
653
  msgid "Your account setting is set to sandbox, no real charging takes place. To accept live payments, switch your environment to live and connect your PayPal account. To reset current credentials and use other sandbox account %1$sclick here%2$s. %3$sLearn more about your API Credentials%2$s."
654
  msgstr ""
655
 
656
- #: includes/settings/settings-ppec.php:58
657
- #: includes/settings/settings-ppec.php:592
658
- msgid "Enable PayPal Credit"
659
  msgstr ""
660
 
661
- #: includes/settings/settings-ppec.php:60
662
  msgid "This option is disabled. Currently PayPal Credit only available for U.S. merchants using USD currency."
663
  msgstr ""
664
 
665
- #: includes/settings/settings-ppec.php:63
666
  msgid "This enables PayPal Credit, which displays a PayPal Credit button next to the primary PayPal Checkout button. PayPal Checkout lets you give customers access to financing through PayPal Credit® - at no additional cost to you. You get paid up front, even though customers have more time to pay. A pre-integrated payment button shows up next to the PayPal Button, and lets customers pay quickly with PayPal Credit®. (Should be unchecked for stores involved in Real Money Gaming.)"
667
  msgstr ""
668
 
669
- #: includes/settings/settings-ppec.php:267
670
  msgid "Enable/Disable"
671
  msgstr ""
672
 
673
- #: includes/settings/settings-ppec.php:269
674
  msgid "Enable PayPal Checkout"
675
  msgstr ""
676
 
677
- #: includes/settings/settings-ppec.php:270
678
  msgid "This enables PayPal Checkout which allows customers to checkout directly via PayPal from your cart page."
679
  msgstr ""
680
 
681
- #: includes/settings/settings-ppec.php:276
682
  msgid "Title"
683
  msgstr ""
684
 
685
- #: includes/settings/settings-ppec.php:278
686
  msgid "This controls the title which the user sees during checkout."
687
  msgstr ""
688
 
689
- #: includes/settings/settings-ppec.php:279
 
 
690
  msgid "PayPal"
691
  msgstr ""
692
 
693
- #: includes/settings/settings-ppec.php:283
694
  msgid "Description"
695
  msgstr ""
696
 
697
- #: includes/settings/settings-ppec.php:286
698
  msgid "This controls the description which the user sees during checkout."
699
  msgstr ""
700
 
701
- #: includes/settings/settings-ppec.php:287
702
  msgid "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account."
703
  msgstr ""
704
 
705
- #: includes/settings/settings-ppec.php:291
706
  msgid "Account Settings"
707
  msgstr ""
708
 
709
- #: includes/settings/settings-ppec.php:296
710
  msgid "Environment"
711
  msgstr ""
712
 
713
- #: includes/settings/settings-ppec.php:299
714
  msgid "This setting specifies whether you will process live transactions, or whether you will process simulated transactions using the PayPal Sandbox."
715
  msgstr ""
716
 
717
- #: includes/settings/settings-ppec.php:303
718
  msgid "Live"
719
  msgstr ""
720
 
721
- #: includes/settings/settings-ppec.php:304
722
  msgid "Sandbox"
723
  msgstr ""
724
 
725
- #: includes/settings/settings-ppec.php:309
726
  msgid "API Credentials"
727
  msgstr ""
728
 
729
- #: includes/settings/settings-ppec.php:314
730
  msgid "Live API Username"
731
  msgstr ""
732
 
733
- #: includes/settings/settings-ppec.php:316
734
- #: includes/settings/settings-ppec.php:323
735
- #: includes/settings/settings-ppec.php:330
736
- #: includes/settings/settings-ppec.php:358
737
- #: includes/settings/settings-ppec.php:365
738
- #: includes/settings/settings-ppec.php:372
739
  msgid "Get your API credentials from PayPal."
740
  msgstr ""
741
 
742
- #: includes/settings/settings-ppec.php:321
743
  msgid "Live API Password"
744
  msgstr ""
745
 
746
- #: includes/settings/settings-ppec.php:328
747
  msgid "Live API Signature"
748
  msgstr ""
749
 
750
- #: includes/settings/settings-ppec.php:333
751
- #: includes/settings/settings-ppec.php:375
752
  msgid "Optional if you provide a certificate below"
753
  msgstr ""
754
 
755
- #: includes/settings/settings-ppec.php:336
756
  msgid "Live API Certificate"
757
  msgstr ""
758
 
759
- #: includes/settings/settings-ppec.php:342
760
  msgid "Live API Subject"
761
  msgstr ""
762
 
763
- #: includes/settings/settings-ppec.php:344
764
- #: includes/settings/settings-ppec.php:386
765
  msgid "If you're processing transactions on behalf of someone else's PayPal account, enter their email address or Secure Merchant Account ID (also known as a Payer ID) here. Generally, you must have API permissions in place with the other account in order to process anything other than \"sale\" transactions for them."
766
  msgstr ""
767
 
768
- #: includes/settings/settings-ppec.php:347
769
- #: includes/settings/settings-ppec.php:389
770
- #: includes/settings/settings-ppec.php:410
771
- #: includes/settings/settings-ppec.php:418
772
- #: includes/settings/settings-ppec.php:426
773
  msgid "Optional"
774
  msgstr ""
775
 
776
- #: includes/settings/settings-ppec.php:351
777
  msgid "Sandbox API Credentials"
778
  msgstr ""
779
 
780
- #: includes/settings/settings-ppec.php:356
781
  msgid "Sandbox API Username"
782
  msgstr ""
783
 
784
- #: includes/settings/settings-ppec.php:363
785
  msgid "Sandbox API Password"
786
  msgstr ""
787
 
788
- #: includes/settings/settings-ppec.php:370
789
  msgid "Sandbox API Signature"
790
  msgstr ""
791
 
792
- #: includes/settings/settings-ppec.php:378
793
  msgid "Sandbox API Certificate"
794
  msgstr ""
795
 
796
- #: includes/settings/settings-ppec.php:384
797
  msgid "Sandbox API Subject"
798
  msgstr ""
799
 
800
- #: includes/settings/settings-ppec.php:393
801
  msgid "PayPal-hosted Checkout Settings"
802
  msgstr ""
803
 
804
- #: includes/settings/settings-ppec.php:395
805
  msgid "Customize the appearance of PayPal Checkout on the PayPal side."
806
  msgstr ""
807
 
808
- #: includes/settings/settings-ppec.php:398
809
  msgid "Brand Name"
810
  msgstr ""
811
 
812
- #: includes/settings/settings-ppec.php:400
813
  msgid "A label that overrides the business name in the PayPal account on the PayPal hosted checkout pages."
814
  msgstr ""
815
 
816
- #: includes/settings/settings-ppec.php:405
817
  msgid "Logo Image (190×60)"
818
  msgstr ""
819
 
820
- #: includes/settings/settings-ppec.php:407
821
  msgid "If you want PayPal to co-brand the checkout page with your logo, enter the URL of your logo image here.<br/>The image must be no larger than 190x60, GIF, PNG, or JPG format, and should be served over HTTPS."
822
  msgstr ""
823
 
824
- #: includes/settings/settings-ppec.php:413
825
  msgid "Header Image (750×90)"
826
  msgstr ""
827
 
828
- #: includes/settings/settings-ppec.php:415
829
  msgid "If you want PayPal to co-brand the checkout page with your header, enter the URL of your header image here.<br/>The image must be no larger than 750x90, GIF, PNG, or JPG format, and should be served over HTTPS."
830
  msgstr ""
831
 
832
- #: includes/settings/settings-ppec.php:421
833
  msgid "Page Style"
834
  msgstr ""
835
 
836
- #: includes/settings/settings-ppec.php:423
837
  msgid "Optionally enter the name of the page style you wish to use. These are defined within your PayPal account."
838
  msgstr ""
839
 
840
- #: includes/settings/settings-ppec.php:429
841
  msgid "Landing Page"
842
  msgstr ""
843
 
844
- #: includes/settings/settings-ppec.php:432
845
  msgid "Type of PayPal page to display."
846
  msgstr ""
847
 
848
- #: includes/settings/settings-ppec.php:436
849
  msgctxt "Type of PayPal page"
850
  msgid "Billing (Non-PayPal account)"
851
  msgstr ""
852
 
853
- #: includes/settings/settings-ppec.php:437
854
  msgctxt "Type of PayPal page"
855
  msgid "Login (PayPal account login)"
856
  msgstr ""
857
 
858
- #: includes/settings/settings-ppec.php:442
859
  msgid "Advanced Settings"
860
  msgstr ""
861
 
862
- #: includes/settings/settings-ppec.php:447
863
  msgid "Debug Log"
864
  msgstr ""
865
 
866
- #: includes/settings/settings-ppec.php:449
867
  msgid "Enable Logging"
868
  msgstr ""
869
 
870
- #: includes/settings/settings-ppec.php:452
871
  msgid "Log PayPal events, such as IPN requests."
872
  msgstr ""
873
 
874
- #: includes/settings/settings-ppec.php:455
875
  msgid "Invoice Prefix"
876
  msgstr ""
877
 
878
- #: includes/settings/settings-ppec.php:457
879
  msgid "Please enter a prefix for your invoice numbers. If you use your PayPal account for multiple stores ensure this prefix is unique as PayPal will not allow orders with the same invoice number."
880
  msgstr ""
881
 
882
- #: includes/settings/settings-ppec.php:462
883
  msgid "Billing Addresses"
884
  msgstr ""
885
 
886
- #: includes/settings/settings-ppec.php:464
887
  msgid "Require Billing Address"
888
  msgstr ""
889
 
890
- #: includes/settings/settings-ppec.php:466
891
  msgid "PayPal only returns a shipping address back to the website. To make sure billing address is returned as well, please enable this functionality on your PayPal account by calling %1$sPayPal Technical Support%2$s."
892
  msgstr ""
893
 
894
- #: includes/settings/settings-ppec.php:469
895
- #: includes/settings/settings-ppec.php:471
896
  msgid "Require Phone Number"
897
  msgstr ""
898
 
899
- #: includes/settings/settings-ppec.php:473
900
  msgid "Require buyer to enter their telephone number during checkout if none is provided by PayPal"
901
  msgstr ""
902
 
903
- #: includes/settings/settings-ppec.php:476
904
  msgid "Payment Action"
905
  msgstr ""
906
 
907
- #: includes/settings/settings-ppec.php:479
908
  msgid "Choose whether you wish to capture funds immediately or authorize payment only."
909
  msgstr ""
910
 
911
- #: includes/settings/settings-ppec.php:483
912
  msgid "Sale"
913
  msgstr ""
914
 
915
- #: includes/settings/settings-ppec.php:484
916
  msgid "Authorize"
917
  msgstr ""
918
 
919
- #: includes/settings/settings-ppec.php:488
920
  msgid "Instant Payments"
921
  msgstr ""
922
 
923
- #: includes/settings/settings-ppec.php:490
924
  msgid "Require Instant Payment"
925
  msgstr ""
926
 
927
- #: includes/settings/settings-ppec.php:493
928
  msgid "If you enable this setting, PayPal will be instructed not to allow the buyer to use funding sources that take additional time to complete (for example, eChecks). Instead, the buyer will be required to use an instant funding source, such as an instant transfer, a credit/debit card, or PayPal Credit."
929
  msgstr ""
930
 
931
- #: includes/settings/settings-ppec.php:496
932
  msgid "Subtotal Mismatch Behavior"
933
  msgstr ""
934
 
935
- #: includes/settings/settings-ppec.php:499
936
  msgid "Internally, WC calculates line item prices and taxes out to four decimal places; however, PayPal can only handle amounts out to two decimal places (or, depending on the currency, no decimal places at all). Occasionally, this can cause discrepancies between the way WooCommerce calculates prices versus the way PayPal calculates them. If a mismatch occurs, this option controls how the order is dealt with so payment can still be taken."
937
  msgstr ""
938
 
939
- #: includes/settings/settings-ppec.php:503
940
  msgid "Add another line item"
941
  msgstr ""
942
 
943
- #: includes/settings/settings-ppec.php:504
944
  msgid "Do not send line items to PayPal"
945
  msgstr ""
946
 
947
- #: includes/settings/settings-ppec.php:509
948
  msgid "Button Settings"
949
  msgstr ""
950
 
951
- #: includes/settings/settings-ppec.php:511
952
  msgid "Customize the appearance of PayPal Checkout on your site."
953
  msgstr ""
954
 
955
- #: includes/settings/settings-ppec.php:514
956
  msgid "Smart Payment Buttons"
957
  msgstr ""
958
 
959
- #: includes/settings/settings-ppec.php:517
960
  msgid "Use Smart Payment Buttons"
961
  msgstr ""
962
 
963
- #: includes/settings/settings-ppec.php:518
964
  msgid "PayPal Checkout's Smart Payment Buttons provide a variety of button customization options, such as color, language, shape, and multiple button layout. <a href=\"%s\">Learn more about Smart Payment Buttons</a>."
965
  msgstr ""
966
 
967
- #: includes/settings/settings-ppec.php:521
968
  msgid "Button Color"
969
  msgstr ""
970
 
971
- #: includes/settings/settings-ppec.php:526
972
  msgid "Controls the background color of the primary button. Use \"Gold\" to leverage PayPal's recognition and preference, or change it to match your site design or aesthetic."
973
  msgstr ""
974
 
975
- #: includes/settings/settings-ppec.php:528
976
  msgid "Gold (Recommended)"
977
  msgstr ""
978
 
979
- #: includes/settings/settings-ppec.php:529
980
  msgid "Blue"
981
  msgstr ""
982
 
983
- #: includes/settings/settings-ppec.php:530
984
  msgid "Silver"
985
  msgstr ""
986
 
987
- #: includes/settings/settings-ppec.php:531
988
  msgid "Black"
989
  msgstr ""
990
 
991
- #: includes/settings/settings-ppec.php:535
992
  msgid "Button Shape"
993
  msgstr ""
994
 
995
- #: includes/settings/settings-ppec.php:540
996
  msgid "The pill-shaped button's unique and powerful shape signifies PayPal in people's minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges."
997
  msgstr ""
998
 
999
- #: includes/settings/settings-ppec.php:542
1000
  msgid "Pill"
1001
  msgstr ""
1002
 
1003
- #: includes/settings/settings-ppec.php:543
1004
  msgid "Rectangle"
1005
  msgstr ""
1006
 
1007
- #: includes/settings/settings-ppec.php:553
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1008
  msgid "Button Layout"
1009
  msgstr ""
1010
 
1011
- #: includes/settings/settings-ppec.php:558
1012
  msgid "If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose \"vertical\" for a dynamic list of alternative and local payment options, or \"horizontal\" when space is limited."
1013
  msgstr ""
1014
 
1015
- #: includes/settings/settings-ppec.php:560
1016
  msgid "Vertical"
1017
  msgstr ""
1018
 
1019
- #: includes/settings/settings-ppec.php:561
1020
  msgid "Horizontal"
1021
  msgstr ""
1022
 
1023
- #: includes/settings/settings-ppec.php:565
1024
  msgid "Button Size"
1025
  msgstr ""
1026
 
1027
- #: includes/settings/settings-ppec.php:570
1028
  msgid "PayPal offers different sizes of the \"PayPal Checkout\" buttons, allowing you to select a size that best fits your site's theme. This setting will allow you to choose which size button(s) appear on your cart page. (The \"Responsive\" option adjusts to container size, and is available and recommended for Smart Payment Buttons.)"
1029
  msgstr ""
1030
 
1031
- #: includes/settings/settings-ppec.php:572
1032
  msgid "Responsive"
1033
  msgstr ""
1034
 
1035
- #: includes/settings/settings-ppec.php:573
1036
  msgid "Small"
1037
  msgstr ""
1038
 
1039
- #: includes/settings/settings-ppec.php:574
1040
  msgid "Medium"
1041
  msgstr ""
1042
 
1043
- #: includes/settings/settings-ppec.php:575
1044
  msgid "Large"
1045
  msgstr ""
1046
 
1047
- #: includes/settings/settings-ppec.php:584
 
 
 
 
1048
  msgid "Hides the specified funding methods."
1049
  msgstr ""
1050
 
1051
- #: includes/settings/settings-ppec.php:587
1052
  msgid "ELV"
1053
  msgstr ""
1054
 
1055
- #: includes/settings/settings-ppec.php:588
1056
- msgid "Credit Card"
 
 
 
 
 
 
 
 
 
 
 
 
1057
  msgstr ""
1058
 
1059
- #: includes/settings/settings-ppec.php:611
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1060
  msgid "Checkout on cart page"
1061
  msgstr ""
1062
 
1063
- #: includes/settings/settings-ppec.php:614
1064
  msgid "Enable PayPal Checkout on the cart page"
1065
  msgstr ""
1066
 
1067
- #: includes/settings/settings-ppec.php:615
1068
  msgid "This shows or hides the PayPal Checkout button on the cart page."
1069
  msgstr ""
1070
 
1071
- #: includes/settings/settings-ppec.php:624
1072
  msgid "Mini-cart Button Settings"
1073
  msgstr ""
1074
 
1075
- #: includes/settings/settings-ppec.php:629
1076
- #: includes/settings/settings-ppec.php:660
1077
- #: includes/settings/settings-ppec.php:692
1078
  msgid "Configure Settings"
1079
  msgstr ""
1080
 
1081
- #: includes/settings/settings-ppec.php:630
1082
  msgid "Configure settings specific to mini-cart"
1083
  msgstr ""
1084
 
1085
- #: includes/settings/settings-ppec.php:635
1086
- #: includes/settings/settings-ppec.php:666
1087
- #: includes/settings/settings-ppec.php:698
1088
  msgid "Optionally override global button settings above and configure buttons for this context."
1089
  msgstr ""
1090
 
1091
- #: includes/settings/settings-ppec.php:646
1092
  msgid "Single Product Button Settings"
1093
  msgstr ""
1094
 
1095
- #: includes/settings/settings-ppec.php:651
1096
- #: includes/settings/settings-ppec.php:654
1097
  msgid "Checkout on Single Product"
1098
  msgstr ""
1099
 
1100
- #: includes/settings/settings-ppec.php:657
1101
  msgid "Enable PayPal Checkout on Single Product view."
1102
  msgstr ""
1103
 
1104
- #: includes/settings/settings-ppec.php:661
1105
  msgid "Configure settings specific to Single Product view"
1106
  msgstr ""
1107
 
1108
- #: includes/settings/settings-ppec.php:678
1109
  msgid "Regular Checkout Button Settings"
1110
  msgstr ""
1111
 
1112
- #: includes/settings/settings-ppec.php:683
1113
  msgid "PayPal Mark"
1114
  msgstr ""
1115
 
1116
- #: includes/settings/settings-ppec.php:686
1117
  msgid "Enable the PayPal Mark on regular checkout"
1118
  msgstr ""
1119
 
1120
- #: includes/settings/settings-ppec.php:687
1121
  msgid "This enables the PayPal mark, which can be shown on regular WooCommerce checkout to use PayPal Checkout like a regular WooCommerce gateway."
1122
  msgstr ""
1123
 
1124
- #: includes/settings/settings-ppec.php:693
1125
  msgid "Configure settings specific to regular checkout"
1126
  msgstr ""
2
  # This file is distributed under the same license as the WooCommerce PayPal Checkout Gateway plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce PayPal Checkout Gateway 2.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-gateway-paypal-express-checkout\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-05-25T14:58:35+10:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woocommerce-gateway-paypal-express-checkout\n"
36
 
37
  #: includes/abstracts/abstract-wc-gateway-ppec.php:18
38
  #: includes/class-wc-gateway-ppec-privacy.php:12
39
+ #: includes/settings/settings-ppec.php:358
40
+ #: includes/settings/settings-ppec.php:404
41
  msgid "PayPal Checkout"
42
  msgstr ""
43
 
45
  msgid "Allow customers to conveniently checkout directly with PayPal."
46
  msgstr ""
47
 
48
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:59
49
  msgid "Continue to payment"
50
  msgstr ""
51
 
52
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:169
53
  msgid "Sorry, an error occurred while trying to process your payment. Please try again."
54
  msgstr ""
55
 
56
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:202
57
  msgid "No API certificate on file."
58
  msgstr ""
59
 
60
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:211
61
  msgid "expires on %s (%s)"
62
  msgstr ""
63
 
64
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:215
65
  msgid "expired on %s (%s)"
66
  msgstr ""
67
 
68
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:225
69
  msgid "Certificate belongs to API username %1$s; %2$s."
70
  msgstr ""
71
 
72
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:227
73
  msgid "The certificate on file is not valid."
74
  msgstr ""
75
 
76
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:292
77
+ msgid "Error: You must enter API username."
78
+ msgstr ""
79
+
80
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:296
81
  msgid "Error: You must enter API password."
82
  msgstr ""
83
 
84
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:300
85
+ msgid "Error: You must provide API signature or certificate."
86
+ msgstr ""
87
+
88
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:310
89
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:337
90
  msgid "Error: The API credentials you provided are not valid. Please double-check that you entered them correctly and try again."
91
  msgstr ""
92
 
93
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:314
94
+ msgid "An error occurred while trying to validate your API credentials. Unable to verify that your API credentials are correct."
 
95
  msgstr ""
96
 
97
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:321
98
  msgid "Error: The API certificate is not valid."
99
  msgstr ""
100
 
101
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:328
102
  msgid "Error: The API certificate has expired."
103
  msgstr ""
104
 
105
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:330
106
+ msgid "Error: The API username does not match the name in the API certificate. Make sure that you have the correct API certificate."
107
  msgstr ""
108
 
109
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:340
110
+ msgid "An error occurred while trying to validate your API credentials. Unable to verify that your API credentials are correct."
111
  msgstr ""
112
 
113
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:359
114
  msgid "The \"require billing address\" option is not enabled by your account and has been disabled."
115
  msgstr ""
116
 
117
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:384
118
  msgid "Refund Error: You need to specify a refund amount."
119
  msgstr ""
120
 
121
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:396
122
+ msgid "Refund Error: Sorry! This is not a refundable transaction."
123
+ msgstr ""
124
+
125
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:408
126
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:431
127
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:481
128
  msgid "PayPal refund completed; transaction ID = %s"
129
  msgstr ""
130
 
131
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:455
132
  msgid "Refund Error: All transactions have been fully refunded. There is no amount left to refund"
133
  msgstr ""
134
 
135
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:457
136
  msgid "Refund Error: The requested refund amount is too large. The refund amount must be less than or equal to %s."
137
  msgstr ""
138
 
139
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:572
140
  msgid "Already using URL as image: %s"
141
  msgstr ""
142
 
143
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:580
144
  msgid "Select a image to upload"
145
  msgstr ""
146
 
147
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:581
148
  msgid "Use this image"
149
  msgstr ""
150
 
151
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:582
152
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:585
153
  msgid "Add image"
154
  msgstr ""
155
 
156
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:593
157
  msgid "Remove image"
158
  msgstr ""
159
 
160
+ #: includes/abstracts/abstract-wc-gateway-ppec.php:632
161
  msgid "Remove"
162
  msgstr ""
163
 
298
  msgid "An error (%s) occurred while processing your PayPal payment. Please contact the store owner for assistance."
299
  msgstr ""
300
 
301
+ #: includes/class-wc-gateway-ppec-cart-handler.php:70
302
+ #: includes/class-wc-gateway-ppec-cart-handler.php:140
303
+ #: includes/class-wc-gateway-ppec-cart-handler.php:161
304
  msgid "Cheatin&#8217; huh?"
305
  msgstr ""
306
 
307
+ #: includes/class-wc-gateway-ppec-cart-handler.php:319
308
+ #: includes/class-wc-gateway-ppec-cart-handler.php:364
309
+ #: includes/class-wc-gateway-ppec-cart-handler.php:399
310
  msgid "Check out with PayPal"
311
  msgstr ""
312
 
313
+ #: includes/class-wc-gateway-ppec-cart-handler.php:354
314
  msgid "&mdash; or &mdash;"
315
  msgstr ""
316
 
317
+ #: includes/class-wc-gateway-ppec-cart-handler.php:369
318
  msgid "Pay with PayPal Credit"
319
  msgstr ""
320
 
321
+ #: includes/class-wc-gateway-ppec-cart-handler.php:509
322
+ msgid "An error occurred while processing your PayPal payment. Please contact the store owner for assistance."
323
+ msgstr ""
324
+
325
  #: includes/class-wc-gateway-ppec-checkout-handler.php:77
326
  msgid "Confirm your PayPal order"
327
  msgstr ""
360
 
361
  #: includes/class-wc-gateway-ppec-checkout-handler.php:444
362
  #: includes/class-wc-gateway-ppec-checkout-handler.php:498
363
+ #: includes/class-wc-gateway-ppec-checkout-handler.php:1124
364
  msgid "Your PayPal checkout session has expired. Please check out again."
365
  msgstr ""
366
 
376
  msgid "You have cancelled Checkout with PayPal. Please try to process your order again."
377
  msgstr ""
378
 
379
+ #: includes/class-wc-gateway-ppec-checkout-handler.php:951
380
  #: includes/class-wc-gateway-ppec-ipn-handler.php:190
381
  msgid "Payment authorized. Change payment status to processing or complete to capture funds."
382
  msgstr ""
383
 
384
+ #: includes/class-wc-gateway-ppec-checkout-handler.php:953
385
  #: includes/class-wc-gateway-ppec-ipn-handler.php:192
386
  msgid "Payment pending (%s)."
387
  msgstr ""
388
 
389
+ #: includes/class-wc-gateway-ppec-checkout-handler.php:1135
390
  msgid "The payment method was updated for this subscription."
391
  msgstr ""
392
 
393
+ #: includes/class-wc-gateway-ppec-checkout-handler.php:1140
394
  msgid "The payment method was updated for all your current subscriptions."
395
  msgstr ""
396
 
397
+ #: includes/class-wc-gateway-ppec-checkout-handler.php:1149
398
  msgid "There was a problem updating your payment method. Please try again later or use a different payment method."
399
  msgstr ""
400
 
401
+ #: includes/class-wc-gateway-ppec-checkout-handler.php:1172
402
  msgid "You have cancelled Checkout with PayPal. The payment method was not updated."
403
  msgstr ""
404
 
518
  msgid "Success! Your PayPal account has been set up successfully."
519
  msgstr ""
520
 
521
+ #: includes/class-wc-gateway-ppec-plugin.php:158
522
  msgid "%s in WooCommerce Gateway PayPal Checkout plugin can only be called once"
523
  msgstr ""
524
 
525
+ #: includes/class-wc-gateway-ppec-plugin.php:260
 
 
 
 
526
  msgid "WooCommerce Gateway PayPal Checkout requires WooCommerce to be activated"
527
  msgstr ""
528
 
529
+ #: includes/class-wc-gateway-ppec-plugin.php:264
530
  msgid "WooCommerce Gateway PayPal Checkout requires WooCommerce version 2.5 or greater"
531
  msgstr ""
532
 
533
+ #: includes/class-wc-gateway-ppec-plugin.php:268
534
  msgid "WooCommerce Gateway PayPal Checkout requires cURL to be installed on your server"
535
  msgstr ""
536
 
537
+ #: includes/class-wc-gateway-ppec-plugin.php:271
538
  msgid "WooCommerce Gateway PayPal Checkout requires OpenSSL >= 1.0.1 to be installed on your server"
539
  msgstr ""
540
 
541
+ #: includes/class-wc-gateway-ppec-plugin.php:298
542
  msgid "PayPal Checkout is almost ready. To get started, <a href=\"%s\">connect your PayPal account</a>."
543
  msgstr ""
544
 
545
+ #: includes/class-wc-gateway-ppec-plugin.php:428
546
  msgid "Settings"
547
  msgstr ""
548
 
549
+ #: includes/class-wc-gateway-ppec-plugin.php:447
550
+ msgid "View Documentation"
551
+ msgstr ""
552
+
553
+ #: includes/class-wc-gateway-ppec-plugin.php:447
554
  msgid "Docs"
555
  msgstr ""
556
 
557
+ #: includes/class-wc-gateway-ppec-plugin.php:448
558
+ msgid "Open a support request at WooCommerce.com"
559
+ msgstr ""
560
+
561
+ #: includes/class-wc-gateway-ppec-plugin.php:448
562
+ msgid "Support"
563
+ msgstr ""
564
+
565
+ #: includes/class-wc-gateway-ppec-plugin.php:503
566
+ msgid "<p>PayPal Checkout with new <strong>Smart Payment Buttons™</strong> gives your customers the power to pay the way they want without leaving your site.</p><p>The <strong>existing buttons will be removed</strong> in the <strong>next release</strong>. Please upgrade to Smart Payment Buttons on the <a href=\"%s\">PayPal Checkout settings page</a>.</p>"
567
+ msgstr ""
568
+
569
  #: includes/class-wc-gateway-ppec-privacy.php:14
570
  msgid "WooCommerce PPEC Order Data"
571
  msgstr ""
613
  msgstr ""
614
 
615
  #. translators: placeholder is pending reason from PayPal API.
616
+ #: includes/class-wc-gateway-ppec-with-paypal-addons.php:206
617
  msgid "PayPal transaction held: %s"
618
  msgstr ""
619
 
620
+ #: includes/class-wc-gateway-ppec-with-paypal-addons.php:217
621
  msgid "PayPal payment approved (ID: %s)"
622
  msgstr ""
623
 
624
+ #: includes/class-wc-gateway-ppec-with-paypal-addons.php:221
625
  msgid "PayPal payment declined"
626
  msgstr ""
627
 
628
  #: includes/class-wc-gateway-ppec-with-paypal-credit.php:15
629
+ #: includes/settings/settings-ppec.php:417
630
  msgid "PayPal Credit"
631
  msgstr ""
632
 
644
  msgid "The buyer's session information could not be found."
645
  msgstr ""
646
 
647
+ #: includes/settings/settings-ppec.php:17
648
  msgid "Setup or link an existing PayPal account"
649
  msgstr ""
650
 
651
+ #: includes/settings/settings-ppec.php:18
652
  msgid "%s or <a href=\"#\" class=\"ppec-toggle-settings\">click here to toggle manual API credential input</a>."
653
  msgstr ""
654
 
655
  #. Translators: Placeholders are opening an closing link HTML tags.
656
+ #: includes/settings/settings-ppec.php:31
657
  msgid "To reset current credentials and use another account %1$sclick here%2$s. %3$sLearn more about your API Credentials%2$s."
658
  msgstr ""
659
 
660
  #. Translators: Placeholders are opening an closing link HTML tags.
661
  #. Translators: Placeholders are opening and closing link HTML tags.
662
+ #: includes/settings/settings-ppec.php:32
663
+ #: includes/settings/settings-ppec.php:54
664
  msgid "Reset current credentials"
665
  msgstr ""
666
 
667
+ #: includes/settings/settings-ppec.php:34
668
+ #: includes/settings/settings-ppec.php:56
669
  msgid "Learn more"
670
  msgstr ""
671
 
672
+ #: includes/settings/settings-ppec.php:39
673
  msgid "Setup or link an existing PayPal Sandbox account"
674
  msgstr ""
675
 
676
+ #: includes/settings/settings-ppec.php:40
677
  msgid "%s or <a href=\"#\" class=\"ppec-toggle-sandbox-settings\">click here to toggle manual API credential input</a>."
678
  msgstr ""
679
 
680
  #. Translators: Placeholders are opening and closing link HTML tags.
681
+ #: includes/settings/settings-ppec.php:53
682
  msgid "Your account setting is set to sandbox, no real charging takes place. To accept live payments, switch your environment to live and connect your PayPal account. To reset current credentials and use other sandbox account %1$sclick here%2$s. %3$sLearn more about your API Credentials%2$s."
683
  msgstr ""
684
 
685
+ #: includes/settings/settings-ppec.php:60
686
+ #: includes/settings/settings-ppec.php:432
687
+ msgid "Enable PayPal Credit to eligible customers"
688
  msgstr ""
689
 
690
+ #: includes/settings/settings-ppec.php:62
691
  msgid "This option is disabled. Currently PayPal Credit only available for U.S. merchants using USD currency."
692
  msgstr ""
693
 
694
+ #: includes/settings/settings-ppec.php:65
695
  msgid "This enables PayPal Credit, which displays a PayPal Credit button next to the primary PayPal Checkout button. PayPal Checkout lets you give customers access to financing through PayPal Credit® - at no additional cost to you. You get paid up front, even though customers have more time to pay. A pre-integrated payment button shows up next to the PayPal Button, and lets customers pay quickly with PayPal Credit®. (Should be unchecked for stores involved in Real Money Gaming.)"
696
  msgstr ""
697
 
698
+ #: includes/settings/settings-ppec.php:72
699
  msgid "Enable/Disable"
700
  msgstr ""
701
 
702
+ #: includes/settings/settings-ppec.php:74
703
  msgid "Enable PayPal Checkout"
704
  msgstr ""
705
 
706
+ #: includes/settings/settings-ppec.php:75
707
  msgid "This enables PayPal Checkout which allows customers to checkout directly via PayPal from your cart page."
708
  msgstr ""
709
 
710
+ #: includes/settings/settings-ppec.php:81
711
  msgid "Title"
712
  msgstr ""
713
 
714
+ #: includes/settings/settings-ppec.php:83
715
  msgid "This controls the title which the user sees during checkout."
716
  msgstr ""
717
 
718
+ #: includes/settings/settings-ppec.php:84
719
+ #: includes/settings/settings-ppec.php:357
720
+ #: includes/settings/settings-ppec.php:403
721
  msgid "PayPal"
722
  msgstr ""
723
 
724
+ #: includes/settings/settings-ppec.php:88
725
  msgid "Description"
726
  msgstr ""
727
 
728
+ #: includes/settings/settings-ppec.php:91
729
  msgid "This controls the description which the user sees during checkout."
730
  msgstr ""
731
 
732
+ #: includes/settings/settings-ppec.php:92
733
  msgid "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account."
734
  msgstr ""
735
 
736
+ #: includes/settings/settings-ppec.php:96
737
  msgid "Account Settings"
738
  msgstr ""
739
 
740
+ #: includes/settings/settings-ppec.php:101
741
  msgid "Environment"
742
  msgstr ""
743
 
744
+ #: includes/settings/settings-ppec.php:104
745
  msgid "This setting specifies whether you will process live transactions, or whether you will process simulated transactions using the PayPal Sandbox."
746
  msgstr ""
747
 
748
+ #: includes/settings/settings-ppec.php:108
749
  msgid "Live"
750
  msgstr ""
751
 
752
+ #: includes/settings/settings-ppec.php:109
753
  msgid "Sandbox"
754
  msgstr ""
755
 
756
+ #: includes/settings/settings-ppec.php:114
757
  msgid "API Credentials"
758
  msgstr ""
759
 
760
+ #: includes/settings/settings-ppec.php:119
761
  msgid "Live API Username"
762
  msgstr ""
763
 
764
+ #: includes/settings/settings-ppec.php:121
765
+ #: includes/settings/settings-ppec.php:128
766
+ #: includes/settings/settings-ppec.php:135
767
+ #: includes/settings/settings-ppec.php:162
768
+ #: includes/settings/settings-ppec.php:169
769
+ #: includes/settings/settings-ppec.php:176
770
  msgid "Get your API credentials from PayPal."
771
  msgstr ""
772
 
773
+ #: includes/settings/settings-ppec.php:126
774
  msgid "Live API Password"
775
  msgstr ""
776
 
777
+ #: includes/settings/settings-ppec.php:133
778
  msgid "Live API Signature"
779
  msgstr ""
780
 
781
+ #: includes/settings/settings-ppec.php:138
782
+ #: includes/settings/settings-ppec.php:179
783
  msgid "Optional if you provide a certificate below"
784
  msgstr ""
785
 
786
+ #: includes/settings/settings-ppec.php:141
787
  msgid "Live API Certificate"
788
  msgstr ""
789
 
790
+ #: includes/settings/settings-ppec.php:147
791
  msgid "Live API Subject"
792
  msgstr ""
793
 
794
+ #: includes/settings/settings-ppec.php:149
795
+ #: includes/settings/settings-ppec.php:190
796
  msgid "If you're processing transactions on behalf of someone else's PayPal account, enter their email address or Secure Merchant Account ID (also known as a Payer ID) here. Generally, you must have API permissions in place with the other account in order to process anything other than \"sale\" transactions for them."
797
  msgstr ""
798
 
799
+ #: includes/settings/settings-ppec.php:152
800
+ #: includes/settings/settings-ppec.php:193
801
+ #: includes/settings/settings-ppec.php:213
802
+ #: includes/settings/settings-ppec.php:221
803
+ #: includes/settings/settings-ppec.php:229
804
  msgid "Optional"
805
  msgstr ""
806
 
807
+ #: includes/settings/settings-ppec.php:155
808
  msgid "Sandbox API Credentials"
809
  msgstr ""
810
 
811
+ #: includes/settings/settings-ppec.php:160
812
  msgid "Sandbox API Username"
813
  msgstr ""
814
 
815
+ #: includes/settings/settings-ppec.php:167
816
  msgid "Sandbox API Password"
817
  msgstr ""
818
 
819
+ #: includes/settings/settings-ppec.php:174
820
  msgid "Sandbox API Signature"
821
  msgstr ""
822
 
823
+ #: includes/settings/settings-ppec.php:182
824
  msgid "Sandbox API Certificate"
825
  msgstr ""
826
 
827
+ #: includes/settings/settings-ppec.php:188
828
  msgid "Sandbox API Subject"
829
  msgstr ""
830
 
831
+ #: includes/settings/settings-ppec.php:196
832
  msgid "PayPal-hosted Checkout Settings"
833
  msgstr ""
834
 
835
+ #: includes/settings/settings-ppec.php:198
836
  msgid "Customize the appearance of PayPal Checkout on the PayPal side."
837
  msgstr ""
838
 
839
+ #: includes/settings/settings-ppec.php:201
840
  msgid "Brand Name"
841
  msgstr ""
842
 
843
+ #: includes/settings/settings-ppec.php:203
844
  msgid "A label that overrides the business name in the PayPal account on the PayPal hosted checkout pages."
845
  msgstr ""
846
 
847
+ #: includes/settings/settings-ppec.php:208
848
  msgid "Logo Image (190×60)"
849
  msgstr ""
850
 
851
+ #: includes/settings/settings-ppec.php:210
852
  msgid "If you want PayPal to co-brand the checkout page with your logo, enter the URL of your logo image here.<br/>The image must be no larger than 190x60, GIF, PNG, or JPG format, and should be served over HTTPS."
853
  msgstr ""
854
 
855
+ #: includes/settings/settings-ppec.php:216
856
  msgid "Header Image (750×90)"
857
  msgstr ""
858
 
859
+ #: includes/settings/settings-ppec.php:218
860
  msgid "If you want PayPal to co-brand the checkout page with your header, enter the URL of your header image here.<br/>The image must be no larger than 750x90, GIF, PNG, or JPG format, and should be served over HTTPS."
861
  msgstr ""
862
 
863
+ #: includes/settings/settings-ppec.php:224
864
  msgid "Page Style"
865
  msgstr ""
866
 
867
+ #: includes/settings/settings-ppec.php:226
868
  msgid "Optionally enter the name of the page style you wish to use. These are defined within your PayPal account."
869
  msgstr ""
870
 
871
+ #: includes/settings/settings-ppec.php:232
872
  msgid "Landing Page"
873
  msgstr ""
874
 
875
+ #: includes/settings/settings-ppec.php:235
876
  msgid "Type of PayPal page to display."
877
  msgstr ""
878
 
879
+ #: includes/settings/settings-ppec.php:239
880
  msgctxt "Type of PayPal page"
881
  msgid "Billing (Non-PayPal account)"
882
  msgstr ""
883
 
884
+ #: includes/settings/settings-ppec.php:240
885
  msgctxt "Type of PayPal page"
886
  msgid "Login (PayPal account login)"
887
  msgstr ""
888
 
889
+ #: includes/settings/settings-ppec.php:245
890
  msgid "Advanced Settings"
891
  msgstr ""
892
 
893
+ #: includes/settings/settings-ppec.php:250
894
  msgid "Debug Log"
895
  msgstr ""
896
 
897
+ #: includes/settings/settings-ppec.php:252
898
  msgid "Enable Logging"
899
  msgstr ""
900
 
901
+ #: includes/settings/settings-ppec.php:255
902
  msgid "Log PayPal events, such as IPN requests."
903
  msgstr ""
904
 
905
+ #: includes/settings/settings-ppec.php:258
906
  msgid "Invoice Prefix"
907
  msgstr ""
908
 
909
+ #: includes/settings/settings-ppec.php:260
910
  msgid "Please enter a prefix for your invoice numbers. If you use your PayPal account for multiple stores ensure this prefix is unique as PayPal will not allow orders with the same invoice number."
911
  msgstr ""
912
 
913
+ #: includes/settings/settings-ppec.php:265
914
  msgid "Billing Addresses"
915
  msgstr ""
916
 
917
+ #: includes/settings/settings-ppec.php:267
918
  msgid "Require Billing Address"
919
  msgstr ""
920
 
921
+ #: includes/settings/settings-ppec.php:269
922
  msgid "PayPal only returns a shipping address back to the website. To make sure billing address is returned as well, please enable this functionality on your PayPal account by calling %1$sPayPal Technical Support%2$s."
923
  msgstr ""
924
 
925
+ #: includes/settings/settings-ppec.php:272
926
+ #: includes/settings/settings-ppec.php:274
927
  msgid "Require Phone Number"
928
  msgstr ""
929
 
930
+ #: includes/settings/settings-ppec.php:276
931
  msgid "Require buyer to enter their telephone number during checkout if none is provided by PayPal"
932
  msgstr ""
933
 
934
+ #: includes/settings/settings-ppec.php:279
935
  msgid "Payment Action"
936
  msgstr ""
937
 
938
+ #: includes/settings/settings-ppec.php:282
939
  msgid "Choose whether you wish to capture funds immediately or authorize payment only."
940
  msgstr ""
941
 
942
+ #: includes/settings/settings-ppec.php:286
943
  msgid "Sale"
944
  msgstr ""
945
 
946
+ #: includes/settings/settings-ppec.php:287
947
  msgid "Authorize"
948
  msgstr ""
949
 
950
+ #: includes/settings/settings-ppec.php:291
951
  msgid "Instant Payments"
952
  msgstr ""
953
 
954
+ #: includes/settings/settings-ppec.php:293
955
  msgid "Require Instant Payment"
956
  msgstr ""
957
 
958
+ #: includes/settings/settings-ppec.php:296
959
  msgid "If you enable this setting, PayPal will be instructed not to allow the buyer to use funding sources that take additional time to complete (for example, eChecks). Instead, the buyer will be required to use an instant funding source, such as an instant transfer, a credit/debit card, or PayPal Credit."
960
  msgstr ""
961
 
962
+ #: includes/settings/settings-ppec.php:299
963
  msgid "Subtotal Mismatch Behavior"
964
  msgstr ""
965
 
966
+ #: includes/settings/settings-ppec.php:302
967
  msgid "Internally, WC calculates line item prices and taxes out to four decimal places; however, PayPal can only handle amounts out to two decimal places (or, depending on the currency, no decimal places at all). Occasionally, this can cause discrepancies between the way WooCommerce calculates prices versus the way PayPal calculates them. If a mismatch occurs, this option controls how the order is dealt with so payment can still be taken."
968
  msgstr ""
969
 
970
+ #: includes/settings/settings-ppec.php:306
971
  msgid "Add another line item"
972
  msgstr ""
973
 
974
+ #: includes/settings/settings-ppec.php:307
975
  msgid "Do not send line items to PayPal"
976
  msgstr ""
977
 
978
+ #: includes/settings/settings-ppec.php:312
979
  msgid "Button Settings"
980
  msgstr ""
981
 
982
+ #: includes/settings/settings-ppec.php:314
983
  msgid "Customize the appearance of PayPal Checkout on your site."
984
  msgstr ""
985
 
986
+ #: includes/settings/settings-ppec.php:317
987
  msgid "Smart Payment Buttons"
988
  msgstr ""
989
 
990
+ #: includes/settings/settings-ppec.php:320
991
  msgid "Use Smart Payment Buttons"
992
  msgstr ""
993
 
994
+ #: includes/settings/settings-ppec.php:321
995
  msgid "PayPal Checkout's Smart Payment Buttons provide a variety of button customization options, such as color, language, shape, and multiple button layout. <a href=\"%s\">Learn more about Smart Payment Buttons</a>."
996
  msgstr ""
997
 
998
+ #: includes/settings/settings-ppec.php:324
999
  msgid "Button Color"
1000
  msgstr ""
1001
 
1002
+ #: includes/settings/settings-ppec.php:329
1003
  msgid "Controls the background color of the primary button. Use \"Gold\" to leverage PayPal's recognition and preference, or change it to match your site design or aesthetic."
1004
  msgstr ""
1005
 
1006
+ #: includes/settings/settings-ppec.php:331
1007
  msgid "Gold (Recommended)"
1008
  msgstr ""
1009
 
1010
+ #: includes/settings/settings-ppec.php:332
1011
  msgid "Blue"
1012
  msgstr ""
1013
 
1014
+ #: includes/settings/settings-ppec.php:333
1015
  msgid "Silver"
1016
  msgstr ""
1017
 
1018
+ #: includes/settings/settings-ppec.php:334
1019
  msgid "Black"
1020
  msgstr ""
1021
 
1022
+ #: includes/settings/settings-ppec.php:338
1023
  msgid "Button Shape"
1024
  msgstr ""
1025
 
1026
+ #: includes/settings/settings-ppec.php:343
1027
  msgid "The pill-shaped button's unique and powerful shape signifies PayPal in people's minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges."
1028
  msgstr ""
1029
 
1030
+ #: includes/settings/settings-ppec.php:345
1031
  msgid "Pill"
1032
  msgstr ""
1033
 
1034
+ #: includes/settings/settings-ppec.php:346
1035
  msgid "Rectangle"
1036
  msgstr ""
1037
 
1038
+ #: includes/settings/settings-ppec.php:350
1039
+ #: includes/settings/settings-ppec.php:396
1040
+ msgid "Button Label"
1041
+ msgstr ""
1042
+
1043
+ #: includes/settings/settings-ppec.php:355
1044
+ msgid "This controls the label on the primary button."
1045
+ msgstr ""
1046
+
1047
+ #: includes/settings/settings-ppec.php:359
1048
+ #: includes/settings/settings-ppec.php:405
1049
+ msgid "PayPal Buy Now"
1050
+ msgstr ""
1051
+
1052
+ #: includes/settings/settings-ppec.php:360
1053
+ #: includes/settings/settings-ppec.php:406
1054
+ msgid "Pay with PayPal"
1055
+ msgstr ""
1056
+
1057
+ #: includes/settings/settings-ppec.php:370
1058
  msgid "Button Layout"
1059
  msgstr ""
1060
 
1061
+ #: includes/settings/settings-ppec.php:375
1062
  msgid "If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose \"vertical\" for a dynamic list of alternative and local payment options, or \"horizontal\" when space is limited."
1063
  msgstr ""
1064
 
1065
+ #: includes/settings/settings-ppec.php:377
1066
  msgid "Vertical"
1067
  msgstr ""
1068
 
1069
+ #: includes/settings/settings-ppec.php:378
1070
  msgid "Horizontal"
1071
  msgstr ""
1072
 
1073
+ #: includes/settings/settings-ppec.php:382
1074
  msgid "Button Size"
1075
  msgstr ""
1076
 
1077
+ #: includes/settings/settings-ppec.php:387
1078
  msgid "PayPal offers different sizes of the \"PayPal Checkout\" buttons, allowing you to select a size that best fits your site's theme. This setting will allow you to choose which size button(s) appear on your cart page. (The \"Responsive\" option adjusts to container size, and is available and recommended for Smart Payment Buttons.)"
1079
  msgstr ""
1080
 
1081
+ #: includes/settings/settings-ppec.php:389
1082
  msgid "Responsive"
1083
  msgstr ""
1084
 
1085
+ #: includes/settings/settings-ppec.php:390
1086
  msgid "Small"
1087
  msgstr ""
1088
 
1089
+ #: includes/settings/settings-ppec.php:391
1090
  msgid "Medium"
1091
  msgstr ""
1092
 
1093
+ #: includes/settings/settings-ppec.php:392
1094
  msgid "Large"
1095
  msgstr ""
1096
 
1097
+ #: includes/settings/settings-ppec.php:401
1098
+ msgid "PayPal offers different labels on the \"PayPal Checkout\" buttons, allowing you to select a suitable label.)"
1099
+ msgstr ""
1100
+
1101
+ #: includes/settings/settings-ppec.php:415
1102
  msgid "Hides the specified funding methods."
1103
  msgstr ""
1104
 
1105
+ #: includes/settings/settings-ppec.php:418
1106
  msgid "ELV"
1107
  msgstr ""
1108
 
1109
+ #: includes/settings/settings-ppec.php:419
1110
+ msgid "Credit or debit cards"
1111
+ msgstr ""
1112
+
1113
+ #: includes/settings/settings-ppec.php:420
1114
+ msgid "Venmo"
1115
+ msgstr ""
1116
+
1117
+ #: includes/settings/settings-ppec.php:421
1118
+ msgid "SEPA-Lastschrift"
1119
+ msgstr ""
1120
+
1121
+ #: includes/settings/settings-ppec.php:422
1122
+ msgid "Bancontact"
1123
  msgstr ""
1124
 
1125
+ #: includes/settings/settings-ppec.php:423
1126
+ msgid "eps"
1127
+ msgstr ""
1128
+
1129
+ #: includes/settings/settings-ppec.php:424
1130
+ msgid "giropay"
1131
+ msgstr ""
1132
+
1133
+ #: includes/settings/settings-ppec.php:425
1134
+ msgid "iDEAL"
1135
+ msgstr ""
1136
+
1137
+ #: includes/settings/settings-ppec.php:426
1138
+ msgid "MyBank"
1139
+ msgstr ""
1140
+
1141
+ #: includes/settings/settings-ppec.php:427
1142
+ msgid "Przelewy24"
1143
+ msgstr ""
1144
+
1145
+ #: includes/settings/settings-ppec.php:428
1146
+ msgid "Sofort"
1147
+ msgstr ""
1148
+
1149
+ #: includes/settings/settings-ppec.php:451
1150
  msgid "Checkout on cart page"
1151
  msgstr ""
1152
 
1153
+ #: includes/settings/settings-ppec.php:454
1154
  msgid "Enable PayPal Checkout on the cart page"
1155
  msgstr ""
1156
 
1157
+ #: includes/settings/settings-ppec.php:455
1158
  msgid "This shows or hides the PayPal Checkout button on the cart page."
1159
  msgstr ""
1160
 
1161
+ #: includes/settings/settings-ppec.php:464
1162
  msgid "Mini-cart Button Settings"
1163
  msgstr ""
1164
 
1165
+ #: includes/settings/settings-ppec.php:469
1166
+ #: includes/settings/settings-ppec.php:500
1167
+ #: includes/settings/settings-ppec.php:532
1168
  msgid "Configure Settings"
1169
  msgstr ""
1170
 
1171
+ #: includes/settings/settings-ppec.php:470
1172
  msgid "Configure settings specific to mini-cart"
1173
  msgstr ""
1174
 
1175
+ #: includes/settings/settings-ppec.php:475
1176
+ #: includes/settings/settings-ppec.php:506
1177
+ #: includes/settings/settings-ppec.php:538
1178
  msgid "Optionally override global button settings above and configure buttons for this context."
1179
  msgstr ""
1180
 
1181
+ #: includes/settings/settings-ppec.php:486
1182
  msgid "Single Product Button Settings"
1183
  msgstr ""
1184
 
1185
+ #: includes/settings/settings-ppec.php:491
1186
+ #: includes/settings/settings-ppec.php:494
1187
  msgid "Checkout on Single Product"
1188
  msgstr ""
1189
 
1190
+ #: includes/settings/settings-ppec.php:497
1191
  msgid "Enable PayPal Checkout on Single Product view."
1192
  msgstr ""
1193
 
1194
+ #: includes/settings/settings-ppec.php:501
1195
  msgid "Configure settings specific to Single Product view"
1196
  msgstr ""
1197
 
1198
+ #: includes/settings/settings-ppec.php:518
1199
  msgid "Regular Checkout Button Settings"
1200
  msgstr ""
1201
 
1202
+ #: includes/settings/settings-ppec.php:523
1203
  msgid "PayPal Mark"
1204
  msgstr ""
1205
 
1206
+ #: includes/settings/settings-ppec.php:526
1207
  msgid "Enable the PayPal Mark on regular checkout"
1208
  msgstr ""
1209
 
1210
+ #: includes/settings/settings-ppec.php:527
1211
  msgid "This enables the PayPal mark, which can be shown on regular WooCommerce checkout to use PayPal Checkout like a regular WooCommerce gateway."
1212
  msgstr ""
1213
 
1214
+ #: includes/settings/settings-ppec.php:533
1215
  msgid "Configure settings specific to regular checkout"
1216
  msgstr ""
readme.txt CHANGED
@@ -2,8 +2,9 @@
2
  Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, fullysupportedphil, dsmithweb, corsonr, bor0, zandyring, pauldechov, robobot3000
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
4
  Requires at least: 4.4
5
- Tested up to: 5.3
6
- Stable tag: 1.6.21
 
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -101,6 +102,23 @@ Please use this to inform us about bugs, or make contributions via PRs.
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  = 1.6.21 - 2020-04-14 =
105
  * Fix - Ensure Puerto Rico and supported Locales are eligible for PayPal Credit. PR#693
106
  * Fix - Support purchasing subscriptions with $0 initial payment - free trials, synced etc. PR#698
2
  Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, fullysupportedphil, dsmithweb, corsonr, bor0, zandyring, pauldechov, robobot3000
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
4
  Requires at least: 4.4
5
+ Tested up to: 5.4
6
+ Requires PHP: 5.5
7
+ Stable tag: 2.0.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
102
 
103
  == Changelog ==
104
 
105
+ = 2.0.0 - 2020-05-25 =
106
+ * New - Upgrade to the latest PayPal Checkout Javascript SDK. PR#668
107
+ * Add - New setting found under Button Styles for choosing a Smart Payment Button label. PR#666
108
+ * Add - Support for more locales. PR#658
109
+ * Fix - Display Smart Payment Buttons on Product pages built from a shortcode. PR#665
110
+ * Fix - Send the product SKU to PayPal so it's displayed in the order/transaction details and reports on PayPal. PR#664
111
+ * Fix - Show an error when saving incomplete/missing API credentials. PR#712
112
+ * Fix - Remove PHP warnings in later versions of PHP when a PayPal Session doesn't exist. PR#727
113
+ * Fix - Error when processing refunds (Already Refunded. No Amount to Refund). PR#710
114
+ * Fix - Required state field errors on the "Confirm your PayPal Order" page when returning from PayPal. PR#725
115
+ * Fix - Display WC Add To Cart validation errors on the product page when clicking the PayPal Smart Payment Buttons. PR#707
116
+ * Update - Smart Payment Buttons are enabled by default and settings to toggle these on/off have been removed and replaced with a filter. PR#660
117
+ * Update - Deprecate unused/incomplete function `WC_Gateway_PPEC_Client::update_billing_agreement()`. PR#602
118
+ * Update - Move inline javascript found in `settings-ppec.php` to `ppec-settings.js`. PR#676
119
+ * Update - Move Support and Documentation links from the plugin actions to plugin meta section on the Plugin activation/deactivation page. PR#735
120
+ * Update - WooCommerce 4.1 and WordPress 5.4 compatibility. PR#732
121
+
122
  = 1.6.21 - 2020-04-14 =
123
  * Fix - Ensure Puerto Rico and supported Locales are eligible for PayPal Credit. PR#693
124
  * Fix - Support purchasing subscriptions with $0 initial payment - free trials, synced etc. PR#698
woocommerce-gateway-paypal-express-checkout.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce PayPal Checkout Gateway
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: Accept all major credit and debit cards, plus Venmo and PayPal Credit in the US, presenting options in a customizable stack of payment buttons. Fast, seamless, and flexible.
6
- * Version: 1.6.21
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2019 WooCommerce / PayPal.
@@ -11,7 +11,7 @@
11
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  * Text Domain: woocommerce-gateway-paypal-express-checkout
13
  * Domain Path: /languages
14
- * WC tested up to: 4.0
15
  * WC requires at least: 2.6
16
  */
17
  /**
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
27
  exit; // Exit if accessed directly
28
  }
29
 
30
- define( 'WC_GATEWAY_PPEC_VERSION', '1.6.21' );
31
 
32
  /**
33
  * Return instance of WC_Gateway_PPEC_Plugin.
3
  * Plugin Name: WooCommerce PayPal Checkout Gateway
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: Accept all major credit and debit cards, plus Venmo and PayPal Credit in the US, presenting options in a customizable stack of payment buttons. Fast, seamless, and flexible.
6
+ * Version: 2.0.0
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2019 WooCommerce / PayPal.
11
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  * Text Domain: woocommerce-gateway-paypal-express-checkout
13
  * Domain Path: /languages
14
+ * WC tested up to: 4.1
15
  * WC requires at least: 2.6
16
  */
17
  /**
27
  exit; // Exit if accessed directly
28
  }
29
 
30
+ define( 'WC_GATEWAY_PPEC_VERSION', '2.0.0' );
31
 
32
  /**
33
  * Return instance of WC_Gateway_PPEC_Plugin.