Version Description
- 2018-01-11 =
- Fix - Add payment method conflict with terms and agreement page.
- Fix - Checkout validation checkout field names/labels were not translated.
- Fix - Card error translations.
- Add - Deprecated Apple Pay Class to prevent errors.
Download this release
Release Info
Developer | royho |
Plugin | WooCommerce Stripe Payment Gateway |
Version | 4.0.1 |
Comparing to | |
See all releases |
Code changes from version 4.0.0 to 4.0.1
- apple-developer-merchantid-domain-association +0 -0
- assets/css/stripe-paymentfonts.css +1 -1
- assets/js/stripe-admin.js +0 -0
- assets/js/stripe-payment-request.min.js +1 -1
- assets/js/stripe.js +18 -1
- assets/js/stripe.min.js +1 -1
- changelog.txt +7 -1
- includes/class-wc-gateway-stripe.php +1 -0
- includes/class-wc-stripe-api.php +0 -0
- includes/class-wc-stripe-customer.php +0 -0
- includes/class-wc-stripe-helper.php +16 -12
- includes/class-wc-stripe-order-handler.php +32 -17
- includes/deprecated/class-wc-stripe-apple-pay.php +30 -0
- readme.txt +14 -14
- woocommerce-gateway-stripe.php +5 -2
apple-developer-merchantid-domain-association
CHANGED
File without changes
|
assets/css/stripe-paymentfonts.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
/*!
|
2 |
-
* PaymentFont 1.2.5 by @AMPoellmann - http://paymentfont.
|
3 |
* License - http://paymentfont.io/#license (Font: SIL OFL 1.1, CSS: MIT License)
|
4 |
*/@font-face{font-family:PaymentFont;src:url(../paymentfonts/paymentfont-webfont.eot);src:url(../paymentfonts/paymentfont-webfont.eot?#iefix) format('embedded-opentype'),url(../paymentfonts/paymentfont-webfont.woff) format('woff2'),url(../paymentfonts/paymentfont-webfont.woff) format('woff'),url(../paymentfonts/paymentfont-webfont.ttf) format('truetype'),url(../paymentfonts/paymentfont-webfont.svg#paymentfont-webfont) format('svg');font-weight:400;font-style:normal}.stripe-pf{display:inline-block;font:normal normal normal 14px/1 PaymentFont;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:1.2em}.stripe-pf-right{float:right}.stripe-pf-left{float:left}.stripe-pf-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.stripe-pf-2x{font-size:2em}.stripe-pf-3x{font-size:3em}.stripe-pf-4x{font-size:4em}.stripe-pf-5x{font-size:5em}.stripe-pf-amazon:before{content:"\f000"}.stripe-pf-american-express:before{content:"\f001"}.stripe-pf-american-express-alt:before{content:"\f002"}.stripe-pf-atm:before{content:"\f003"}.stripe-pf-bankomat:before{content:"\f004"}.stripe-pf-bank-transfer:before{content:"\f005"}.stripe-pf-bitcoin:before{content:"\f006"}.stripe-pf-bitcoin-sign:before{content:"\f007"}.stripe-pf-braintree:before{content:"\f008"}.stripe-pf-btc:before{content:"\f009"}.stripe-pf-card:before{content:"\f00a"}.stripe-pf-carta-si:before{content:"\f00b"}.stripe-pf-cash:before{content:"\f00c"}.stripe-pf-cash-on-delivery:before{content:"\f00d"}.stripe-pf-cb:before{content:"\f00e"}.stripe-pf-cirrus:before{content:"\f00f"}.stripe-pf-cirrus-alt:before{content:"\f010"}.stripe-pf-clickandbuy:before{content:"\f011"}.stripe-pf-credit-card:before{content:"\f012"}.stripe-pf-diners:before{content:"\f013"}.stripe-pf-discover:before{content:"\f014"}.stripe-pf-ec:before{content:"\f015"}.stripe-pf-eps:before{content:"\f016"}.stripe-pf-eur:before{content:"\f017"}.stripe-pf-facture:before{content:"\f018"}.stripe-pf-fattura:before{content:"\f019"}.stripe-pf-flattr:before{content:"\f01a"}.stripe-pf-giropay:before{content:"\f01b"}.stripe-pf-google-wallet:before{content:"\f01c"}.stripe-pf-google-wallet-alt:before{content:"\f01d"}.stripe-pf-gpb:before{content:"\f01e"}.stripe-pf-gratipay:before{content:"\f01f"}.stripe-pf-ideal:before{content:"\f020"}.stripe-pf-ils:before{content:"\f021"}.stripe-pf-inr:before{content:"\f022"}.stripe-pf-invoice:before{content:"\f023"}.stripe-pf-invoice-sign:before{content:"\f024"}.stripe-pf-invoice-sign-alt:before{content:"\f025"}.stripe-pf-invoice-sign-alt-o:before{content:"\f026"}.stripe-pf-invoice-sign-o:before{content:"\f027"}.stripe-pf-jcb:before{content:"\f028"}.stripe-pf-jpy:before{content:"\f029"}.stripe-pf-krw:before{content:"\f02a"}.stripe-pf-maestro:before{content:"\f02b"}.stripe-pf-maestro-alt:before{content:"\f02c"}.stripe-pf-mastercard:before{content:"\f02d"}.stripe-pf-mastercard-alt:before{content:"\f02e"}.stripe-pf-mastercard-securecode:before{content:"\f02f"}.stripe-pf-ogone:before{content:"\f030"}.stripe-pf-paybox:before{content:"\f031"}.stripe-pf-paylife:before{content:"\f032"}.stripe-pf-paypal:before{content:"\f033"}.stripe-pf-paypal-alt:before{content:"\f034"}.stripe-pf-paysafecard:before{content:"\f035"}.stripe-pf-postepay:before{content:"\f036"}.stripe-pf-quick:before{content:"\f037"}.stripe-pf-rechnung:before{content:"\f038"}.stripe-pf-ripple:before{content:"\f039"}.stripe-pf-rub:before{content:"\f03a"}.stripe-pf-skrill:before{content:"\f03b"}.stripe-pf-sofort:before{content:"\f03c"}.stripe-pf-square:before{content:"\f03d"}.stripe-pf-stripe:before{content:"\f03e"}.stripe-pf-truste:before{content:"\f03f"}.stripe-pf-try:before{content:"\f040"}.stripe-pf-unionpay:before{content:"\f041"}.stripe-pf-usd:before{content:"\f042"}.stripe-pf-verified-by-visa:before{content:"\f043"}.stripe-pf-verisign:before{content:"\f044"}.stripe-pf-visa:before{content:"\f045"}.stripe-pf-visa-electron:before{content:"\f046"}.stripe-pf-western-union:before{content:"\f047"}.stripe-pf-western-union-alt:before{content:"\f048"}.stripe-pf-wirecard:before{content:"\f049"}.stripe-pf-sepa:before{content:"\f04a"}.stripe-pf-sepa-alt:before{content:"\f04b"}.stripe-pf-apple-pay:before{content:"\f04c"}.stripe-pf-interac:before{content:"\f04d"}.stripe-pf-paymill:before{content:"\f04e"}.stripe-pf-dankort:before{content:"\f04f"}.stripe-pf-bancontact-mister-cash:before{content:"\f050"}.stripe-pf-moip:before{content:"\f051"}.stripe-pf-pagseguro:before{content:"\f052"}.stripe-pf-cash-on-pickup:before{content:"\f053"}.stripe-pf-sage:before{content:"\f054"}.stripe-pf-elo:before{content:"\f055"}.stripe-pf-elo-alt:before{content:"\f056"}.stripe-pf-payu:before{content:"\f057"}.stripe-pf-mercado-pago:before{content:"\f058"}.stripe-pf-mercado-pago-sign:before{content:"\f059"}.stripe-pf-payshop:before{content:"\f05a"}.stripe-pf-multibanco:before{content:"\f05b"}.stripe-pf-gratipay-sign:before{content:"\f05c"}.stripe-pf-six:before{content:"\f05d"}.stripe-pf-cashcloud:before{content:"\f05e"}.stripe-pf-interac-alt:before{content:"\f05f"}.stripe-pf-klarna:before{content:"\f060"}.stripe-pf-bitpay:before{content:"\f061"}.stripe-pf-venmo:before{content:"\f062"}.stripe-pf-visa-debit:before{content:"\f063"}.stripe-pf-alipay:before{content:"\f064"}.stripe-pf-diners-alt:before{content:"\f065"}.stripe-pf-hipercard:before{content:"\f066"}.stripe-pf-skrill-alt:before{content:"\f067"}.stripe-pf-shopify:before{content:"\f068"}.stripe-pf-direct-debit:before{content:"\f069"}.stripe-pf-sodexo:before{content:"\f06a"}.stripe-pf-bpay:before{content:"\f06b"}.stripe-pf-contactless:before{content:"\f06c"}.stripe-pf-contactless-alt:before{content:"\f06d"}.stripe-pf-eth:before{content:"\f06e"}.stripe-pf-ltc:before{content:"\f06f"}.stripe-pf-visa-pay:before{content:"\f070"}.stripe-pf-wechat-pay:before{content:"\f071"}.stripe-pf-amazon-pay:before{content:"\f072"}.stripe-pf-amazon-pay-alt:before{content:"\f073"}.stripe-pf-p24{background-image:url(../images/p24.svg);background-repeat:no-repeat;width:2.5em;height:2.5em}
|
1 |
/*!
|
2 |
+
* PaymentFont 1.2.5 by @AMPoellmann - http://paymentfont.com
|
3 |
* License - http://paymentfont.io/#license (Font: SIL OFL 1.1, CSS: MIT License)
|
4 |
*/@font-face{font-family:PaymentFont;src:url(../paymentfonts/paymentfont-webfont.eot);src:url(../paymentfonts/paymentfont-webfont.eot?#iefix) format('embedded-opentype'),url(../paymentfonts/paymentfont-webfont.woff) format('woff2'),url(../paymentfonts/paymentfont-webfont.woff) format('woff'),url(../paymentfonts/paymentfont-webfont.ttf) format('truetype'),url(../paymentfonts/paymentfont-webfont.svg#paymentfont-webfont) format('svg');font-weight:400;font-style:normal}.stripe-pf{display:inline-block;font:normal normal normal 14px/1 PaymentFont;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:1.2em}.stripe-pf-right{float:right}.stripe-pf-left{float:left}.stripe-pf-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.stripe-pf-2x{font-size:2em}.stripe-pf-3x{font-size:3em}.stripe-pf-4x{font-size:4em}.stripe-pf-5x{font-size:5em}.stripe-pf-amazon:before{content:"\f000"}.stripe-pf-american-express:before{content:"\f001"}.stripe-pf-american-express-alt:before{content:"\f002"}.stripe-pf-atm:before{content:"\f003"}.stripe-pf-bankomat:before{content:"\f004"}.stripe-pf-bank-transfer:before{content:"\f005"}.stripe-pf-bitcoin:before{content:"\f006"}.stripe-pf-bitcoin-sign:before{content:"\f007"}.stripe-pf-braintree:before{content:"\f008"}.stripe-pf-btc:before{content:"\f009"}.stripe-pf-card:before{content:"\f00a"}.stripe-pf-carta-si:before{content:"\f00b"}.stripe-pf-cash:before{content:"\f00c"}.stripe-pf-cash-on-delivery:before{content:"\f00d"}.stripe-pf-cb:before{content:"\f00e"}.stripe-pf-cirrus:before{content:"\f00f"}.stripe-pf-cirrus-alt:before{content:"\f010"}.stripe-pf-clickandbuy:before{content:"\f011"}.stripe-pf-credit-card:before{content:"\f012"}.stripe-pf-diners:before{content:"\f013"}.stripe-pf-discover:before{content:"\f014"}.stripe-pf-ec:before{content:"\f015"}.stripe-pf-eps:before{content:"\f016"}.stripe-pf-eur:before{content:"\f017"}.stripe-pf-facture:before{content:"\f018"}.stripe-pf-fattura:before{content:"\f019"}.stripe-pf-flattr:before{content:"\f01a"}.stripe-pf-giropay:before{content:"\f01b"}.stripe-pf-google-wallet:before{content:"\f01c"}.stripe-pf-google-wallet-alt:before{content:"\f01d"}.stripe-pf-gpb:before{content:"\f01e"}.stripe-pf-gratipay:before{content:"\f01f"}.stripe-pf-ideal:before{content:"\f020"}.stripe-pf-ils:before{content:"\f021"}.stripe-pf-inr:before{content:"\f022"}.stripe-pf-invoice:before{content:"\f023"}.stripe-pf-invoice-sign:before{content:"\f024"}.stripe-pf-invoice-sign-alt:before{content:"\f025"}.stripe-pf-invoice-sign-alt-o:before{content:"\f026"}.stripe-pf-invoice-sign-o:before{content:"\f027"}.stripe-pf-jcb:before{content:"\f028"}.stripe-pf-jpy:before{content:"\f029"}.stripe-pf-krw:before{content:"\f02a"}.stripe-pf-maestro:before{content:"\f02b"}.stripe-pf-maestro-alt:before{content:"\f02c"}.stripe-pf-mastercard:before{content:"\f02d"}.stripe-pf-mastercard-alt:before{content:"\f02e"}.stripe-pf-mastercard-securecode:before{content:"\f02f"}.stripe-pf-ogone:before{content:"\f030"}.stripe-pf-paybox:before{content:"\f031"}.stripe-pf-paylife:before{content:"\f032"}.stripe-pf-paypal:before{content:"\f033"}.stripe-pf-paypal-alt:before{content:"\f034"}.stripe-pf-paysafecard:before{content:"\f035"}.stripe-pf-postepay:before{content:"\f036"}.stripe-pf-quick:before{content:"\f037"}.stripe-pf-rechnung:before{content:"\f038"}.stripe-pf-ripple:before{content:"\f039"}.stripe-pf-rub:before{content:"\f03a"}.stripe-pf-skrill:before{content:"\f03b"}.stripe-pf-sofort:before{content:"\f03c"}.stripe-pf-square:before{content:"\f03d"}.stripe-pf-stripe:before{content:"\f03e"}.stripe-pf-truste:before{content:"\f03f"}.stripe-pf-try:before{content:"\f040"}.stripe-pf-unionpay:before{content:"\f041"}.stripe-pf-usd:before{content:"\f042"}.stripe-pf-verified-by-visa:before{content:"\f043"}.stripe-pf-verisign:before{content:"\f044"}.stripe-pf-visa:before{content:"\f045"}.stripe-pf-visa-electron:before{content:"\f046"}.stripe-pf-western-union:before{content:"\f047"}.stripe-pf-western-union-alt:before{content:"\f048"}.stripe-pf-wirecard:before{content:"\f049"}.stripe-pf-sepa:before{content:"\f04a"}.stripe-pf-sepa-alt:before{content:"\f04b"}.stripe-pf-apple-pay:before{content:"\f04c"}.stripe-pf-interac:before{content:"\f04d"}.stripe-pf-paymill:before{content:"\f04e"}.stripe-pf-dankort:before{content:"\f04f"}.stripe-pf-bancontact-mister-cash:before{content:"\f050"}.stripe-pf-moip:before{content:"\f051"}.stripe-pf-pagseguro:before{content:"\f052"}.stripe-pf-cash-on-pickup:before{content:"\f053"}.stripe-pf-sage:before{content:"\f054"}.stripe-pf-elo:before{content:"\f055"}.stripe-pf-elo-alt:before{content:"\f056"}.stripe-pf-payu:before{content:"\f057"}.stripe-pf-mercado-pago:before{content:"\f058"}.stripe-pf-mercado-pago-sign:before{content:"\f059"}.stripe-pf-payshop:before{content:"\f05a"}.stripe-pf-multibanco:before{content:"\f05b"}.stripe-pf-gratipay-sign:before{content:"\f05c"}.stripe-pf-six:before{content:"\f05d"}.stripe-pf-cashcloud:before{content:"\f05e"}.stripe-pf-interac-alt:before{content:"\f05f"}.stripe-pf-klarna:before{content:"\f060"}.stripe-pf-bitpay:before{content:"\f061"}.stripe-pf-venmo:before{content:"\f062"}.stripe-pf-visa-debit:before{content:"\f063"}.stripe-pf-alipay:before{content:"\f064"}.stripe-pf-diners-alt:before{content:"\f065"}.stripe-pf-hipercard:before{content:"\f066"}.stripe-pf-skrill-alt:before{content:"\f067"}.stripe-pf-shopify:before{content:"\f068"}.stripe-pf-direct-debit:before{content:"\f069"}.stripe-pf-sodexo:before{content:"\f06a"}.stripe-pf-bpay:before{content:"\f06b"}.stripe-pf-contactless:before{content:"\f06c"}.stripe-pf-contactless-alt:before{content:"\f06d"}.stripe-pf-eth:before{content:"\f06e"}.stripe-pf-ltc:before{content:"\f06f"}.stripe-pf-visa-pay:before{content:"\f070"}.stripe-pf-wechat-pay:before{content:"\f071"}.stripe-pf-amazon-pay:before{content:"\f072"}.stripe-pf-amazon-pay-alt:before{content:"\f073"}.stripe-pf-p24{background-image:url(../images/p24.svg);background-repeat:no-repeat;width:2.5em;height:2.5em}
|
assets/js/stripe-admin.js
CHANGED
File without changes
|
assets/js/stripe-payment-request.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(a){"use strict";var b=Stripe(wc_stripe_payment_request_params.stripe.key),c={getAjaxURL:function(a){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+a)},getCartDetails:function(b){var d={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:d,url:c.getAjaxURL("get_cart_details"),success:function(a){b.update({total:a.order_data.total})}})},getAttributes:function(){var b=a(".variations_form").find(".variations select"),c={},d=0,e=0;return b.each(function(){var b=a(this).data("attribute_name")||a(this).attr("name"),f=a(this).val()||"";f.length>0&&e++,d++,c[b]=f}),{count:d,chosenCount:e,data:c}},processSource:function(b,d){var e=c.getOrderData(b,d);return a.ajax({type:"POST",data:e,dataType:"json",url:c.getAjaxURL("create_order")})},getOrderData:function(a,b){var c=a.source,d=c.owner.email,e=c.owner.phone,f=c.owner.address,g=c.owner.name,h=a.shippingAddress,i={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==g?g.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==g?g.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==d?d:a.payerEmail,billing_phone:null!==e?e:a.payerPhone.replace("/[() -]/g",""),billing_country:null!==f?f.country:"",billing_address_1:null!==f?f.line1:"",billing_address_2:null!==f?f.line2:"",billing_city:null!==f?f.city:"",billing_state:null!==f?f.state:"",billing_postcode:null!==f?f.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===a.shippingOption?null:a.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:JSON.stringify(c),payment_request_type:b};return h&&(i.shipping_first_name=h.recipient.split(" ").slice(0,1).join(" "),i.shipping_last_name=h.recipient.split(" ").slice(1).join(" "),i.shipping_company=h.organization,i.shipping_country=h.country,i.shipping_address_1=
|
1 |
+
jQuery(function(a){"use strict";var b=Stripe(wc_stripe_payment_request_params.stripe.key),c={getAjaxURL:function(a){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+a)},getCartDetails:function(b){var d={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:d,url:c.getAjaxURL("get_cart_details"),success:function(a){b.update({total:a.order_data.total})}})},getAttributes:function(){var b=a(".variations_form").find(".variations select"),c={},d=0,e=0;return b.each(function(){var b=a(this).data("attribute_name")||a(this).attr("name"),f=a(this).val()||"";f.length>0&&e++,d++,c[b]=f}),{count:d,chosenCount:e,data:c}},processSource:function(b,d){var e=c.getOrderData(b,d);return a.ajax({type:"POST",data:e,dataType:"json",url:c.getAjaxURL("create_order")})},getOrderData:function(a,b){var c=a.source,d=c.owner.email,e=c.owner.phone,f=c.owner.address,g=c.owner.name,h=a.shippingAddress,i={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==g?g.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==g?g.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==d?d:a.payerEmail,billing_phone:null!==e?e:a.payerPhone.replace("/[() -]/g",""),billing_country:null!==f?f.country:"",billing_address_1:null!==f?f.line1:"",billing_address_2:null!==f?f.line2:"",billing_city:null!==f?f.city:"",billing_state:null!==f?f.state:"",billing_postcode:null!==f?f.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===a.shippingOption?null:a.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:JSON.stringify(c),payment_request_type:b};return h&&(i.shipping_first_name=h.recipient.split(" ").slice(0,1).join(" "),i.shipping_last_name=h.recipient.split(" ").slice(1).join(" "),i.shipping_company=h.organization,i.shipping_country=h.country,i.shipping_address_1=void 0===h.addressLine[0]?"":h.addressLine[0],i.shipping_address_2=void 0===h.addressLine[1]?"":h.addressLine[1],i.shipping_city=h.city,i.shipping_state=h.region,i.shipping_postcode=h.postalCode),i},getErrorMessageHTML:function(b){return a('<div class="woocommerce-error" />').text(b)},abortPayment:function(b,c){if(b.complete("fail"),a(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var d=a(".product");d.before(c),a("html, body").animate({scrollTop:d.prev(".woocommerce-error").offset().top},600)}else{var e=a(".shop_table.cart").closest("form");e.before(c),a("html, body").animate({scrollTop:e.prev(".woocommerce-error").offset().top},600)}},completePayment:function(a,b){c.block(),a.complete("success"),window.location=b},block:function(){a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(b,d){var e={security:wc_stripe_payment_request_params.nonce.shipping,country:d.country,state:d.region,postcode:d.postalCode,city:d.city,address:void 0===d.addressLine[0]?"":d.addressLine[0],address_2:void 0===d.addressLine[1]?"":d.addressLine[1]};return a.ajax({type:"POST",data:e,url:c.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(b,d){var e={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[d.id]};return a.ajax({type:"POST",data:e,url:c.getAjaxURL("update_shipping_method")})},addToCart:function(){var b=a(".single_add_to_cart_button").val();a(".single_variation_wrap").length&&(b=a(".single_variation_wrap").find('input[name="product_id"]').val());var d={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:b,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?c.getAttributes().data:[]};return a.ajax({type:"POST",data:d,url:c.getAjaxURL("add_to_cart")})},clearCart:function(){var b={security:wc_stripe_payment_request_params.nonce.clear_cart};return a.ajax({type:"POST",data:b,url:c.getAjaxURL("clear_cart"),success:function(a){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(d){var e,f;wc_stripe_payment_request_params.is_product_page?(f=c.getRequestOptionsFromLocal(),e=f):(f={total:d.order_data.total,currency:d.order_data.currency,country:d.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:!!d.shipping_required,displayItems:d.order_data.displayItems},e=d.order_data);var g=b.paymentRequest(f),h="",i=b.elements({locale:wc_stripe_payment_request_params.button.locale}),j=i.create("paymentRequestButton",{paymentRequest:g,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}});g.canMakePayment().then(function(b){if(b){if(h=b.applePay?"apple_pay":"payment_request_api",wc_stripe_payment_request_params.is_product_page){var d=a(".single_add_to_cart_button");j.on("click",function(a){d.is(".disabled")?(a.preventDefault(),d.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):d.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)):c.addToCart()}),a(document.body).on("woocommerce_variation_has_changed",function(){a("#wc-stripe-payment-request-button").block({message:null}),a.when(c.getSelectedProductData()).then(function(b){a.when(g.update({total:b.total,displayItems:b.displayItems})).then(function(){a("#wc-stripe-payment-request-button").unblock()})})}),a(".quantity").on("change",".qty",function(){a("#wc-stripe-payment-request-button").block({message:null}),a.when(c.getSelectedProductData()).then(function(b){a.when(g.update({total:b.total,displayItems:b.displayItems})).then(function(){a("#wc-stripe-payment-request-button").unblock()})})})}a("#wc-stripe-payment-request-button").length&&(j.mount("#wc-stripe-payment-request-button"),a("#wc-stripe-payment-request-button-separator").show())}else a("#wc-stripe-payment-request-button").hide(),a("#wc-stripe-payment-request-button-separator").hide()}),g.on("shippingaddresschange",function(b){a.when(c.updateShippingOptions(e,b.shippingAddress)).then(function(a){b.updateWith({status:a.result,shippingOptions:a.shipping_options,total:a.total,displayItems:a.displayItems})})}),g.on("shippingoptionchange",function(b){a.when(c.updateShippingDetails(e,b.shippingOption)).then(function(a){"success"===a.result&&b.updateWith({status:"success",total:a.total,displayItems:a.displayItems}),"fail"===a.result&&b.updateWith({status:"fail"})})}),g.on("source",function(b){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===b.source.card.funding?c.abortPayment(b,c.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):a.when(c.processSource(b,h)).then(function(a){"success"===a.result?c.completePayment(b,a.redirect):c.abortPayment(b,a.messages)})})},getSelectedProductData:function(){var b=a(".single_add_to_cart_button").val();a(".single_variation_wrap").length&&(b=a(".single_variation_wrap").find('input[name="product_id"]').val());var d={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:b,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?c.getAttributes().data:[]};return a.ajax({type:"POST",data:d,url:c.getAjaxURL("get_selected_product_data")})},init:function(){var b={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:b,url:c.getAjaxURL("get_cart_details"),success:function(a){c.startPaymentRequest(a)}})}};c.init(),a(document.body).on("updated_cart_totals",function(){c.init()}),a(document.body).on("updated_checkout",function(){c.init()})});
|
assets/js/stripe.js
CHANGED
@@ -369,6 +369,10 @@ jQuery( function( $ ) {
|
|
369 |
message = wc_stripe_params[ result.error.code ];
|
370 |
}
|
371 |
|
|
|
|
|
|
|
|
|
372 |
wc_stripe_form.reset();
|
373 |
console.log( result.error.message ); // Leave for troubleshooting.
|
374 |
$( errorContainer ).html( '<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li>' + message + '</li></ul>' );
|
@@ -389,6 +393,18 @@ jQuery( function( $ ) {
|
|
389 |
extra_details.owner.email = $( '#billing_email' ).val();
|
390 |
extra_details.owner.phone = $( '#billing_phone' ).val();
|
391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
if ( $( '#billing_address_1' ).length > 0 ) {
|
393 |
extra_details.owner.address.line1 = $( '#billing_address_1' ).val();
|
394 |
extra_details.owner.address.line2 = $( '#billing_address_2' ).val();
|
@@ -723,7 +739,8 @@ jQuery( function( $ ) {
|
|
723 |
'nonce': wc_stripe_params.stripe_nonce,
|
724 |
'required_fields': wc_stripe_form.getRequiredFields().serialize(),
|
725 |
'all_fields': wc_stripe_form.form.serialize(),
|
726 |
-
'source_type': wc_stripe_form.getSelectedPaymentElement().val()
|
|
|
727 |
};
|
728 |
|
729 |
$.ajax({
|
369 |
message = wc_stripe_params[ result.error.code ];
|
370 |
}
|
371 |
|
372 |
+
if ( 'validation_error' === result.error.type && wc_stripe_params.hasOwnProperty( result.error.code ) ) {
|
373 |
+
message = wc_stripe_params[ result.error.code ];
|
374 |
+
}
|
375 |
+
|
376 |
wc_stripe_form.reset();
|
377 |
console.log( result.error.message ); // Leave for troubleshooting.
|
378 |
$( errorContainer ).html( '<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li>' + message + '</li></ul>' );
|
393 |
extra_details.owner.email = $( '#billing_email' ).val();
|
394 |
extra_details.owner.phone = $( '#billing_phone' ).val();
|
395 |
|
396 |
+
/* Stripe does not like empty string values so
|
397 |
+
* we need to remove the parameter if we're not
|
398 |
+
* passing any value.
|
399 |
+
*/
|
400 |
+
if ( typeof extra_details.owner.phone !== 'undefined' && 0 >= extra_details.owner.phone.length ) {
|
401 |
+
delete extra_details.owner.phone;
|
402 |
+
}
|
403 |
+
|
404 |
+
if ( typeof extra_details.owner.email !== 'undefined' && 0 >= extra_details.owner.email.length ) {
|
405 |
+
delete extra_details.owner.email;
|
406 |
+
}
|
407 |
+
|
408 |
if ( $( '#billing_address_1' ).length > 0 ) {
|
409 |
extra_details.owner.address.line1 = $( '#billing_address_1' ).val();
|
410 |
extra_details.owner.address.line2 = $( '#billing_address_2' ).val();
|
739 |
'nonce': wc_stripe_params.stripe_nonce,
|
740 |
'required_fields': wc_stripe_form.getRequiredFields().serialize(),
|
741 |
'all_fields': wc_stripe_form.form.serialize(),
|
742 |
+
'source_type': wc_stripe_form.getSelectedPaymentElement().val(),
|
743 |
+
'is_add_payment_page': wc_stripe_params.is_add_payment_method_page
|
744 |
};
|
745 |
|
746 |
$.ajax({
|
assets/js/stripe.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(a){"use strict";var b=Stripe(wc_stripe_params.key);if("yes"===wc_stripe_params.use_elements)var c,d,e,f=b.elements();var g={getAjaxURL:function(a){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+a)},init:function(){"yes"===wc_stripe_params.is_change_payment_page&&a(document.body).trigger("wc-credit-card-form-init"),this.stripe_checkout_submit=!1,a("form.woocommerce-checkout").length&&(this.form=a("form.woocommerce-checkout")),a("form.woocommerce-checkout").on("checkout_place_order_stripe checkout_place_order_stripe_bancontact checkout_place_order_stripe_sofort checkout_place_order_stripe_giropay checkout_place_order_stripe_ideal checkout_place_order_stripe_alipay checkout_place_order_stripe_sepa checkout_place_order_stripe_bitcoin",this.onSubmit),a("form#order_review").length&&(this.form=a("form#order_review")),a("form#order_review").on("submit",this.onSubmit),a("form#add_payment_method").length&&(this.form=a("form#add_payment_method")),a("form#add_payment_method").on("submit",this.onSubmit),a("form.woocommerce-checkout").on("change","#stripe-bank-country",this.reset),a(document).on("stripeError",this.onError).on("checkout_error",this.reset);var b={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},h={focus:"focused",empty:"empty",invalid:"invalid"};"yes"===wc_stripe_params.use_elements&&a("#stripe-card-element").length&&(b=wc_stripe_params.elements_styling?wc_stripe_params.elements_styling:b,h=wc_stripe_params.elements_classes?wc_stripe_params.elements_classes:h,"yes"===wc_stripe_params.inline_cc_form?(c=f.create("card",{style:b,hidePostalCode:!0}),c.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})):(c=f.create("cardNumber",{style:b,classes:h}),d=f.create("cardExpiry",{style:b,classes:h}),e=f.create("cardCvc",{style:b,classes:h}),c.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),d.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),e.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})),wc_stripe_params.is_checkout?a(document.body).on("updated_checkout",function(){c&&("yes"===wc_stripe_params.inline_cc_form?c.unmount("#stripe-card-element"):(c.unmount("#stripe-card-element"),d.unmount("#stripe-exp-element"),e.unmount("#stripe-cvc-element"))),"yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))}):(a("form#add_payment_method").length||a("form#order_review").length)&&("yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))))},isStripeChosen:function(){return a("#payment_method_stripe, #payment_method_stripe_bancontact, #payment_method_stripe_sofort, #payment_method_stripe_giropay, #payment_method_stripe_ideal, #payment_method_stripe_alipay, #payment_method_stripe_sepa, #payment_method_stripe_bitcoin").is(":checked")||"new"===a('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return a("#payment_method_stripe").is(":checked")&&a('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe-payment-token"]:checked').val()||a("#payment_method_stripe_sepa").is(":checked")&&a('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return a("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return a("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return a("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return a("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return a("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return a("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return a("#payment_method_stripe_sepa").is(":checked")},isBitcoinChosen:function(){return a("#payment_method_stripe_bitcoin").is(":checked")},hasSource:function(){return 0<a("input.stripe-source").length},hasToken:function(){return 0<a("input.stripe_token").length},isMobile:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?!0:!1},isStripeModalNeeded:function(a){var b=g.form.find("input.stripe_token");return g.stripe_submit&&b?!1:g.isStripeChosen()?!0:!1},block:function(){g.isMobile()?a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}}):g.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){g.isMobile()?a.unblockUI():g.form.unblock()},getSelectedPaymentElement:function(){return a('.payment_methods input[name="payment_method"]:checked')},openModal:function(){var b=g.form,c=a("#stripe-payment-data"),d=b.find("input.stripe_token");d.val("");var e=function(c){b.find("input.stripe_token").remove(),b.append('<input type="hidden" class="stripe_token" name="stripe_token" value="'+c.id+'"/>'),b.append("<input type='hidden' class='stripe-checkout-object' name='stripe_checkout_object' value='"+g.prepareSourceToServer(c)+"'/>"),g.stripe_submit=!0,a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),b.submit()};StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address,amount:c.data("amount"),name:c.data("name"),description:c.data("description"),currency:c.data("currency"),image:c.data("image"),bitcoin:c.data("bitcoin"),locale:c.data("locale"),email:a("#billing_email").val()||c.data("email"),panelLabel:c.data("panel-label"),allowRememberMe:c.data("allow-remember-me"),token:e,closed:g.onClose()})},resetModal:function(){g.reset(),g.stripe_checkout_submit=!1},onClose:function(){g.unblock()},onError:function(b,c){var d=c.error.message,e=g.getSelectedPaymentElement().parent(".wc_payment_method, .woocommerce-PaymentMethod").find(".stripe-source-errors");("invalid_request_error"===c.error.type||"api_connection_error"===c.error.type||"api_error"===c.error.type||"authentication_error"===c.error.type||"rate_limit_error"===c.error.type)&&(d=wc_stripe_params.invalid_request_error),"card_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),g.reset(),console.log(c.error.message),a(e).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li>'+d+"</li></ul>"),g.unblock()},getOwnerDetails:function(){var b=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,c=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,d={owner:{name:"",address:{},email:"",phone:""}};return d.owner.name=b,b&&c&&(d.owner.name=b+" "+c),d.owner.email=a("#billing_email").val(),d.owner.phone=a("#billing_phone").val(),a("#billing_address_1").length>0?(d.owner.address.line1=a("#billing_address_1").val(),d.owner.address.line2=a("#billing_address_2").val(),d.owner.address.state=a("#billing_state").val(),d.owner.address.city=a("#billing_city").val(),d.owner.address.postal_code=a("#billing_postcode").val(),d.owner.address.country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(d.owner.address.line1=wc_stripe_params.billing_address_1,d.owner.address.line2=wc_stripe_params.billing_address_2,d.owner.address.state=wc_stripe_params.billing_state,d.owner.address.city=wc_stripe_params.billing_city,d.owner.address.postal_code=wc_stripe_params.billing_postcode,d.owner.address.country=wc_stripe_params.billing_country),d},createSource:function(){var d=g.getOwnerDetails(),e="card";if(g.isBancontactChosen()&&(e="bancontact"),g.isSepaChosen()&&(e="sepa_debit"),g.isIdealChosen()&&(e="ideal"),g.isSofortChosen()&&(e="sofort"),g.isBitcoinChosen()&&(e="bitcoin"),g.isGiropayChosen()&&(e="giropay"),g.isAlipayChosen()&&(e="alipay"),"card"===e)b.createSource(c,d).then(g.sourceResponse);else{switch(e){case"bancontact":case"giropay":case"ideal":case"sofort":case"alipay":d.amount=a("#stripe-"+e+"-payment-data").data("amount"),d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.redirect={return_url:wc_stripe_params.return_url},wc_stripe_params.statement_descriptor&&(d.statement_descriptor=wc_stripe_params.statement_descriptor)}switch(e){case"sepa_debit":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.owner.name=a("#stripe-sepa-owner").val(),d.sepa_debit={iban:a("#stripe-sepa-iban").val()};break;case"ideal":d.ideal={bank:a("#stripe-ideal-bank").val()};break;case"sofort":d.sofort={country:a("#stripe-sofort-country").val()};break;case"bitcoin":case"alipay":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.amount=a("#stripe-"+e+"-payment-data").data("amount")}d.type=e,b.createSource(d).then(g.sourceResponse)}},sourceResponse:function(b){b.error?a(document.body).trigger("stripeError",b):"no"===wc_stripe_params.allow_prepaid_card&&"card"===b.source.type&&"prepaid"===b.source.card.funding?(b.error={message:wc_stripe_params.no_prepaid_card_msg},a(document.body).trigger("stripeError",b)):g.processStripeResponse(b.source)},createToken:function(){var b=a("#stripe-card-number").val(),c=a("#stripe-card-cvc").val(),d=a("#stripe-card-expiry").payment("cardExpiryVal"),e=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,f=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,h={number:b,cvc:c,exp_month:parseInt(d.month,10)||0,exp_year:parseInt(d.year,10)||0};e&&f&&(h.name=e+" "+f),a("#billing_address_1").length>0?(h.address_line1=a("#billing_address_1").val(),h.address_line2=a("#billing_address_2").val(),h.address_state=a("#billing_state").val(),h.address_city=a("#billing_city").val(),h.address_zip=a("#billing_postcode").val(),h.address_country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(h.address_line1=wc_stripe_params.billing_address_1,h.address_line2=wc_stripe_params.billing_address_2,h.address_state=wc_stripe_params.billing_state,h.address_city=wc_stripe_params.billing_city,h.address_zip=wc_stripe_params.billing_postcode,h.address_country=wc_stripe_params.billing_country),Stripe.setPublishableKey(wc_stripe_params.key),Stripe.createToken(h,g.onStripeTokenResponse)},onStripeTokenResponse:function(b,c){if(c.error)a(document).trigger("stripeError",c);else{if("no"===wc_stripe_params.allow_prepaid_card&&"prepaid"===c.card.funding)return c.error={message:wc_stripe_params.no_prepaid_card_msg},a(document).trigger("stripeError",{response:c}),!1;var d=c.id;g.form.append("<input type='hidden' class='stripe_token' name='stripe_token' value='"+d+"'/>"),a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),g.form.submit()}},onSubmit:function(b){if(g.isStripeChosen()&&!g.isStripeSaveCardChosen()&&!g.hasSource()&&!g.hasToken()){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&g.isStripeModalNeeded()&&g.isStripeCardChosen())return g.isMobile()?g.openModal():g.validateCheckout("modal"),!1;if(g.block(),g.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements)return g.createToken(),!1;if(g.isBancontactChosen()||g.isGiropayChosen()||g.isIdealChosen()||g.isAlipayChosen())return a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),g.form.submit()),!0;if(g.isSofortChosen()){if("-1"===a("#stripe-bank-country").val()){var c={error:{message:wc_stripe_params.no_bank_country_msg}};return a(document.body).trigger("stripeError",c),!1}return a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),g.form.submit()),!0}return g.validateCheckout(),!1}if(a("form#add_payment_method").length){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&g.isStripeModalNeeded()&&g.isStripeCardChosen())return g.openModal(),!1;if(g.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}return g.block(),g.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements?(g.createToken(),!1):(g.createSource(),!1)}},onCCFormChange:function(){g.reset()},prepareSourceToServer:function(a){var b={id:a.id,card:a.card?a.card:"",bitcoin:a.bitcoin?a.bitcoin:"",flow:a.flow,object:a.object,status:a.status,type:a.type,usage:a.usage};return b},processStripeResponse:function(b){g.reset(),g.form.append("<input type='hidden' class='stripe-source' name='stripe_source' value='"+JSON.stringify(g.prepareSourceToServer(b))+"'/>"),a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),g.form.submit()},reset:function(){a(".wc-stripe-error, .stripe-source, .stripe_token, .stripe-checkout-object").remove(),"yes"===wc_stripe_params.is_stripe_checkout&&(g.stripe_submit=!1)},getRequiredFields:function(){return g.form.find(".form-row.validate-required > input, .form-row.validate-required > select")},validateCheckout:function(b){"undefined"==typeof b&&(b="");var c={nonce:wc_stripe_params.stripe_nonce,required_fields:g.getRequiredFields().serialize(),all_fields:g.form.serialize(),source_type:g.getSelectedPaymentElement().val()};a.ajax({type:"POST",url:g.getAjaxURL("validate_checkout"),data:c,dataType:"json",success:function(c){if("success"===c)if("modal"===b)g.openModal();else{if(g.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}g.createSource()}else c.messages&&(g.resetModal(),g.reset(),g.submitError(c.messages))}})},submitError:function(b){a(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),g.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+b+"</div>"),g.form.removeClass("processing").unblock(),g.form.find(".input-text, select, input:checkbox").blur(),a("html, body").animate({scrollTop:a("form.checkout").offset().top-100},1e3),a(document.body).trigger("checkout_error"),g.unblock()}};g.init()});
|
1 |
+
jQuery(function(a){"use strict";var b=Stripe(wc_stripe_params.key);if("yes"===wc_stripe_params.use_elements)var c,d,e,f=b.elements();var g={getAjaxURL:function(a){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+a)},init:function(){"yes"===wc_stripe_params.is_change_payment_page&&a(document.body).trigger("wc-credit-card-form-init"),this.stripe_checkout_submit=!1,a("form.woocommerce-checkout").length&&(this.form=a("form.woocommerce-checkout")),a("form.woocommerce-checkout").on("checkout_place_order_stripe checkout_place_order_stripe_bancontact checkout_place_order_stripe_sofort checkout_place_order_stripe_giropay checkout_place_order_stripe_ideal checkout_place_order_stripe_alipay checkout_place_order_stripe_sepa checkout_place_order_stripe_bitcoin",this.onSubmit),a("form#order_review").length&&(this.form=a("form#order_review")),a("form#order_review").on("submit",this.onSubmit),a("form#add_payment_method").length&&(this.form=a("form#add_payment_method")),a("form#add_payment_method").on("submit",this.onSubmit),a("form.woocommerce-checkout").on("change","#stripe-bank-country",this.reset),a(document).on("stripeError",this.onError).on("checkout_error",this.reset);var b={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},h={focus:"focused",empty:"empty",invalid:"invalid"};"yes"===wc_stripe_params.use_elements&&a("#stripe-card-element").length&&(b=wc_stripe_params.elements_styling?wc_stripe_params.elements_styling:b,h=wc_stripe_params.elements_classes?wc_stripe_params.elements_classes:h,"yes"===wc_stripe_params.inline_cc_form?(c=f.create("card",{style:b,hidePostalCode:!0}),c.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})):(c=f.create("cardNumber",{style:b,classes:h}),d=f.create("cardExpiry",{style:b,classes:h}),e=f.create("cardCvc",{style:b,classes:h}),c.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),d.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),e.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})),wc_stripe_params.is_checkout?a(document.body).on("updated_checkout",function(){c&&("yes"===wc_stripe_params.inline_cc_form?c.unmount("#stripe-card-element"):(c.unmount("#stripe-card-element"),d.unmount("#stripe-exp-element"),e.unmount("#stripe-cvc-element"))),"yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))}):(a("form#add_payment_method").length||a("form#order_review").length)&&("yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))))},isStripeChosen:function(){return a("#payment_method_stripe, #payment_method_stripe_bancontact, #payment_method_stripe_sofort, #payment_method_stripe_giropay, #payment_method_stripe_ideal, #payment_method_stripe_alipay, #payment_method_stripe_sepa, #payment_method_stripe_bitcoin").is(":checked")||"new"===a('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return a("#payment_method_stripe").is(":checked")&&a('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe-payment-token"]:checked').val()||a("#payment_method_stripe_sepa").is(":checked")&&a('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return a("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return a("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return a("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return a("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return a("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return a("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return a("#payment_method_stripe_sepa").is(":checked")},isBitcoinChosen:function(){return a("#payment_method_stripe_bitcoin").is(":checked")},hasSource:function(){return 0<a("input.stripe-source").length},hasToken:function(){return 0<a("input.stripe_token").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},isStripeModalNeeded:function(a){var b=g.form.find("input.stripe_token");return(!g.stripe_submit||!b)&&!!g.isStripeChosen()},block:function(){g.isMobile()?a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}}):g.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){g.isMobile()?a.unblockUI():g.form.unblock()},getSelectedPaymentElement:function(){return a('.payment_methods input[name="payment_method"]:checked')},openModal:function(){var b=g.form,c=a("#stripe-payment-data");b.find("input.stripe_token").val("");var d=function(c){b.find("input.stripe_token").remove(),b.append('<input type="hidden" class="stripe_token" name="stripe_token" value="'+c.id+'"/>'),b.append("<input type='hidden' class='stripe-checkout-object' name='stripe_checkout_object' value='"+g.prepareSourceToServer(c)+"'/>"),g.stripe_submit=!0,a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),b.submit()};StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address,amount:c.data("amount"),name:c.data("name"),description:c.data("description"),currency:c.data("currency"),image:c.data("image"),bitcoin:c.data("bitcoin"),locale:c.data("locale"),email:a("#billing_email").val()||c.data("email"),panelLabel:c.data("panel-label"),allowRememberMe:c.data("allow-remember-me"),token:d,closed:g.onClose()})},resetModal:function(){g.reset(),g.stripe_checkout_submit=!1},onClose:function(){g.unblock()},onError:function(b,c){var d=c.error.message,e=g.getSelectedPaymentElement().parent(".wc_payment_method, .woocommerce-PaymentMethod").find(".stripe-source-errors");"invalid_request_error"!==c.error.type&&"api_connection_error"!==c.error.type&&"api_error"!==c.error.type&&"authentication_error"!==c.error.type&&"rate_limit_error"!==c.error.type||(d=wc_stripe_params.invalid_request_error),"card_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),"validation_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),g.reset(),console.log(c.error.message),a(e).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li>'+d+"</li></ul>"),g.unblock()},getOwnerDetails:function(){var b=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,c=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,d={owner:{name:"",address:{},email:"",phone:""}};return d.owner.name=b,b&&c&&(d.owner.name=b+" "+c),d.owner.email=a("#billing_email").val(),d.owner.phone=a("#billing_phone").val(),void 0!==d.owner.phone&&0>=d.owner.phone.length&&delete d.owner.phone,void 0!==d.owner.email&&0>=d.owner.email.length&&delete d.owner.email,a("#billing_address_1").length>0?(d.owner.address.line1=a("#billing_address_1").val(),d.owner.address.line2=a("#billing_address_2").val(),d.owner.address.state=a("#billing_state").val(),d.owner.address.city=a("#billing_city").val(),d.owner.address.postal_code=a("#billing_postcode").val(),d.owner.address.country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(d.owner.address.line1=wc_stripe_params.billing_address_1,d.owner.address.line2=wc_stripe_params.billing_address_2,d.owner.address.state=wc_stripe_params.billing_state,d.owner.address.city=wc_stripe_params.billing_city,d.owner.address.postal_code=wc_stripe_params.billing_postcode,d.owner.address.country=wc_stripe_params.billing_country),d},createSource:function(){var d=g.getOwnerDetails(),e="card";if(g.isBancontactChosen()&&(e="bancontact"),g.isSepaChosen()&&(e="sepa_debit"),g.isIdealChosen()&&(e="ideal"),g.isSofortChosen()&&(e="sofort"),g.isBitcoinChosen()&&(e="bitcoin"),g.isGiropayChosen()&&(e="giropay"),g.isAlipayChosen()&&(e="alipay"),"card"===e)b.createSource(c,d).then(g.sourceResponse);else{switch(e){case"bancontact":case"giropay":case"ideal":case"sofort":case"alipay":d.amount=a("#stripe-"+e+"-payment-data").data("amount"),d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.redirect={return_url:wc_stripe_params.return_url},wc_stripe_params.statement_descriptor&&(d.statement_descriptor=wc_stripe_params.statement_descriptor)}switch(e){case"sepa_debit":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.owner.name=a("#stripe-sepa-owner").val(),d.sepa_debit={iban:a("#stripe-sepa-iban").val()};break;case"ideal":d.ideal={bank:a("#stripe-ideal-bank").val()};break;case"sofort":d.sofort={country:a("#stripe-sofort-country").val()};break;case"bitcoin":case"alipay":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.amount=a("#stripe-"+e+"-payment-data").data("amount")}d.type=e,b.createSource(d).then(g.sourceResponse)}},sourceResponse:function(b){b.error?a(document.body).trigger("stripeError",b):"no"===wc_stripe_params.allow_prepaid_card&&"card"===b.source.type&&"prepaid"===b.source.card.funding?(b.error={message:wc_stripe_params.no_prepaid_card_msg},a(document.body).trigger("stripeError",b)):g.processStripeResponse(b.source)},createToken:function(){var b=a("#stripe-card-number").val(),c=a("#stripe-card-cvc").val(),d=a("#stripe-card-expiry").payment("cardExpiryVal"),e=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,f=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,h={number:b,cvc:c,exp_month:parseInt(d.month,10)||0,exp_year:parseInt(d.year,10)||0};e&&f&&(h.name=e+" "+f),a("#billing_address_1").length>0?(h.address_line1=a("#billing_address_1").val(),h.address_line2=a("#billing_address_2").val(),h.address_state=a("#billing_state").val(),h.address_city=a("#billing_city").val(),h.address_zip=a("#billing_postcode").val(),h.address_country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(h.address_line1=wc_stripe_params.billing_address_1,h.address_line2=wc_stripe_params.billing_address_2,h.address_state=wc_stripe_params.billing_state,h.address_city=wc_stripe_params.billing_city,h.address_zip=wc_stripe_params.billing_postcode,h.address_country=wc_stripe_params.billing_country),Stripe.setPublishableKey(wc_stripe_params.key),Stripe.createToken(h,g.onStripeTokenResponse)},onStripeTokenResponse:function(b,c){if(c.error)a(document).trigger("stripeError",c);else{if("no"===wc_stripe_params.allow_prepaid_card&&"prepaid"===c.card.funding)return c.error={message:wc_stripe_params.no_prepaid_card_msg},a(document).trigger("stripeError",{response:c}),!1;var d=c.id;g.form.append("<input type='hidden' class='stripe_token' name='stripe_token' value='"+d+"'/>"),a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),g.form.submit()}},onSubmit:function(b){if(g.isStripeChosen()&&!g.isStripeSaveCardChosen()&&!g.hasSource()&&!g.hasToken()){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&g.isStripeModalNeeded()&&g.isStripeCardChosen())return g.isMobile()?g.openModal():g.validateCheckout("modal"),!1;if(g.block(),g.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements)return g.createToken(),!1;if(g.isBancontactChosen()||g.isGiropayChosen()||g.isIdealChosen()||g.isAlipayChosen())return a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),g.form.submit()),!0;if(g.isSofortChosen()){if("-1"===a("#stripe-bank-country").val()){var c={error:{message:wc_stripe_params.no_bank_country_msg}};return a(document.body).trigger("stripeError",c),!1}return a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),g.form.submit()),!0}return g.validateCheckout(),!1}if(a("form#add_payment_method").length){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&g.isStripeModalNeeded()&&g.isStripeCardChosen())return g.openModal(),!1;if(g.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}return g.block(),g.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements?(g.createToken(),!1):(g.createSource(),!1)}},onCCFormChange:function(){g.reset()},prepareSourceToServer:function(a){return{id:a.id,card:a.card?a.card:"",bitcoin:a.bitcoin?a.bitcoin:"",flow:a.flow,object:a.object,status:a.status,type:a.type,usage:a.usage}},processStripeResponse:function(b){g.reset(),g.form.append("<input type='hidden' class='stripe-source' name='stripe_source' value='"+JSON.stringify(g.prepareSourceToServer(b))+"'/>"),a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),g.form.submit()},reset:function(){a(".wc-stripe-error, .stripe-source, .stripe_token, .stripe-checkout-object").remove(),"yes"===wc_stripe_params.is_stripe_checkout&&(g.stripe_submit=!1)},getRequiredFields:function(){return g.form.find(".form-row.validate-required > input, .form-row.validate-required > select")},validateCheckout:function(b){void 0===b&&(b="");var c={nonce:wc_stripe_params.stripe_nonce,required_fields:g.getRequiredFields().serialize(),all_fields:g.form.serialize(),source_type:g.getSelectedPaymentElement().val(),is_add_payment_page:wc_stripe_params.is_add_payment_method_page};a.ajax({type:"POST",url:g.getAjaxURL("validate_checkout"),data:c,dataType:"json",success:function(c){if("success"===c)if("modal"===b)g.openModal();else{if(g.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}g.createSource()}else c.messages&&(g.resetModal(),g.reset(),g.submitError(c.messages))}})},submitError:function(b){a(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),g.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+b+"</div>"),g.form.removeClass("processing").unblock(),g.form.find(".input-text, select, input:checkbox").blur(),a("html, body").animate({scrollTop:a("form.checkout").offset().top-100},1e3),a(document.body).trigger("checkout_error"),g.unblock()}};g.init()});
|
changelog.txt
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
*** Changelog ***
|
2 |
|
3 |
-
= 4.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
* Add - Stripe Elements Credit Card form for PCI compliance.
|
5 |
* Add - Stripe Sources.
|
6 |
* Add - SEPA Direct Debit.
|
1 |
*** Changelog ***
|
2 |
|
3 |
+
= 4.0.1 - 2018-01-11 =
|
4 |
+
* Fix - Add payment method conflict with terms and agreement page.
|
5 |
+
* Fix - Checkout validation checkout field names/labels were not translated.
|
6 |
+
* Fix - Card error translations.
|
7 |
+
* Add - Deprecated Apple Pay Class to prevent errors.
|
8 |
+
|
9 |
+
= 4.0.0 - 2018-01-08 =
|
10 |
* Add - Stripe Elements Credit Card form for PCI compliance.
|
11 |
* Add - Stripe Sources.
|
12 |
* Add - SEPA Direct Debit.
|
includes/class-wc-gateway-stripe.php
CHANGED
@@ -574,6 +574,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
|
|
574 |
$stripe_params['use_elements'] = apply_filters( 'wc_stripe_use_elements_checkout_form', true ) ? 'yes' : 'no';
|
575 |
$stripe_params['is_stripe_checkout'] = $this->stripe_checkout ? 'yes' : 'no';
|
576 |
$stripe_params['is_change_payment_page'] = ( isset( $_GET['pay_for_order'] ) || isset( $_GET['change_payment_method'] ) ) ? 'yes' : 'no';
|
|
|
577 |
$stripe_params['elements_styling'] = apply_filters( 'wc_stripe_elements_styling', false );
|
578 |
$stripe_params['elements_classes'] = apply_filters( 'wc_stripe_elements_classes', false );
|
579 |
|
574 |
$stripe_params['use_elements'] = apply_filters( 'wc_stripe_use_elements_checkout_form', true ) ? 'yes' : 'no';
|
575 |
$stripe_params['is_stripe_checkout'] = $this->stripe_checkout ? 'yes' : 'no';
|
576 |
$stripe_params['is_change_payment_page'] = ( isset( $_GET['pay_for_order'] ) || isset( $_GET['change_payment_method'] ) ) ? 'yes' : 'no';
|
577 |
+
$stripe_params['is_add_payment_method_page'] = is_add_payment_method_page() ? 'yes' : 'no';
|
578 |
$stripe_params['elements_styling'] = apply_filters( 'wc_stripe_elements_styling', false );
|
579 |
$stripe_params['elements_classes'] = apply_filters( 'wc_stripe_elements_classes', false );
|
580 |
|
includes/class-wc-stripe-api.php
CHANGED
File without changes
|
includes/class-wc-stripe-customer.php
CHANGED
File without changes
|
includes/class-wc-stripe-helper.php
CHANGED
@@ -38,18 +38,22 @@ class WC_Stripe_Helper {
|
|
38 |
*/
|
39 |
public static function get_localized_messages() {
|
40 |
return apply_filters( 'wc_stripe_localized_messages', array(
|
41 |
-
'invalid_number'
|
42 |
-
'invalid_expiry_month'
|
43 |
-
'invalid_expiry_year'
|
44 |
-
'invalid_cvc'
|
45 |
-
'incorrect_number'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'
|
51 |
-
'
|
52 |
-
'
|
|
|
|
|
|
|
|
|
53 |
) );
|
54 |
}
|
55 |
|
38 |
*/
|
39 |
public static function get_localized_messages() {
|
40 |
return apply_filters( 'wc_stripe_localized_messages', array(
|
41 |
+
'invalid_number' => __( 'The card number is not a valid credit card number.', 'woocommerce-gateway-stripe' ),
|
42 |
+
'invalid_expiry_month' => __( 'The card\'s expiration month is invalid.', 'woocommerce-gateway-stripe' ),
|
43 |
+
'invalid_expiry_year' => __( 'The card\'s expiration year is invalid.', 'woocommerce-gateway-stripe' ),
|
44 |
+
'invalid_cvc' => __( 'The card\'s security code is invalid.', 'woocommerce-gateway-stripe' ),
|
45 |
+
'incorrect_number' => __( 'The card number is incorrect.', 'woocommerce-gateway-stripe' ),
|
46 |
+
'incomplete_number' => __( 'Your card number is incomplete.', 'woocommerce-gateway-stripe' ),
|
47 |
+
'incomplete_cvc' => __( 'Your card\'s security code is incomplete.', 'woocommerce-gateway-stripe' ),
|
48 |
+
'incomplete_expiry' => __( 'Your card\'s expiration date is incomplete.', 'woocommerce-gateway-stripe' ),
|
49 |
+
'expired_card' => __( 'The card has expired.', 'woocommerce-gateway-stripe' ),
|
50 |
+
'incorrect_cvc' => __( 'The card\'s security code is incorrect.', 'woocommerce-gateway-stripe' ),
|
51 |
+
'incorrect_zip' => __( 'The card\'s zip code failed validation.', 'woocommerce-gateway-stripe' ),
|
52 |
+
'card_declined' => __( 'The card was declined.', 'woocommerce-gateway-stripe' ),
|
53 |
+
'missing' => __( 'There is no card on a customer that is being charged.', 'woocommerce-gateway-stripe' ),
|
54 |
+
'processing_error' => __( 'An error occurred while processing the card.', 'woocommerce-gateway-stripe' ),
|
55 |
+
'invalid_request_error' => __( 'Could not find payment information. Please try with another payment method.', 'woocommerce-gateway-stripe' ),
|
56 |
+
'invalid_expiry_year_past' => __( 'Your card\'s expiration year is in the past', 'woocommerce-gateway-stripe' ),
|
57 |
) );
|
58 |
}
|
59 |
|
includes/class-wc-stripe-order-handler.php
CHANGED
@@ -140,7 +140,7 @@ class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
|
|
140 |
|
141 |
$localized_messages = WC_Stripe_Helper::get_localized_messages();
|
142 |
|
143 |
-
$message = isset( $localized_messages[ $response->error->
|
144 |
|
145 |
throw new Exception( $message );
|
146 |
}
|
@@ -278,32 +278,44 @@ class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
|
|
278 |
}
|
279 |
|
280 |
/**
|
281 |
-
* Normalize the error field name.
|
282 |
*
|
283 |
* @since 4.0.0
|
284 |
-
* @
|
285 |
* @param string $field
|
286 |
* @return string $error_field
|
287 |
*/
|
288 |
public function normalize_field( $field ) {
|
289 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
-
|
292 |
-
|
293 |
|
294 |
-
|
295 |
-
|
296 |
|
297 |
-
|
298 |
-
|
299 |
|
300 |
-
|
301 |
-
|
302 |
|
303 |
-
|
304 |
-
|
305 |
|
306 |
-
|
|
|
|
|
|
|
307 |
}
|
308 |
|
309 |
/**
|
@@ -408,8 +420,11 @@ class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
|
|
408 |
}
|
409 |
}
|
410 |
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
413 |
}
|
414 |
|
415 |
if ( WC()->cart->needs_shipping() && $validate_shipping_fields ) {
|
140 |
|
141 |
$localized_messages = WC_Stripe_Helper::get_localized_messages();
|
142 |
|
143 |
+
$message = isset( $localized_messages[ $response->error->code ] ) ? $localized_messages[ $response->error->code ] : $response->error->message;
|
144 |
|
145 |
throw new Exception( $message );
|
146 |
}
|
278 |
}
|
279 |
|
280 |
/**
|
281 |
+
* Normalize the error field name with appropriate locale.
|
282 |
*
|
283 |
* @since 4.0.0
|
284 |
+
* @since 4.0.1 Map localized checkout fields.
|
285 |
* @param string $field
|
286 |
* @return string $error_field
|
287 |
*/
|
288 |
public function normalize_field( $field ) {
|
289 |
+
$checkout_fields = WC()->checkout->get_checkout_fields();
|
290 |
+
$org_str = array();
|
291 |
+
$replace_str = array();
|
292 |
+
|
293 |
+
if ( array_key_exists( $field, $checkout_fields['billing'] ) ) {
|
294 |
+
$error_field = $checkout_fields['billing'][ $field ]['label'];
|
295 |
+
} elseif ( array_key_exists( $field, $checkout_fields['shipping'] ) ) {
|
296 |
+
$error_field = $checkout_fields['shipping'][ $field ]['label'];
|
297 |
+
} else {
|
298 |
+
$error_field = str_replace( '_', ' ', $field );
|
299 |
|
300 |
+
$org_str[] = 'stripe';
|
301 |
+
$replace_str[] = '';
|
302 |
|
303 |
+
$org_str[] = 'sepa';
|
304 |
+
$replace_str[] = 'SEPA';
|
305 |
|
306 |
+
$org_str[] = 'iban';
|
307 |
+
$replace_str[] = 'IBAN';
|
308 |
|
309 |
+
$org_str[] = 'sofort';
|
310 |
+
$replace_str[] = 'SOFORT';
|
311 |
|
312 |
+
$org_str[] = 'owner';
|
313 |
+
$replace_str[] = __( 'Owner', 'woocommerce-gateway-stripe' );
|
314 |
|
315 |
+
$error_field = str_replace( $org_str, $replace_str, $error_field );
|
316 |
+
}
|
317 |
+
|
318 |
+
return $error_field;
|
319 |
}
|
320 |
|
321 |
/**
|
420 |
}
|
421 |
}
|
422 |
|
423 |
+
// Don't check this on add payment method page.
|
424 |
+
if ( ( isset( $_POST['is_add_payment_page'] ) && 'no' === $_POST['is_add_payment_page'] ) ) {
|
425 |
+
if ( empty( $all_fields['woocommerce_checkout_update_totals'] ) && empty( $all_fields['terms'] ) && apply_filters( 'woocommerce_checkout_show_terms', wc_get_page_id( 'terms' ) > 0 ) ) {
|
426 |
+
$errors->add( 'terms', __( 'You must accept our Terms & Conditions.', 'woocommerce-gateway-stripe' ) );
|
427 |
+
}
|
428 |
}
|
429 |
|
430 |
if ( WC()->cart->needs_shipping() && $validate_shipping_fields ) {
|
includes/deprecated/class-wc-stripe-apple-pay.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* DEPRECATED DO NOT USE!!
|
8 |
+
*/
|
9 |
+
if ( ! class_exists( 'WC_Stripe_Apple_Pay' ) ) {
|
10 |
+
class WC_Stripe_Apple_Pay {
|
11 |
+
/**
|
12 |
+
* This Instance.
|
13 |
+
*
|
14 |
+
* @var
|
15 |
+
*/
|
16 |
+
private static $_this;
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
self::$_this = $this;
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
public static function instance() {
|
24 |
+
WC_Stripe_Logger::log( "DEPRECATED! WC_Stripe_Apple_Pay class has been hard deprecated. Please remove any code that references this class or instance." );
|
25 |
+
return self::$_this;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
new WC_Stripe_Apple_Pay();
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== WooCommerce Stripe Payment Gateway ===
|
2 |
-
Contributors: automattic, royho,
|
3 |
Tags: credit card, stripe, woocommerce
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 4.0.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
Attributions: thorsten-stripe
|
@@ -101,7 +101,13 @@ If you get stuck, you can ask for help in the Plugin Forum.
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
-
= 4.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
* Add - Stripe Elements Credit Card form for PCI compliance.
|
106 |
* Add - Stripe Sources.
|
107 |
* Add - SEPA Direct Debit.
|
@@ -228,14 +234,8 @@ If you get stuck, you can ask for help in the Plugin Forum.
|
|
228 |
|
229 |
== Upgrade Notice ==
|
230 |
|
231 |
-
= 4.0.
|
232 |
-
*
|
233 |
-
*
|
234 |
-
*
|
235 |
-
* Add -
|
236 |
-
* Add - Giropay.
|
237 |
-
* Add - Sofort.
|
238 |
-
* Add - iDeal.
|
239 |
-
* Add - Bitcoin.
|
240 |
-
* Add - P24.
|
241 |
-
* Add - Alipay.
|
1 |
=== WooCommerce Stripe Payment Gateway ===
|
2 |
+
Contributors: automattic, royho, akeda, mattyza, bor0, woothemes
|
3 |
Tags: credit card, stripe, woocommerce
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 4.0.1
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
Attributions: thorsten-stripe
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 4.0.1 - 2018-01-11 =
|
105 |
+
* Fix - Add payment method conflict with terms and agreement page.
|
106 |
+
* Fix - Checkout validation checkout field names/labels were not translated.
|
107 |
+
* Fix - Card error translations.
|
108 |
+
* Add - Deprecated Apple Pay Class to prevent errors.
|
109 |
+
|
110 |
+
= 4.0.0 - 2018-01-08 =
|
111 |
* Add - Stripe Elements Credit Card form for PCI compliance.
|
112 |
* Add - Stripe Sources.
|
113 |
* Add - SEPA Direct Debit.
|
234 |
|
235 |
== Upgrade Notice ==
|
236 |
|
237 |
+
= 4.0.1 =
|
238 |
+
* Fix - Add payment method conflict with terms and agreement page.
|
239 |
+
* Fix - Checkout validation checkout field names/labels were not translated.
|
240 |
+
* Fix - Card error translations.
|
241 |
+
* Add - Deprecated Apple Pay Class to prevent errors.
|
|
|
|
|
|
|
|
|
|
|
|
woocommerce-gateway-stripe.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Take credit card payments on your store using Stripe.
|
6 |
* Author: WooCommerce
|
7 |
* Author URI: https://woocommerce.com/
|
8 |
-
* Version: 4.0.
|
9 |
* Requires at least: 4.4
|
10 |
* Tested up to: 4.9
|
11 |
* WC requires at least: 2.6
|
@@ -22,7 +22,7 @@ if ( ! class_exists( 'WC_Stripe' ) ) :
|
|
22 |
/**
|
23 |
* Required minimums and constants
|
24 |
*/
|
25 |
-
define( 'WC_STRIPE_VERSION', '4.0.
|
26 |
define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
|
27 |
define( 'WC_STRIPE_MIN_WC_VER', '2.6.0' );
|
28 |
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
|
@@ -123,6 +123,9 @@ if ( ! class_exists( 'WC_Stripe' ) ) :
|
|
123 |
require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php' );
|
124 |
require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php' );
|
125 |
|
|
|
|
|
|
|
126 |
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
|
127 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
|
128 |
add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) );
|
5 |
* Description: Take credit card payments on your store using Stripe.
|
6 |
* Author: WooCommerce
|
7 |
* Author URI: https://woocommerce.com/
|
8 |
+
* Version: 4.0.1
|
9 |
* Requires at least: 4.4
|
10 |
* Tested up to: 4.9
|
11 |
* WC requires at least: 2.6
|
22 |
/**
|
23 |
* Required minimums and constants
|
24 |
*/
|
25 |
+
define( 'WC_STRIPE_VERSION', '4.0.1' );
|
26 |
define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
|
27 |
define( 'WC_STRIPE_MIN_WC_VER', '2.6.0' );
|
28 |
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
|
123 |
require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php' );
|
124 |
require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php' );
|
125 |
|
126 |
+
// REMOVE IN THE FUTURE.
|
127 |
+
require_once( dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php' );
|
128 |
+
|
129 |
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
|
130 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
|
131 |
add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) );
|