Version Description
- Fixed - Payment request button disappearing on variable product page
- Updated - Only validate visible fields on checkout page
- Update - WC tested up to 4.6.0
- Added - SEPA WooCommerce Subscriptions support
- Added - Autofocus on custom credit card forms
Download this release
Release Info
Developer | mr.clayton |
Plugin | Payment Plugins for Stripe WooCommerce |
Version | 3.2.4 |
Comparing to | |
See all releases |
Code changes from version 3.2.3 to 3.2.4
- assets/css/stripe.css +6 -0
- assets/css/stripe.min.css +1 -0
- assets/js/frontend/applepay-cart.js +6 -6
- assets/js/frontend/applepay-product.js +4 -0
- assets/js/frontend/credit-card.js +40 -8
- assets/js/frontend/googlepay-product.js +4 -1
- assets/js/frontend/local-payment.js +9 -0
- assets/js/frontend/payment-request.js +3 -0
- assets/js/frontend/wc-stripe.js +8 -18
- assets/js/frontend/wc-stripe.min.js +1 -5
- i18n/languages/woo-stripe-payment.pot +21 -11
- includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php +15 -0
- includes/abstract/abstract-wc-payment-gateway-stripe.php +1 -1
- includes/abstract/abstract-wc-payment-token-stripe.php +8 -0
- includes/class-stripe.php +2 -1
- includes/class-wc-stripe-field-manager.php +3 -0
- includes/class-wc-stripe-gateway-conversions.php +7 -0
- includes/class-wc-stripe-payment-charge-local.php +1 -9
- includes/gateways/class-wc-payment-gateway-stripe-klarna.php +1 -1
- includes/gateways/class-wc-payment-gateway-stripe-sepa.php +40 -11
- includes/tokens/class-wc-payment-token-stripe-local-payment.php +10 -7
- includes/tokens/class-wc-payment-token-stripe-sepa.php +70 -0
- readme.txt +7 -1
- stripe-payments.php +2 -2
assets/css/stripe.css
CHANGED
@@ -194,6 +194,12 @@ label.wc-stripe-label-payment-type:after {
|
|
194 |
background-image: url(../img/cards/jcb.svg);
|
195 |
}
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
.select2-results__options li.wc-stripe-select2-container.wc-stripe-ach:before {
|
198 |
display: none;
|
199 |
}
|
194 |
background-image: url(../img/cards/jcb.svg);
|
195 |
}
|
196 |
|
197 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.stripe_sepa:before,
|
198 |
+
.select2-results__options li.wc-stripe-select2-container.stripe_sepa:before,
|
199 |
+
.select2-results__options li.wc-stripe-select2-container.stripe_sepa:before {
|
200 |
+
background-image: url(../img/sepa.svg);
|
201 |
+
}
|
202 |
+
|
203 |
.select2-results__options li.wc-stripe-select2-container.wc-stripe-ach:before {
|
204 |
display: none;
|
205 |
}
|
assets/css/stripe.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.wc-stripe-card-icons-container,.wc-stripe-paymentRequest-icons-container{float:right;display:inline-block}ul.payment_methods li[class*=payment_method]{margin:0;padding:0}li[class*=payment_method] input[type=radio]{margin:0 10px 0 5px}li[class*=payment_method] input[type=radio]+label:not(.wc-stripe-label-payment-type){margin:0}.woocommerce-checkout #payment ul.payment_methods li[class*=payment_method_stripe_]:nth-child(n+2),ul.payment_methods li[class*=payment_method_stripe_]:nth-child(n+2){margin:0}li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon,li.payment_method_stripe_payment_request .wc-stripe-paymentRequest-icons-container img{max-width:44px;max-height:27px;width:44px;height:27px;float:none;display:inline}li.payment_method_stripe_payment_request .wc-stripe-paymentRequest-icons-container img{width:25px;height:25px;max-width:25px;max-height:25px}ul.payment_methods label[for*=payment_method_stripe]:after{clear:right;content:"";display:block}li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon:nth-child(2n+2){margin:0 2px}li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon.open.visa{padding-top:2px}ul.payment_methods li[class*=payment_method_stripe_] label>img:first-of-type{float:right!important}.wc-stripe_cc-new-method-container{margin-bottom:1em}.wc-stripe_cc-container .StripeElement{box-sizing:border-box;height:40px;padding:10px 12px;border-radius:4px;background-color:#fff;-webkit-transition:box-shadow 150ms ease;transition:box-shadow 150ms ease}input.wc-stripe-klarna-category,input.wc-stripe-payment-type{display:none!important}body .wfacp_main_form.woocommerce .wc-stripe-save-source label.checkbox{padding:0!important}input[type=radio]+label.wc-stripe-label-payment-type,label.wc-stripe-label-klarna-category,label.wc-stripe-label-payment-type{margin-bottom:1em;display:block;padding:0!important;color:#000}.theme-flatsome div.wc-stripe-saved-methods-container{margin:0 0 1em 0}label.wc-stripe-label-klarna-category:before,label.wc-stripe-label-payment-type:before{content:"";display:inline-block;width:11px;height:11px;border:2px solid #fff;box-shadow:0 0 0 2px #000;background:#fff;margin-left:4px;margin-right:.5em;border-radius:100%;-webkit-transform:translateY(2px);-ms-transform:translateY(2px);transform:translateY(2px)}input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:before,input.wc-stripe-payment-type:checked+label.wc-stripe-label-payment-type:before{background:#000}label.wc-stripe-label-payment-type:after{content:none!important;display:none!important}.select2-results__options li.wc-stripe-select2-container,.wc-stripe-saved-methods-container .select2-container .select2-selection--single .wc-stripe-select2-container{display:flex;align-items:center;height:42px;line-height:42px!important}.select2-container .select2-selection--single .wc-stripe-select2-container:before,.select2-results__options li.wc-stripe-select2-container:before{content:'';background-repeat:no-repeat;background-size:40px 24px;width:40px;height:42px;display:inline-block;margin-right:8px;background-position:center}.select2-container .select2-selection--single .wc-stripe-select2-container.visa:before,.select2-results__options li.wc-stripe-select2-container.visa:before{background-image:url(../img/cards/visa.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.mastercard:before,.select2-results__options li.wc-stripe-select2-container.mastercard:before{background-image:url(../img/cards/mastercard.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.americanexpress:before,.select2-results__options li.wc-stripe-select2-container.americanexpress:before{background-image:url(../img/cards/amex.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.amex:before,.select2-results__options li.wc-stripe-select2-container.amex:before{background-image:url(../img/cards/amex.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.discover:before,.select2-results__options li.wc-stripe-select2-container.discover:before{background-image:url(../img/cards/discover.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.mastercard:before,.select2-results__options li.wc-stripe-select2-container.mastercard:before{background-image:url(../img/cards/mastercard.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.dinersclub:before,.select2-results__options li.wc-stripe-select2-container.dinersclub:before{background-image:url(../img/cards/diners.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.diners:before,.select2-results__options li.wc-stripe-select2-container.diners:before{background-image:url(../img/cards/diners.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.jcb:before,.select2-results__options li.wc-stripe-select2-container.jcb:before{background-image:url(../img/cards/jcb.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.stripe_sepa:before,.select2-results__options li.wc-stripe-select2-container.stripe_sepa:before{background-image:url(../img/sepa.svg)}.select2-results__options li.wc-stripe-select2-container.wc-stripe-ach:before{display:none}#wc-stripe-card-element{margin-bottom:1em}.wc-stripe_cc-container .wc-stripe-save-source .save-source-label{display:block;margin-top:10px}.wc-stripe_cc-container .wc-stripe-save-source input[type=checkbox]{opacity:0;position:absolute;width:20px;height:20px}.wc-stripe_cc-container .wc-stripe-save-source label.checkbox{position:relative}.wc-stripe_cc-container .save-source-checkbox{height:20px;width:20px;position:relative;background-color:#fff;display:block;border-radius:3px;border:1px solid #bababa}.wc-stripe_cc-container .save-source-checkbox:after{content:"";position:absolute;top:0;left:0}.wc-stripe_cc-container .wc-stripe-save-source input[type=checkbox]:checked+.save-source-checkbox:after{left:6px;top:2px;width:7px;height:12px;border:solid #2196f3;border-width:0 3px 3px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}li.payment_method_stripe_applepay,li.payment_method_stripe_googlepay,li.payment_method_stripe_payment_request{display:none}#payment #place_order.wc-stripe-hide,#place_order.wc-stripe-hide,.woocommerce-checkout-review-order #payment #place_order.wc-stripe-hide{position:absolute!important;z-index:-1000!important;height:0!important;padding:0!important;opacity:0!important}.wc-stripe-product-checkout-container{display:none;width:100%}.wc-stripe-product-checkout-container.bottom{margin-top:1em}.wc-stripe-product-checkout-container.top{margin-bottom:1em}.wc-stripe-product-checkout-container.active{display:block}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods,.wc-stripe-product-checkout-container ul.wc_stripe_product_payment_methods{list-style:none;margin:0;padding:0}.wc-stripe-cart-checkout-container{margin:0;padding:0;clear:both}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods{margin-bottom:1.5em}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods li[class*=payment_method_stripe_],.wc-stripe-product-checkout-container ul.wc_stripe_product_payment_methods li[class*=payment_method_stripe_]{margin:0 0 1em 0}.wc_stripe_cart_payment_methods .gpay-button,.wc_stripe_product_payment_methods .gpay-button{width:100%!important;margin:0}.wc_stripe_product_payment_methods .disabled{opacity:.45}.stripe_cart_gateway_active .checkout-button,.woocommerce-cart .stripe_cart_gateway_active .wc-proceed-to-checkout .checkout-button{margin-bottom:0}.wc-stripe-cart-or{margin:1em 0;text-align:center}li.wc-stripe-payment-method.or{display:none}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or{display:block;margin:15px 0}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or p{margin:0}li[class*=payment_method_stripe_].active~li.wc-stripe-payment-method.or{display:block;margin:0}li.payment_method_stripe_applepay label:first-of-type img{width:49px;max-height:32px}li.payment_method_stripe_googlepay label:first-of-type img{width:48px;max-height:35px}li.payment_method_stripe_googlepay label:first-of-type img[src*=googlepay_standard]{width:60px;max-height:35px}li.payment_method_stripe_ach label:first-of-type img{width:32px;height:32px;min-width:32px;min-height:32px}.gpay-button:hover{background-origin:content-box;background-position:center center;background-repeat:no-repeat;background-size:contain}.gpay-button:active{background-origin:content-box;background-position:center center;background-repeat:no-repeat;background-size:contain}.gpay-button:focus{background-origin:content-box;background-position:center center;background-repeat:no-repeat;background-size:contain}@supports (-webkit-appearance:-apple-pay-button){.apple-pay-button{display:block;-webkit-appearance:-apple-pay-button;width:100%;max-width:100%;min-width:200px;height:40px;max-height:40px}.apple-pay-button-black{-apple-pay-button-style:#000}.apple-pay-button-white{-apple-pay-button-style:#fff}.apple-pay-button-white-with-line{-apple-pay-button-style:white-outline}.applepay-top-container .apple-pay-button{max-width:240px}.woocommerce-checkout-payment .apple-pay-button{max-width:240px}body.single-product div.product form.cart .wc_stripe_product_payment_methods .apple-pay-button{max-width:100%}}.wc-stripe-banner-checkout{display:none;padding:20px 15px 0 15px;border:1px solid #d1d1d1;border-width:0 0 1px;position:relative;margin:1em 0}.wc-stripe-banner-checkout.active{display:block}.wc-stripe-banner-checkout span.banner-title{position:absolute;display:flex;align-items:center;top:-13px;right:0;left:0;background:0 0;white-space:nowrap;font-size:16px}.wc-stripe-banner-checkout span.banner-title:after,.wc-stripe-banner-checkout span.banner-title:before{content:' ';height:1px;background:#d1d1d1;display:block;width:50%}.wc-stripe-banner-checkout span.banner-title:before{margin-right:8px}.wc-stripe-banner-checkout span.banner-title:after{margin-left:8px}.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways{list-style:none;margin:0;padding:0}.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway{margin:0 0 20px 0;display:none}.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway .gpay-button{margin:0}.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways .gpay-button{width:100%}.wc_stripe_cart_payment_methods .payment_method_stripe_payment_request .StripeElement,.wc_stripe_product_payment_methods .payment_method_stripe_payment_request .StripeElement{padding:0;width:100%}.woocommerce-checkout #wc-stripe-payment-request-container.StripeElement{width:240px;padding:0}.wc-stripe-checkout-banner-gateway #wc-stripe-payment-request-banner.StripeElement{width:100%}ul.payment_methods li.payment_method_stripe_p24 img{max-width:90px;width:90px;max-height:45px}ul.payment_methods li.payment_method_stripe_ideal img{max-width:38px;width:38px;max-height:35px}ul.payment_methods li.payment_method_stripe_fpx img{max-width:75px;width:75px;max-height:25px}ul.payment_methods li.payment_method_stripe_klarna img{max-width:72px;width:72px;max-height:20px}ul.payment_methods li.payment_method_stripe_giropay img{max-width:65px;width:65px;max-height:28px}ul.payment_methods li.payment_method_stripe_eps img{max-width:70px;width:70px;max-height:46px}ul.payment_methods li.payment_method_stripe_multibanco img{max-width:48px;width:48px;max-height:48px}ul.payment_methods li.payment_method_stripe_sepa img{max-width:67px;width:67px;max-height:18px}ul.payment_methods li.payment_method_stripe_sofort img{max-width:70px;width:70px;max-height:21px}label[for=payment_method_stripe_bancontact] img,ul.payment_methods li.payment_method_stripe_bancontact img{width:60px;height:42px;max-width:60px;max-height:42px}ul.payment_methods li.payment_method_stripe_wechat label img{max-width:82px;width:82px;max-height:23px}ul.payment_methods li.payment_method_stripe_alipay img{max-width:72px;width:72px;height:36px;max-height:36px}ul.payment_methods li.payment_method_stripe_grabpay img{max-width:95px;width:95px;max-height:28px}#wc-stripe-card-element{width:100%}li.banner_payment_method_stripe_payment_request .StripeElement{padding:0}.single-product .blockMsg{border:none!important;background-color:transparent!important}#wc-stripe-card{position:absolute!important;top:50%;right:8px;transform:translatey(-50%);width:23px;height:15px;padding:0;border:none}#wc-stripe-card.active{width:32px;height:20px}input[id=stripe-postal-code]:focus{outline:0;background:0 0;border:none;box-shadow:none}div.postalCode:focus{outline:0;border:none}li[class*=payment_method_stripe] .select2-container .select2-selection--single{height:42px;padding:0 5px}li[class*=payment_method_stripe] .select2-container--default .select2-selection--single .select2-selection__arrow{height:42px;top:1px;right:1px}.blockUI.blockMsg{font-size:20px;white-space:nowrap}#wc-stripe-payment-request-container.disabled{opactity:.45}.wc-stripe-paymentRequest-icons-container img{float:none}.select2-container .select2-selection--single .wc-stripe-select2-container.wc-stripe-ach:before{display:none}ul.wc_stripe_cart_payment_methods li.wc-stripe-payment-method button,ul.wc_stripe_checkout_banner_gateways li button,ul.wc_stripe_product_payment_methods li[class*=payment_method_stripe_] button{margin:0}ul.payment_methods li[class*=payment_method]{margin:0;padding:10px 0}ul.payment_methods li[class*=payment_method] input[name=payment_method]{margin:0 10px 0 5px;float:none}ul.payment_methods li[class*=payment_method]>input[name=payment_method]+label{padding-top:0;padding-right:0;padding-bottom:0}ul.payment_methods{list-style:none}ul.payment_methods li[class*=payment_method_stripe_] .wc-stripe_cc-new-method-container label:before{display:none}.wc-stripe_cc-container .wc-stripe-save-source label.checkbox{padding:0!important;margin:0}.wc-stripe_cc-container .wc-stripe-save-source .save-source-label{padding:0;margin-bottom:5px}div[id*=wc_stripe_local_payment_stripe_].StripeElement{border:1px solid #eee;border-radius:4px}.qrcode-message{margin:10px 0 0 0}#wc_stripe_local_payment_stripe_becs,#wc_stripe_local_payment_stripe_sepa{padding:10px 12px;box-shadow:0 1px 3px 0 #e6ebf1}.wc-stripe-local-desc.stripe_becs,.wc-stripe-local-desc.stripe_sepa{margin:10px 0}.wc-stripe-clear{clear:both;height:0;visibility:hidden}.wc-stripe-gateway-desc p{margin:0}#wc_stripe_local_payment_stripe_klarna,div.payment_method_stripe_cc,div.payment_method_stripe_fpx,div.payment_method_stripe_ideal,div.payment_method_stripe_sepa,li[class*=payment_method_stripe_] div.wc-stripe_applepay-container.has_tokens,li[class*=payment_method_stripe_] div.wc-stripe_googlepay-container.has_tokens,li[class*=payment_method_stripe_] div.wc-stripe_payment_request-container.has_tokens{margin-top:10px}.wc-stripe-gateway-desc{margin-top:10px}#wc-stripe-card-element.StripeElement--webkit-autofill{background-color:transparent!important}#wc_stripe_local_payment_stripe_klarna .stripe-klarna-categories{list-style:none;margin:0;padding:10px}li.payment_method_stripe_alipay,li.payment_method_stripe_bancontact,li.payment_method_stripe_becs,li.payment_method_stripe_eps,li.payment_method_stripe_fpx,li.payment_method_stripe_giropay,li.payment_method_stripe_ideal,li.payment_method_stripe_klarna,li.payment_method_stripe_multibanco,li.payment_method_stripe_p24,li.payment_method_stripe_sepa,li.payment_method_stripe_sofort,li.payment_method_stripe_wechat{display:none}.widget_shopping_cart_content .wc-stripe-mini-cart-payment-methods{list-style:none;margin:0;padding:0}.widget_shopping_cart_content .wc-stripe-mini-cart-payment-methods li{margin:0}.widget_shopping_cart_content a.wc-stripe-applepay-mini-cart,.widget_shopping_cart_content a.wc-stripe-gpay-mini-cart,.widget_shopping_cart_content a.wc-stripe-payment-request-mini-cart{background:0 0;padding:0;border:none}a.wc-stripe-applepay-mini-cart .apple-pay-button,a.wc-stripe-gpay-mini-cart .gpay-button{width:100%;margin:0}.wc-stripe-payment-request-mini-cart.StripeElement{padding:0;background:0 0;border:none;width:100%}.wc-stripe-payment-request-mini-cart.StripeElement .__PrivateStripeElement{width:100%}.widget_shopping_cart_content .wc-stripe-overlay{display:none!important;position:absolute;background:rgba(255,255,255,.75);height:100%;width:100%;z-index:-1}.widget_shopping_cart_content .wc-stripe-overlay.active{display:block!important;z-index:9999}
|
assets/js/frontend/applepay-cart.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
(function($, wc_stripe) {
|
2 |
|
3 |
/**
|
4 |
* @constructor
|
@@ -13,10 +13,10 @@
|
|
13 |
*/
|
14 |
ApplePay.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.CartGateway.prototype, wc_stripe.ApplePay.prototype);
|
15 |
|
16 |
-
ApplePay.prototype.initialize = function() {
|
17 |
wc_stripe.CartGateway.call(this);
|
18 |
wc_stripe.ApplePay.prototype.initialize.call(this);
|
19 |
-
this.canMakePayment().then(function() {
|
20 |
$(this.container).addClass('active').parent().addClass('active');
|
21 |
this.add_cart_totals_class();
|
22 |
}.bind(this));
|
@@ -25,14 +25,14 @@
|
|
25 |
/**
|
26 |
* @return {[type]}
|
27 |
*/
|
28 |
-
ApplePay.prototype.append_button = function() {
|
29 |
$('#wc-stripe-applepay-container').append(this.$button);
|
30 |
}
|
31 |
|
32 |
/**
|
33 |
* @return {[type]}
|
34 |
*/
|
35 |
-
ApplePay.prototype.updated_html = function() {
|
36 |
if (!$(this.container).length) {
|
37 |
this.can_pay = false;
|
38 |
}
|
@@ -48,7 +48,7 @@
|
|
48 |
* @param {[type]} e [description]
|
49 |
* @return {[type]} [description]
|
50 |
*/
|
51 |
-
ApplePay.prototype.cart_emptied = function(e) {
|
52 |
this.can_pay = false;
|
53 |
}
|
54 |
|
1 |
+
(function ($, wc_stripe) {
|
2 |
|
3 |
/**
|
4 |
* @constructor
|
13 |
*/
|
14 |
ApplePay.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.CartGateway.prototype, wc_stripe.ApplePay.prototype);
|
15 |
|
16 |
+
ApplePay.prototype.initialize = function () {
|
17 |
wc_stripe.CartGateway.call(this);
|
18 |
wc_stripe.ApplePay.prototype.initialize.call(this);
|
19 |
+
this.canMakePayment().then(function () {
|
20 |
$(this.container).addClass('active').parent().addClass('active');
|
21 |
this.add_cart_totals_class();
|
22 |
}.bind(this));
|
25 |
/**
|
26 |
* @return {[type]}
|
27 |
*/
|
28 |
+
ApplePay.prototype.append_button = function () {
|
29 |
$('#wc-stripe-applepay-container').append(this.$button);
|
30 |
}
|
31 |
|
32 |
/**
|
33 |
* @return {[type]}
|
34 |
*/
|
35 |
+
ApplePay.prototype.updated_html = function () {
|
36 |
if (!$(this.container).length) {
|
37 |
this.can_pay = false;
|
38 |
}
|
48 |
* @param {[type]} e [description]
|
49 |
* @return {[type]} [description]
|
50 |
*/
|
51 |
+
ApplePay.prototype.cart_emptied = function (e) {
|
52 |
this.can_pay = false;
|
53 |
}
|
54 |
|
assets/js/frontend/applepay-product.js
CHANGED
@@ -12,6 +12,10 @@
|
|
12 |
ApplePay.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.ProductGateway.prototype, wc_stripe.ApplePay.prototype);
|
13 |
|
14 |
ApplePay.prototype.initialize = function () {
|
|
|
|
|
|
|
|
|
15 |
this.container = '.wc_stripe_product_payment_methods ' + this.container;
|
16 |
wc_stripe.ProductGateway.call(this);
|
17 |
wc_stripe.ApplePay.prototype.initialize.call(this);
|
12 |
ApplePay.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.ProductGateway.prototype, wc_stripe.ApplePay.prototype);
|
13 |
|
14 |
ApplePay.prototype.initialize = function () {
|
15 |
+
if (!$('.wc_stripe_product_payment_methods ' + this.container).length) {
|
16 |
+
setTimeout(this.initialize.bind(this), 1000);
|
17 |
+
return;
|
18 |
+
}
|
19 |
this.container = '.wc_stripe_product_payment_methods ' + this.container;
|
20 |
wc_stripe.ProductGateway.call(this);
|
21 |
wc_stripe.ApplePay.prototype.initialize.call(this);
|
assets/js/frontend/credit-card.js
CHANGED
@@ -21,6 +21,12 @@
|
|
21 |
|
22 |
CC.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.CheckoutGateway.prototype);
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
/**
|
25 |
*
|
26 |
*/
|
@@ -59,6 +65,9 @@
|
|
59 |
style: this.params.style,
|
60 |
classes: elementClasses
|
61 |
});
|
|
|
|
|
|
|
62 |
if (this.fields.required('billing_postcode') && '' !== this.fields.get('billing_postcode')) {
|
63 |
if ($('#stripe-postal-code').length > 0) {
|
64 |
$('#stripe-postal-code').val(this.fields.get('billing_postcode'));
|
@@ -124,15 +133,15 @@
|
|
124 |
CC.prototype.create_card_element = function () {
|
125 |
if (this.is_custom_form()) {
|
126 |
if ($('#wc-stripe-cc-custom-form').length && $('#wc-stripe-cc-custom-form').find('iframe').length == 0) {
|
127 |
-
if ($(
|
128 |
-
this.cardNumber.mount(
|
129 |
-
$(
|
130 |
}
|
131 |
-
if ($(
|
132 |
-
this.cardExpiry.mount(
|
133 |
}
|
134 |
-
if ($(
|
135 |
-
this.cardCvc.mount(
|
136 |
}
|
137 |
if ($('#stripe-postal-code').length) {
|
138 |
$('#stripe-postal-code, .postalCode').on('focus', function (e) {
|
@@ -368,7 +377,7 @@
|
|
368 |
}
|
369 |
|
370 |
CC.prototype.card_number_change = function (data) {
|
371 |
-
if (data.brand === "
|
372 |
$('#wc-stripe-card').removeClass('active');
|
373 |
} else {
|
374 |
$('#wc-stripe-card').addClass('active');
|
@@ -376,6 +385,29 @@
|
|
376 |
$('#wc-stripe-card').attr('src', this.params.cards[data.brand]);
|
377 |
}
|
378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
CC.prototype.clear_card_elements = function () {
|
380 |
var elements = ['cardNumber', 'cardExpiry', 'cardCvc'];
|
381 |
for (var i = 0; i < elements.length; i++) {
|
21 |
|
22 |
CC.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.CheckoutGateway.prototype);
|
23 |
|
24 |
+
CC.prototype.mappings = {
|
25 |
+
cardNumber: '#stripe-card-number',
|
26 |
+
cardExpiry: '#stripe-exp',
|
27 |
+
cardCvc: '#stripe-cvv'
|
28 |
+
}
|
29 |
+
|
30 |
/**
|
31 |
*
|
32 |
*/
|
65 |
style: this.params.style,
|
66 |
classes: elementClasses
|
67 |
});
|
68 |
+
this.cardNumber.on('change', this.on_input_change.bind(this));
|
69 |
+
this.cardExpiry.on('change', this.on_input_change.bind(this));
|
70 |
+
this.cardCvc.on('change', this.on_input_change.bind(this));
|
71 |
if (this.fields.required('billing_postcode') && '' !== this.fields.get('billing_postcode')) {
|
72 |
if ($('#stripe-postal-code').length > 0) {
|
73 |
$('#stripe-postal-code').val(this.fields.get('billing_postcode'));
|
133 |
CC.prototype.create_card_element = function () {
|
134 |
if (this.is_custom_form()) {
|
135 |
if ($('#wc-stripe-cc-custom-form').length && $('#wc-stripe-cc-custom-form').find('iframe').length == 0) {
|
136 |
+
if ($(this.mappings.cardNumber).length) {
|
137 |
+
this.cardNumber.mount(this.mappings.cardNumber);
|
138 |
+
$(this.mappings.cardNumber).prepend(this.params.html.card_brand);
|
139 |
}
|
140 |
+
if ($(this.mappings.cardExpiry).length) {
|
141 |
+
this.cardExpiry.mount(this.mappings.cardExpiry);
|
142 |
}
|
143 |
+
if ($(this.mappings.cardCvc).length) {
|
144 |
+
this.cardCvc.mount(this.mappings.cardCvc);
|
145 |
}
|
146 |
if ($('#stripe-postal-code').length) {
|
147 |
$('#stripe-postal-code, .postalCode').on('focus', function (e) {
|
377 |
}
|
378 |
|
379 |
CC.prototype.card_number_change = function (data) {
|
380 |
+
if (data.brand === "unknown") {
|
381 |
$('#wc-stripe-card').removeClass('active');
|
382 |
} else {
|
383 |
$('#wc-stripe-card').addClass('active');
|
385 |
$('#wc-stripe-card').attr('src', this.params.cards[data.brand]);
|
386 |
}
|
387 |
|
388 |
+
CC.prototype.on_input_change = function (event) {
|
389 |
+
if (event.complete) {
|
390 |
+
var $elements = $('#wc-stripe-cc-custom-form').find('.StripeElement, #stripe-postal-code');
|
391 |
+
var order = [];
|
392 |
+
$elements.each(function (idx, el) {
|
393 |
+
order.push('#' + $(el).attr('id'));
|
394 |
+
}.bind(this));
|
395 |
+
var selector = this.mappings[event.elementType];
|
396 |
+
var idx = order.indexOf(selector);
|
397 |
+
if (typeof order[idx + 1] !== 'undefined') {
|
398 |
+
if (order[idx + 1] === '#stripe-postal-code') {
|
399 |
+
document.getElementById('stripe-postal-code').focus();
|
400 |
+
} else {
|
401 |
+
for (var k in this.mappings) {
|
402 |
+
if (this.mappings[k] === order[idx + 1]) {
|
403 |
+
this[k].focus();
|
404 |
+
}
|
405 |
+
}
|
406 |
+
}
|
407 |
+
}
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
CC.prototype.clear_card_elements = function () {
|
412 |
var elements = ['cardNumber', 'cardExpiry', 'cardCvc'];
|
413 |
for (var i = 0; i < elements.length; i++) {
|
assets/js/frontend/googlepay-product.js
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
*/
|
6 |
function GPay() {
|
7 |
wc_stripe.BaseGateway.call(this, wc_stripe_googlepay_product_params);
|
8 |
-
wc_stripe.ProductGateway.call(this);
|
9 |
}
|
10 |
|
11 |
/**
|
@@ -18,6 +17,10 @@
|
|
18 |
* @return {[type]}
|
19 |
*/
|
20 |
GPay.prototype.initialize = function () {
|
|
|
|
|
|
|
|
|
21 |
this.createPaymentsClient();
|
22 |
this.isReadyToPay().then(function () {
|
23 |
$(this.container).show();
|
5 |
*/
|
6 |
function GPay() {
|
7 |
wc_stripe.BaseGateway.call(this, wc_stripe_googlepay_product_params);
|
|
|
8 |
}
|
9 |
|
10 |
/**
|
17 |
* @return {[type]}
|
18 |
*/
|
19 |
GPay.prototype.initialize = function () {
|
20 |
+
if (!$(this.container).length) {
|
21 |
+
return setTimeout(this.initialize.bind(this), 1000);
|
22 |
+
}
|
23 |
+
wc_stripe.ProductGateway.call(this);
|
24 |
this.createPaymentsClient();
|
25 |
this.isReadyToPay().then(function () {
|
26 |
$(this.container).show();
|
assets/js/frontend/local-payment.js
CHANGED
@@ -423,6 +423,15 @@
|
|
423 |
return args;
|
424 |
}
|
425 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
IDEAL.prototype = $.extend({}, LocalPayment.prototype, IDEAL.prototype);
|
427 |
|
428 |
Sepa.prototype = $.extend({}, LocalPayment.prototype, Sepa.prototype);
|
423 |
return args;
|
424 |
}
|
425 |
|
426 |
+
Sepa.prototype.getSourceArgs = function () {
|
427 |
+
return $.extend({}, LocalPayment.prototype.getSourceArgs.apply(this, arguments), {
|
428 |
+
mandate: {
|
429 |
+
notification_method: 'email',
|
430 |
+
interval: this.cart_contains_subscription() ? 'scheduled' : 'one_time'
|
431 |
+
}
|
432 |
+
});
|
433 |
+
}
|
434 |
+
|
435 |
IDEAL.prototype = $.extend({}, LocalPayment.prototype, IDEAL.prototype);
|
436 |
|
437 |
Sepa.prototype = $.extend({}, LocalPayment.prototype, Sepa.prototype);
|
assets/js/frontend/payment-request.js
CHANGED
@@ -13,6 +13,9 @@
|
|
13 |
PaymentRequest.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.ProductGateway.prototype, wc_stripe.PaymentRequest.prototype);
|
14 |
|
15 |
PaymentRequest.prototype.initialize = function () {
|
|
|
|
|
|
|
16 |
wc_stripe.ProductGateway.call(this);
|
17 |
wc_stripe.PaymentRequest.prototype.initialize.call(this);
|
18 |
}
|
13 |
PaymentRequest.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.ProductGateway.prototype, wc_stripe.PaymentRequest.prototype);
|
14 |
|
15 |
PaymentRequest.prototype.initialize = function () {
|
16 |
+
if (!$(this.container).length) {
|
17 |
+
return setTimeout(this.initialize.bind(this), 1000);
|
18 |
+
}
|
19 |
wc_stripe.ProductGateway.call(this);
|
20 |
wc_stripe.PaymentRequest.prototype.initialize.call(this);
|
21 |
}
|
assets/js/frontend/wc-stripe.js
CHANGED
@@ -1011,8 +1011,12 @@
|
|
1011 |
|
1012 |
return valid;
|
1013 |
};
|
1014 |
-
/************** Product Gateway ***************/
|
1015 |
|
|
|
|
|
|
|
|
|
|
|
1016 |
|
1017 |
wc_stripe.ProductGateway = function () {
|
1018 |
this.message_container = 'div.product'; // events
|
@@ -1194,34 +1198,20 @@
|
|
1194 |
}.bind(this));
|
1195 |
}.bind(this));
|
1196 |
};
|
1197 |
-
/************* Cart Gateway *************/
|
1198 |
-
|
1199 |
-
/**
|
1200 |
-
* @constructor
|
1201 |
-
*/
|
1202 |
|
|
|
1203 |
|
1204 |
wc_stripe.CartGateway = function () {
|
1205 |
-
this.message_container = 'div.woocommerce';
|
1206 |
|
1207 |
$(document.body).on('updated_wc_div', this.updated_html.bind(this));
|
1208 |
$(document.body).on('updated_cart_totals', this.updated_html.bind(this));
|
1209 |
$(document.body).on('wc_cart_emptied', this.cart_emptied.bind(this));
|
1210 |
};
|
1211 |
-
/**
|
1212 |
-
* @param {[type]}
|
1213 |
-
* @return {[type]}
|
1214 |
-
*/
|
1215 |
-
|
1216 |
|
1217 |
wc_stripe.CartGateway.prototype.submit_error = function (message) {
|
1218 |
this.submit_message(this.get_error_message(message));
|
1219 |
};
|
1220 |
-
/**
|
1221 |
-
* @param {[@event]}
|
1222 |
-
* @return {[null]}
|
1223 |
-
*/
|
1224 |
-
|
1225 |
|
1226 |
wc_stripe.CartGateway.prototype.updated_html = function (e) {
|
1227 |
};
|
@@ -1978,7 +1968,7 @@
|
|
1978 |
for (var k in this.params) {
|
1979 |
var field = this.params[k];
|
1980 |
if (k.indexOf(prefix) > -1 && field.required) {
|
1981 |
-
if ($('#' + k).length) {
|
1982 |
var val = $('#' + k).val();
|
1983 |
if (typeof val === 'undefined' || val === null || val.length === 0) {
|
1984 |
return false;
|
1011 |
|
1012 |
return valid;
|
1013 |
};
|
|
|
1014 |
|
1015 |
+
wc_stripe.CheckoutGateway.prototype.cart_contains_subscription = function () {
|
1016 |
+
return typeof wc_stripe_cart_contains_subscription !== 'undefined' && wc_stripe_cart_contains_subscription === true;
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
/************** Product Gateway ***************/
|
1020 |
|
1021 |
wc_stripe.ProductGateway = function () {
|
1022 |
this.message_container = 'div.product'; // events
|
1198 |
}.bind(this));
|
1199 |
}.bind(this));
|
1200 |
};
|
|
|
|
|
|
|
|
|
|
|
1201 |
|
1202 |
+
/************* Cart Gateway *************/
|
1203 |
|
1204 |
wc_stripe.CartGateway = function () {
|
1205 |
+
this.message_container = 'div.woocommerce';
|
1206 |
|
1207 |
$(document.body).on('updated_wc_div', this.updated_html.bind(this));
|
1208 |
$(document.body).on('updated_cart_totals', this.updated_html.bind(this));
|
1209 |
$(document.body).on('wc_cart_emptied', this.cart_emptied.bind(this));
|
1210 |
};
|
|
|
|
|
|
|
|
|
|
|
1211 |
|
1212 |
wc_stripe.CartGateway.prototype.submit_error = function (message) {
|
1213 |
this.submit_message(this.get_error_message(message));
|
1214 |
};
|
|
|
|
|
|
|
|
|
|
|
1215 |
|
1216 |
wc_stripe.CartGateway.prototype.updated_html = function (e) {
|
1217 |
};
|
1968 |
for (var k in this.params) {
|
1969 |
var field = this.params[k];
|
1970 |
if (k.indexOf(prefix) > -1 && field.required) {
|
1971 |
+
if ($('#' + k).length && $('#' + k).is(':visible')) {
|
1972 |
var val = $('#' + k).val();
|
1973 |
if (typeof val === 'undefined' || val === null || val.length === 0) {
|
1974 |
return false;
|
assets/js/frontend/wc-stripe.min.js
CHANGED
@@ -1,5 +1 @@
|
|
1 |
-
(function(a,b){a.wc_stripe={};var c=null;"undefined"==typeof wc_stripe_checkout_fields&&(a.wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(a,d){this.params=a,this.gateway_id=this.params.gateway_id,this.container="undefined"==typeof d?"li.payment_method_".concat(this.gateway_id):d,b(this.container).length||(this.container=".payment_method_".concat(this.gateway_id)),this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=c,this.elements=c.elements(b.extend({},{locale:"auto"},this.get_element_options())),this.fields=f,this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(a){this.fields.set(this.gateway_id+"_token_key",a),b(this.token_selector).val(a)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return b("[name=\"payment_method\"]:checked").val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===b("[name=\""+this.gateway_id+"_payment_type_key\"]:checked").val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return 0<b("#wc_stripe_checkout_error").length&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(a){a=this.get_error_message(a),-1==a.indexOf("</ul>")&&(a="<div class=\"woocommerce-error\">"+a+"</div>"),this.submit_message(a)},wc_stripe.BaseGateway.prototype.submit_error_code=function(a){console.log(a)},wc_stripe.BaseGateway.prototype.get_error_message=function(a){return"object"==typeof a&&a.code&&(wc_stripe_messages[a.code]?a=wc_stripe_messages[a.code]:a=a.message),a},wc_stripe.BaseGateway.prototype.submit_message=function(a){b(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var c=b(this.message_container);c.closest("form").length&&(c=c.closest("form")),c.prepend(a),c.removeClass("processing").unblock(),c.find(".input-text, select, input:checkbox").blur(),b.scroll_to_notices?b.scroll_to_notices(c):b("html, body").animate({scrollTop:c.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(a){return b("#"+a+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(a){return b("#"+a+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_shipping_prefix=function(){return this.needs_shipping()&&0<b("[name=\"ship_to_different_address\"]").length&&b("[name=\"ship_to_different_address\"]").is(":checked")?"shipping":"billing"},wc_stripe.BaseGateway.prototype.should_save_method=function(){return b("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return"add_payment_method"===this.get_page()||b(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return b(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){return b(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway")},wc_stripe.BaseGateway.prototype.set_gateway_data=function(a){b(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway",a)},wc_stripe.BaseGateway.prototype.get_customer_name=function(a){return this.fields.get(a+"_first_name")+" "+this.fields.get(a+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(a){for(var b=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],c="",d=0;d<b.length;d++)c+=this.fields.get(a+b[d])+"_";return c},wc_stripe.BaseGateway.prototype.block=function(){b().block&&b.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){b().block&&b.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return b(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(a){var b=this.get_gateway_data();b.total=a,this.set_gateway_data(b)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(a){var b=this.get_gateway_data();b.total_cents=a,this.set_gateway_data(b)},wc_stripe.BaseGateway.prototype.set_payment_method=function(a){b("[name=\"payment_method\"][value=\""+a+"\"]").prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(a){if(this.fields.set("shipping_method",a),a&&b("[name^=\"shipping_method\"]").length)for(var c in a){var d=a[c];b("[name=\"shipping_method["+c+"]\"][value=\""+d+"\"]").prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(a){this.payment_token_received=!0,this.set_nonce(a.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.payment_request_options=this.get_payment_request_options(),this.paymentRequest=c.paymentRequest(this.payment_request_options)}catch(a){return void this.submit_error(a.message)}this.payment_request_options.requestShipping&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var a={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:this.fields.requestFieldInWallet("billing_email"),requestPayerPhone:this.fields.requestFieldInWallet("billing_phone"),requestShipping:function(){if(this.needs_shipping()){var a=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(a),a,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)()},b=this.get_display_items(),c=this.get_shipping_options();return b&&(a.displayItems=b),a.requestShipping&&c&&(a.shippingOptions=c),a},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(a){var c={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},d=this.get_display_items(),e=this.get_shipping_options();return d&&(c.displayItems=d),this.payment_request_options.requestShipping&&e&&(c.shippingOptions=e),a&&(c=b.extend(!0,{},c,a)),c},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(a){var b=this.get_gateway_data();b.items=a,this.set_gateway_data(b)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(a){var b=this.get_gateway_data();b.shipping_options=a,this.set_gateway_data(b)},wc_stripe.BaseGateway.prototype.map_address=function(a){return{city:a.city,postcode:a.postalCode,state:a.region,country:a.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(b){try{this.payment_response=b,this.populate_checkout_fields(b),b.complete("success"),this.on_token_received(b.paymentMethod)}catch(b){a.alert(b)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(a){this.set_nonce(a.paymentMethod.id),this.update_addresses(a)},wc_stripe.BaseGateway.prototype.update_addresses=function(a){a.payerName&&this.fields.set("name",a.payerName,"billing"),a.payerEmail&&this.fields.set("email",a.payerEmail,"billing"),a.payerPhone&&this.fields.set("phone",a.payerPhone,"billing"),a.shippingAddress&&this.populate_shipping_fields(a.shippingAddress),a.paymentMethod.billing_details.address&&this.populate_billing_fields(a.paymentMethod.billing_details.address)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(a,b){for(var c in a)null!==a[c]&&this.fields.set(c,a[c],b)},wc_stripe.BaseGateway.prototype.populate_billing_fields=function(a){this.populate_address_fields(a,"billing")},wc_stripe.BaseGateway.prototype.populate_shipping_fields=function(a){this.populate_address_fields(a,"shipping")},wc_stripe.BaseGateway.prototype.get_address_fields=function(){return["first_name","last_name","country","address_1","address_2","city","state","postcode","phone","email"]},wc_stripe.BaseGateway.prototype.get_address_object=function(a){var b={};return this.get_address_fields().forEach(function(c){b[c]=this.fields.get(c,a)}.bind(this)),b},wc_stripe.BaseGateway.prototype.is_current_page=function(a){return this.get_page()===a},wc_stripe.BaseGateway.prototype.is_valid_address=function(a,c,d){if(b.isEmptyObject(a))return!1;var e=this.get_address_fields();"undefined"!=typeof d&&d.forEach(function(a){-1<e.indexOf(a)&&e.splice(e.indexOf(a),1)});for(var f=0;f<e.length;f++){var g=e[f],h=this.fields.required(c+"_"+g);if(h&&(!a[g]||"undefined"==typeof a[g]||!this.fields.isValid(g,a[g],a)))return!1}return!0},wc_stripe.BaseGateway.prototype.ajax_before_send=function(a){0<this.params.user_id&&a.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(){this.block(),b.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:b.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:this.ajax_before_send.bind(this)}).done(function(b){return b.reload?void a.location.reload():void("success"===b.result?a.location=b.redirect:(b.messages&&this.submit_error(b.messages),this.unblock()))}.bind(this)).fail(function(a,b,c){this.unblock(),this.submit_error(c)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(a){var c=a.find("input").filter(function(a,c){return!b(c).is("[name^=\"add-to-cart\"]")}.bind(this)).serializeArray(),d={};for(var e in c){var f=c[e];d[f.name]=f.value}return d.payment_method=this.gateway_id,d},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return b.extend({},this.fields.toJson(),b(document.body).triggerHandler("wc_stripe_process_checkout_data",[this,this.fields]))},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(a){var b={};if("default"!==a){var c=a.match(/^([\w+]):(.+)$/);1<c.length&&(b[c[1]]=c[2])}return b},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){b("[name=\"ship_to_different_address\"]").length&&b("[name=\"ship_to_different_address\"]").prop("checked",this.get_address_field_hash("billing")!==this.get_address_field_hash("shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(a){return new Promise(function(c,d){b.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(a.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(b){b.code?(a.updateWith(b.data.newData),d(b.data)):(a.updateWith(b.data.newData),this.fields.set("shipping_method",b.data.shipping_method),c(b.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(a){return new Promise(function(c,d){b.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:a.shippingOption.id,payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(b){b.code?(a.updateWith(b.data.newData),d(b.data)):(this.set_selected_shipping_methods(b.data.shipping_methods),a.updateWith(b.data.newData),c(b.data))}.bind(this)).fail(function(a,b,c){this.submit_error(c)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){// events for showing gateway payment buttons
|
2 |
-
this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,b(document.body).on("update_checkout",this.update_checkout.bind(this)),b(document.body).on("updated_checkout",this.updated_checkout.bind(this)),b(document.body).on("cfw_updated_checkout",this.updated_checkout.bind(this)),b(document.body).on("checkout_error",this.checkout_error.bind(this)),b(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),b(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),b(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),b(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&b(".woocommerce-billing-fields").length&&b(".wc-stripe-banner-checkout").css("max-width",b(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var b=a.location.href,c=b.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(c&&1<c.length){var d=c[1],e=c[2];this.gateway_id===d&&(this.payment_token_received=!0,this.set_nonce(e),this.set_use_new_option(!0))}},wc_stripe.CheckoutGateway.prototype.update_shipping_address=function(){return wc_stripe.BaseGateway.prototype.update_shipping_address.apply(this,arguments).then(function(a){// populate the checkout fields with the address
|
3 |
-
this.populate_address_fields(a.address,this.get_shipping_prefix()),this.fields.toFormFields({update_shipping_method:!1})}.bind(this))},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!b("[name=\"terms\"]").length||b("[name=\"terms\"]").is(":checked")},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return b("[name=\"payment_method\"]:checked").val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(a){b("#"+this.gateway_id+"_use_new").prop("checked",a).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(a){this.payment_token_received=!0,this.set_nonce(a.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){b().block&&b("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){b().block&&b("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){b("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){b("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,b("[name=\"payment_method\"]:checked").val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(a,b){b===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),0>b.indexOf("stripe_")&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if(0>["checkout","order_pay"].indexOf(this.get_page()))return!0;var a=!0;return(a=this.fields.validateFields("billing"))?this.needs_shipping()&&b("#ship-to-different-address-checkbox").is(":checked")?!(a=this.fields.validateFields("shipping"))&&this.submit_error(this.params.messages.required_field):!(a=this.is_valid_checkout())&&this.submit_error(this.params.messages.terms):this.submit_error(this.params.messages.required_field),a},wc_stripe.ProductGateway=function(){this.message_container="div.product",b("form.cart").on("found_variation",this.found_variation.bind(this)),b("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=b("form.cart div.quantity").outerWidth(!0)+b(".single_add_to_cart_button").outerWidth();var a=b(".single_add_to_cart_button").css("marginLeft");a&&(this.buttonWidth+=parseInt(a.replace("px",""))),b(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(b("[name=\"quantity\"]").val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(a,b){this.params.rest_nonce=b},wc_stripe.ProductGateway.prototype.found_variation=function(a,b){var c=this.get_gateway_data();c.product.price=b.display_price,c.needs_shipping=!b.is_virtual,c.product.variation=b,this.set_gateway_data(c)},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var a=this.get_product_data();a.variation=!1,this.set_product_data(a),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return 0<b("[name=\"variation_id\"]").length},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){return!1!==this.get_product_data().variation},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(a){var b=this.get_gateway_data();b.product=a,this.set_gateway_data(b)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(a,c){this.block(),b.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?b("[name=\"variation_id\"]").val():0,qty:b("[name=\"quantity\"]").val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(b){this.unblock(),b.code?(this.submit_error(b.message),c(b)):(this.set_total_price(b.data.total),this.set_total_price_cents(b.data.totalCents),this.set_display_items(b.data.displayItems),a(b.data))}.bind(this)).fail(function(a,b,c){this.unblock(),this.submit_error(c)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(a){return new Promise(function(c,d){b.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&a?a:0,qty:b("[name=\"quantity\"]").val(),payment_method:this.gateway_id},beforeSend:this.ajax_before_send.bind(this)}).done(function(a){a.code?(this.cart_calculation_error=!0,d(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),c(a.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){// cart events
|
4 |
-
this.message_container="div.woocommerce",b(document.body).on("updated_wc_div",this.updated_html.bind(this)),b(document.body).on("updated_cart_totals",this.updated_html.bind(this)),b(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(a){this.submit_message(this.get_error_message(a))},wc_stripe.CartGateway.prototype.updated_html=function(){},wc_stripe.CartGateway.prototype.cart_emptied=function(){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){b(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};var d={apiVersion:2,apiVersionMinor:0},e={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.update_addresses=function(a){this.populate_billing_fields(a.paymentMethodData.info.billingAddress),a.shippingAddress&&this.populate_shipping_fields(a.shippingAddress),a.email&&this.fields.set("email",a.email,"billing")},wc_stripe.GooglePay.prototype.map_address=function(a){return{city:a.locality,postcode:a.postalCode,state:a.administrativeArea,country:a.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(a){return new Promise(function(c,d){var e="default"==a.shippingOptionData.id?null:a.shippingOptionData.id;b.when(b.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(a.shippingAddress),shipping_method:e,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)})).done(function(a){a.code?d(a.data.data):c(a.data)}.bind(this)).fail(function(){d()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(a){return new Promise(function(b){this.update_payment_data(a).then(function(c){b(c.paymentRequestUpdate),this.set_selected_shipping_methods(c.shipping_methods),this.payment_data_updated(c,a)}.bind(this))["catch"](function(a){b(a)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(){},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var a={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete a.merchantId,a},wc_stripe.GooglePay.prototype.get_payment_options=function(){var a={environment:this.params.environment,merchantInfo:this.get_merchant_info(),paymentDataCallbacks:{onPaymentAuthorized:function(){return new Promise(function(a){a({transactionState:"SUCCESS"})}.bind(this))}}};if(this.needs_shipping()){var b=this.get_shipping_prefix();(!this.is_current_page("checkout")||this.is_valid_address(this.get_address_object(b),b,["email","phone"]))&&this.is_current_page("checkout")||(a.paymentDataCallbacks.onPaymentDataChanged=this.on_payment_data_changed.bind(this))}return a},wc_stripe.GooglePay.prototype.build_payment_request=function(){var a=b.extend({},d,{emailRequired:this.fields.requestFieldInWallet("billing_email"),merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[b.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},e)],shippingAddressRequired:function(){if(this.needs_shipping()){var a=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(a),a,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)(),transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return a.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,a.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.fields.requestFieldInWallet("billing_phone")},a.shippingAddressRequired?(a.shippingAddressParameters={},a.shippingOptionRequired=!0,a.shippingOptionParameters={shippingOptions:this.get_shipping_options()},a.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):a.callbackIntents=["PAYMENT_AUTHORIZATION"],this.payment_request_options=a,a},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(a){var c=b.extend({},d);c.allowedPaymentMethods=[e],this.paymentsClient.isReadyToPay(c).then(function(){this.can_pay=!0,this.create_button(),a()}.bind(this))["catch"](function(a){this.submit_error(a)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=b(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){// always recreate the paymentClient to ensure latest data is used.
|
5 |
-
this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(a){var b=JSON.parse(a.paymentMethodData.tokenizationData.token);this.update_addresses(a),this.on_token_received(b)}.bind(this))["catch"](function(a){"CANCELED"===a.statusCode||(a.statusMessage&&-1<a.statusMessage.indexOf("paymentDataRequest.callbackIntent")?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(a.message))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){var a=".apple-pay-button";0>["checkout","order_pay"].indexOf(this.get_page())&&(a=this.container+" .apple-pay-button"),b(document.body).on("click",a,this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=b(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(a){this.paymentRequest.canMakePayment().then(function(c){c&&c.applePay&&(this.can_pay=!0,this.create_button(),b(this.container).show(),a(c))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(a){a.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.createPaymentRequestButton(),this.canMakePayment(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){this.paymentRequestButton&&this.paymentRequestButton.destroy(),this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(a){this.paymentRequest.canMakePayment().then(function(c){c&&!c.applePay&&(this.can_pay=!0,this.create_button(),b(this.container).show(),a(c))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")},wc_stripe.CheckoutFields=function(a,c){this.params=a,this.page=c,this.fields=new Map(Object.keys(this.params).map(function(a){return null===this.params[a].value&&(this.params[a].value=""),[a,this.params[a].value]}.bind(this))),"checkout"===c&&(b("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),b("form.checkout").on("change","[name=\"ship_to_different_address\"]",this.on_ship_to_address_change.bind(this)),this.init_i18n())},wc_stripe.CheckoutFields.prototype.init_i18n=function(){this.locales="undefined"==typeof wc_address_i18n_params?null:b.parseJSON(wc_address_i18n_params.locale.replace(/"/g,"\""))},wc_stripe.CheckoutFields.prototype.onChange=function(a){try{var b=a.currentTarget.name,c=a.currentTarget.value;this.fields.set(b,c),("billing_country"===b||"shipping_country"===b)&&this.update_required_fields(c,b)}catch(a){console.log(a)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(a,c){if(this.locales){var d=-1<c.indexOf("billing_")?"billing_":"shipping_",e="undefined"==typeof this.locales[a]?this.locales["default"]:this.locales[a],f=b.extend(!0,{},this.locales["default"],e);for(var g in f){var h=d+g;this.params[h]&&(this.params[h]=b.extend(!0,{},this.params[h],f[g]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(a){b(a.currentTarget).is(":checked")&&this.update_required_fields(b("shipping_country"),"shipping_country")},wc_stripe.CheckoutFields.prototype.requestFieldInWallet=function(a){if("checkout"===this.page)return this.required(a)&&this.isEmpty(a);return"order_pay"!==this.page&&this.required(a)},wc_stripe.CheckoutFields.prototype.set=function(a,b,c){this[a]&&"function"==typeof this[a]?this[a]().set.call(this,b,c):this.fields.set(a,b)},wc_stripe.CheckoutFields.prototype.get=function(a,b){if(this[a]&&"function"==typeof this[a])var c=this[a]().get.call(this,b);else{var c=this.fields.get(a);("undefined"==typeof c||null===c||""===c)&&"undefined"!=typeof b&&(c=b)}return"undefined"==typeof c?"":c},wc_stripe.CheckoutFields.prototype.required=function(a){return!!(this.params[a]&&"undefined"!=typeof this.params[a].required)&&this.params[a].required},wc_stripe.CheckoutFields.prototype.isEmpty=function(a){if(this.fields.has(a)){var b=this.fields.get(a);return"undefined"==typeof b||null===b||"string"==typeof b&&0===b.trim().length}return!0},wc_stripe.CheckoutFields.prototype.isValid=function(a){if(this[a]&&"function"==typeof this[a])return this[a]().isValid.apply(this,Array.prototype.slice.call(arguments,1))},wc_stripe.CheckoutFields.prototype.first_name=function(){return{set:function set(a,b){this.fields.set(b+"_first_name",a)},get:function get(a){return this.fields.get(a+"_first_name")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.last_name=function(){return{set:function set(a,b){this.fields.set(b+"_last_name",a)},get:function get(a){return this.fields.get(a+"_last_name")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.address_1=function(){return{set:function(a,b){this.fields.set(b+"_address_1",a)},get:function(a){return this.fields.get(a+"_address_1")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.address_2=function(){return{set:function(a,b){this.fields.set(b+"_address_2",a)},get:function(a){return this.fields.get(a+"_address_2")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(a,b){var c=a.split(" ");0<c.length&&this.fields.set(b+"_first_name",c[0]),1<c.length&&this.fields.set(b+"_last_name",c[1])},get:function(a){return this.fields.get(a+"_first_name")+" "+this.fields.get(a+"_last_name")}}},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(a,b){this.fields.set(b+"_email",a)},get:function(a){return this.fields.get(a+"_email")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(a,b){this.fields.set(b+"_phone",a)},get:function(a){return this.fields.get(a+"_phone")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(a,b){this.fields.set(b+"_country",a)},get:function(a){return this.fields.get(a+"_country")},isValid:function isValid(a){return"string"==typeof a&&2===a.length}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(a,c){a=a.toUpperCase(),2<a.length&&"checkout"===this.page&&b("#"+c+"_state option").each(function(){var c=b(this),d=c.text().toUpperCase();a===d&&(a=c.val())}),this.fields.set(c+"_state",a)},get:function(a){return this.fields.get(a+"_state")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(a,b){this.fields.set(b+"_city",a)},get:function(a){return this.fields.get(a+"_city")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.postcode=function(){return{set:function(a,b){this.fields.set(b+"_postcode",a)},get:function(a){return this.fields.get(a+"_postcode")},isValid:function isValid(a){return"string"==typeof a&&0<a.length}}},wc_stripe.CheckoutFields.prototype.recipient=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(a,b){0<a.length&&this.fields.set(b+"_address_1",a[0]),1<a.length&&this.fields.set(b+"_address_2",a[1])},get:function(a){return[this.fields.get(a+"_address_1"),this.fields.get(a+"_address_2")]},isValid:function isValid(a){return!!(0<a.length)&&"string"==typeof a[0]&&0<a[0].length}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var a={};return this.fields.forEach(function(b,c){a[c]=b}),a},wc_stripe.CheckoutFields.prototype.toFormFields=function(a){var c=[];this.fields.forEach(function(a,d){var e="[name=\""+d+"\"]";b(e).length&&""!==a&&(b(e).val()!==a&&b(e).is("select")&&c.push(e),b(e).val(a))}),0<c.length&&b(c.join(",")).trigger("change"),"undefined"!=typeof a&&b(document.body).trigger("update_checkout",a)},wc_stripe.CheckoutFields.prototype.validateFields=function(a){for(var c in this.params){var d=this.params[c];if(-1<c.indexOf(a)&&d.required&&b("#"+c).length){var e=b("#"+c).val();if("undefined"==typeof e||null===e||0===e.length)return!1}}return!0};try{c=Stripe(wc_stripe_params_v3.api_key,{stripeAccount:wc_stripe_params_v3.account})}catch(b){return a.alert(b),void console.log(b)}var f=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)})(window,jQuery);
|
1 |
+
!function(i,o){i.wc_stripe={};var s=null;"undefined"==typeof wc_stripe_checkout_fields&&(i.wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(t,e){this.params=t,this.gateway_id=this.params.gateway_id,this.container=void 0===e?"li.payment_method_".concat(this.gateway_id):e,o(this.container).length||(this.container=".payment_method_".concat(this.gateway_id)),this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=s,this.elements=s.elements(o.extend({},{locale:"auto"},this.get_element_options())),this.fields=r,this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){this.fields.set(this.gateway_id+"_token_key",t),o(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return o('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===o('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return 0<o("#wc_stripe_checkout_error").length&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==(t=this.get_error_message(t)).indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){console.log(t)},wc_stripe.BaseGateway.prototype.get_error_message=function(t){return"object"==typeof t&&t.code&&(t=wc_stripe_messages[t.code]||t.message),t},wc_stripe.BaseGateway.prototype.submit_message=function(t){o(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var e=o(this.message_container);e.closest("form").length&&(e=e.closest("form")),e.prepend(t),e.removeClass("processing").unblock(),e.find(".input-text, select, input:checkbox").blur(),o.scroll_to_notices?o.scroll_to_notices(e):o("html, body").animate({scrollTop:e.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return o("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return o("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_shipping_prefix=function(){return this.needs_shipping()&&0<o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').is(":checked")?"shipping":"billing"},wc_stripe.BaseGateway.prototype.should_save_method=function(){return o("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return"add_payment_method"===this.get_page()||o(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return o(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){return o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway")},wc_stripe.BaseGateway.prototype.set_gateway_data=function(t){o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway",t)},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var e=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],i="",s=0;s<e.length;s++)i+=this.fields.get(t+e[s])+"_";return i},wc_stripe.BaseGateway.prototype.block=function(){o().block&&o.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){o().block&&o.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return o(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(t){var e=this.get_gateway_data();e.total=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){var e=this.get_gateway_data();e.total_cents=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){o('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(this.fields.set("shipping_method",t),t&&o('[name^="shipping_method"]').length)for(var e in t){var i=t[e];o('[name="shipping_method['+e+']"][value="'+i+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.payment_request_options=this.get_payment_request_options(),this.paymentRequest=s.paymentRequest(this.payment_request_options)}catch(t){return void this.submit_error(t.message)}this.payment_request_options.requestShipping&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:this.fields.requestFieldInWallet("billing_email"),requestPayerPhone:this.fields.requestFieldInWallet("billing_phone"),requestShipping:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),t.requestShipping&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var e={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},i=this.get_display_items(),s=this.get_shipping_options();return i&&(e.displayItems=i),this.payment_request_options.requestShipping&&s&&(e.shippingOptions=s),t&&(e=o.extend(!0,{},e,t)),e},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(t){var e=this.get_gateway_data();e.items=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){var e=this.get_gateway_data();e.shipping_options=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(t){try{this.payment_response=t,this.populate_checkout_fields(t),t.complete("success"),this.on_token_received(t.paymentMethod)}catch(e){i.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){this.set_nonce(t.paymentMethod.id),this.update_addresses(t)},wc_stripe.BaseGateway.prototype.update_addresses=function(t){t.payerName&&this.fields.set("name",t.payerName,"billing"),t.payerEmail&&this.fields.set("email",t.payerEmail,"billing"),t.payerPhone&&this.fields.set("phone",t.payerPhone,"billing"),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.paymentMethod.billing_details.address&&this.populate_billing_fields(t.paymentMethod.billing_details.address)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t,e){for(var i in t)null!==t[i]&&this.fields.set(i,t[i],e)},wc_stripe.BaseGateway.prototype.populate_billing_fields=function(t){this.populate_address_fields(t,"billing")},wc_stripe.BaseGateway.prototype.populate_shipping_fields=function(t){this.populate_address_fields(t,"shipping")},wc_stripe.BaseGateway.prototype.get_address_fields=function(){return["first_name","last_name","country","address_1","address_2","city","state","postcode","phone","email"]},wc_stripe.BaseGateway.prototype.get_address_object=function(e){var i={};return this.get_address_fields().forEach(function(t){i[t]=this.fields.get(t,e)}.bind(this)),i},wc_stripe.BaseGateway.prototype.is_current_page=function(t){return this.get_page()===t},wc_stripe.BaseGateway.prototype.is_valid_address=function(t,e,i){if(o.isEmptyObject(t))return!1;var s=this.get_address_fields();void 0!==i&&i.forEach(function(t){-1<s.indexOf(t)&&s.splice(s.indexOf(t),1)});for(var a=0;a<s.length;a++){var n=s[a];if(this.fields.required(e+"_"+n)&&(!t[n]||"undefined"==typeof t[n]||!this.fields.isValid(n,t[n],t)))return!1}return!0},wc_stripe.BaseGateway.prototype.ajax_before_send=function(t){0<this.params.user_id&&t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(){this.block(),o.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:o.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.reload?i.location.reload():"success"===t.result?i.location=t.redirect:(t.messages&&this.submit_error(t.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var e,i=t.find("input").filter(function(t,e){return!o(e).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),s={};for(e in i){var a=i[e];s[a.name]=a.value}return s.payment_method=this.gateway_id,s},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return o.extend({},this.fields.toJson(),o(document.body).triggerHandler("wc_stripe_process_checkout_data",[this,this.fields]))},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};return"default"===t||1<(t=t.match(/^([\w+]):(.+)$/)).length&&(e[t[1]]=t[2]),e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("billing")!==this.get_address_field_hash("shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(s.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(s.updateWith(t.data.newData),this.fields.set("shipping_method",t.data.shipping_method),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:s.shippingOption.id,payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(this.set_selected_shipping_methods(t.data.shipping_methods),s.updateWith(t.data.newData),e(t.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,o(document.body).on("update_checkout",this.update_checkout.bind(this)),o(document.body).on("updated_checkout",this.updated_checkout.bind(this)),o(document.body).on("cfw_updated_checkout",this.updated_checkout.bind(this)),o(document.body).on("checkout_error",this.checkout_error.bind(this)),o(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),o(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),o(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),o(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&o(".woocommerce-billing-fields").length&&o(".wc-stripe-banner-checkout").css("max-width",o(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var t,e=i.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);e&&1<e.length&&(t=e[1],e=e[2],this.gateway_id===t&&(this.payment_token_received=!0,this.set_nonce(e),this.set_use_new_option(!0)))},wc_stripe.CheckoutGateway.prototype.update_shipping_address=function(){return wc_stripe.BaseGateway.prototype.update_shipping_address.apply(this,arguments).then(function(t){this.populate_address_fields(t.address,this.get_shipping_prefix()),this.fields.toFormFields({update_shipping_method:!1})}.bind(this))},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(o('[name="terms"]').length&&!o('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return o('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){o("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){o().block&&o("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){o().block&&o("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){o("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){o("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,o('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if(["checkout","order_pay"].indexOf(this.get_page())<0)return!0;var t=!0;return(t=this.fields.validateFields("billing"))?this.needs_shipping()&&o("#ship-to-different-address-checkbox").is(":checked")?(t=this.fields.validateFields("shipping"))||this.submit_error(this.params.messages.required_field):(t=this.is_valid_checkout())||this.submit_error(this.params.messages.terms):this.submit_error(this.params.messages.required_field),t},wc_stripe.CheckoutGateway.prototype.cart_contains_subscription=function(){return"undefined"!=typeof wc_stripe_cart_contains_subscription&&!0===wc_stripe_cart_contains_subscription},wc_stripe.ProductGateway=function(){this.message_container="div.product",o("form.cart").on("found_variation",this.found_variation.bind(this)),o("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=o("form.cart div.quantity").outerWidth(!0)+o(".single_add_to_cart_button").outerWidth();var t=o(".single_add_to_cart_button").css("marginLeft");t&&(this.buttonWidth+=parseInt(t.replace("px",""))),o(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(o('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_gateway_data();i.product.price=e.display_price,i.needs_shipping=!e.is_virtual,i.product.variation=e,this.set_gateway_data(i)},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var t=this.get_product_data();t.variation=!1,this.set_product_data(t),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return 0<o('[name="variation_id"]').length},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){return!1!==this.get_product_data().variation},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(t){var e=this.get_gateway_data();e.product=t,this.set_gateway_data(e)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(e,i){this.block(),o.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?o('[name="variation_id"]').val():0,qty:o('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){this.unblock(),t.code?(this.submit_error(t.message),i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(e,i){o.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&t?t:0,qty:o('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(this.cart_calculation_error=!0,i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.message_container="div.woocommerce",o(document.body).on("updated_wc_div",this.updated_html.bind(this)),o(document.body).on("updated_cart_totals",this.updated_html.bind(this)),o(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(this.get_error_message(t))},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.cart_emptied=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){o(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};var a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.update_addresses=function(t){this.populate_billing_fields(t.paymentMethodData.info.billingAddress),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.email&&this.fields.set("email",t.email,"billing")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(s){return new Promise(function(e,i){var t="default"==s.shippingOptionData.id?null:s.shippingOptionData.id;o.when(o.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(s.shippingAddress),shipping_method:t,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){t.code?i(t.data.data):e(t.data)}.bind(this)).fail(function(){i()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(i){return new Promise(function(e){this.update_payment_data(i).then(function(t){e(t.paymentRequestUpdate),this.set_selected_shipping_methods(t.shipping_methods),this.payment_data_updated(t,i)}.bind(this))["catch"](function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t,e={environment:this.params.environment,merchantInfo:this.get_merchant_info(),paymentDataCallbacks:{onPaymentAuthorized:function(){return new Promise(function(t){t({transactionState:"SUCCESS"})}.bind(this))}}};return this.needs_shipping()&&(t=this.get_shipping_prefix(),(!this.is_current_page("checkout")||this.is_valid_address(this.get_address_object(t),t,["email","phone"]))&&this.is_current_page("checkout")||(e.paymentDataCallbacks.onPaymentDataChanged=this.on_payment_data_changed.bind(this))),e},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=o.extend({},a,{emailRequired:this.fields.requestFieldInWallet("billing_email"),merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[o.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)(),transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.fields.requestFieldInWallet("billing_phone")},t.shippingAddressRequired?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"],this.payment_request_options=t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var e=o.extend({},a);e.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(e).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this))["catch"](function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.update_addresses(t),this.on_token_received(e)}.bind(this))["catch"](function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&-1<t.statusMessage.indexOf("paymentDataRequest.callbackIntent")?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.message))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){var t=".apple-pay-button";["checkout","order_pay"].indexOf(this.get_page())<0&&(t=this.container+" .apple-pay-button"),o(document.body).on("click",t,this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.createPaymentRequestButton(),this.canMakePayment(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){this.paymentRequestButton&&this.paymentRequestButton.destroy(),this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&!t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")},wc_stripe.CheckoutFields=function(t,e){this.params=t,this.page=e,this.fields=new Map(Object.keys(this.params).map(function(t){return null===this.params[t].value&&(this.params[t].value=""),[t,this.params[t].value]}.bind(this))),"checkout"===e&&(o("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),o("form.checkout").on("change",'[name="ship_to_different_address"]',this.on_ship_to_address_change.bind(this)),this.init_i18n())},wc_stripe.CheckoutFields.prototype.init_i18n=function(){"undefined"!=typeof wc_address_i18n_params?this.locales=o.parseJSON(wc_address_i18n_params.locale.replace(/"/g,'"')):this.locales=null},wc_stripe.CheckoutFields.prototype.onChange=function(t){try{var e=t.currentTarget.name,i=t.currentTarget.value;this.fields.set(e,i),"billing_country"!==e&&"shipping_country"!==e||this.update_required_fields(i,e)}catch(s){console.log(s)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(t,e){if(this.locales){var i,s=-1<e.indexOf("billing_")?"billing_":"shipping_",t="undefined"!=typeof this.locales[t]?this.locales[t]:this.locales["default"],a=o.extend(!0,{},this.locales["default"],t);for(i in a){var n=s+i;this.params[n]&&(this.params[n]=o.extend(!0,{},this.params[n],a[i]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(t){o(t.currentTarget).is(":checked")&&this.update_required_fields(o("shipping_country"),"shipping_country")},wc_stripe.CheckoutFields.prototype.requestFieldInWallet=function(t){return"checkout"===this.page?this.required(t)&&this.isEmpty(t):"order_pay"!==this.page&&this.required(t)},wc_stripe.CheckoutFields.prototype.set=function(t,e,i){this[t]&&"function"==typeof this[t]?this[t]().set.call(this,e,i):this.fields.set(t,e)},wc_stripe.CheckoutFields.prototype.get=function(t,e){var i;return this[t]&&"function"==typeof this[t]?i=this[t]().get.call(this,e):null!=(i=this.fields.get(t))&&""!==i||void 0!==e&&(i=e),void 0===i?"":i},wc_stripe.CheckoutFields.prototype.required=function(t){return!(!this.params[t]||"undefined"==typeof this.params[t].required)&&this.params[t].required},wc_stripe.CheckoutFields.prototype.isEmpty=function(t){if(this.fields.has(t)){t=this.fields.get(t);return null==t||"string"==typeof t&&0===t.trim().length}return!0},wc_stripe.CheckoutFields.prototype.isValid=function(t){if(this[t]&&"function"==typeof this[t])return this[t]().isValid.apply(this,Array.prototype.slice.call(arguments,1))},wc_stripe.CheckoutFields.prototype.first_name=function(){return{set:function(t,e){this.fields.set(e+"_first_name",t)},get:function(t){return this.fields.get(t+"_first_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.last_name=function(){return{set:function(t,e){this.fields.set(e+"_last_name",t)},get:function(t){return this.fields.get(t+"_last_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_1=function(){return{set:function(t,e){this.fields.set(e+"_address_1",t)},get:function(t){return this.fields.get(t+"_address_1")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_2=function(){return{set:function(t,e){this.fields.set(e+"_address_2",t)},get:function(t){return this.fields.get(t+"_address_2")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(t,e){t=t.split(" ");0<t.length&&this.fields.set(e+"_first_name",t[0]),1<t.length&&this.fields.set(e+"_last_name",t[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(t,e){this.fields.set(e+"_email",t)},get:function(t){return this.fields.get(t+"_email")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(t,e){this.fields.set(e+"_phone",t)},get:function(t){return this.fields.get(t+"_phone")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(t,e){this.fields.set(e+"_country",t)},get:function(t){return this.fields.get(t+"_country")},isValid:function(t){return"string"==typeof t&&2===t.length}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(i,t){2<(i=i.toUpperCase()).length&&"checkout"===this.page&&o("#"+t+"_state option").each(function(){var t=o(this),e=t.text().toUpperCase();i===e&&(i=t.val())}),this.fields.set(t+"_state",i)},get:function(t){return this.fields.get(t+"_state")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(t,e){this.fields.set(e+"_city",t)},get:function(t){return this.fields.get(t+"_city")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.postcode=function(){return{set:function(t,e){this.fields.set(e+"_postcode",t)},get:function(t){return this.fields.get(t+"_postcode")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.recipient=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(t,e){0<t.length&&this.fields.set(e+"_address_1",t[0]),1<t.length&&this.fields.set(e+"_address_2",t[1])},get:function(t){return[this.fields.get(t+"_address_1"),this.fields.get(t+"_address_2")]},isValid:function(t){return 0<t.length&&("string"==typeof t[0]&&0<t[0].length)}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var i={};return this.fields.forEach(function(t,e){i[e]=t}),i},wc_stripe.CheckoutFields.prototype.toFormFields=function(t){var i=[];this.fields.forEach(function(t,e){e='[name="'+e+'"]';o(e).length&&""!==t&&(o(e).val()!==t&&o(e).is("select")&&i.push(e),o(e).val(t))}),0<i.length&&o(i.join(",")).trigger("change"),void 0!==t&&o(document.body).trigger("update_checkout",t)},wc_stripe.CheckoutFields.prototype.validateFields=function(t){for(var e in this.params){var i=this.params[e];if(-1<e.indexOf(t)&&i.required&&o("#"+e).length&&o("#"+e).is(":visible")){i=o("#"+e).val();if(null==i||0===i.length)return!1}}return!0};try{s=Stripe(wc_stripe_params_v3.api_key,{stripeAccount:wc_stripe_params_v3.account})}catch(t){return i.alert(t),console.log(t)}var r=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)}(window,jQuery);
|
|
|
|
|
|
|
|
i18n/languages/woo-stripe-payment.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the same license as the Stripe For WooCommerce plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Stripe For WooCommerce 3.2.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\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-10-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: woo-stripe-payment\n"
|
@@ -90,11 +90,11 @@ msgstr ""
|
|
90 |
msgid "Order %s"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
94 |
msgid "Gateway will appear when store currency is <strong>%s</strong>"
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
98 |
msgid " & billing country is <strong>%s</strong>"
|
99 |
msgstr ""
|
100 |
|
@@ -1050,15 +1050,16 @@ msgid "Adding to cart..."
|
|
1050 |
msgstr ""
|
1051 |
|
1052 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:23
|
1053 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
|
|
1054 |
msgid "SEPA"
|
1055 |
msgstr ""
|
1056 |
|
1057 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1058 |
msgid "Sepa"
|
1059 |
msgstr ""
|
1060 |
|
1061 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1062 |
msgid "Sepa gateway that integrates with your Stripe account."
|
1063 |
msgstr ""
|
1064 |
|
@@ -1070,18 +1071,26 @@ msgid ""
|
|
1070 |
"\t\t\tterms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited."
|
1071 |
msgstr ""
|
1072 |
|
1073 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1074 |
msgid "Company Name"
|
1075 |
msgstr ""
|
1076 |
|
1077 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1078 |
msgid "The name of your company that will appear in the SEPA mandate."
|
1079 |
msgstr ""
|
1080 |
|
1081 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1082 |
msgid "SEPA Test Accounts"
|
1083 |
msgstr ""
|
1084 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1085 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:24
|
1086 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:27
|
1087 |
msgid "Sofort"
|
@@ -1612,7 +1621,8 @@ msgstr ""
|
|
1612 |
msgid "Gateway Name"
|
1613 |
msgstr ""
|
1614 |
|
1615 |
-
#: includes/tokens/class-wc-payment-token-stripe-local-payment.php:
|
|
|
1616 |
msgid "Gateway Title"
|
1617 |
msgstr ""
|
1618 |
|
2 |
# This file is distributed under the same license as the Stripe For WooCommerce plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Stripe For WooCommerce 3.2.4\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\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-10-15T23:34:19+00: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: woo-stripe-payment\n"
|
90 |
msgid "Order %s"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:279
|
94 |
msgid "Gateway will appear when store currency is <strong>%s</strong>"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:282
|
98 |
msgid " & billing country is <strong>%s</strong>"
|
99 |
msgstr ""
|
100 |
|
1050 |
msgstr ""
|
1051 |
|
1052 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:23
|
1053 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:28
|
1054 |
+
#: includes/tokens/class-wc-payment-token-stripe-sepa.php:54
|
1055 |
msgid "SEPA"
|
1056 |
msgstr ""
|
1057 |
|
1058 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:25
|
1059 |
msgid "Sepa"
|
1060 |
msgstr ""
|
1061 |
|
1062 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:26
|
1063 |
msgid "Sepa gateway that integrates with your Stripe account."
|
1064 |
msgstr ""
|
1065 |
|
1071 |
"\t\t\tterms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited."
|
1072 |
msgstr ""
|
1073 |
|
1074 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:62
|
1075 |
msgid "Company Name"
|
1076 |
msgstr ""
|
1077 |
|
1078 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:66
|
1079 |
msgid "The name of your company that will appear in the SEPA mandate."
|
1080 |
msgstr ""
|
1081 |
|
1082 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:73
|
1083 |
msgid "SEPA Test Accounts"
|
1084 |
msgstr ""
|
1085 |
|
1086 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:77
|
1087 |
+
msgid "New Account"
|
1088 |
+
msgstr ""
|
1089 |
+
|
1090 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:81
|
1091 |
+
msgid "Saved Accounts"
|
1092 |
+
msgstr ""
|
1093 |
+
|
1094 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:24
|
1095 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:27
|
1096 |
msgid "Sofort"
|
1621 |
msgid "Gateway Name"
|
1622 |
msgstr ""
|
1623 |
|
1624 |
+
#: includes/tokens/class-wc-payment-token-stripe-local-payment.php:33
|
1625 |
+
#: includes/tokens/class-wc-payment-token-stripe-sepa.php:60
|
1626 |
msgid "Gateway Title"
|
1627 |
msgstr ""
|
1628 |
|
includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php
CHANGED
@@ -194,6 +194,21 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
194 |
return apply_filters( 'wc_stripe_get_source_args', $args );
|
195 |
}
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
/**
|
198 |
*
|
199 |
* @param WC_Order $order
|
194 |
return apply_filters( 'wc_stripe_get_source_args', $args );
|
195 |
}
|
196 |
|
197 |
+
/**
|
198 |
+
* @param WC_Order $order
|
199 |
+
*
|
200 |
+
* @retun array
|
201 |
+
* @since 3.2.4
|
202 |
+
*/
|
203 |
+
public function get_update_source_args( $order ) {
|
204 |
+
return array(
|
205 |
+
'metadata' => array(
|
206 |
+
'order_id' => $order->get_id(),
|
207 |
+
'created' => time(),
|
208 |
+
),
|
209 |
+
);
|
210 |
+
}
|
211 |
+
|
212 |
/**
|
213 |
*
|
214 |
* @param WC_Order $order
|
includes/abstract/abstract-wc-payment-gateway-stripe.php
CHANGED
@@ -285,7 +285,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
285 |
}
|
286 |
}
|
287 |
if ( ! empty( wc_stripe()->scripts()->enqueued_scripts ) ) {
|
288 |
-
wp_enqueue_style( wc_stripe()->scripts()->prefix . 'styles', wc_stripe()->assets_url( 'css/stripe.css' ), array(), wc_stripe()->version() );
|
289 |
}
|
290 |
}
|
291 |
|
285 |
}
|
286 |
}
|
287 |
if ( ! empty( wc_stripe()->scripts()->enqueued_scripts ) ) {
|
288 |
+
wp_enqueue_style( wc_stripe()->scripts()->prefix . 'styles', wc_stripe()->assets_url( 'css/stripe' . wc_stripe()->scripts()->get_min() . '.css' ), array(), wc_stripe()->version() );
|
289 |
}
|
290 |
}
|
291 |
|
includes/abstract/abstract-wc-payment-token-stripe.php
CHANGED
@@ -77,11 +77,16 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
77 |
|
78 |
/**
|
79 |
* Return a human readable representation of the payment method.
|
|
|
|
|
|
|
|
|
80 |
*/
|
81 |
public function get_payment_method_title( $format = '' ) {
|
82 |
$format = empty( $format ) ? $this->get_format() : $format;
|
83 |
$format = $this->get_formats()[ $format ]['format'];
|
84 |
$data = $this->get_props_data();
|
|
|
85 |
return apply_filters( 'wc_stripe_payment_method_title', str_replace( array_keys( $data ), $data, $format ), $this );
|
86 |
}
|
87 |
|
@@ -94,6 +99,7 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
94 |
$data[ '{' . $k . '}' ] = $this->get_prop( $k );
|
95 |
}
|
96 |
}
|
|
|
97 |
return $data;
|
98 |
}
|
99 |
|
@@ -113,6 +119,7 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
113 |
if ( is_subclass_of( get_parent_class( $instance ), 'WC_Payment_Token_Stripe' ) ) {
|
114 |
$data = array_merge( $this->get_stripe_data( get_parent_class( $instance ) ), $data );
|
115 |
}
|
|
|
116 |
return $data;
|
117 |
} catch ( Exception $e ) {
|
118 |
return array();
|
@@ -173,6 +180,7 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
173 |
public static function token_exists( $token_id, $user_id ) {
|
174 |
global $wpdb;
|
175 |
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_payment_tokens WHERE token = %s AND gateway_id LIKE %s AND user_id = %d", $token_id, '%stripe_%', $user_id ) );
|
|
|
176 |
return $count > 0;
|
177 |
}
|
178 |
}
|
77 |
|
78 |
/**
|
79 |
* Return a human readable representation of the payment method.
|
80 |
+
*
|
81 |
+
* @param string $format
|
82 |
+
*
|
83 |
+
* @retun string
|
84 |
*/
|
85 |
public function get_payment_method_title( $format = '' ) {
|
86 |
$format = empty( $format ) ? $this->get_format() : $format;
|
87 |
$format = $this->get_formats()[ $format ]['format'];
|
88 |
$data = $this->get_props_data();
|
89 |
+
|
90 |
return apply_filters( 'wc_stripe_payment_method_title', str_replace( array_keys( $data ), $data, $format ), $this );
|
91 |
}
|
92 |
|
99 |
$data[ '{' . $k . '}' ] = $this->get_prop( $k );
|
100 |
}
|
101 |
}
|
102 |
+
|
103 |
return $data;
|
104 |
}
|
105 |
|
119 |
if ( is_subclass_of( get_parent_class( $instance ), 'WC_Payment_Token_Stripe' ) ) {
|
120 |
$data = array_merge( $this->get_stripe_data( get_parent_class( $instance ) ), $data );
|
121 |
}
|
122 |
+
|
123 |
return $data;
|
124 |
} catch ( Exception $e ) {
|
125 |
return array();
|
180 |
public static function token_exists( $token_id, $user_id ) {
|
181 |
global $wpdb;
|
182 |
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_payment_tokens WHERE token = %s AND gateway_id LIKE %s AND user_id = %d", $token_id, '%stripe_%', $user_id ) );
|
183 |
+
|
184 |
return $count > 0;
|
185 |
}
|
186 |
}
|
includes/class-stripe.php
CHANGED
@@ -25,7 +25,7 @@ class WC_Stripe_Manager {
|
|
25 |
*
|
26 |
* @var string
|
27 |
*/
|
28 |
-
public $version = '3.2.
|
29 |
|
30 |
/**
|
31 |
*
|
@@ -186,6 +186,7 @@ class WC_Stripe_Manager {
|
|
186 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-googlepay.php';
|
187 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-local-payment.php';
|
188 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-ach.php';
|
|
|
189 |
|
190 |
// main classes
|
191 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-frontend-scripts.php';
|
25 |
*
|
26 |
* @var string
|
27 |
*/
|
28 |
+
public $version = '3.2.4';
|
29 |
|
30 |
/**
|
31 |
*
|
186 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-googlepay.php';
|
187 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-local-payment.php';
|
188 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-ach.php';
|
189 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-sepa.php';
|
190 |
|
191 |
// main classes
|
192 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-frontend-scripts.php';
|
includes/class-wc-stripe-field-manager.php
CHANGED
@@ -43,6 +43,9 @@ class WC_Stripe_Field_Manager {
|
|
43 |
}
|
44 |
|
45 |
public static function output_checkout_fields() {
|
|
|
|
|
|
|
46 |
do_action( 'wc_stripe_output_checkout_fields' );
|
47 |
}
|
48 |
|
43 |
}
|
44 |
|
45 |
public static function output_checkout_fields() {
|
46 |
+
if ( WC()->cart && wcs_stripe_active() && WC_Subscriptions_Cart::cart_contains_subscription() ) {
|
47 |
+
wp_add_inline_script( 'wc-checkout', 'var wc_stripe_cart_contains_subscription = true;' );
|
48 |
+
}
|
49 |
do_action( 'wc_stripe_output_checkout_fields' );
|
50 |
}
|
51 |
|
includes/class-wc-stripe-gateway-conversions.php
CHANGED
@@ -24,13 +24,20 @@ class WC_Stripe_Gateway_Conversion {
|
|
24 |
|
25 |
switch ( $payment_method ) {
|
26 |
case 'stripe':
|
|
|
|
|
|
|
|
|
|
|
27 |
$payment_method = 'stripe_cc';
|
28 |
break;
|
29 |
}
|
30 |
if ( $payment_method != $old_payment_method && ! empty( $payment_method ) ) {
|
31 |
update_post_meta( $order->get_id(), '_payment_method', $payment_method );
|
32 |
}
|
|
|
33 |
return $payment_method;
|
34 |
}
|
35 |
}
|
|
|
36 |
WC_Stripe_Gateway_Conversion::init();
|
24 |
|
25 |
switch ( $payment_method ) {
|
26 |
case 'stripe':
|
27 |
+
// Another Stripe plugin is active, don't convert $payment_method as that could affect
|
28 |
+
// checkout functionality.
|
29 |
+
if ( did_action( 'woocommerce_checkout_order_processed' ) ) {
|
30 |
+
return $payment_method;
|
31 |
+
}
|
32 |
$payment_method = 'stripe_cc';
|
33 |
break;
|
34 |
}
|
35 |
if ( $payment_method != $old_payment_method && ! empty( $payment_method ) ) {
|
36 |
update_post_meta( $order->get_id(), '_payment_method', $payment_method );
|
37 |
}
|
38 |
+
|
39 |
return $payment_method;
|
40 |
}
|
41 |
}
|
42 |
+
|
43 |
WC_Stripe_Gateway_Conversion::init();
|
includes/class-wc-stripe-payment-charge-local.php
CHANGED
@@ -30,15 +30,7 @@ class WC_Stripe_Payment_Charge_Local extends WC_Stripe_Payment_Charge {
|
|
30 |
}
|
31 |
|
32 |
// update the source's metadata with the order id
|
33 |
-
$this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->update(
|
34 |
-
$source_id,
|
35 |
-
array(
|
36 |
-
'metadata' => array(
|
37 |
-
'order_id' => $order->get_id(),
|
38 |
-
'created' => time(),
|
39 |
-
),
|
40 |
-
)
|
41 |
-
);
|
42 |
} else {
|
43 |
// create the source
|
44 |
$args = $this->payment_method->get_source_args( $order );
|
30 |
}
|
31 |
|
32 |
// update the source's metadata with the order id
|
33 |
+
$source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->update( $source_id, $this->payment_method->get_update_source_args( $order ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
} else {
|
35 |
// create the source
|
36 |
$args = $this->payment_method->get_source_args( $order );
|
includes/gateways/class-wc-payment-gateway-stripe-klarna.php
CHANGED
@@ -99,7 +99,7 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
|
|
99 |
);
|
100 |
}
|
101 |
|
102 |
-
|
103 |
$args = $this->get_source_args( $order, true );
|
104 |
unset( $args['type'], $args['currency'], $args['statement_descriptor'], $args['redirect'], $args['klarna']['product'], $args['klarna']['locale'], $args['klarna']['custom_payment_methods'] );
|
105 |
|
99 |
);
|
100 |
}
|
101 |
|
102 |
+
public function get_update_source_args( $order ) {
|
103 |
$args = $this->get_source_args( $order, true );
|
104 |
unset( $args['type'], $args['currency'], $args['statement_descriptor'], $args['redirect'], $args['klarna']['product'], $args['klarna']['locale'], $args['klarna']['custom_payment_methods'] );
|
105 |
|
includes/gateways/class-wc-payment-gateway-stripe-sepa.php
CHANGED
@@ -22,12 +22,12 @@ class WC_Payment_Gateway_Stripe_Sepa extends WC_Payment_Gateway_Stripe_Local_Pay
|
|
22 |
$this->id = 'stripe_sepa';
|
23 |
$this->tab_title = __( 'SEPA', 'woo-stripe-payment' );
|
24 |
$this->template_name = 'local-payment.php';
|
25 |
-
$this->token_type = 'Stripe_Local';
|
26 |
$this->method_title = __( 'Sepa', 'woo-stripe-payment' );
|
27 |
$this->method_description = __( 'Sepa gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
28 |
$this->icon = wc_stripe()->assets_url( 'img/sepa.svg' );
|
29 |
$this->order_button_text = $this->get_order_button_text( __( 'SEPA', 'woo-stripe-payment' ) );
|
30 |
parent::__construct();
|
|
|
31 |
|
32 |
$this->local_payment_description = sprintf(
|
33 |
__(
|
@@ -41,24 +41,53 @@ class WC_Payment_Gateway_Stripe_Sepa extends WC_Payment_Gateway_Stripe_Local_Pay
|
|
41 |
);
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
public function get_element_params() {
|
45 |
return array_merge( parent::get_element_params(), array( 'supportedCountries' => array( 'SEPA' ) ) );
|
46 |
}
|
47 |
|
48 |
public function get_local_payment_settings() {
|
49 |
return parent::get_local_payment_settings() + array(
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
}
|
59 |
|
60 |
public function get_payment_description() {
|
61 |
return parent::get_payment_description() .
|
62 |
-
|
63 |
}
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
$this->id = 'stripe_sepa';
|
23 |
$this->tab_title = __( 'SEPA', 'woo-stripe-payment' );
|
24 |
$this->template_name = 'local-payment.php';
|
|
|
25 |
$this->method_title = __( 'Sepa', 'woo-stripe-payment' );
|
26 |
$this->method_description = __( 'Sepa gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
27 |
$this->icon = wc_stripe()->assets_url( 'img/sepa.svg' );
|
28 |
$this->order_button_text = $this->get_order_button_text( __( 'SEPA', 'woo-stripe-payment' ) );
|
29 |
parent::__construct();
|
30 |
+
$this->token_type = 'Stripe_Sepa';
|
31 |
|
32 |
$this->local_payment_description = sprintf(
|
33 |
__(
|
41 |
);
|
42 |
}
|
43 |
|
44 |
+
public function init_supports() {
|
45 |
+
parent::init_supports();
|
46 |
+
$this->supports[] = 'subscriptions';
|
47 |
+
$this->supports[] = 'subscription_cancellation';
|
48 |
+
$this->supports[] = 'multiple_subscriptions';
|
49 |
+
$this->supports[] = 'subscription_reactivation';
|
50 |
+
$this->supports[] = 'subscription_suspension';
|
51 |
+
$this->supports[] = 'subscription_date_changes';
|
52 |
+
$this->supports[] = 'subscription_payment_method_change_admin';
|
53 |
+
}
|
54 |
+
|
55 |
public function get_element_params() {
|
56 |
return array_merge( parent::get_element_params(), array( 'supportedCountries' => array( 'SEPA' ) ) );
|
57 |
}
|
58 |
|
59 |
public function get_local_payment_settings() {
|
60 |
return parent::get_local_payment_settings() + array(
|
61 |
+
'company_name' => array(
|
62 |
+
'title' => __( 'Company Name', 'woo-stripe-payment' ),
|
63 |
+
'type' => 'text',
|
64 |
+
'default' => get_bloginfo( 'name' ),
|
65 |
+
'desc_tip' => true,
|
66 |
+
'description' => __( 'The name of your company that will appear in the SEPA mandate.', 'woo-stripe-payment' ),
|
67 |
+
),
|
68 |
+
);
|
69 |
}
|
70 |
|
71 |
public function get_payment_description() {
|
72 |
return parent::get_payment_description() .
|
73 |
+
sprintf( '<p><a target="_blank" href="https://stripe.com/docs/sources/sepa-debit#testing">%s</a></p>', __( 'SEPA Test Accounts', 'woo-stripe-payment' ) );
|
74 |
}
|
75 |
+
|
76 |
+
public function get_new_method_label() {
|
77 |
+
return __( 'New Account', 'woo-stripe-payment' );
|
78 |
+
}
|
79 |
+
|
80 |
+
public function get_saved_methods_label() {
|
81 |
+
return __( 'Saved Accounts', 'woo-stripe-payment' );
|
82 |
+
}
|
83 |
+
|
84 |
+
public function get_tokens() {
|
85 |
+
// always return an empty array if this is the checkout page because
|
86 |
+
// saved SEPA src's can only be used for the amount specified at source creation.
|
87 |
+
if ( is_checkout() ) {
|
88 |
+
return array();
|
89 |
+
}
|
90 |
+
|
91 |
+
return parent::get_tokens();
|
92 |
+
}
|
93 |
+
}
|
includes/tokens/class-wc-payment-token-stripe-local-payment.php
CHANGED
@@ -10,11 +10,14 @@ defined( 'ABSPATH' ) || exit();
|
|
10 |
*/
|
11 |
class WC_Payment_Token_Stripe_Local extends WC_Payment_Token_Stripe {
|
12 |
|
|
|
|
|
13 |
protected $type = 'Stripe_Local';
|
14 |
|
15 |
protected $stripe_data = array( 'gateway_title' => '' );
|
16 |
|
17 |
-
public function details_to_props( $details ) {
|
|
|
18 |
|
19 |
public function set_gateway_title( $value ) {
|
20 |
$this->set_prop( 'gateway_title', $value );
|
@@ -25,16 +28,16 @@ class WC_Payment_Token_Stripe_Local extends WC_Payment_Token_Stripe {
|
|
25 |
}
|
26 |
|
27 |
public function get_formats() {
|
28 |
-
return array(
|
29 |
'gateway_title' => array(
|
30 |
'label' => __( 'Gateway Title', 'woo-stripe-payment' ),
|
31 |
'example' => 'P24',
|
32 |
'format' => '{gateway_title}',
|
33 |
-
)
|
34 |
-
);
|
35 |
}
|
36 |
|
37 |
-
public function
|
38 |
-
|
39 |
-
|
40 |
}
|
10 |
*/
|
11 |
class WC_Payment_Token_Stripe_Local extends WC_Payment_Token_Stripe {
|
12 |
|
13 |
+
use WC_Payment_Token_Source_Trait;
|
14 |
+
|
15 |
protected $type = 'Stripe_Local';
|
16 |
|
17 |
protected $stripe_data = array( 'gateway_title' => '' );
|
18 |
|
19 |
+
public function details_to_props( $details ) {
|
20 |
+
}
|
21 |
|
22 |
public function set_gateway_title( $value ) {
|
23 |
$this->set_prop( 'gateway_title', $value );
|
28 |
}
|
29 |
|
30 |
public function get_formats() {
|
31 |
+
return apply_filters( 'wc_stripe_get_local_token_formats', array(
|
32 |
'gateway_title' => array(
|
33 |
'label' => __( 'Gateway Title', 'woo-stripe-payment' ),
|
34 |
'example' => 'P24',
|
35 |
'format' => '{gateway_title}',
|
36 |
+
)
|
37 |
+
), $this );
|
38 |
}
|
39 |
|
40 |
+
public function get_html_classes() {
|
41 |
+
return $this->get_gateway_id();
|
42 |
+
}
|
43 |
}
|
includes/tokens/class-wc-payment-token-stripe-sepa.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @since 3.2.4
|
7 |
+
* @package Stripe/Tokens
|
8 |
+
* @author PaymentPlugins
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class WC_Payment_Token_Stripe_Sepa extends WC_Payment_Token_Stripe_Local {
|
12 |
+
|
13 |
+
protected $type = 'Stripe_Sepa';
|
14 |
+
|
15 |
+
protected $stripe_data = array(
|
16 |
+
'bank_code' => '',
|
17 |
+
'last4' => '',
|
18 |
+
'mandate_url' => ''
|
19 |
+
);
|
20 |
+
|
21 |
+
public function details_to_props( $details ) {
|
22 |
+
if ( isset( $details['sepa_debit'] ) ) {
|
23 |
+
$this->set_last4( $details['sepa_debit']['last4'] );
|
24 |
+
$this->set_bank_code( $details['sepa_debit']['bank_code'] );
|
25 |
+
$this->set_mandate_url( $details['sepa_debit']['mandate_url'] );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
public function set_last4( $value ) {
|
30 |
+
$this->set_prop( 'last4', $value );
|
31 |
+
}
|
32 |
+
|
33 |
+
public function get_last4( $context = 'view' ) {
|
34 |
+
return $this->get_prop( 'last4', $context );
|
35 |
+
}
|
36 |
+
|
37 |
+
public function set_bank_code( $value ) {
|
38 |
+
$this->set_prop( 'bank_code', $value );
|
39 |
+
}
|
40 |
+
|
41 |
+
public function get_bank_code( $context = 'view' ) {
|
42 |
+
return $this->get_prop( 'bank_code', $context );
|
43 |
+
}
|
44 |
+
|
45 |
+
public function set_mandate_url( $value ) {
|
46 |
+
$this->set_prop( 'mandate_url', $value );
|
47 |
+
}
|
48 |
+
|
49 |
+
public function get_mandate_url( $context = 'view' ) {
|
50 |
+
return $this->get_prop( 'mandate_url', $context );
|
51 |
+
}
|
52 |
+
|
53 |
+
public function get_brand( $context = 'view' ) {
|
54 |
+
return __( 'SEPA', 'woo-stripe-payment' );
|
55 |
+
}
|
56 |
+
|
57 |
+
public function get_formats() {
|
58 |
+
return wp_parse_args( array(
|
59 |
+
'sepa_last4' => array(
|
60 |
+
'label' => __( 'Gateway Title', 'woo-stripe-payment' ),
|
61 |
+
'example' => 'P24',
|
62 |
+
'format' => '{gateway_title} ending in {last4}',
|
63 |
+
)
|
64 |
+
), parent::get_formats() );
|
65 |
+
}
|
66 |
+
|
67 |
+
public function get_payment_method_title( $format = '' ) {
|
68 |
+
return parent::get_payment_method_title( 'sepa_last4' );
|
69 |
+
}
|
70 |
+
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofo
|
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 3.2.
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -58,6 +58,12 @@ If you're site is not loading over https, then Stripe won't render the Payment R
|
|
58 |
8. Edit payment gateways on the product page
|
59 |
|
60 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
= 3.2.3 =
|
62 |
* Fixed - 3DS pop up on order pay page
|
63 |
* Fixed - One time use coupon error when 3DS triggered on checkout page
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 3.2.4
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
58 |
8. Edit payment gateways on the product page
|
59 |
|
60 |
== Changelog ==
|
61 |
+
= 3.2.4 =
|
62 |
+
* Fixed - Payment request button disappearing on variable product page
|
63 |
+
* Updated - Only validate visible fields on checkout page
|
64 |
+
* Update - WC tested up to 4.6.0
|
65 |
+
* Added - SEPA WooCommerce Subscriptions support
|
66 |
+
* Added - Autofocus on custom credit card forms
|
67 |
= 3.2.3 =
|
68 |
* Fixed - 3DS pop up on order pay page
|
69 |
* Fixed - One time use coupon error when 3DS triggered on checkout page
|
stripe-payments.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
* Plugin Name: Stripe For WooCommerce
|
4 |
* Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
|
5 |
* Description: Accept credit cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
|
6 |
-
* Version: 3.2.
|
7 |
* Author: Payment Plugins, support@paymentplugins.com
|
8 |
* Text Domain: woo-stripe-payment
|
9 |
* Domain Path: /i18n/languages/
|
10 |
* Tested up to: 5.5
|
11 |
* WC requires at least: 3.0.0
|
12 |
-
* WC tested up to: 4.
|
13 |
*/
|
14 |
defined( 'ABSPATH' ) || exit ();
|
15 |
|
3 |
* Plugin Name: Stripe For WooCommerce
|
4 |
* Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
|
5 |
* Description: Accept credit cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
|
6 |
+
* Version: 3.2.4
|
7 |
* Author: Payment Plugins, support@paymentplugins.com
|
8 |
* Text Domain: woo-stripe-payment
|
9 |
* Domain Path: /i18n/languages/
|
10 |
* Tested up to: 5.5
|
11 |
* WC requires at least: 3.0.0
|
12 |
+
* WC tested up to: 4.6.0
|
13 |
*/
|
14 |
defined( 'ABSPATH' ) || exit ();
|
15 |
|