Version Description
- Added - Payment methods with payment sheets like Apple Pay now show order items on order pay page instead of just total.
- Fixed - Error if 100% off coupon is used on checkout page.
Download this release
Release Info
Developer | mr.clayton |
Plugin | Payment Plugins for Stripe WooCommerce |
Version | 3.0.9 |
Comparing to | |
See all releases |
Code changes from version 3.0.8 to 3.0.9
- assets/css/admin/admin.css +8 -1
- assets/js/admin/meta-boxes-order.js +1 -0
- assets/js/admin/modals.js +13 -4
- assets/js/frontend/wc-stripe.js +3 -0
- assets/js/frontend/wc-stripe.min.js +1 -1
- i18n/languages/woo-stripe-payment.pot +65 -52
- includes/abstract/abstract-wc-payment-gateway-stripe-charge.php +0 -2
- includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php +3 -3
- includes/abstract/abstract-wc-payment-gateway-stripe.php +8 -1
- includes/class-stripe.php +1 -1
- includes/class-wc-stripe-field-manager.php +2 -1
- includes/gateways/class-wc-payment-gateway-stripe-googlepay.php +82 -1
- includes/wc-stripe-functions.php +67 -10
- readme.txt +4 -1
- stripe-payments.php +1 -1
- templates/cart/payment-methods.php +2 -2
- templates/product/googlepay.php +5 -9
assets/css/admin/admin.css
CHANGED
@@ -76,7 +76,7 @@
|
|
76 |
.wc-transaction-data .data-container .metadata{
|
77 |
margin-bottom: 0.5em;
|
78 |
}
|
79 |
-
#wc-stripe-card-container{
|
80 |
margin: 1em 0;
|
81 |
border: 1px solid #e8e8e8;
|
82 |
}
|
@@ -84,6 +84,13 @@
|
|
84 |
background-color: #fff;
|
85 |
padding: 12px 6px;
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
#wc-stripe-pay-order-form .modal-wide{
|
88 |
width: 100%;
|
89 |
margin-bottom: 1.5em;
|
76 |
.wc-transaction-data .data-container .metadata{
|
77 |
margin-bottom: 0.5em;
|
78 |
}
|
79 |
+
#wc-stripe-card-container #card-element{
|
80 |
margin: 1em 0;
|
81 |
border: 1px solid #e8e8e8;
|
82 |
}
|
84 |
background-color: #fff;
|
85 |
padding: 12px 6px;
|
86 |
}
|
87 |
+
.wc-stripe-save-card label{
|
88 |
+
display: block;
|
89 |
+
margin-bottom: 8px;
|
90 |
+
}
|
91 |
+
#pay-order{
|
92 |
+
min-width: 75px;
|
93 |
+
}
|
94 |
#wc-stripe-pay-order-form .modal-wide{
|
95 |
width: 100%;
|
96 |
margin-bottom: 1.5em;
|
assets/js/admin/meta-boxes-order.js
CHANGED
@@ -115,6 +115,7 @@
|
|
115 |
$(e.target).WCStripePayOrderBackboneModal({
|
116 |
template: 'wc-stripe-modal-pay-order',
|
117 |
params: {
|
|
|
118 |
payment_methods: wc_stripe_order_pay_params.payment_methods,
|
119 |
order_id: $('#post_ID').val()
|
120 |
}
|
115 |
$(e.target).WCStripePayOrderBackboneModal({
|
116 |
template: 'wc-stripe-modal-pay-order',
|
117 |
params: {
|
118 |
+
customer_id: $('#customer_user').val(),
|
119 |
payment_methods: wc_stripe_order_pay_params.payment_methods,
|
120 |
order_id: $('#post_ID').val()
|
121 |
}
|
assets/js/admin/modals.js
CHANGED
@@ -43,7 +43,8 @@
|
|
43 |
}
|
44 |
|
45 |
}
|
46 |
-
}
|
|
|
47 |
});
|
48 |
this.card.mount('#card-element');
|
49 |
},
|
@@ -60,12 +61,17 @@
|
|
60 |
country: $('#_billing_country').val(),
|
61 |
line1: $('#_billing_address_1').val(),
|
62 |
line2: $('#_billing_address_2').val(),
|
63 |
-
state: $('#_billing_state').val()
|
|
|
64 |
}
|
65 |
}
|
66 |
}).then(function(result) {
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
}.bind(this));
|
70 |
} else {
|
71 |
this.api_pay_order()
|
@@ -114,6 +120,9 @@
|
|
114 |
},
|
115 |
add_messages: function(messages) {
|
116 |
this.$el.find('.woocommerce-error').remove();
|
|
|
|
|
|
|
117 |
this.$el.find('form').prepend(messages);
|
118 |
},
|
119 |
use_token: function() {
|
43 |
}
|
44 |
|
45 |
}
|
46 |
+
},
|
47 |
+
hidePostalCode: true
|
48 |
});
|
49 |
this.card.mount('#card-element');
|
50 |
},
|
61 |
country: $('#_billing_country').val(),
|
62 |
line1: $('#_billing_address_1').val(),
|
63 |
line2: $('#_billing_address_2').val(),
|
64 |
+
state: $('#_billing_state').val(),
|
65 |
+
postal_code: $('#_billing_postcode').val()
|
66 |
}
|
67 |
}
|
68 |
}).then(function(result) {
|
69 |
+
if (result.error) {
|
70 |
+
this.add_messages(result.error.message);
|
71 |
+
} else {
|
72 |
+
$('[name="payment_nonce"]').val(result.paymentMethod.id);
|
73 |
+
this.api_pay_order();
|
74 |
+
}
|
75 |
}.bind(this));
|
76 |
} else {
|
77 |
this.api_pay_order()
|
120 |
},
|
121 |
add_messages: function(messages) {
|
122 |
this.$el.find('.woocommerce-error').remove();
|
123 |
+
if (messages.indexOf('woocommerce-error') == -1) {
|
124 |
+
messages = '<div class="woocommerce-error">' + messages + '</div>';
|
125 |
+
}
|
126 |
this.$el.find('form').prepend(messages);
|
127 |
},
|
128 |
use_token: function() {
|
assets/js/frontend/wc-stripe.js
CHANGED
@@ -916,6 +916,9 @@
|
|
916 |
}
|
917 |
|
918 |
wc_stripe.CheckoutGateway.prototype.checkout_fields_valid = function() {
|
|
|
|
|
|
|
919 |
var billing = Object.keys(wc_stripe_checkout_fields.billing),
|
920 |
shipping = Object.keys(wc_stripe_checkout_fields.shipping);
|
921 |
valid = true;
|
916 |
}
|
917 |
|
918 |
wc_stripe.CheckoutGateway.prototype.checkout_fields_valid = function() {
|
919 |
+
if (typeof wc_stripe_checkout_fields == 'undefined') {
|
920 |
+
return true;
|
921 |
+
}
|
922 |
var billing = Object.keys(wc_stripe_checkout_fields.billing),
|
923 |
shipping = Object.keys(wc_stripe_checkout_fields.shipping);
|
924 |
valid = true;
|
assets/js/frontend/wc-stripe.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t,e){t.wc_stripe={};var i=Stripe(wc_stripe_params_v3.api_key);wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_intent_selector=this.params.payment_intent_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){e(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 e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==t.indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return"1"===this.params.needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return e("#wc_stripe_currency").val()},wc_stripe.BaseGateway.prototype.get_country=function(){return e("#wc_stripe_country").val()},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return e("#billing_email").val()},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var i=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],a="",n=0;n<i.length;n++)a+=e(t+i[n]).val()+"_";return a},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return e("#wc_stripe_order_total").data("amount")},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return e("#wc_stripe_order_total_cents").data("amount")},wc_stripe.BaseGateway.prototype.set_total_price=function(t){e("#wc_stripe_order_total").data("amount",t)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){e("#wc_stripe_order_total_cents").data("amount",t)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var a=t[i];e('[name="shipping_method['+i+']"][value="'+a+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){this.paymentRequest=i.paymentRequest(this.get_payment_request_options()),this.needs_shipping()&&(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:!0,requestPayerPhone:!0,requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},a=this.get_display_items(),n=this.get_shipping_options();return a&&(i.displayItems=a),this.needs_shipping()&&n&&(i.shippingOptions=n),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return e("#wc_stripe_display_items").data("items")},wc_stripe.BaseGateway.prototype.set_display_items=function(t){e("#wc_stripe_display_items").data("items",t)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return e("#wc_stripe_shipping_options").data("items")},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){e("#wc_stripe_shipping_options").data("items",t)},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(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){e(this.token_selector).val(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){var i=this.address_mappings();if(t.payerName&&i.payerName.set(t.payerName),t.payerEmail&&i.payerEmail.set(t.payerEmail),t.payerPhone&&i.payerPhone.set(t.payerPhone),t.shippingAddress){var a=t.shippingAddress;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#shipping")}if(t.paymentMethod.billing_details.address){a=t.paymentMethod.billing_details.address;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#billing")}this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return{payerName:{set:function(t,i){var a=t.split(" ");a.length>0&&e("#billing_first_name").val(a[0]),a.length>1&&e("#billing_last_name").val(a[1])},get:function(t){return e("#billing_first_name").val()+" "+e("#billing_last_name").val()}},payerEmail:{set:function(t){e("#billing_email").val(t)},get:function(){return e("#billing_email").val()}},payerPhone:{set:function(t){e("#billing_phone").val(t)},get:function(){return e("#billing_phone").val()}},recipient:{set:function(t,i){var a=t.split(" ");a.length>0&&e(i+"_first_name").val(a[0]),a.length>1&&e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()}},country:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},addressLine:{set:function(t,i){t.length>0&&e(i+"_address_1").val(t[0]),t.length>1&&e(i+"_address_2").val(t[1])},get:function(t){return[e(t+"_address_1").val(),e(t+"_address_2").val()]}},line1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},line2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},region:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},state:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},city:{set:function(t,i){e(i+"_city").val(t)},get:function(t){e(t+"_city").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}},postal_code:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}}}},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,a){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_form(this.get_form()),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.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 i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),a={};for(var n in i){var s=i[n];a[s.name]=s.value}return a.payment_method=this.gateway_id,a},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^(\d):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[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(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_methods:this.map_shipping_methods(t.shippingOption.id),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.container=this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("update_checkout",this.update_checkout.bind(this)),e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(".wc-stripe-banner-checkout").css("max-width",e(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var e=t.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(e&&e.length>1){var i=e[1],a=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(a),this.set_use_new_option(!0))}},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!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+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,e(this.token_selector).val(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#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,e('[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(){var t=Object.keys(wc_stripe_checkout_fields.billing),i=Object.keys(wc_stripe_checkout_fields.shipping);function a(t,i){for(var a=0;a<t.length;a++){if(i[t[a]].required){var n=e("#"+t[a]).val();if(void 0===n||0==n.length)return void(valid=!1)}}}return valid=!0,a(t,wc_stripe_checkout_fields.billing),this.needs_shipping()&&e("#ship-to-different-address-checkbox").is(":checked")&&a(i,wc_stripe_checkout_fields.shipping),valid=this.is_valid_checkout(),valid},wc_stripe.ProductGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.product",e(document.body).on("wc_stripe_updated_rest_nonce",this.set_rest_nonce.bind(this)),e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth(),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[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_product_data();i.price=e.display_price,i.needs_shipping=!e.is_virtual,i.variation=e,this.set_product_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){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 e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.needs_shipping=function(){return this.get_product_data().needs_shipping},wc_stripe.ProductGateway.prototype.get_product_data=function(){return e("#wc_stripe_product_data").data("product")},wc_stripe.ProductGateway.prototype.set_product_data=function(t){e("#wc_stripe_product_data").data("product",t)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(a,n,s){this.unblock(),e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",s.getResponseHeader("X-WP-Nonce")),a.code?(this.submit_error(a.message),i(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),t(a.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(i,a){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(t,a,n){e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",n.getResponseHeader("X-WP-Nonce")),t.code?this.cart_calculation_error=!0:(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),i(t.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this))},wc_stripe.CartGateway.prototype.needs_shipping=function(){return 1===e("#wc_stripe_needs_shipping").data("value")},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(t)},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){e(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};const a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.address_mappings=function(t){return{name:{set:function(t,i){var a=t.split(" ");e(i+"_first_name").val(a[0]),e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+e(t+"_last_name").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){return e(t+"_postcode").val()}},countryCode:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},phoneNumber:{set:function(t,i){e("#billing_phone").val(t)},get:function(){return"#billing_phone".val()}},address1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},address2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},locality:{set:function(t,i){e(i+"_city").val(t)},get:function(t){return e(t+"_city").val()}},administrativeArea:{set:function(t,i){e(i+"_state").val(t)},get:function(t){return e(t+"_state").val()}}}},wc_stripe.GooglePay.prototype.serialize_form=function(t){return e.extend({},wc_stripe.BaseGateway.prototype.serialize_form.apply(this,arguments),{order_review:!this.dynamic_price_enabled()})},wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress,a=this.address_mappings();for(var n in i)a[n]&&a[n].set.call(this,i[n],"#billing");if(t.shippingAddress)for(var n in t.shippingAddress)a[n]&&a[n].set.call(this,t.shippingAddress[n],"#shipping");t.email&&e("#billing_email").val(t.email),this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},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(t){return new Promise(function(i,a){e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_methods:this.map_shipping_methods(t.shippingOptionData.id),shipping_method_id:t.shippingOptionData.id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)})).done(function(t){t.code?a(t.data.data):i(t.data)}.bind(this)).fail(function(){a()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.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_googlepay_display_items=function(){return e("#googlepay_display_items").data("items")},wc_stripe.GooglePay.prototype.set_googlepay_display_items=function(t){e("#googlepay_display_items").data("items",t)},wc_stripe.GooglePay.prototype.get_shipping_options=function(){return e("#googlepay_shipping_options").data("items")},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.dynamic_price_enabled=function(){return"1"===this.params.dynamic_price},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}}),t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},a,{emailRequired:!0,merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:this.needs_shipping()&&this.get_total_price_cents()>0,transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_googlepay_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:e("#billing_phone").length>0},this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"]),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 i=e.extend({},a);i.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(i).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=e(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.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){e(document.body).on("click",".apple-pay-button",this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.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.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return 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(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")}}(window,jQuery);
|
1 |
+
!function(t,e){t.wc_stripe={};var i=Stripe(wc_stripe_params_v3.api_key);wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_intent_selector=this.params.payment_intent_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){e(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 e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==t.indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return"1"===this.params.needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return e("#wc_stripe_currency").val()},wc_stripe.BaseGateway.prototype.get_country=function(){return e("#wc_stripe_country").val()},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return e("#billing_email").val()},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var i=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],a="",n=0;n<i.length;n++)a+=e(t+i[n]).val()+"_";return a},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return e("#wc_stripe_order_total").data("amount")},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return e("#wc_stripe_order_total_cents").data("amount")},wc_stripe.BaseGateway.prototype.set_total_price=function(t){e("#wc_stripe_order_total").data("amount",t)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){e("#wc_stripe_order_total_cents").data("amount",t)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var a=t[i];e('[name="shipping_method['+i+']"][value="'+a+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){this.paymentRequest=i.paymentRequest(this.get_payment_request_options()),this.needs_shipping()&&(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:!0,requestPayerPhone:!0,requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},a=this.get_display_items(),n=this.get_shipping_options();return a&&(i.displayItems=a),this.needs_shipping()&&n&&(i.shippingOptions=n),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return e("#wc_stripe_display_items").data("items")},wc_stripe.BaseGateway.prototype.set_display_items=function(t){e("#wc_stripe_display_items").data("items",t)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return e("#wc_stripe_shipping_options").data("items")},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){e("#wc_stripe_shipping_options").data("items",t)},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(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){e(this.token_selector).val(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){var i=this.address_mappings();if(t.payerName&&i.payerName.set(t.payerName),t.payerEmail&&i.payerEmail.set(t.payerEmail),t.payerPhone&&i.payerPhone.set(t.payerPhone),t.shippingAddress){var a=t.shippingAddress;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#shipping")}if(t.paymentMethod.billing_details.address){a=t.paymentMethod.billing_details.address;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#billing")}this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return{payerName:{set:function(t,i){var a=t.split(" ");a.length>0&&e("#billing_first_name").val(a[0]),a.length>1&&e("#billing_last_name").val(a[1])},get:function(t){return e("#billing_first_name").val()+" "+e("#billing_last_name").val()}},payerEmail:{set:function(t){e("#billing_email").val(t)},get:function(){return e("#billing_email").val()}},payerPhone:{set:function(t){e("#billing_phone").val(t)},get:function(){return e("#billing_phone").val()}},recipient:{set:function(t,i){var a=t.split(" ");a.length>0&&e(i+"_first_name").val(a[0]),a.length>1&&e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()}},country:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},addressLine:{set:function(t,i){t.length>0&&e(i+"_address_1").val(t[0]),t.length>1&&e(i+"_address_2").val(t[1])},get:function(t){return[e(t+"_address_1").val(),e(t+"_address_2").val()]}},line1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},line2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},region:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},state:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},city:{set:function(t,i){e(i+"_city").val(t)},get:function(t){e(t+"_city").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}},postal_code:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}}}},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,a){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_form(this.get_form()),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.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 i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),a={};for(var n in i){var s=i[n];a[s.name]=s.value}return a.payment_method=this.gateway_id,a},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^(\d):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[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(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_methods:this.map_shipping_methods(t.shippingOption.id),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.container=this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("update_checkout",this.update_checkout.bind(this)),e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(".wc-stripe-banner-checkout").css("max-width",e(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var e=t.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(e&&e.length>1){var i=e[1],a=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(a),this.set_use_new_option(!0))}},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!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+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,e(this.token_selector).val(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#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,e('[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("undefined"==typeof wc_stripe_checkout_fields)return!0;var t=Object.keys(wc_stripe_checkout_fields.billing),i=Object.keys(wc_stripe_checkout_fields.shipping);function a(t,i){for(var a=0;a<t.length;a++){if(i[t[a]].required){var n=e("#"+t[a]).val();if(void 0===n||0==n.length)return void(valid=!1)}}}return valid=!0,a(t,wc_stripe_checkout_fields.billing),this.needs_shipping()&&e("#ship-to-different-address-checkbox").is(":checked")&&a(i,wc_stripe_checkout_fields.shipping),valid=this.is_valid_checkout(),valid},wc_stripe.ProductGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.product",e(document.body).on("wc_stripe_updated_rest_nonce",this.set_rest_nonce.bind(this)),e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth(),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[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_product_data();i.price=e.display_price,i.needs_shipping=!e.is_virtual,i.variation=e,this.set_product_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){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 e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.needs_shipping=function(){return this.get_product_data().needs_shipping},wc_stripe.ProductGateway.prototype.get_product_data=function(){return e("#wc_stripe_product_data").data("product")},wc_stripe.ProductGateway.prototype.set_product_data=function(t){e("#wc_stripe_product_data").data("product",t)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(a,n,s){this.unblock(),e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",s.getResponseHeader("X-WP-Nonce")),a.code?(this.submit_error(a.message),i(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),t(a.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(i,a){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(t,a,n){e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",n.getResponseHeader("X-WP-Nonce")),t.code?this.cart_calculation_error=!0:(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),i(t.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this))},wc_stripe.CartGateway.prototype.needs_shipping=function(){return 1===e("#wc_stripe_needs_shipping").data("value")},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(t)},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){e(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};const a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.address_mappings=function(t){return{name:{set:function(t,i){var a=t.split(" ");e(i+"_first_name").val(a[0]),e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+e(t+"_last_name").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){return e(t+"_postcode").val()}},countryCode:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},phoneNumber:{set:function(t,i){e("#billing_phone").val(t)},get:function(){return"#billing_phone".val()}},address1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},address2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},locality:{set:function(t,i){e(i+"_city").val(t)},get:function(t){return e(t+"_city").val()}},administrativeArea:{set:function(t,i){e(i+"_state").val(t)},get:function(t){return e(t+"_state").val()}}}},wc_stripe.GooglePay.prototype.serialize_form=function(t){return e.extend({},wc_stripe.BaseGateway.prototype.serialize_form.apply(this,arguments),{order_review:!this.dynamic_price_enabled()})},wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress,a=this.address_mappings();for(var n in i)a[n]&&a[n].set.call(this,i[n],"#billing");if(t.shippingAddress)for(var n in t.shippingAddress)a[n]&&a[n].set.call(this,t.shippingAddress[n],"#shipping");t.email&&e("#billing_email").val(t.email),this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},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(t){return new Promise(function(i,a){e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_methods:this.map_shipping_methods(t.shippingOptionData.id),shipping_method_id:t.shippingOptionData.id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)})).done(function(t){t.code?a(t.data.data):i(t.data)}.bind(this)).fail(function(){a()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.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_googlepay_display_items=function(){return e("#googlepay_display_items").data("items")},wc_stripe.GooglePay.prototype.set_googlepay_display_items=function(t){e("#googlepay_display_items").data("items",t)},wc_stripe.GooglePay.prototype.get_shipping_options=function(){return e("#googlepay_shipping_options").data("items")},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.dynamic_price_enabled=function(){return"1"===this.params.dynamic_price},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}}),t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},a,{emailRequired:!0,merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:this.needs_shipping()&&this.get_total_price_cents()>0,transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_googlepay_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:e("#billing_phone").length>0},this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"]),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 i=e.extend({},a);i.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(i).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=e(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.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){e(document.body).on("click",".apple-pay-button",this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.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.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return 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(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")}}(window,jQuery);
|
i18n/languages/woo-stripe-payment.pot
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: woo-stripe-payment\n"
|
5 |
-
"POT-Creation-Date: 2020-02-
|
6 |
"PO-Revision-Date: 2019-08-16 14:27-0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
@@ -43,63 +43,63 @@ msgstr ""
|
|
43 |
msgid "Order charge successful in Stripe. Charge: %s. Payment Method: %s"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
47 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
48 |
#, php-format
|
49 |
msgid "Order amount captured in Stripe. Amount: %s"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
53 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
54 |
#, php-format
|
55 |
msgid "Error capturing charge in Stripe. Reason: %s"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
59 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
60 |
#, php-format
|
61 |
msgid "Error voiding charge. Reason: %s"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
65 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
66 |
msgid "Charge voided in Stripe."
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
70 |
#, php-format
|
71 |
msgid ""
|
72 |
"Recurring payment for subscription failed. Reason: %s. Payment method: %s"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
76 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
77 |
#, php-format
|
78 |
msgid "Recurring payment captured in Stripe. Payment method: %s"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
82 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
83 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
84 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
85 |
#, php-format
|
86 |
msgid "Recurring payment authorized in Stripe. Payment method: %s"
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
90 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
91 |
#, php-format
|
92 |
msgid "Error deleting Stripe card. Token Id: %s"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
96 |
#, php-format
|
97 |
msgid ""
|
98 |
"Pre-order payment for subscription failed. Reason: %s. Payment method: %s"
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:
|
102 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
103 |
#, php-format
|
104 |
msgid "Pre-order payment captured in Stripe. Payment method: %s"
|
105 |
msgstr ""
|
@@ -138,22 +138,22 @@ msgstr ""
|
|
138 |
msgid "authorization"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
142 |
msgid "A new payment method is required."
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
146 |
#, php-format
|
147 |
msgid "Recurring payment for order failed. Reason: %s"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
151 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
152 |
#, php-format
|
153 |
msgid "Customer must manually complete payment for payment method %s"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:
|
157 |
#, php-format
|
158 |
msgid "Pre-order payment for order failed. Reason: %s"
|
159 |
msgstr ""
|
@@ -208,32 +208,32 @@ msgstr ""
|
|
208 |
msgid "Saved Cards"
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
212 |
#, php-format
|
213 |
msgid "Attemp to save payment method failed. Reason: %s"
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
217 |
msgid ""
|
218 |
"We were not able to save your payment method. To prevent billing issues with "
|
219 |
"your subscription, please add a payment method to the subscription."
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
223 |
#, php-format
|
224 |
msgid "We were not able to save your payment method. Reason: %s"
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
228 |
msgid "Payment Method Token"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
232 |
#, php-format
|
233 |
msgid "Error saving payment method for subscription. Reason: %s"
|
234 |
msgstr ""
|
235 |
|
236 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
237 |
#, php-format
|
238 |
msgid "Order %s from %s"
|
239 |
msgstr ""
|
@@ -425,6 +425,11 @@ msgstr ""
|
|
425 |
msgid "Authorize"
|
426 |
msgstr ""
|
427 |
|
|
|
|
|
|
|
|
|
|
|
428 |
#: includes/admin/settings/class-wc-stripe-api-settings.php:6
|
429 |
#: includes/admin/settings/class-wc-stripe-api-settings.php:26
|
430 |
msgid "API Settings"
|
@@ -725,7 +730,7 @@ msgid ""
|
|
725 |
"This order has already been processed. Transaction ID: %s. Payment method: %s"
|
726 |
msgstr ""
|
727 |
|
728 |
-
#: includes/controllers/class-wc-stripe-controller-order-actions.php:
|
729 |
msgid "Order customer Id and payment method customer Id do not match."
|
730 |
msgstr ""
|
731 |
|
@@ -956,29 +961,41 @@ msgstr ""
|
|
956 |
msgid "Please update you product quantity before using Google Pay."
|
957 |
msgstr ""
|
958 |
|
959 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
960 |
-
#: includes/wc-stripe-functions.php:366
|
961 |
msgid "Subscription"
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
965 |
-
#: includes/wc-stripe-
|
|
|
966 |
msgid "Shipping"
|
967 |
msgstr ""
|
968 |
|
969 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:187
|
971 |
-
#: includes/wc-stripe-functions.php:
|
972 |
msgid "Tax"
|
973 |
msgstr ""
|
974 |
|
975 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
976 |
-
#: includes/wc-stripe-functions.php:
|
977 |
msgid "Waiting..."
|
978 |
msgstr ""
|
979 |
|
980 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
981 |
-
#: includes/wc-stripe-functions.php:
|
982 |
msgid "loading shipping methods..."
|
983 |
msgstr ""
|
984 |
|
@@ -1733,23 +1750,23 @@ msgstr ""
|
|
1733 |
msgid "Please enter a valid postcode / ZIP."
|
1734 |
msgstr ""
|
1735 |
|
1736 |
-
#: includes/wc-stripe-functions.php:
|
1737 |
msgid "Bootstrap form"
|
1738 |
msgstr ""
|
1739 |
|
1740 |
-
#: includes/wc-stripe-functions.php:
|
1741 |
msgid "Simple form"
|
1742 |
msgstr ""
|
1743 |
|
1744 |
-
#: includes/wc-stripe-functions.php:
|
1745 |
msgid "Minimalist form"
|
1746 |
msgstr ""
|
1747 |
|
1748 |
-
#: includes/wc-stripe-functions.php:
|
1749 |
msgid "Inline Form"
|
1750 |
msgstr ""
|
1751 |
|
1752 |
-
#: includes/wc-stripe-functions.php:
|
1753 |
msgid "Rounded Form"
|
1754 |
msgstr ""
|
1755 |
|
@@ -1816,7 +1833,3 @@ msgstr ""
|
|
1816 |
#: templates/checkout/checkout-banner.php:9
|
1817 |
msgid "Express Checkout"
|
1818 |
msgstr ""
|
1819 |
-
|
1820 |
-
#: templates/checkout/credit-card.php:17
|
1821 |
-
msgid "Save Card"
|
1822 |
-
msgstr ""
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: woo-stripe-payment\n"
|
5 |
+
"POT-Creation-Date: 2020-02-09 19:06-0800\n"
|
6 |
"PO-Revision-Date: 2019-08-16 14:27-0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
43 |
msgid "Order charge successful in Stripe. Charge: %s. Payment Method: %s"
|
44 |
msgstr ""
|
45 |
|
46 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:133
|
47 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:196
|
48 |
#, php-format
|
49 |
msgid "Order amount captured in Stripe. Amount: %s"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:137
|
53 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:200
|
54 |
#, php-format
|
55 |
msgid "Error capturing charge in Stripe. Reason: %s"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:147
|
59 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:221
|
60 |
#, php-format
|
61 |
msgid "Error voiding charge. Reason: %s"
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:149
|
65 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:223
|
66 |
msgid "Charge voided in Stripe."
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:176
|
70 |
#, php-format
|
71 |
msgid ""
|
72 |
"Recurring payment for subscription failed. Reason: %s. Payment method: %s"
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:180
|
76 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:262
|
77 |
#, php-format
|
78 |
msgid "Recurring payment captured in Stripe. Payment method: %s"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:182
|
82 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:220
|
83 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:264
|
84 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:330
|
85 |
#, php-format
|
86 |
msgid "Recurring payment authorized in Stripe. Payment method: %s"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:194
|
90 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:296
|
91 |
#, php-format
|
92 |
msgid "Error deleting Stripe card. Token Id: %s"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:214
|
96 |
#, php-format
|
97 |
msgid ""
|
98 |
"Pre-order payment for subscription failed. Reason: %s. Payment method: %s"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:218
|
102 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:328
|
103 |
#, php-format
|
104 |
msgid "Pre-order payment captured in Stripe. Payment method: %s"
|
105 |
msgstr ""
|
138 |
msgid "authorization"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:118
|
142 |
msgid "A new payment method is required."
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:251
|
146 |
#, php-format
|
147 |
msgid "Recurring payment for order failed. Reason: %s"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:268
|
151 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:334
|
152 |
#, php-format
|
153 |
msgid "Customer must manually complete payment for payment method %s"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:317
|
157 |
#, php-format
|
158 |
msgid "Pre-order payment for order failed. Reason: %s"
|
159 |
msgstr ""
|
208 |
msgid "Saved Cards"
|
209 |
msgstr ""
|
210 |
|
211 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:841
|
212 |
#, php-format
|
213 |
msgid "Attemp to save payment method failed. Reason: %s"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:861
|
217 |
msgid ""
|
218 |
"We were not able to save your payment method. To prevent billing issues with "
|
219 |
"your subscription, please add a payment method to the subscription."
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:863
|
223 |
#, php-format
|
224 |
msgid "We were not able to save your payment method. Reason: %s"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:895
|
228 |
msgid "Payment Method Token"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:921
|
232 |
#, php-format
|
233 |
msgid "Error saving payment method for subscription. Reason: %s"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:974
|
237 |
#, php-format
|
238 |
msgid "Order %s from %s"
|
239 |
msgstr ""
|
425 |
msgid "Authorize"
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: includes/admin/meta-boxes/views/html-order-pay.php:48
|
429 |
+
#: templates/checkout/credit-card.php:17
|
430 |
+
msgid "Save Card"
|
431 |
+
msgstr ""
|
432 |
+
|
433 |
#: includes/admin/settings/class-wc-stripe-api-settings.php:6
|
434 |
#: includes/admin/settings/class-wc-stripe-api-settings.php:26
|
435 |
msgid "API Settings"
|
730 |
"This order has already been processed. Transaction ID: %s. Payment method: %s"
|
731 |
msgstr ""
|
732 |
|
733 |
+
#: includes/controllers/class-wc-stripe-controller-order-actions.php:187
|
734 |
msgid "Order customer Id and payment method customer Id do not match."
|
735 |
msgstr ""
|
736 |
|
961 |
msgid "Please update you product quantity before using Google Pay."
|
962 |
msgstr ""
|
963 |
|
964 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:88
|
|
|
965 |
msgid "Subscription"
|
966 |
msgstr ""
|
967 |
|
968 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:118
|
969 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:166
|
970 |
+
#: includes/wc-stripe-functions.php:352 includes/wc-stripe-functions.php:399
|
971 |
msgid "Shipping"
|
972 |
msgstr ""
|
973 |
|
974 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:126
|
975 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:187
|
976 |
+
#: includes/wc-stripe-functions.php:368 includes/wc-stripe-functions.php:407
|
977 |
+
msgid "Discount"
|
978 |
+
msgstr ""
|
979 |
+
|
980 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:137
|
981 |
+
#: includes/wc-stripe-functions.php:418
|
982 |
+
msgid "Fees"
|
983 |
+
msgstr ""
|
984 |
+
|
985 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:145
|
986 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:195
|
987 |
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:187
|
988 |
+
#: includes/wc-stripe-functions.php:376 includes/wc-stripe-functions.php:426
|
989 |
msgid "Tax"
|
990 |
msgstr ""
|
991 |
|
992 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:226
|
993 |
+
#: includes/wc-stripe-functions.php:478
|
994 |
msgid "Waiting..."
|
995 |
msgstr ""
|
996 |
|
997 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:227
|
998 |
+
#: includes/wc-stripe-functions.php:479
|
999 |
msgid "loading shipping methods..."
|
1000 |
msgstr ""
|
1001 |
|
1750 |
msgid "Please enter a valid postcode / ZIP."
|
1751 |
msgstr ""
|
1752 |
|
1753 |
+
#: includes/wc-stripe-functions.php:696
|
1754 |
msgid "Bootstrap form"
|
1755 |
msgstr ""
|
1756 |
|
1757 |
+
#: includes/wc-stripe-functions.php:730
|
1758 |
msgid "Simple form"
|
1759 |
msgstr ""
|
1760 |
|
1761 |
+
#: includes/wc-stripe-functions.php:763
|
1762 |
msgid "Minimalist form"
|
1763 |
msgstr ""
|
1764 |
|
1765 |
+
#: includes/wc-stripe-functions.php:797
|
1766 |
msgid "Inline Form"
|
1767 |
msgstr ""
|
1768 |
|
1769 |
+
#: includes/wc-stripe-functions.php:833
|
1770 |
msgid "Rounded Form"
|
1771 |
msgstr ""
|
1772 |
|
1833 |
#: templates/checkout/checkout-banner.php:9
|
1834 |
msgid "Express Checkout"
|
1835 |
msgstr ""
|
|
|
|
|
|
|
|
includes/abstract/abstract-wc-payment-gateway-stripe-charge.php
CHANGED
@@ -87,8 +87,6 @@ abstract class WC_Payment_Gateway_Stripe_Charge extends WC_Payment_Gateway_Strip
|
|
87 |
$order->add_order_note ( sprintf ( __ ( 'Order charge successful in Stripe. Charge: %s. Payment Method: %s', 'woo-stripe-payment' ), $order->get_transaction_id (), $order->get_payment_method_title () ) );
|
88 |
}
|
89 |
|
90 |
-
WC ()->cart->empty_cart ();
|
91 |
-
|
92 |
$this->trigger_post_payment_processes ( $order, $this );
|
93 |
|
94 |
return array( 'result' => 'success',
|
87 |
$order->add_order_note ( sprintf ( __ ( 'Order charge successful in Stripe. Charge: %s. Payment Method: %s', 'woo-stripe-payment' ), $order->get_transaction_id (), $order->get_payment_method_title () ) );
|
88 |
}
|
89 |
|
|
|
|
|
90 |
$this->trigger_post_payment_processes ( $order, $this );
|
91 |
|
92 |
return array( 'result' => 'success',
|
includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php
CHANGED
@@ -89,7 +89,6 @@ abstract class WC_Payment_Gateway_Stripe_Payment_Intent extends WC_Payment_Gatew
|
|
89 |
$this->save_order_meta ( $order, $charge );
|
90 |
$order->add_order_note ( sprintf ( __ ( 'Order %s successful in Stripe. Charge: %s. Payment Method: %s', 'woo-stripe-payment' ), $charge->captured ? __ ( 'charge', 'woo-stripe-payment' ) : __ ( 'authorization', 'woo-stripe-payment' ), $order->get_transaction_id (), $order->get_payment_method_title () ) );
|
91 |
}
|
92 |
-
WC ()->cart->empty_cart ();
|
93 |
|
94 |
/**
|
95 |
* Save the payment method if appropriate.
|
@@ -336,10 +335,11 @@ abstract class WC_Payment_Gateway_Stripe_Payment_Intent extends WC_Payment_Gatew
|
|
336 |
}
|
337 |
}
|
338 |
}
|
339 |
-
|
340 |
/**
|
341 |
-
*
|
342 |
* {@inheritDoc}
|
|
|
343 |
* @see WC_Payment_Gateway_Stripe::get_payment_method_from_charge()
|
344 |
*/
|
345 |
public function get_payment_method_from_charge($charge) {
|
89 |
$this->save_order_meta ( $order, $charge );
|
90 |
$order->add_order_note ( sprintf ( __ ( 'Order %s successful in Stripe. Charge: %s. Payment Method: %s', 'woo-stripe-payment' ), $charge->captured ? __ ( 'charge', 'woo-stripe-payment' ) : __ ( 'authorization', 'woo-stripe-payment' ), $order->get_transaction_id (), $order->get_payment_method_title () ) );
|
91 |
}
|
|
|
92 |
|
93 |
/**
|
94 |
* Save the payment method if appropriate.
|
335 |
}
|
336 |
}
|
337 |
}
|
338 |
+
|
339 |
/**
|
340 |
+
*
|
341 |
* {@inheritDoc}
|
342 |
+
*
|
343 |
* @see WC_Payment_Gateway_Stripe::get_payment_method_from_charge()
|
344 |
*/
|
345 |
public function get_payment_method_from_charge($charge) {
|
includes/abstract/abstract-wc-payment-gateway-stripe.php
CHANGED
@@ -633,9 +633,15 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
633 |
*/
|
634 |
public function get_needs_shipping() {
|
635 |
if (is_checkout () || is_cart ()) {
|
|
|
636 |
if (wcs_stripe_active () && WC_Subscriptions_Change_Payment_Gateway::$is_request_to_change_payment) {
|
637 |
return false;
|
638 |
}
|
|
|
|
|
|
|
|
|
|
|
639 |
return WC ()->cart->needs_shipping ();
|
640 |
}
|
641 |
if (is_product ()) {
|
@@ -729,7 +735,8 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
729 |
* @return bool
|
730 |
*/
|
731 |
public function banner_checkout_enabled() {
|
732 |
-
|
|
|
733 |
}
|
734 |
|
735 |
/**
|
633 |
*/
|
634 |
public function get_needs_shipping() {
|
635 |
if (is_checkout () || is_cart ()) {
|
636 |
+
global $wp;
|
637 |
if (wcs_stripe_active () && WC_Subscriptions_Change_Payment_Gateway::$is_request_to_change_payment) {
|
638 |
return false;
|
639 |
}
|
640 |
+
// return false if this is the order pay page. Gateways that have payment sheets don't need
|
641 |
+
// to make any changes to the order.
|
642 |
+
if (! empty ( $wp->query_vars[ 'order-pay' ] )) {
|
643 |
+
return false;
|
644 |
+
}
|
645 |
return WC ()->cart->needs_shipping ();
|
646 |
}
|
647 |
if (is_product ()) {
|
735 |
* @return bool
|
736 |
*/
|
737 |
public function banner_checkout_enabled() {
|
738 |
+
global $wp;
|
739 |
+
return empty ( $wp->query_vars[ 'order-pay' ] ) && $this->supports ( 'wc_stripe_banner_checkout' ) && in_array ( 'checkout_banner', $this->get_option ( 'payment_sections', [] ) );
|
740 |
}
|
741 |
|
742 |
/**
|
includes/class-stripe.php
CHANGED
@@ -21,7 +21,7 @@ class WC_Stripe_Manager {
|
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
-
public $version = '3.0.
|
25 |
|
26 |
/**
|
27 |
*
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
+
public $version = '3.0.9';
|
25 |
|
26 |
/**
|
27 |
*
|
includes/class-wc-stripe-field-manager.php
CHANGED
@@ -136,7 +136,8 @@ class WC_Stripe_Field_Manager {
|
|
136 |
|
137 |
wc_stripe_get_template ( 'cart/payment-methods.php', [
|
138 |
'gateways' => $gateways,
|
139 |
-
'after' => self::$_cart_priority > 20
|
|
|
140 |
] );
|
141 |
echo '</form>';
|
142 |
}
|
136 |
|
137 |
wc_stripe_get_template ( 'cart/payment-methods.php', [
|
138 |
'gateways' => $gateways,
|
139 |
+
'after' => self::$_cart_priority > 20,
|
140 |
+
'cart_total' => WC ()->cart->total
|
141 |
] );
|
142 |
echo '</form>';
|
143 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-googlepay.php
CHANGED
@@ -81,6 +81,7 @@ class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe_Char
|
|
81 |
|
82 |
public function get_display_items($encode = false) {
|
83 |
$items = [];
|
|
|
84 |
if (wcs_stripe_active () && WC_Subscriptions_Change_Payment_Gateway::$is_request_to_change_payment) {
|
85 |
$subscription = wcs_get_subscription ( absint ( $_GET[ 'change_payment_method' ] ) );
|
86 |
$items[] = [
|
@@ -88,6 +89,64 @@ class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe_Char
|
|
88 |
'type' => 'SUBTOTAL',
|
89 |
'price' => strval ( $subscription->get_total () )
|
90 |
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
} else {
|
92 |
foreach ( WC ()->cart->get_cart () as $cart_item ) {
|
93 |
/**
|
@@ -109,10 +168,32 @@ class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe_Char
|
|
109 |
'price' => strval ( WC ()->cart->shipping_total )
|
110 |
];
|
111 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
if (wc_tax_enabled ()) {
|
113 |
$items[] = [
|
114 |
'label' => __ ( 'Tax', 'woo-stripe-payment' ),
|
115 |
-
'type' => '
|
116 |
'price' => strval ( WC ()->cart->get_taxes_total () )
|
117 |
];
|
118 |
}
|
81 |
|
82 |
public function get_display_items($encode = false) {
|
83 |
$items = [];
|
84 |
+
global $wp;
|
85 |
if (wcs_stripe_active () && WC_Subscriptions_Change_Payment_Gateway::$is_request_to_change_payment) {
|
86 |
$subscription = wcs_get_subscription ( absint ( $_GET[ 'change_payment_method' ] ) );
|
87 |
$items[] = [
|
89 |
'type' => 'SUBTOTAL',
|
90 |
'price' => strval ( $subscription->get_total () )
|
91 |
];
|
92 |
+
} elseif (is_product ()) {
|
93 |
+
global $product;
|
94 |
+
$items[] = [
|
95 |
+
'label' => esc_attr ( $product->get_name () ),
|
96 |
+
'type' => 'LINE_ITEM',
|
97 |
+
'price' => strval ( $product->get_price () )
|
98 |
+
];
|
99 |
+
} elseif (is_checkout () && isset ( $wp->query_vars[ 'order-pay' ] )) {
|
100 |
+
$order = wc_get_order ( absint ( $wp->query_vars[ 'order-pay' ] ) );
|
101 |
+
// add all order items
|
102 |
+
foreach ( $order->get_items () as $item ) {
|
103 |
+
/**
|
104 |
+
*
|
105 |
+
* @var WC_Order_Item_Product $item
|
106 |
+
*/
|
107 |
+
$qty = $item->get_quantity ();
|
108 |
+
|
109 |
+
$items[] = [
|
110 |
+
'label' => $qty > 1 ? sprintf ( '%s X %s', $item->get_name (), $qty ) : $item->get_name (),
|
111 |
+
'type' => 'LINE_ITEM',
|
112 |
+
'price' => strval ( $item->get_subtotal () )
|
113 |
+
];
|
114 |
+
}
|
115 |
+
// shipping total
|
116 |
+
if ($order->get_shipping_total ()) {
|
117 |
+
$items[] = [
|
118 |
+
'label' => __ ( 'Shipping', 'woo-stripe-payment' ),
|
119 |
+
'type' => 'LINE_ITEM',
|
120 |
+
'price' => strval ( $order->get_shipping_total () )
|
121 |
+
];
|
122 |
+
}
|
123 |
+
// discount total
|
124 |
+
if ($order->get_total_discount ()) {
|
125 |
+
$items[] = [
|
126 |
+
'label' => __ ( 'Discount', 'woo-stripe-payment' ),
|
127 |
+
'type' => 'LINE_ITEM',
|
128 |
+
'price' => strval ( $order->get_total_discount () )
|
129 |
+
];
|
130 |
+
}
|
131 |
+
if ($order->get_fees ()) {
|
132 |
+
$fee_total = 0;
|
133 |
+
foreach ( $order->get_fees () as $fee ) {
|
134 |
+
$fee_total += $fee->get_total ();
|
135 |
+
}
|
136 |
+
$items[] = [
|
137 |
+
'label' => __ ( 'Fees', 'woo-stripe-payment' ),
|
138 |
+
'type' => 'LINE_ITEM',
|
139 |
+
'price' => strval ( $fee_total )
|
140 |
+
];
|
141 |
+
}
|
142 |
+
// tax total
|
143 |
+
if ($order->get_total_tax ()) {
|
144 |
+
$items[] = [
|
145 |
+
'label' => __ ( 'Tax', 'woocommerce' ),
|
146 |
+
'type' => 'TAX',
|
147 |
+
'price' => strval ( $order->get_total_tax () )
|
148 |
+
];
|
149 |
+
}
|
150 |
} else {
|
151 |
foreach ( WC ()->cart->get_cart () as $cart_item ) {
|
152 |
/**
|
168 |
'price' => strval ( WC ()->cart->shipping_total )
|
169 |
];
|
170 |
}
|
171 |
+
|
172 |
+
// fees
|
173 |
+
foreach ( WC ()->cart->get_fees () as $fee_item ) {
|
174 |
+
/**
|
175 |
+
*
|
176 |
+
* @var WC_Order_I
|
177 |
+
*/
|
178 |
+
$items[] = [ 'label' => $fee_item->name,
|
179 |
+
'type' => 'LINE_ITEM',
|
180 |
+
'price' => strval ( $fee_item->total )
|
181 |
+
];
|
182 |
+
}
|
183 |
+
|
184 |
+
// coupons
|
185 |
+
if (WC ()->cart->discount_cart != 0) {
|
186 |
+
$items[] = [
|
187 |
+
'label' => __ ( 'Discount', 'woo-stripe-payment' ),
|
188 |
+
'type' => 'LINE_ITEM',
|
189 |
+
'price' => strval ( - 1 * abs ( WC ()->cart->discount_cart ) )
|
190 |
+
];
|
191 |
+
}
|
192 |
+
|
193 |
if (wc_tax_enabled ()) {
|
194 |
$items[] = [
|
195 |
'label' => __ ( 'Tax', 'woo-stripe-payment' ),
|
196 |
+
'type' => 'TAX',
|
197 |
'price' => strval ( WC ()->cart->get_taxes_total () )
|
198 |
];
|
199 |
}
|
includes/wc-stripe-functions.php
CHANGED
@@ -332,8 +332,8 @@ function wc_stripe_shipping_address_serviceable() {
|
|
332 |
*/
|
333 |
function wc_stripe_get_display_items($encode = false, $order = null) {
|
334 |
$items = [];
|
335 |
-
$cart = WC ()->cart;
|
336 |
if (! $order) {
|
|
|
337 |
foreach ( $cart->get_cart () as $cart_item ) {
|
338 |
/**
|
339 |
*
|
@@ -354,6 +354,23 @@ function wc_stripe_get_display_items($encode = false, $order = null) {
|
|
354 |
'amount' => wc_stripe_add_number_precision ( $cart->shipping_total )
|
355 |
];
|
356 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
if (wc_tax_enabled ()) {
|
358 |
$items[] = [
|
359 |
'label' => __ ( 'Tax', 'woo-stripe-payment' ),
|
@@ -362,11 +379,55 @@ function wc_stripe_get_display_items($encode = false, $order = null) {
|
|
362 |
];
|
363 |
}
|
364 |
} else {
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
}
|
371 |
$items = apply_filters ( 'wc_stripe_get_display_items', $items, $order );
|
372 |
return $encode ? htmlspecialchars ( wp_json_encode ( $items ) ) : $items;
|
@@ -593,10 +654,6 @@ function wc_stripe_api_options($options) {
|
|
593 |
*/
|
594 |
function wc_stripe_payment_complete_order_status($order_status, $order_id, $order) {
|
595 |
if (is_checkout () && $order->get_payment_method ()) {
|
596 |
-
/**
|
597 |
-
*
|
598 |
-
* @var WC_Payment_Gateway_Stripe $gateway
|
599 |
-
*/
|
600 |
$gateway = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
|
601 |
if ($gateway instanceof WC_Payment_Gateway_Stripe && 'default' !== $gateway->get_option ( 'order_status' )) {
|
602 |
$order_status = $gateway->get_option ( 'order_status' );
|
332 |
*/
|
333 |
function wc_stripe_get_display_items($encode = false, $order = null) {
|
334 |
$items = [];
|
|
|
335 |
if (! $order) {
|
336 |
+
$cart = WC ()->cart;
|
337 |
foreach ( $cart->get_cart () as $cart_item ) {
|
338 |
/**
|
339 |
*
|
354 |
'amount' => wc_stripe_add_number_precision ( $cart->shipping_total )
|
355 |
];
|
356 |
}
|
357 |
+
|
358 |
+
// fees
|
359 |
+
foreach ( $cart->get_fees () as $fee ) {
|
360 |
+
$items[] = [ 'label' => $fee->name,
|
361 |
+
'pending' => false,
|
362 |
+
'amount' => wc_stripe_add_number_precision ( $fee->total )
|
363 |
+
];
|
364 |
+
}
|
365 |
+
// coupons
|
366 |
+
if ($cart->discount_cart != 0) {
|
367 |
+
$items[] = [
|
368 |
+
'label' => __ ( 'Discount', 'woo-stripe-payment' ),
|
369 |
+
'pending' => false,
|
370 |
+
'amount' => wc_stripe_add_number_precision ( - 1 * abs ( $cart->discount_cart ) )
|
371 |
+
];
|
372 |
+
}
|
373 |
+
|
374 |
if (wc_tax_enabled ()) {
|
375 |
$items[] = [
|
376 |
'label' => __ ( 'Tax', 'woo-stripe-payment' ),
|
379 |
];
|
380 |
}
|
381 |
} else {
|
382 |
+
// add all order items
|
383 |
+
foreach ( $order->get_items () as $item ) {
|
384 |
+
/**
|
385 |
+
*
|
386 |
+
* @var WC_Order_Item_Product $item
|
387 |
+
*/
|
388 |
+
$qty = $item->get_quantity ();
|
389 |
+
|
390 |
+
$items[] = [
|
391 |
+
'label' => $qty > 1 ? sprintf ( '%s X %s', $item->get_name (), $qty ) : $item->get_name (),
|
392 |
+
'pending' => false,
|
393 |
+
'amount' => wc_stripe_add_number_precision ( $item->get_subtotal () )
|
394 |
+
];
|
395 |
+
}
|
396 |
+
// shipping total
|
397 |
+
if ($order->get_shipping_total ()) {
|
398 |
+
$items[] = [
|
399 |
+
'label' => __ ( 'Shipping', 'woo-stripe-payment' ),
|
400 |
+
'pending' => false,
|
401 |
+
'amount' => wc_stripe_add_number_precision ( $order->get_shipping_total () )
|
402 |
+
];
|
403 |
+
}
|
404 |
+
// discount total
|
405 |
+
if ($order->get_total_discount ()) {
|
406 |
+
$items[] = [
|
407 |
+
'label' => __ ( 'Discount', 'woo-stripe-payment' ),
|
408 |
+
'pending' => false,
|
409 |
+
'amount' => wc_stripe_add_number_precision ( $order->get_total_discount () )
|
410 |
+
];
|
411 |
+
}
|
412 |
+
if ($order->get_fees ()) {
|
413 |
+
$fee_total = 0;
|
414 |
+
foreach ( $order->get_fees () as $fee ) {
|
415 |
+
$fee_total += $fee->get_total ();
|
416 |
+
}
|
417 |
+
$items[] = [
|
418 |
+
'label' => __ ( 'Fees', 'woo-stripe-payment' ),
|
419 |
+
'pending' => false,
|
420 |
+
'amount' => wc_stripe_add_number_precision ( $fee_total )
|
421 |
+
];
|
422 |
+
}
|
423 |
+
// tax total
|
424 |
+
if ($order->get_total_tax ()) {
|
425 |
+
$items[] = [
|
426 |
+
'label' => __ ( 'Tax', 'woocommerce' ),
|
427 |
+
'pending' => false,
|
428 |
+
'amount' => wc_stripe_add_number_precision ( $order->get_total_tax () )
|
429 |
+
];
|
430 |
+
}
|
431 |
}
|
432 |
$items = apply_filters ( 'wc_stripe_get_display_items', $items, $order );
|
433 |
return $encode ? htmlspecialchars ( wp_json_encode ( $items ) ) : $items;
|
654 |
*/
|
655 |
function wc_stripe_payment_complete_order_status($order_status, $order_id, $order) {
|
656 |
if (is_checkout () && $order->get_payment_method ()) {
|
|
|
|
|
|
|
|
|
657 |
$gateway = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
|
658 |
if ($gateway instanceof WC_Payment_Gateway_Stripe && 'default' !== $gateway->get_option ( 'order_status' )) {
|
659 |
$order_status = $gateway->get_option ( 'order_status' );
|
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.3
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 3.0.
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -53,6 +53,9 @@ If you're site is not loading over https, then Stripe won't render the Payment R
|
|
53 |
7. Payment options at top of checkout page for easy one click checkout
|
54 |
|
55 |
== Changelog ==
|
|
|
|
|
|
|
56 |
= 3.0.8 =
|
57 |
* Updated - billing phone and email check added for card payment
|
58 |
* Updated - template checkout/payment-method.php name changed to checkout/stripe-payment-method.php
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 3.0.9
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
53 |
7. Payment options at top of checkout page for easy one click checkout
|
54 |
|
55 |
== Changelog ==
|
56 |
+
= 3.0.9 =
|
57 |
+
* Added - Payment methods with payment sheets like Apple Pay now show order items on order pay page instead of just total.
|
58 |
+
* Fixed - Error if 100% off coupon is used on checkout page.
|
59 |
= 3.0.8 =
|
60 |
* Updated - billing phone and email check added for card payment
|
61 |
* Updated - template checkout/payment-method.php name changed to checkout/stripe-payment-method.php
|
stripe-payments.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Stripe For WooCommerce
|
5 |
* Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
|
6 |
* Description: Accept credit cards, Google Pay, & Apple Pay, ACH, Klarna and more using Stripe.
|
7 |
-
* Version: 3.0.
|
8 |
* Author: Payment Plugins, support@paymentplugins.com
|
9 |
* Text Domain: woo-stripe-payment
|
10 |
* Domain Path: /i18n/languages/
|
4 |
* Plugin Name: Stripe For WooCommerce
|
5 |
* Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
|
6 |
* Description: Accept credit cards, Google Pay, & Apple Pay, ACH, Klarna and more using Stripe.
|
7 |
+
* Version: 3.0.9
|
8 |
* Author: Payment Plugins, support@paymentplugins.com
|
9 |
* Text Domain: woo-stripe-payment
|
10 |
* Domain Path: /i18n/languages/
|
templates/cart/payment-methods.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* @version 3.0.
|
4 |
*
|
5 |
* @var WC_Payment_Gateway_Stripe[] $gateways
|
6 |
*/
|
7 |
?>
|
8 |
-
<div class="wc-stripe-cart-checkout-container"
|
9 |
<ul class="wc_stripe_cart_payment_methods">
|
10 |
<?php if($after):?>
|
11 |
<li class="wc-stripe-payment-method or">
|
1 |
<?php
|
2 |
/**
|
3 |
+
* @version 3.0.9
|
4 |
*
|
5 |
* @var WC_Payment_Gateway_Stripe[] $gateways
|
6 |
*/
|
7 |
?>
|
8 |
+
<div class="wc-stripe-cart-checkout-container" <?php if($cart_total == 0){?>style="display: none"<?php }?>>
|
9 |
<ul class="wc_stripe_cart_payment_methods">
|
10 |
<?php if($after):?>
|
11 |
<li class="wc-stripe-payment-method or">
|
templates/product/googlepay.php
CHANGED
@@ -1,17 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* @version 3.0.
|
4 |
*
|
5 |
-
* @var
|
6 |
*/
|
7 |
-
|
8 |
-
'label' => esc_attr ( $product->get_name () ),
|
9 |
-
'type' => 'LINE_ITEM',
|
10 |
-
'price' => strval ( $product->get_price () )
|
11 |
-
]?>
|
12 |
<div id="wc-stripe-googlepay-container">
|
13 |
<input type="hidden" id="googlepay_display_items"
|
14 |
-
data-items="<?php echo
|
15 |
-
|
16 |
data-items="<?php echo $gateway->get_shipping_methods(true)?>" />
|
17 |
</div>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* @version 3.0.9
|
4 |
*
|
5 |
+
* @var WC_Payment_Gateway_Stripe_GooglePay $gateway
|
6 |
*/
|
7 |
+
?>
|
|
|
|
|
|
|
|
|
8 |
<div id="wc-stripe-googlepay-container">
|
9 |
<input type="hidden" id="googlepay_display_items"
|
10 |
+
data-items="<?php echo $gateway->get_display_items(true)?>" /> <input
|
11 |
+
type="hidden" id="googlepay_shipping_options"
|
12 |
data-items="<?php echo $gateway->get_shipping_methods(true)?>" />
|
13 |
</div>
|