Version Description
- Fix - Remove bitcoin icon when not using Stripe Checkout mode as it is not supported.
- Fix - Failed payment order was not sending email to admin.
- Fix - Saved card option was not being honored.
- New - Filter for WC_Payment_Gateway_CC::wc_stripe_generate_payment_request return value.
- New - Filter to disallow prepaid cards. "wc_stripe_allow_prepaid_card".
- New - Filter to require billing address on Stripe Modal Checkout. "wc_stripe_checkout_require_billing_address".
- New - Localized Stripe error messages.
Download this release
Release Info
| Developer | royho |
| Plugin | |
| Version | 3.0.3 |
| Comparing to | |
| See all releases | |
Code changes from version 3.0.2 to 3.0.3
- assets/js/stripe.js +62 -22
- assets/js/stripe.min.js +1 -0
- assets/js/stripe_checkout.js +4 -4
- assets/js/stripe_checkout.min.js +1 -0
- includes/class-wc-gateway-stripe-addons.php +6 -23
- includes/class-wc-gateway-stripe.php +168 -27
- includes/class-wc-stripe-customer.php +4 -1
- includes/legacy/class-wc-gateway-stripe.php +1 -1
- languages/woocommerce-gateway-stripe.pot +134 -70
- readme.txt +22 -2
- woocommerce-gateway-stripe.php +41 -41
assets/js/stripe.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
| 2 |
Stripe.setPublishableKey( wc_stripe_params.key );
|
| 3 |
|
| 4 |
jQuery( function( $ ) {
|
| 5 |
-
|
|
|
|
| 6 |
/* Open and close for legacy class */
|
| 7 |
-
|
| 8 |
-
if (
|
| 9 |
-
|
| 10 |
} else {
|
| 11 |
-
|
| 12 |
}
|
| 13 |
} );
|
| 14 |
|
|
@@ -20,12 +21,37 @@ jQuery( function( $ ) {
|
|
| 20 |
/**
|
| 21 |
* Initialize event handlers and UI state.
|
| 22 |
*/
|
| 23 |
-
init: function(
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
.on(
|
| 28 |
-
'submit
|
| 29 |
this.onSubmit
|
| 30 |
);
|
| 31 |
|
|
@@ -64,8 +90,14 @@ jQuery( function( $ ) {
|
|
| 64 |
},
|
| 65 |
|
| 66 |
onError: function( e, responseObject ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
$( '.woocommerce-error, .stripe_token' ).remove();
|
| 68 |
-
$( '#stripe-card-number' ).closest( 'p' ).before( '<ul class="woocommerce_error woocommerce-error"><li>' +
|
| 69 |
wc_stripe_form.unblock();
|
| 70 |
},
|
| 71 |
|
|
@@ -79,26 +111,25 @@ jQuery( function( $ ) {
|
|
| 79 |
expires = $( '#stripe-card-expiry' ).payment( 'cardExpiryVal' ),
|
| 80 |
first_name = $( '#billing_first_name' ).length ? $( '#billing_first_name' ).val() : wc_stripe_params.billing_first_name,
|
| 81 |
last_name = $( '#billing_last_name' ).length ? $( '#billing_last_name' ).val() : wc_stripe_params.billing_last_name,
|
| 82 |
-
address = {
|
| 83 |
-
|
| 84 |
-
},
|
| 85 |
data = {
|
| 86 |
number : card,
|
| 87 |
cvc : cvc,
|
| 88 |
-
exp_month: parseInt( expires['month'] ) || 0,
|
| 89 |
-
exp_year : parseInt( expires['year'] ) || 0
|
| 90 |
-
name : first_name + ' ' + last_name
|
| 91 |
-
|
| 92 |
};
|
| 93 |
|
| 94 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
data.address_line1 = $( '#billing_address_1' ).val();
|
| 96 |
data.address_line2 = $( '#billing_address_2' ).val();
|
| 97 |
data.address_state = $( '#billing_state' ).val();
|
| 98 |
data.address_city = $( '#billing_city' ).val();
|
| 99 |
data.address_zip = $( '#billing_postcode' ).val();
|
| 100 |
data.address_country = $( '#billing_country' ).val();
|
| 101 |
-
} else if (
|
| 102 |
data.address_line1 = wc_stripe_params.billing_address_1;
|
| 103 |
data.address_line2 = wc_stripe_params.billing_address_2;
|
| 104 |
data.address_state = wc_stripe_params.billing_state;
|
|
@@ -107,7 +138,7 @@ jQuery( function( $ ) {
|
|
| 107 |
data.address_country = wc_stripe_params.billing_country;
|
| 108 |
}
|
| 109 |
|
| 110 |
-
Stripe.createToken( data, wc_stripe_form.
|
| 111 |
|
| 112 |
// Prevent form submitting
|
| 113 |
return false;
|
|
@@ -118,10 +149,19 @@ jQuery( function( $ ) {
|
|
| 118 |
$( '.woocommerce-error, .stripe_token' ).remove();
|
| 119 |
},
|
| 120 |
|
| 121 |
-
|
| 122 |
if ( response.error ) {
|
| 123 |
$( document ).trigger( 'stripeError', { response: response } );
|
| 124 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
// token contains id, last4, and card type
|
| 126 |
var token = response['id'];
|
| 127 |
|
|
@@ -132,5 +172,5 @@ jQuery( function( $ ) {
|
|
| 132 |
}
|
| 133 |
};
|
| 134 |
|
| 135 |
-
wc_stripe_form.init(
|
| 136 |
} );
|
| 2 |
Stripe.setPublishableKey( wc_stripe_params.key );
|
| 3 |
|
| 4 |
jQuery( function( $ ) {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
/* Open and close for legacy class */
|
| 8 |
+
$( 'form.checkout, form#order_review' ).on( 'change', 'input[name="wc-stripe-payment-token"]', function() {
|
| 9 |
+
if ( 'new' === $( '.stripe-legacy-payment-fields input[name="wc-stripe-payment-token"]:checked' ).val() ) {
|
| 10 |
+
$( '.stripe-legacy-payment-fields #stripe-payment-data' ).slideDown( 200 );
|
| 11 |
} else {
|
| 12 |
+
$( '.stripe-legacy-payment-fields #stripe-payment-data' ).slideUp( 200 );
|
| 13 |
}
|
| 14 |
} );
|
| 15 |
|
| 21 |
/**
|
| 22 |
* Initialize event handlers and UI state.
|
| 23 |
*/
|
| 24 |
+
init: function() {
|
| 25 |
+
// checkout page
|
| 26 |
+
if ( $( 'form.woocommerce-checkout' ).length ) {
|
| 27 |
+
this.form = $( 'form.woocommerce-checkout' );
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
$( 'form.woocommerce-checkout' )
|
| 31 |
+
.on(
|
| 32 |
+
'checkout_place_order_stripe',
|
| 33 |
+
this.onSubmit
|
| 34 |
+
);
|
| 35 |
+
|
| 36 |
+
// pay order page
|
| 37 |
+
if ( $( 'form#order_review' ).length ) {
|
| 38 |
+
this.form = $( 'form#order_review' );
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
$( 'form#order_review' )
|
| 42 |
+
.on(
|
| 43 |
+
'submit',
|
| 44 |
+
this.onSubmit
|
| 45 |
+
);
|
| 46 |
|
| 47 |
+
// add payment method page
|
| 48 |
+
if ( $( 'form#add_payment_method' ).length ) {
|
| 49 |
+
this.form = $( 'form#add_payment_method' );
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
$( 'form#add_payment_method' )
|
| 53 |
.on(
|
| 54 |
+
'submit',
|
| 55 |
this.onSubmit
|
| 56 |
);
|
| 57 |
|
| 90 |
},
|
| 91 |
|
| 92 |
onError: function( e, responseObject ) {
|
| 93 |
+
var message = responseObject.response.error.message;
|
| 94 |
+
|
| 95 |
+
if ( wc_stripe_params.hasOwnProperty( responseObject.response.error.code ) ) {
|
| 96 |
+
message = wc_stripe_params[ responseObject.response.error.code ];
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
$( '.woocommerce-error, .stripe_token' ).remove();
|
| 100 |
+
$( '#stripe-card-number' ).closest( 'p' ).before( '<ul class="woocommerce_error woocommerce-error"><li>' + message + '</li></ul>' );
|
| 101 |
wc_stripe_form.unblock();
|
| 102 |
},
|
| 103 |
|
| 111 |
expires = $( '#stripe-card-expiry' ).payment( 'cardExpiryVal' ),
|
| 112 |
first_name = $( '#billing_first_name' ).length ? $( '#billing_first_name' ).val() : wc_stripe_params.billing_first_name,
|
| 113 |
last_name = $( '#billing_last_name' ).length ? $( '#billing_last_name' ).val() : wc_stripe_params.billing_last_name,
|
|
|
|
|
|
|
|
|
|
| 114 |
data = {
|
| 115 |
number : card,
|
| 116 |
cvc : cvc,
|
| 117 |
+
exp_month: parseInt( expires['month'], 10 ) || 0,
|
| 118 |
+
exp_year : parseInt( expires['year'], 10 ) || 0
|
|
|
|
|
|
|
| 119 |
};
|
| 120 |
|
| 121 |
+
if ( first_name && last_name ) {
|
| 122 |
+
data.name = first_name + ' ' + last_name
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
if ( $( '#billing_address_1' ).length > 0 ) {
|
| 126 |
data.address_line1 = $( '#billing_address_1' ).val();
|
| 127 |
data.address_line2 = $( '#billing_address_2' ).val();
|
| 128 |
data.address_state = $( '#billing_state' ).val();
|
| 129 |
data.address_city = $( '#billing_city' ).val();
|
| 130 |
data.address_zip = $( '#billing_postcode' ).val();
|
| 131 |
data.address_country = $( '#billing_country' ).val();
|
| 132 |
+
} else if ( wc_stripe_params.billing_address_1 ) {
|
| 133 |
data.address_line1 = wc_stripe_params.billing_address_1;
|
| 134 |
data.address_line2 = wc_stripe_params.billing_address_2;
|
| 135 |
data.address_state = wc_stripe_params.billing_state;
|
| 138 |
data.address_country = wc_stripe_params.billing_country;
|
| 139 |
}
|
| 140 |
|
| 141 |
+
Stripe.createToken( data, wc_stripe_form.onStripeResponse );
|
| 142 |
|
| 143 |
// Prevent form submitting
|
| 144 |
return false;
|
| 149 |
$( '.woocommerce-error, .stripe_token' ).remove();
|
| 150 |
},
|
| 151 |
|
| 152 |
+
onStripeResponse: function( status, response ) {
|
| 153 |
if ( response.error ) {
|
| 154 |
$( document ).trigger( 'stripeError', { response: response } );
|
| 155 |
} else {
|
| 156 |
+
// check if we allow prepaid cards
|
| 157 |
+
if ( 'no' === wc_stripe_params.allow_prepaid_card && 'prepaid' === response.card.funding ) {
|
| 158 |
+
response.error = { message: wc_stripe_params.no_prepaid_card_msg };
|
| 159 |
+
|
| 160 |
+
$( document ).trigger( 'stripeError', { response: response } );
|
| 161 |
+
|
| 162 |
+
return false;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
// token contains id, last4, and card type
|
| 166 |
var token = response['id'];
|
| 167 |
|
| 172 |
}
|
| 173 |
};
|
| 174 |
|
| 175 |
+
wc_stripe_form.init();
|
| 176 |
} );
|
assets/js/stripe.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
Stripe.setPublishableKey(wc_stripe_params.key),jQuery(function(a){"use strict";a("form.checkout, form#order_review").on("change",'input[name="wc-stripe-payment-token"]',function(){"new"===a('.stripe-legacy-payment-fields input[name="wc-stripe-payment-token"]:checked').val()?a(".stripe-legacy-payment-fields #stripe-payment-data").slideDown(200):a(".stripe-legacy-payment-fields #stripe-payment-data").slideUp(200)});var b={init:function(){a("form.woocommerce-checkout").length&&(this.form=a("form.woocommerce-checkout")),a("form.woocommerce-checkout").on("checkout_place_order_stripe",this.onSubmit),a("form#order_review").length&&(this.form=a("form#order_review")),a("form#order_review").on("submit",this.onSubmit),a("form#add_payment_method").length&&(this.form=a("form#add_payment_method")),a("form#add_payment_method").on("submit",this.onSubmit),a(document).on("change","#wc-stripe-cc-form :input",this.onCCFormChange).on("stripeError",this.onError)},isStripeChosen:function(){return a("#payment_method_stripe").is(":checked")&&(!a('input[name="wc-stripe-payment-token"]:checked').length||"new"===a('input[name="wc-stripe-payment-token"]:checked').val())},hasToken:function(){return 0<a("input.stripe_token").length},block:function(){b.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){b.form.unblock()},onError:function(c,d){var e=d.response.error.message;wc_stripe_params.hasOwnProperty(d.response.error.code)&&(e=wc_stripe_params[d.response.error.code]),a(".woocommerce-error, .stripe_token").remove(),a("#stripe-card-number").closest("p").before('<ul class="woocommerce_error woocommerce-error"><li>'+e+"</li></ul>"),b.unblock()},onSubmit:function(c){if(b.isStripeChosen()&&!b.hasToken()){c.preventDefault(),b.block();var d=a("#stripe-card-number").val(),e=a("#stripe-card-cvc").val(),f=a("#stripe-card-expiry").payment("cardExpiryVal"),g=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,h=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,i={number:d,cvc:e,exp_month:parseInt(f.month,10)||0,exp_year:parseInt(f.year,10)||0};return g&&h&&(i.name=g+" "+h),a("#billing_address_1").length>0?(i.address_line1=a("#billing_address_1").val(),i.address_line2=a("#billing_address_2").val(),i.address_state=a("#billing_state").val(),i.address_city=a("#billing_city").val(),i.address_zip=a("#billing_postcode").val(),i.address_country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(i.address_line1=wc_stripe_params.billing_address_1,i.address_line2=wc_stripe_params.billing_address_2,i.address_state=wc_stripe_params.billing_state,i.address_city=wc_stripe_params.billing_city,i.address_zip=wc_stripe_params.billing_postcode,i.address_country=wc_stripe_params.billing_country),Stripe.createToken(i,b.onStripeResponse),!1}},onCCFormChange:function(){a(".woocommerce-error, .stripe_token").remove()},onStripeResponse:function(c,d){if(d.error)a(document).trigger("stripeError",{response:d});else{if("no"===wc_stripe_params.allow_prepaid_card&&"prepaid"===d.card.funding)return d.error={message:wc_stripe_params.no_prepaid_card_msg},a(document).trigger("stripeError",{response:d}),!1;var e=d.id;b.form.append("<input type='hidden' class='stripe_token' name='stripe_token' value='"+e+"'/>"),b.form.submit()}}};b.init()});
|
assets/js/stripe_checkout.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
jQuery( function( $ ) {
|
| 2 |
-
|
|
|
|
| 3 |
/**
|
| 4 |
* Object to handle Stripe payment forms.
|
| 5 |
*/
|
|
@@ -109,7 +110,7 @@ jQuery( function( $ ) {
|
|
| 109 |
|
| 110 |
StripeCheckout.open({
|
| 111 |
key : wc_stripe_params.key,
|
| 112 |
-
|
| 113 |
amount : $data.data( 'amount' ),
|
| 114 |
name : $data.data( 'name' ),
|
| 115 |
description : $data.data( 'description' ),
|
|
@@ -117,9 +118,8 @@ jQuery( function( $ ) {
|
|
| 117 |
image : $data.data( 'image' ),
|
| 118 |
bitcoin : $data.data( 'bitcoin' ),
|
| 119 |
locale : $data.data( 'locale' ),
|
| 120 |
-
refund_mispayments: true, // for bitcoin payments let Stripe handle refunds if too little is paid
|
| 121 |
email : $( '#billing_email' ).val() || $data.data( 'email' ),
|
| 122 |
-
|
| 123 |
token : token_action,
|
| 124 |
closed : wc_stripe_form.onClose()
|
| 125 |
});
|
| 1 |
jQuery( function( $ ) {
|
| 2 |
+
'use strict';
|
| 3 |
+
|
| 4 |
/**
|
| 5 |
* Object to handle Stripe payment forms.
|
| 6 |
*/
|
| 110 |
|
| 111 |
StripeCheckout.open({
|
| 112 |
key : wc_stripe_params.key,
|
| 113 |
+
billingAddress : 'yes' === wc_stripe_params.stripe_checkout_require_billing_address ? true : false,
|
| 114 |
amount : $data.data( 'amount' ),
|
| 115 |
name : $data.data( 'name' ),
|
| 116 |
description : $data.data( 'description' ),
|
| 118 |
image : $data.data( 'image' ),
|
| 119 |
bitcoin : $data.data( 'bitcoin' ),
|
| 120 |
locale : $data.data( 'locale' ),
|
|
|
|
| 121 |
email : $( '#billing_email' ).val() || $data.data( 'email' ),
|
| 122 |
+
panelLabel : $data.data( 'panel-label' ),
|
| 123 |
token : token_action,
|
| 124 |
closed : wc_stripe_form.onClose()
|
| 125 |
});
|
assets/js/stripe_checkout.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
jQuery(function(a){"use strict";var b={init:function(b){this.form=b,this.stripe_submit=!1,a(this.form).on("click","#place_order",this.onSubmit).on("submit checkout_place_order_stripe")},isStripeChosen:function(){return a("#payment_method_stripe").is(":checked")&&(!a('input[name="wc-stripe-payment-token"]:checked').length||"new"===a('input[name="wc-stripe-payment-token"]:checked').val())},isStripeModalNeeded:function(c){var d=b.form.find("input.stripe_token");if(b.stripe_submit&&d)return!1;if(!b.isStripeChosen())return!1;if(1===a("input#terms").length&&0===a("input#terms:checked").length)return!1;if(a("#createaccount").is(":checked")&&a("#account_password").length&&""===a("#account_password").val())return!1;if(a("#ship-to-different-address-checkbox").is(":checked")?$required_inputs=a(".woocommerce-billing-fields .validate-required, .woocommerce-shipping-fields .validate-required"):$required_inputs=a(".woocommerce-billing-fields .validate-required"),$required_inputs.length){var e=!1;if($required_inputs.each(function(){""===a(this).find("input.input-text, select").not(a("#account_password, #account_username")).val()&&(e=!0)}),e)return!1}return!0},block:function(){b.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){b.form.unblock()},onClose:function(){b.unblock()},onSubmit:function(c){if(b.isStripeModalNeeded()){c.preventDefault();var d=b.form,e=a("#stripe-payment-data"),f=d.find("input.stripe_token");f.val("");var g=function(a){d.find("input.stripe_token").remove(),d.append('<input type="hidden" class="stripe_token" name="stripe_token" value="'+a.id+'"/>'),b.stripe_submit=!0,d.submit()};return StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address?!0:!1,amount:e.data("amount"),name:e.data("name"),description:e.data("description"),currency:e.data("currency"),image:e.data("image"),bitcoin:e.data("bitcoin"),locale:e.data("locale"),email:a("#billing_email").val()||e.data("email"),panelLabel:e.data("panel-label"),token:g,closed:b.onClose()}),!1}return!0}};b.init(a("form.checkout, form#order_review, form#add_payment_method"))});
|
includes/class-wc-gateway-stripe-addons.php
CHANGED
|
@@ -78,9 +78,9 @@ class WC_Gateway_Stripe_Addons extends WC_Gateway_Stripe {
|
|
| 78 |
parent::save_source( $order, $source );
|
| 79 |
|
| 80 |
// Also store it on the subscriptions being purchased or paid for in the order
|
| 81 |
-
if ( wcs_order_contains_subscription( $order->id ) ) {
|
| 82 |
$subscriptions = wcs_get_subscriptions_for_order( $order->id );
|
| 83 |
-
} elseif ( wcs_order_contains_renewal( $order->id ) ) {
|
| 84 |
$subscriptions = wcs_get_subscriptions_for_renewal_order( $order->id );
|
| 85 |
} else {
|
| 86 |
$subscriptions = array();
|
|
@@ -117,7 +117,7 @@ class WC_Gateway_Stripe_Addons extends WC_Gateway_Stripe {
|
|
| 117 |
return new WP_Error( 'stripe_error', __( 'Customer not found', 'woocommerce-gateway-stripe' ) );
|
| 118 |
}
|
| 119 |
|
| 120 |
-
WC_Stripe::log( "Info: Begin processing
|
| 121 |
|
| 122 |
// Make the request
|
| 123 |
$request = $this->generate_payment_request( $order, $source );
|
|
@@ -255,27 +255,10 @@ class WC_Gateway_Stripe_Addons extends WC_Gateway_Stripe {
|
|
| 255 |
* @param $renewal_order WC_Order A WC_Order object created to record the renewal payment.
|
| 256 |
*/
|
| 257 |
public function scheduled_subscription_payment( $amount_to_charge, $renewal_order ) {
|
| 258 |
-
|
| 259 |
-
$retry_callbacks = array(
|
| 260 |
-
'remove_order_source_before_retry',
|
| 261 |
-
'remove_order_customer_before_retry',
|
| 262 |
-
);
|
| 263 |
-
|
| 264 |
-
while ( 1 ) {
|
| 265 |
-
$response = $this->process_subscription_payment( $renewal_order, $amount_to_charge );
|
| 266 |
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
$renewal_order->update_status( 'failed', sprintf( __( 'Stripe Transaction Failed (%s)', 'woocommerce-gateway-stripe' ), $response->get_error_message() ) );
|
| 270 |
-
break;
|
| 271 |
-
} else {
|
| 272 |
-
$retry_callback = array_shift( $retry_callbacks );
|
| 273 |
-
call_user_func( array( $this, $retry_callback ), $renewal_order );
|
| 274 |
-
}
|
| 275 |
-
} else {
|
| 276 |
-
// Successful
|
| 277 |
-
break;
|
| 278 |
-
}
|
| 279 |
}
|
| 280 |
}
|
| 281 |
|
| 78 |
parent::save_source( $order, $source );
|
| 79 |
|
| 80 |
// Also store it on the subscriptions being purchased or paid for in the order
|
| 81 |
+
if ( function_exists( 'wcs_order_contains_subscription' ) && wcs_order_contains_subscription( $order->id ) ) {
|
| 82 |
$subscriptions = wcs_get_subscriptions_for_order( $order->id );
|
| 83 |
+
} elseif ( function_exists( 'wcs_order_contains_renewal' ) && wcs_order_contains_renewal( $order->id ) ) {
|
| 84 |
$subscriptions = wcs_get_subscriptions_for_renewal_order( $order->id );
|
| 85 |
} else {
|
| 86 |
$subscriptions = array();
|
| 117 |
return new WP_Error( 'stripe_error', __( 'Customer not found', 'woocommerce-gateway-stripe' ) );
|
| 118 |
}
|
| 119 |
|
| 120 |
+
WC_Stripe::log( "Info: Begin processing subscription payment for order {$order->id} for the amount of {$amount}" );
|
| 121 |
|
| 122 |
// Make the request
|
| 123 |
$request = $this->generate_payment_request( $order, $source );
|
| 255 |
* @param $renewal_order WC_Order A WC_Order object created to record the renewal payment.
|
| 256 |
*/
|
| 257 |
public function scheduled_subscription_payment( $amount_to_charge, $renewal_order ) {
|
| 258 |
+
$response = $this->process_subscription_payment( $renewal_order, $amount_to_charge );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
|
| 260 |
+
if ( is_wp_error( $response ) ) {
|
| 261 |
+
$renewal_order->update_status( 'failed', sprintf( __( 'Stripe Transaction Failed (%s)', 'woocommerce-gateway-stripe' ), $response->get_error_message() ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
}
|
| 263 |
}
|
| 264 |
|
includes/class-wc-gateway-stripe.php
CHANGED
|
@@ -10,6 +10,76 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
| 10 |
*/
|
| 11 |
class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
/**
|
| 14 |
* Constructor
|
| 15 |
*/
|
|
@@ -27,7 +97,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 27 |
'subscription_reactivation',
|
| 28 |
'subscription_suspension',
|
| 29 |
'subscription_amount_changes',
|
| 30 |
-
'subscription_payment_method_change', // Subs 1.n compatibility
|
| 31 |
'subscription_payment_method_change_customer',
|
| 32 |
'subscription_payment_method_change_admin',
|
| 33 |
'subscription_date_changes',
|
|
@@ -36,7 +106,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 36 |
'tokenization',
|
| 37 |
);
|
| 38 |
|
| 39 |
-
// Load the form fields
|
| 40 |
$this->init_form_fields();
|
| 41 |
|
| 42 |
// Load the settings.
|
|
@@ -68,14 +138,14 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 68 |
|
| 69 |
WC_Stripe_API::set_secret_key( $this->secret_key );
|
| 70 |
|
| 71 |
-
// Hooks
|
| 72 |
add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
|
| 73 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
| 74 |
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
| 75 |
}
|
| 76 |
|
| 77 |
/**
|
| 78 |
-
*
|
| 79 |
*
|
| 80 |
* @access public
|
| 81 |
* @return string
|
|
@@ -94,7 +164,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 94 |
$icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/diners' . $ext ) . '" alt="Diners" width="32" ' . $style . ' />';
|
| 95 |
}
|
| 96 |
|
| 97 |
-
if ( $this->bitcoin ) {
|
| 98 |
$icon .= '<img src="' . WC_HTTPS::force_https_url( plugins_url( '/assets/images/bitcoin' . $ext, WC_STRIPE_MAIN_FILE ) ) . '" alt="Bitcoin" width="32" ' . $style . ' />';
|
| 99 |
}
|
| 100 |
|
|
@@ -103,14 +173,18 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 103 |
|
| 104 |
/**
|
| 105 |
* Get Stripe amount to pay
|
| 106 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
*/
|
| 108 |
public function get_stripe_amount( $total, $currency = '' ) {
|
| 109 |
if ( ! $currency ) {
|
| 110 |
$currency = get_woocommerce_currency();
|
| 111 |
}
|
| 112 |
switch ( strtoupper( $currency ) ) {
|
| 113 |
-
// Zero decimal currencies
|
| 114 |
case 'BIF' :
|
| 115 |
case 'CLP' :
|
| 116 |
case 'DJF' :
|
|
@@ -129,7 +203,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 129 |
$total = absint( $total );
|
| 130 |
break;
|
| 131 |
default :
|
| 132 |
-
$total = round( $total, 2 ) * 100; // In cents
|
| 133 |
break;
|
| 134 |
}
|
| 135 |
return $total;
|
|
@@ -143,9 +217,9 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 143 |
return;
|
| 144 |
}
|
| 145 |
|
| 146 |
-
// Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected
|
| 147 |
if ( ( function_exists( 'wc_site_is_https' ) && ! wc_site_is_https() ) && ( 'no' === get_option( 'woocommerce_force_ssl_checkout' ) && ! class_exists( 'WordPressHTTPS' ) ) ) {
|
| 148 |
-
echo '<div class="error"><p>' . sprintf( __( 'Stripe is enabled, but the <a href="%s">force SSL option</a> is disabled; your checkout may not be secure! Please enable SSL and ensure your server has a valid SSL certificate - Stripe will only work in test mode.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ) ) . '</p></div>';
|
| 149 |
}
|
| 150 |
}
|
| 151 |
|
|
@@ -211,7 +285,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 211 |
*/
|
| 212 |
public function payment_fields() {
|
| 213 |
$user = wp_get_current_user();
|
| 214 |
-
$display_tokenization = $this->supports( 'tokenization' ) && is_checkout() && $this->saved_cards
|
| 215 |
|
| 216 |
if ( $user->ID ) {
|
| 217 |
$user_email = get_user_meta( $user->ID, 'billing_email', true );
|
|
@@ -249,7 +323,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 249 |
|
| 250 |
if ( ! $this->stripe_checkout ) {
|
| 251 |
$this->form();
|
| 252 |
-
|
| 253 |
if ( $display_tokenization ) {
|
| 254 |
$this->save_payment_method_checkbox();
|
| 255 |
}
|
|
@@ -266,12 +340,14 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 266 |
* @access public
|
| 267 |
*/
|
| 268 |
public function payment_scripts() {
|
|
|
|
|
|
|
| 269 |
if ( $this->stripe_checkout ) {
|
| 270 |
wp_enqueue_script( 'stripe', 'https://checkout.stripe.com/v2/checkout.js', '', '2.0', true );
|
| 271 |
-
wp_enqueue_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe_checkout.js', WC_STRIPE_MAIN_FILE ), array( 'stripe' ), WC_STRIPE_VERSION, true );
|
| 272 |
} else {
|
| 273 |
wp_enqueue_script( 'stripe', 'https://js.stripe.com/v2/', '', '1.0', true );
|
| 274 |
-
wp_enqueue_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe.js', WC_STRIPE_MAIN_FILE ), array( 'jquery-payment', 'stripe' ), WC_STRIPE_VERSION, true );
|
| 275 |
}
|
| 276 |
|
| 277 |
$stripe_params = array(
|
|
@@ -298,6 +374,24 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 298 |
}
|
| 299 |
}
|
| 300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
wp_localize_script( 'woocommerce_stripe', 'wc_stripe_params', apply_filters( 'wc_stripe_params', $stripe_params ) );
|
| 302 |
}
|
| 303 |
|
|
@@ -328,12 +422,24 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 328 |
$post_data['source'] = $source->source;
|
| 329 |
}
|
| 330 |
|
| 331 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
}
|
| 333 |
|
| 334 |
/**
|
| 335 |
* Get payment source. This can be a new token or existing card.
|
| 336 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
* @return object
|
| 338 |
*/
|
| 339 |
protected function get_source( $user_id, $force_customer = false ) {
|
|
@@ -344,7 +450,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 344 |
// New CC info was entered and we have a new token to process
|
| 345 |
if ( isset( $_POST['stripe_token'] ) ) {
|
| 346 |
$stripe_token = wc_clean( $_POST['stripe_token'] );
|
| 347 |
-
$maybe_saved_card =
|
| 348 |
|
| 349 |
// This is true if the user wants to store the card to their account.
|
| 350 |
if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_customer ) {
|
|
@@ -415,6 +521,14 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 415 |
|
| 416 |
/**
|
| 417 |
* Process the payment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
*/
|
| 419 |
public function process_payment( $order_id, $retry = true, $force_customer = false ) {
|
| 420 |
try {
|
|
@@ -427,10 +541,10 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 427 |
throw new Exception( $error_msg );
|
| 428 |
}
|
| 429 |
|
| 430 |
-
// Store source to order meta
|
| 431 |
$this->save_source( $order, $source );
|
| 432 |
|
| 433 |
-
// Handle payment
|
| 434 |
if ( $order->get_total() > 0 ) {
|
| 435 |
|
| 436 |
if ( $order->get_total() * 100 < 50 ) {
|
|
@@ -439,7 +553,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 439 |
|
| 440 |
WC_Stripe::log( "Info: Begin processing payment for order $order_id for the amount of {$order->get_total()}" );
|
| 441 |
|
| 442 |
-
// Make the request
|
| 443 |
$response = WC_Stripe_API::request( $this->generate_payment_request( $order, $source ) );
|
| 444 |
|
| 445 |
if ( is_wp_error( $response ) ) {
|
|
@@ -447,8 +561,8 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 447 |
if ( 'customer' === $response->get_error_code() && $retry ) {
|
| 448 |
delete_user_meta( get_current_user_id(), '_stripe_customer_id' );
|
| 449 |
return $this->process_payment( $order_id, false, $force_customer );
|
| 450 |
-
|
| 451 |
-
|
| 452 |
$token = WC_Payment_Tokens::get( $source->token_id );
|
| 453 |
$token->delete();
|
| 454 |
throw new Exception( __( 'This card is no longer available and has been removed.', 'woocommerce-gateway-stripe' ) );
|
|
@@ -456,16 +570,16 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 456 |
throw new Exception( $response->get_error_code() . ': ' . $response->get_error_message() );
|
| 457 |
}
|
| 458 |
|
| 459 |
-
// Process valid response
|
| 460 |
$this->process_response( $response, $order );
|
| 461 |
} else {
|
| 462 |
$order->payment_complete();
|
| 463 |
}
|
| 464 |
|
| 465 |
-
// Remove cart
|
| 466 |
WC()->cart->empty_cart();
|
| 467 |
|
| 468 |
-
// Return thank you page redirect
|
| 469 |
return array(
|
| 470 |
'result' => 'success',
|
| 471 |
'redirect' => $this->get_return_url( $order )
|
|
@@ -475,15 +589,23 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 475 |
wc_add_notice( $e->getMessage(), 'error' );
|
| 476 |
WC()->session->set( 'refresh_totals', true );
|
| 477 |
WC_Stripe::log( sprintf( __( 'Error: %s', 'woocommerce-gateway-stripe' ), $e->getMessage() ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
return;
|
| 479 |
}
|
| 480 |
}
|
| 481 |
|
| 482 |
/**
|
| 483 |
* Save source to order.
|
|
|
|
|
|
|
|
|
|
| 484 |
*/
|
| 485 |
protected function save_source( $order, $source ) {
|
| 486 |
-
// Store source in the order
|
| 487 |
if ( $source->customer ) {
|
| 488 |
update_post_meta( $order->id, '_stripe_customer_id', $source->customer );
|
| 489 |
}
|
|
@@ -511,7 +633,11 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 511 |
|
| 512 |
if ( $response->captured ) {
|
| 513 |
$order->payment_complete( $response->id );
|
| 514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
} else {
|
| 516 |
add_post_meta( $order->id, '_transaction_id', $response->id, true );
|
| 517 |
|
|
@@ -589,4 +715,19 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
| 589 |
return true;
|
| 590 |
}
|
| 591 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
}
|
| 10 |
*/
|
| 11 |
class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
| 12 |
|
| 13 |
+
/**
|
| 14 |
+
* Should we capture Credit cards
|
| 15 |
+
*
|
| 16 |
+
* @var bool
|
| 17 |
+
*/
|
| 18 |
+
public $capture;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Checkout enabled
|
| 22 |
+
*
|
| 23 |
+
* @var bool
|
| 24 |
+
*/
|
| 25 |
+
public $stripe_checkout;
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Checkout Locale
|
| 29 |
+
*
|
| 30 |
+
* @var string
|
| 31 |
+
*/
|
| 32 |
+
public $stripe_checkout_locale;
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Credit card image
|
| 36 |
+
*
|
| 37 |
+
* @var string
|
| 38 |
+
*/
|
| 39 |
+
public $stripe_checkout_image;
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Should we store the users credit cards?
|
| 43 |
+
*
|
| 44 |
+
* @var bool
|
| 45 |
+
*/
|
| 46 |
+
public $saved_cards;
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* API access secret key
|
| 50 |
+
*
|
| 51 |
+
* @var string
|
| 52 |
+
*/
|
| 53 |
+
public $secret_key;
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Api access publishable key
|
| 57 |
+
*
|
| 58 |
+
* @var string
|
| 59 |
+
*/
|
| 60 |
+
public $publishable_key;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Do we accept bitcoin?
|
| 64 |
+
*
|
| 65 |
+
* @var bool
|
| 66 |
+
*/
|
| 67 |
+
public $bitcoin;
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Is test mode active?
|
| 71 |
+
*
|
| 72 |
+
* @var bool
|
| 73 |
+
*/
|
| 74 |
+
public $testmode;
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Logging enabled?
|
| 78 |
+
*
|
| 79 |
+
* @var bool
|
| 80 |
+
*/
|
| 81 |
+
public $logging;
|
| 82 |
+
|
| 83 |
/**
|
| 84 |
* Constructor
|
| 85 |
*/
|
| 97 |
'subscription_reactivation',
|
| 98 |
'subscription_suspension',
|
| 99 |
'subscription_amount_changes',
|
| 100 |
+
'subscription_payment_method_change', // Subs 1.n compatibility.
|
| 101 |
'subscription_payment_method_change_customer',
|
| 102 |
'subscription_payment_method_change_admin',
|
| 103 |
'subscription_date_changes',
|
| 106 |
'tokenization',
|
| 107 |
);
|
| 108 |
|
| 109 |
+
// Load the form fields.
|
| 110 |
$this->init_form_fields();
|
| 111 |
|
| 112 |
// Load the settings.
|
| 138 |
|
| 139 |
WC_Stripe_API::set_secret_key( $this->secret_key );
|
| 140 |
|
| 141 |
+
// Hooks.
|
| 142 |
add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
|
| 143 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
| 144 |
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
| 145 |
}
|
| 146 |
|
| 147 |
/**
|
| 148 |
+
* Get_icon function.
|
| 149 |
*
|
| 150 |
* @access public
|
| 151 |
* @return string
|
| 164 |
$icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/diners' . $ext ) . '" alt="Diners" width="32" ' . $style . ' />';
|
| 165 |
}
|
| 166 |
|
| 167 |
+
if ( 'yes' === $this->bitcoin && 'yes' === $this->stripe_checkout ) {
|
| 168 |
$icon .= '<img src="' . WC_HTTPS::force_https_url( plugins_url( '/assets/images/bitcoin' . $ext, WC_STRIPE_MAIN_FILE ) ) . '" alt="Bitcoin" width="32" ' . $style . ' />';
|
| 169 |
}
|
| 170 |
|
| 173 |
|
| 174 |
/**
|
| 175 |
* Get Stripe amount to pay
|
| 176 |
+
*
|
| 177 |
+
* @param float $total Amount due.
|
| 178 |
+
* @param string $currency Accepted currency.
|
| 179 |
+
*
|
| 180 |
+
* @return float|int
|
| 181 |
*/
|
| 182 |
public function get_stripe_amount( $total, $currency = '' ) {
|
| 183 |
if ( ! $currency ) {
|
| 184 |
$currency = get_woocommerce_currency();
|
| 185 |
}
|
| 186 |
switch ( strtoupper( $currency ) ) {
|
| 187 |
+
// Zero decimal currencies.
|
| 188 |
case 'BIF' :
|
| 189 |
case 'CLP' :
|
| 190 |
case 'DJF' :
|
| 203 |
$total = absint( $total );
|
| 204 |
break;
|
| 205 |
default :
|
| 206 |
+
$total = round( $total, 2 ) * 100; // In cents.
|
| 207 |
break;
|
| 208 |
}
|
| 209 |
return $total;
|
| 217 |
return;
|
| 218 |
}
|
| 219 |
|
| 220 |
+
// Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected.
|
| 221 |
if ( ( function_exists( 'wc_site_is_https' ) && ! wc_site_is_https() ) && ( 'no' === get_option( 'woocommerce_force_ssl_checkout' ) && ! class_exists( 'WordPressHTTPS' ) ) ) {
|
| 222 |
+
echo '<div class="error stripe-ssl-message"><p>' . sprintf( __( 'Stripe is enabled, but the <a href="%s">force SSL option</a> is disabled; your checkout may not be secure! Please enable SSL and ensure your server has a valid SSL certificate - Stripe will only work in test mode.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ) ) . '</p></div>';
|
| 223 |
}
|
| 224 |
}
|
| 225 |
|
| 285 |
*/
|
| 286 |
public function payment_fields() {
|
| 287 |
$user = wp_get_current_user();
|
| 288 |
+
$display_tokenization = $this->supports( 'tokenization' ) && is_checkout() && $this->saved_cards;
|
| 289 |
|
| 290 |
if ( $user->ID ) {
|
| 291 |
$user_email = get_user_meta( $user->ID, 'billing_email', true );
|
| 323 |
|
| 324 |
if ( ! $this->stripe_checkout ) {
|
| 325 |
$this->form();
|
| 326 |
+
|
| 327 |
if ( $display_tokenization ) {
|
| 328 |
$this->save_payment_method_checkbox();
|
| 329 |
}
|
| 340 |
* @access public
|
| 341 |
*/
|
| 342 |
public function payment_scripts() {
|
| 343 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
| 344 |
+
|
| 345 |
if ( $this->stripe_checkout ) {
|
| 346 |
wp_enqueue_script( 'stripe', 'https://checkout.stripe.com/v2/checkout.js', '', '2.0', true );
|
| 347 |
+
wp_enqueue_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe_checkout' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), array( 'stripe' ), WC_STRIPE_VERSION, true );
|
| 348 |
} else {
|
| 349 |
wp_enqueue_script( 'stripe', 'https://js.stripe.com/v2/', '', '1.0', true );
|
| 350 |
+
wp_enqueue_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), array( 'jquery-payment', 'stripe' ), WC_STRIPE_VERSION, true );
|
| 351 |
}
|
| 352 |
|
| 353 |
$stripe_params = array(
|
| 374 |
}
|
| 375 |
}
|
| 376 |
|
| 377 |
+
$stripe_params['no_prepaid_card_msg'] = __( 'Sorry, we\'re not accepting prepaid cards at this time.', 'woocommerce-gateway-stripe' );
|
| 378 |
+
$stripe_params['allow_prepaid_card'] = apply_filters( 'wc_stripe_allow_prepaid_card', true ) ? 'yes' : 'no';
|
| 379 |
+
$stripe_params['stripe_checkout_require_billing_address'] = apply_filters( 'wc_stripe_checkout_require_billing_address', false ) ? 'yes' : 'no';
|
| 380 |
+
|
| 381 |
+
// localize error messages from Stripe
|
| 382 |
+
$stripe_params['invalid_number'] = __( 'The card number is not a valid credit card number.', 'woocommerce-gateway-stripe' );
|
| 383 |
+
$stripe_params['invalid_expiry_month'] = __( 'The card\'s expiration month is invalid.', 'woocommerce-gateway-stripe' );
|
| 384 |
+
$stripe_params['invalid_expiry_year'] = __( 'The card\'s expiration year is invalid.', 'woocommerce-gateway-stripe' );
|
| 385 |
+
$stripe_params['invalid_cvc'] = __( 'The card\'s security code is invalid.', 'woocommerce-gateway-stripe' );
|
| 386 |
+
$stripe_params['incorrect_number'] = __( 'The card number is incorrect.', 'woocommerce-gateway-stripe' );
|
| 387 |
+
$stripe_params['expired_card'] = __( 'The card has expired.', 'woocommerce-gateway-stripe' );
|
| 388 |
+
$stripe_params['incorrect_cvc'] = __( 'The card\'s security code is incorrect.', 'woocommerce-gateway-stripe' );
|
| 389 |
+
$stripe_params['incorrect_zip'] = __( 'The card\'s zip code failed validation.', 'woocommerce-gateway-stripe' );
|
| 390 |
+
$stripe_params['card_declined'] = __( 'The card was declined.', 'woocommerce-gateway-stripe' );
|
| 391 |
+
$stripe_params['missing'] = __( 'There is no card on a customer that is being charged.', 'woocommerce-gateway-stripe' );
|
| 392 |
+
$stripe_params['processing_error'] = __( 'An error occurred while processing the card.', 'woocommerce-gateway-stripe' );
|
| 393 |
+
$stripe_params['invalid_request_error'] = __( 'Could not find payment information.', 'woocommerce-gateway-stripe' );
|
| 394 |
+
|
| 395 |
wp_localize_script( 'woocommerce_stripe', 'wc_stripe_params', apply_filters( 'wc_stripe_params', $stripe_params ) );
|
| 396 |
}
|
| 397 |
|
| 422 |
$post_data['source'] = $source->source;
|
| 423 |
}
|
| 424 |
|
| 425 |
+
/**
|
| 426 |
+
* Filter the return value of the WC_Payment_Gateway_CC::generate_payment_request.
|
| 427 |
+
*
|
| 428 |
+
* @since 3.1.0
|
| 429 |
+
* @param array $post_data
|
| 430 |
+
* @param WC_Order $order
|
| 431 |
+
* @param object $source
|
| 432 |
+
*/
|
| 433 |
+
return apply_filters( 'wc_stripe_generate_payment_request', $post_data, $order, $source );
|
| 434 |
}
|
| 435 |
|
| 436 |
/**
|
| 437 |
* Get payment source. This can be a new token or existing card.
|
| 438 |
+
*
|
| 439 |
+
* @param string $user_id
|
| 440 |
+
* @param bool $force_customer Should we force customer creation.
|
| 441 |
+
*
|
| 442 |
+
* @throws Exception When card was not added or for and invalid card.
|
| 443 |
* @return object
|
| 444 |
*/
|
| 445 |
protected function get_source( $user_id, $force_customer = false ) {
|
| 450 |
// New CC info was entered and we have a new token to process
|
| 451 |
if ( isset( $_POST['stripe_token'] ) ) {
|
| 452 |
$stripe_token = wc_clean( $_POST['stripe_token'] );
|
| 453 |
+
$maybe_saved_card = isset( $_POST['wc-stripe-new-payment-method'] ) && ! empty( $_POST['wc-stripe-new-payment-method'] );
|
| 454 |
|
| 455 |
// This is true if the user wants to store the card to their account.
|
| 456 |
if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_customer ) {
|
| 521 |
|
| 522 |
/**
|
| 523 |
* Process the payment
|
| 524 |
+
*
|
| 525 |
+
* @param int $order_id Reference.
|
| 526 |
+
* @param bool $retry Should we retry on fail.
|
| 527 |
+
* @param bool $force_customer Force user creation.
|
| 528 |
+
*
|
| 529 |
+
* @throws Exception If payment will not be accepted.
|
| 530 |
+
*
|
| 531 |
+
* @return array|void
|
| 532 |
*/
|
| 533 |
public function process_payment( $order_id, $retry = true, $force_customer = false ) {
|
| 534 |
try {
|
| 541 |
throw new Exception( $error_msg );
|
| 542 |
}
|
| 543 |
|
| 544 |
+
// Store source to order meta.
|
| 545 |
$this->save_source( $order, $source );
|
| 546 |
|
| 547 |
+
// Handle payment.
|
| 548 |
if ( $order->get_total() > 0 ) {
|
| 549 |
|
| 550 |
if ( $order->get_total() * 100 < 50 ) {
|
| 553 |
|
| 554 |
WC_Stripe::log( "Info: Begin processing payment for order $order_id for the amount of {$order->get_total()}" );
|
| 555 |
|
| 556 |
+
// Make the request.
|
| 557 |
$response = WC_Stripe_API::request( $this->generate_payment_request( $order, $source ) );
|
| 558 |
|
| 559 |
if ( is_wp_error( $response ) ) {
|
| 561 |
if ( 'customer' === $response->get_error_code() && $retry ) {
|
| 562 |
delete_user_meta( get_current_user_id(), '_stripe_customer_id' );
|
| 563 |
return $this->process_payment( $order_id, false, $force_customer );
|
| 564 |
+
// Source param wrong? The CARD may have been deleted on stripe's end. Remove token and show message.
|
| 565 |
+
} elseif ( 'source' === $response->get_error_code() && $source->token_id ) {
|
| 566 |
$token = WC_Payment_Tokens::get( $source->token_id );
|
| 567 |
$token->delete();
|
| 568 |
throw new Exception( __( 'This card is no longer available and has been removed.', 'woocommerce-gateway-stripe' ) );
|
| 570 |
throw new Exception( $response->get_error_code() . ': ' . $response->get_error_message() );
|
| 571 |
}
|
| 572 |
|
| 573 |
+
// Process valid response.
|
| 574 |
$this->process_response( $response, $order );
|
| 575 |
} else {
|
| 576 |
$order->payment_complete();
|
| 577 |
}
|
| 578 |
|
| 579 |
+
// Remove cart.
|
| 580 |
WC()->cart->empty_cart();
|
| 581 |
|
| 582 |
+
// Return thank you page redirect.
|
| 583 |
return array(
|
| 584 |
'result' => 'success',
|
| 585 |
'redirect' => $this->get_return_url( $order )
|
| 589 |
wc_add_notice( $e->getMessage(), 'error' );
|
| 590 |
WC()->session->set( 'refresh_totals', true );
|
| 591 |
WC_Stripe::log( sprintf( __( 'Error: %s', 'woocommerce-gateway-stripe' ), $e->getMessage() ) );
|
| 592 |
+
|
| 593 |
+
if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
|
| 594 |
+
$this->send_failed_order_email( $order_id );
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
return;
|
| 598 |
}
|
| 599 |
}
|
| 600 |
|
| 601 |
/**
|
| 602 |
* Save source to order.
|
| 603 |
+
*
|
| 604 |
+
* @param WC_Order $order For to which the source applies.
|
| 605 |
+
* @param stdClass $source Source information.
|
| 606 |
*/
|
| 607 |
protected function save_source( $order, $source ) {
|
| 608 |
+
// Store source in the order.
|
| 609 |
if ( $source->customer ) {
|
| 610 |
update_post_meta( $order->id, '_stripe_customer_id', $source->customer );
|
| 611 |
}
|
| 633 |
|
| 634 |
if ( $response->captured ) {
|
| 635 |
$order->payment_complete( $response->id );
|
| 636 |
+
|
| 637 |
+
$message = sprintf( __( 'Stripe charge complete (Charge ID: %s)', 'woocommerce-gateway-stripe' ), $response->id );
|
| 638 |
+
$order->add_order_note( $message );
|
| 639 |
+
WC_Stripe::log( 'Success: ' . $message );
|
| 640 |
+
|
| 641 |
} else {
|
| 642 |
add_post_meta( $order->id, '_transaction_id', $response->id, true );
|
| 643 |
|
| 715 |
return true;
|
| 716 |
}
|
| 717 |
}
|
| 718 |
+
|
| 719 |
+
/**
|
| 720 |
+
* Sends the failed order email to admin
|
| 721 |
+
*
|
| 722 |
+
* @version 3.1.0
|
| 723 |
+
* @since 3.1.0
|
| 724 |
+
* @param int $order_id
|
| 725 |
+
* @return null
|
| 726 |
+
*/
|
| 727 |
+
public function send_failed_order_email( $order_id ) {
|
| 728 |
+
$emails = WC()->mailer()->get_emails();
|
| 729 |
+
if ( ! empty( $emails ) && ! empty( $order_id ) ) {
|
| 730 |
+
$emails['WC_Email_Failed_Order']->trigger( $order_id );
|
| 731 |
+
}
|
| 732 |
+
}
|
| 733 |
}
|
includes/class-wc-stripe-customer.php
CHANGED
|
@@ -123,9 +123,12 @@ class WC_Stripe_Customer {
|
|
| 123 |
*/
|
| 124 |
public function create_customer( $args = array() ) {
|
| 125 |
if ( $user = $this->get_user() ) {
|
|
|
|
|
|
|
|
|
|
| 126 |
$defaults = array(
|
| 127 |
'email' => $user->user_email,
|
| 128 |
-
'description' => $
|
| 129 |
);
|
| 130 |
} else {
|
| 131 |
$defaults = array(
|
| 123 |
*/
|
| 124 |
public function create_customer( $args = array() ) {
|
| 125 |
if ( $user = $this->get_user() ) {
|
| 126 |
+
$billing_first_name = get_user_meta( $user->ID, 'billing_first_name', true );
|
| 127 |
+
$billing_last_name = get_user_meta( $user->ID, 'billing_last_name', true );
|
| 128 |
+
|
| 129 |
$defaults = array(
|
| 130 |
'email' => $user->user_email,
|
| 131 |
+
'description' => $billing_first_name . ' ' . $billing_last_name,
|
| 132 |
);
|
| 133 |
} else {
|
| 134 |
$defaults = array(
|
includes/legacy/class-wc-gateway-stripe.php
CHANGED
|
@@ -361,7 +361,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway {
|
|
| 361 |
// New CC info was entered and we have a new token to process
|
| 362 |
if ( isset( $_POST['stripe_token'] ) ) {
|
| 363 |
$stripe_token = wc_clean( $_POST['stripe_token'] );
|
| 364 |
-
$maybe_saved_card =
|
| 365 |
|
| 366 |
// This is true if the user wants to store the card to their account.
|
| 367 |
if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_customer ) {
|
| 361 |
// New CC info was entered and we have a new token to process
|
| 362 |
if ( isset( $_POST['stripe_token'] ) ) {
|
| 363 |
$stripe_token = wc_clean( $_POST['stripe_token'] );
|
| 364 |
+
$maybe_saved_card = isset( $_POST['wc-stripe-new-payment-method'] ) && ! empty( $_POST['wc-stripe-new-payment-method'] );
|
| 365 |
|
| 366 |
// This is true if the user wants to store the card to their account.
|
| 367 |
if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_customer ) {
|
languages/woocommerce-gateway-stripe.pot
CHANGED
|
@@ -1,20 +1,27 @@
|
|
| 1 |
-
# Copyright (C) 2016 WooCommerce Stripe Gateway
|
| 2 |
-
# This file is distributed under the same license as the WooCommerce Stripe Gateway package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: WooCommerce Stripe Gateway
|
| 6 |
-
"
|
| 7 |
-
"
|
|
|
|
|
|
|
|
|
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
-
"
|
| 12 |
-
"
|
| 13 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
#: includes/class-wc-gateway-stripe-addons.php:104
|
| 16 |
#: includes/class-wc-gateway-stripe-addons.php:150
|
| 17 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 18 |
#: includes/legacy/class-wc-gateway-stripe.php:446
|
| 19 |
msgid ""
|
| 20 |
"Sorry, the minimum allowed order total is 0.50 to use this payment method."
|
|
@@ -29,123 +36,189 @@ msgid "Unable to store payment details. Please try again."
|
|
| 29 |
msgstr ""
|
| 30 |
|
| 31 |
#: includes/class-wc-gateway-stripe-addons.php:218
|
| 32 |
-
#: includes/class-wc-gateway-stripe-addons.php:
|
|
|
|
| 33 |
msgid "Stripe Transaction Failed (%s)"
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
-
#: includes/class-wc-gateway-stripe-addons.php:
|
| 37 |
-
#: includes/class-wc-gateway-stripe-addons.php:
|
|
|
|
| 38 |
msgid "Via %s card ending in %s"
|
| 39 |
msgstr ""
|
| 40 |
|
| 41 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 42 |
#: includes/legacy/class-wc-gateway-stripe.php:18
|
| 43 |
msgid "Stripe"
|
| 44 |
msgstr ""
|
| 45 |
|
| 46 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 47 |
#: includes/legacy/class-wc-gateway-stripe.php:19
|
| 48 |
msgid ""
|
| 49 |
"Stripe works by adding credit card fields on the checkout and then sending "
|
| 50 |
"the details to Stripe for verification."
|
| 51 |
msgstr ""
|
| 52 |
|
| 53 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 54 |
#: includes/legacy/class-wc-gateway-stripe.php:60
|
| 55 |
msgid "Continue to payment"
|
| 56 |
msgstr ""
|
| 57 |
|
| 58 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 59 |
#: includes/legacy/class-wc-gateway-stripe.php:64
|
|
|
|
| 60 |
msgid ""
|
| 61 |
"TEST MODE ENABLED. In test mode, you can use the card number "
|
| 62 |
"4242424242424242 with any CVC and a valid expiration date or check the "
|
| 63 |
"documentation \"<a href=\"%s\">Testing Stripe</a>\" for more card numbers."
|
| 64 |
msgstr ""
|
| 65 |
|
| 66 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 67 |
#: includes/legacy/class-wc-gateway-stripe.php:165
|
|
|
|
| 68 |
msgid ""
|
| 69 |
"Stripe is enabled, but the <a href=\"%s\">force SSL option</a> is disabled; "
|
| 70 |
"your checkout may not be secure! Please enable SSL and ensure your server "
|
| 71 |
"has a valid SSL certificate - Stripe will only work in test mode."
|
| 72 |
msgstr ""
|
| 73 |
|
| 74 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 75 |
msgid ""
|
| 76 |
"This is not a valid live key. Live keys start with \"sk_live_\" and "
|
| 77 |
"\"pk_live_\"."
|
| 78 |
msgstr ""
|
| 79 |
|
| 80 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 81 |
msgid ""
|
| 82 |
"This is not a valid test key. Test keys start with \"sk_test_\" and "
|
| 83 |
"\"pk_test_\"."
|
| 84 |
msgstr ""
|
| 85 |
|
| 86 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 87 |
msgid "Add Card"
|
| 88 |
msgstr ""
|
| 89 |
|
| 90 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 91 |
#: includes/legacy/class-wc-gateway-stripe.php:262
|
|
|
|
| 92 |
msgid "%s"
|
| 93 |
msgstr ""
|
| 94 |
|
| 95 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 96 |
#: includes/legacy/class-wc-gateway-stripe.php:296
|
| 97 |
msgid "Please accept the terms and conditions first"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 101 |
#: includes/legacy/class-wc-gateway-stripe.php:297
|
| 102 |
msgid "Please fill in required checkout fields first"
|
| 103 |
msgstr ""
|
| 104 |
|
| 105 |
-
#: includes/class-wc-gateway-stripe.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
#: includes/legacy/class-wc-gateway-stripe.php:331
|
|
|
|
| 107 |
msgid "%s - Order %s"
|
| 108 |
msgstr ""
|
| 109 |
|
| 110 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 111 |
msgid "Invalid payment method. Please input a new card number."
|
| 112 |
msgstr ""
|
| 113 |
|
| 114 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 115 |
#: includes/legacy/class-wc-gateway-stripe.php:434
|
| 116 |
msgid "Please enter your card details to make a payment."
|
| 117 |
msgstr ""
|
| 118 |
|
| 119 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 120 |
#: includes/legacy/class-wc-gateway-stripe.php:435
|
| 121 |
msgid ""
|
| 122 |
"Developers: Please make sure that you are including jQuery and there are no "
|
| 123 |
"JavaScript errors on the page."
|
| 124 |
msgstr ""
|
| 125 |
|
| 126 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 127 |
msgid "This card is no longer available and has been removed."
|
| 128 |
msgstr ""
|
| 129 |
|
| 130 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 131 |
#: includes/legacy/class-wc-gateway-stripe.php:481
|
|
|
|
| 132 |
msgid "Error: %s"
|
| 133 |
msgstr ""
|
| 134 |
|
| 135 |
-
#: includes/class-wc-gateway-stripe.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
#: includes/legacy/class-wc-gateway-stripe.php:526
|
|
|
|
| 137 |
msgid ""
|
| 138 |
"Stripe charge authorized (Charge ID: %s). Process order to take payment, or "
|
| 139 |
"cancel to remove the pre-authorization."
|
| 140 |
msgstr ""
|
| 141 |
|
| 142 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 143 |
#: includes/legacy/class-wc-gateway-stripe.php:540
|
| 144 |
msgid "There was a problem adding the card."
|
| 145 |
msgstr ""
|
| 146 |
|
| 147 |
-
#: includes/class-wc-gateway-stripe.php:
|
| 148 |
#: includes/legacy/class-wc-gateway-stripe.php:590
|
|
|
|
| 149 |
msgid "Refunded %s - Refund ID: %s - Reason: %s"
|
| 150 |
msgstr ""
|
| 151 |
|
|
@@ -183,10 +256,12 @@ msgid "Default card updated."
|
|
| 183 |
msgstr ""
|
| 184 |
|
| 185 |
#: includes/legacy/class-wc-gateway-stripe.php:149
|
|
|
|
| 186 |
msgid "Stripe error: Please enter your secret key <a href=\"%s\">here</a>"
|
| 187 |
msgstr ""
|
| 188 |
|
| 189 |
#: includes/legacy/class-wc-gateway-stripe.php:153
|
|
|
|
| 190 |
msgid "Stripe error: Please enter your publishable key <a href=\"%s\">here</a>"
|
| 191 |
msgstr ""
|
| 192 |
|
|
@@ -201,6 +276,7 @@ msgid "Manage cards"
|
|
| 201 |
msgstr ""
|
| 202 |
|
| 203 |
#: includes/legacy/class-wc-gateway-stripe.php:229
|
|
|
|
| 204 |
msgid "%s card ending in %s (Expires %s/%s)"
|
| 205 |
msgstr ""
|
| 206 |
|
|
@@ -221,6 +297,7 @@ msgid "Expires"
|
|
| 221 |
msgstr ""
|
| 222 |
|
| 223 |
#: includes/legacy/templates/saved-cards.php:19
|
|
|
|
| 224 |
msgid "%s card ending in %s"
|
| 225 |
msgstr ""
|
| 226 |
|
|
@@ -229,6 +306,7 @@ msgid "(Default)"
|
|
| 229 |
msgstr ""
|
| 230 |
|
| 231 |
#: includes/legacy/templates/saved-cards.php:22
|
|
|
|
| 232 |
msgid "Expires %s/%s"
|
| 233 |
msgstr ""
|
| 234 |
|
|
@@ -257,7 +335,7 @@ msgid "This controls the title which the user sees during checkout."
|
|
| 257 |
msgstr ""
|
| 258 |
|
| 259 |
#: includes/settings-stripe.php:19
|
| 260 |
-
msgid "Credit
|
| 261 |
msgstr ""
|
| 262 |
|
| 263 |
#: includes/settings-stripe.php:23
|
|
@@ -432,89 +510,75 @@ msgstr ""
|
|
| 432 |
msgid "Save debug messages to the WooCommerce System Status log."
|
| 433 |
msgstr ""
|
| 434 |
|
| 435 |
-
#: woocommerce-gateway-stripe.php:
|
|
|
|
| 436 |
msgid ""
|
| 437 |
"Stripe is almost ready. To get started, <a href=\"%s\">set your Stripe "
|
| 438 |
"account keys</a>."
|
| 439 |
msgstr ""
|
| 440 |
|
| 441 |
-
#: woocommerce-gateway-stripe.php:
|
|
|
|
| 442 |
msgid ""
|
| 443 |
"The plugin could not be activated. The minimum PHP version required for this "
|
| 444 |
"plugin is %1$s. You are running %2$s."
|
| 445 |
msgstr ""
|
| 446 |
|
| 447 |
-
#: woocommerce-gateway-stripe.php:
|
|
|
|
| 448 |
msgid ""
|
| 449 |
"The WooCommerce Stripe plugin has been deactivated. The minimum PHP version "
|
| 450 |
"required for this plugin is %1$s. You are running %2$s."
|
| 451 |
msgstr ""
|
| 452 |
|
| 453 |
-
#: woocommerce-gateway-stripe.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 454 |
msgid ""
|
| 455 |
"The plugin could not be activated. The minimum WooCommerce version required "
|
| 456 |
"for this plugin is %1$s. You are running %2$s."
|
| 457 |
msgstr ""
|
| 458 |
|
| 459 |
-
#: woocommerce-gateway-stripe.php:
|
|
|
|
| 460 |
msgid ""
|
| 461 |
"The WooCommerce Stripe plugin has been deactivated. The minimum WooCommerce "
|
| 462 |
"version required for this plugin is %1$s. You are running %2$s."
|
| 463 |
msgstr ""
|
| 464 |
|
| 465 |
-
#: woocommerce-gateway-stripe.php:
|
| 466 |
msgid "The plugin could not be activated. cURL is not installed."
|
| 467 |
msgstr ""
|
| 468 |
|
| 469 |
-
#: woocommerce-gateway-stripe.php:
|
| 470 |
msgid ""
|
| 471 |
"The WooCommerce Stripe plugin has been deactivated. cURL is not installed."
|
| 472 |
msgstr ""
|
| 473 |
|
| 474 |
-
#: woocommerce-gateway-stripe.php:
|
| 475 |
msgid "Settings"
|
| 476 |
msgstr ""
|
| 477 |
|
| 478 |
-
#: woocommerce-gateway-stripe.php:
|
| 479 |
msgid "Docs"
|
| 480 |
msgstr ""
|
| 481 |
|
| 482 |
-
#: woocommerce-gateway-stripe.php:
|
| 483 |
msgid "Support"
|
| 484 |
msgstr ""
|
| 485 |
|
| 486 |
-
#: woocommerce-gateway-stripe.php:
|
| 487 |
msgid "Unable to capture charge!"
|
| 488 |
msgstr ""
|
| 489 |
|
| 490 |
-
#: woocommerce-gateway-stripe.php:
|
| 491 |
-
msgid "Stripe charge complete (Charge ID: %s)"
|
| 492 |
-
msgstr ""
|
| 493 |
-
|
| 494 |
-
#: woocommerce-gateway-stripe.php:348
|
| 495 |
msgid "Unable to refund charge!"
|
| 496 |
msgstr ""
|
| 497 |
|
| 498 |
-
#: woocommerce-gateway-stripe.php:
|
|
|
|
| 499 |
msgid "Stripe charge refunded (Charge ID: %s)"
|
| 500 |
msgstr ""
|
| 501 |
-
|
| 502 |
-
#. Plugin Name of the plugin/theme
|
| 503 |
-
msgid "WooCommerce Stripe Gateway"
|
| 504 |
-
msgstr ""
|
| 505 |
-
|
| 506 |
-
#. Plugin URI of the plugin/theme
|
| 507 |
-
msgid "https://wordpress.org/plugins/woocommerce-gateway-stripe/"
|
| 508 |
-
msgstr ""
|
| 509 |
-
|
| 510 |
-
#. Description of the plugin/theme
|
| 511 |
-
msgid "Take credit card payments on your store using Stripe."
|
| 512 |
-
msgstr ""
|
| 513 |
-
|
| 514 |
-
#. Author of the plugin/theme
|
| 515 |
-
msgid "Automattic"
|
| 516 |
-
msgstr ""
|
| 517 |
-
|
| 518 |
-
#. Author URI of the plugin/theme
|
| 519 |
-
msgid "http://woothemes.com/"
|
| 520 |
-
msgstr ""
|
|
|
|
|
|
|
| 1 |
msgid ""
|
| 2 |
msgstr ""
|
| 3 |
+
"Project-Id-Version: WooCommerce Stripe Gateway\n"
|
| 4 |
+
"POT-Creation-Date: 2016-09-24 08:19-0800\n"
|
| 5 |
+
"PO-Revision-Date: 2016-09-24 08:19-0800\n"
|
| 6 |
+
"Last-Translator: \n"
|
| 7 |
+
"Language-Team: \n"
|
| 8 |
+
"Language: en_US\n"
|
| 9 |
"MIME-Version: 1.0\n"
|
| 10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
| 11 |
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
+
"X-Generator: Poedit 1.7.3\n"
|
| 13 |
+
"X-Poedit-Basepath: ..\n"
|
| 14 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
| 15 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
| 16 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
| 17 |
+
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
| 18 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
| 19 |
+
"X-Poedit-SearchPath-0: .\n"
|
| 20 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
| 21 |
|
| 22 |
#: includes/class-wc-gateway-stripe-addons.php:104
|
| 23 |
#: includes/class-wc-gateway-stripe-addons.php:150
|
| 24 |
+
#: includes/class-wc-gateway-stripe.php:548
|
| 25 |
#: includes/legacy/class-wc-gateway-stripe.php:446
|
| 26 |
msgid ""
|
| 27 |
"Sorry, the minimum allowed order total is 0.50 to use this payment method."
|
| 36 |
msgstr ""
|
| 37 |
|
| 38 |
#: includes/class-wc-gateway-stripe-addons.php:218
|
| 39 |
+
#: includes/class-wc-gateway-stripe-addons.php:261
|
| 40 |
+
#, php-format
|
| 41 |
msgid "Stripe Transaction Failed (%s)"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
+
#: includes/class-wc-gateway-stripe-addons.php:383
|
| 45 |
+
#: includes/class-wc-gateway-stripe-addons.php:388
|
| 46 |
+
#, php-format
|
| 47 |
msgid "Via %s card ending in %s"
|
| 48 |
msgstr ""
|
| 49 |
|
| 50 |
+
#: includes/class-wc-gateway-stripe.php:88
|
| 51 |
#: includes/legacy/class-wc-gateway-stripe.php:18
|
| 52 |
msgid "Stripe"
|
| 53 |
msgstr ""
|
| 54 |
|
| 55 |
+
#: includes/class-wc-gateway-stripe.php:89
|
| 56 |
#: includes/legacy/class-wc-gateway-stripe.php:19
|
| 57 |
msgid ""
|
| 58 |
"Stripe works by adding credit card fields on the checkout and then sending "
|
| 59 |
"the details to Stripe for verification."
|
| 60 |
msgstr ""
|
| 61 |
|
| 62 |
+
#: includes/class-wc-gateway-stripe.php:131
|
| 63 |
#: includes/legacy/class-wc-gateway-stripe.php:60
|
| 64 |
msgid "Continue to payment"
|
| 65 |
msgstr ""
|
| 66 |
|
| 67 |
+
#: includes/class-wc-gateway-stripe.php:135
|
| 68 |
#: includes/legacy/class-wc-gateway-stripe.php:64
|
| 69 |
+
#, php-format
|
| 70 |
msgid ""
|
| 71 |
"TEST MODE ENABLED. In test mode, you can use the card number "
|
| 72 |
"4242424242424242 with any CVC and a valid expiration date or check the "
|
| 73 |
"documentation \"<a href=\"%s\">Testing Stripe</a>\" for more card numbers."
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
+
#: includes/class-wc-gateway-stripe.php:222
|
| 77 |
#: includes/legacy/class-wc-gateway-stripe.php:165
|
| 78 |
+
#, php-format
|
| 79 |
msgid ""
|
| 80 |
"Stripe is enabled, but the <a href=\"%s\">force SSL option</a> is disabled; "
|
| 81 |
"your checkout may not be secure! Please enable SSL and ensure your server "
|
| 82 |
"has a valid SSL certificate - Stripe will only work in test mode."
|
| 83 |
msgstr ""
|
| 84 |
|
| 85 |
+
#: includes/class-wc-gateway-stripe.php:262
|
| 86 |
msgid ""
|
| 87 |
"This is not a valid live key. Live keys start with \"sk_live_\" and "
|
| 88 |
"\"pk_live_\"."
|
| 89 |
msgstr ""
|
| 90 |
|
| 91 |
+
#: includes/class-wc-gateway-stripe.php:273
|
| 92 |
msgid ""
|
| 93 |
"This is not a valid test key. Test keys start with \"sk_test_\" and "
|
| 94 |
"\"pk_test_\"."
|
| 95 |
msgstr ""
|
| 96 |
|
| 97 |
+
#: includes/class-wc-gateway-stripe.php:298
|
| 98 |
msgid "Add Card"
|
| 99 |
msgstr ""
|
| 100 |
|
| 101 |
+
#: includes/class-wc-gateway-stripe.php:309
|
| 102 |
#: includes/legacy/class-wc-gateway-stripe.php:262
|
| 103 |
+
#, php-format
|
| 104 |
msgid "%s"
|
| 105 |
msgstr ""
|
| 106 |
|
| 107 |
+
#: includes/class-wc-gateway-stripe.php:353
|
| 108 |
#: includes/legacy/class-wc-gateway-stripe.php:296
|
| 109 |
msgid "Please accept the terms and conditions first"
|
| 110 |
msgstr ""
|
| 111 |
|
| 112 |
+
#: includes/class-wc-gateway-stripe.php:354
|
| 113 |
#: includes/legacy/class-wc-gateway-stripe.php:297
|
| 114 |
msgid "Please fill in required checkout fields first"
|
| 115 |
msgstr ""
|
| 116 |
|
| 117 |
+
#: includes/class-wc-gateway-stripe.php:375
|
| 118 |
+
msgid "Sorry, we're not accepting prepaid cards at this time."
|
| 119 |
+
msgstr ""
|
| 120 |
+
|
| 121 |
+
#: includes/class-wc-gateway-stripe.php:379
|
| 122 |
+
msgid "The card number is not a valid credit card number."
|
| 123 |
+
msgstr ""
|
| 124 |
+
|
| 125 |
+
#: includes/class-wc-gateway-stripe.php:380
|
| 126 |
+
msgid "The card's expiration month is invalid."
|
| 127 |
+
msgstr ""
|
| 128 |
+
|
| 129 |
+
#: includes/class-wc-gateway-stripe.php:381
|
| 130 |
+
msgid "The card's expiration year is invalid."
|
| 131 |
+
msgstr ""
|
| 132 |
+
|
| 133 |
+
#: includes/class-wc-gateway-stripe.php:382
|
| 134 |
+
msgid "The card's security code is invalid."
|
| 135 |
+
msgstr ""
|
| 136 |
+
|
| 137 |
+
#: includes/class-wc-gateway-stripe.php:383
|
| 138 |
+
msgid "The card number is incorrect."
|
| 139 |
+
msgstr ""
|
| 140 |
+
|
| 141 |
+
#: includes/class-wc-gateway-stripe.php:384
|
| 142 |
+
msgid "The card has expired."
|
| 143 |
+
msgstr ""
|
| 144 |
+
|
| 145 |
+
#: includes/class-wc-gateway-stripe.php:385
|
| 146 |
+
msgid "The card's security code is incorrect."
|
| 147 |
+
msgstr ""
|
| 148 |
+
|
| 149 |
+
#: includes/class-wc-gateway-stripe.php:386
|
| 150 |
+
msgid "The card's zip code failed validation."
|
| 151 |
+
msgstr ""
|
| 152 |
+
|
| 153 |
+
#: includes/class-wc-gateway-stripe.php:387
|
| 154 |
+
msgid "The card was declined."
|
| 155 |
+
msgstr ""
|
| 156 |
+
|
| 157 |
+
#: includes/class-wc-gateway-stripe.php:388
|
| 158 |
+
msgid "There is no card on a customer that is being charged."
|
| 159 |
+
msgstr ""
|
| 160 |
+
|
| 161 |
+
#: includes/class-wc-gateway-stripe.php:389
|
| 162 |
+
msgid "An error occurred while processing the card."
|
| 163 |
+
msgstr ""
|
| 164 |
+
|
| 165 |
+
#: includes/class-wc-gateway-stripe.php:390
|
| 166 |
+
msgid "Could not find payment information."
|
| 167 |
+
msgstr ""
|
| 168 |
+
|
| 169 |
+
#: includes/class-wc-gateway-stripe.php:405
|
| 170 |
#: includes/legacy/class-wc-gateway-stripe.php:331
|
| 171 |
+
#, php-format
|
| 172 |
msgid "%s - Order %s"
|
| 173 |
msgstr ""
|
| 174 |
|
| 175 |
+
#: includes/class-wc-gateway-stripe.php:474
|
| 176 |
msgid "Invalid payment method. Please input a new card number."
|
| 177 |
msgstr ""
|
| 178 |
|
| 179 |
+
#: includes/class-wc-gateway-stripe.php:536
|
| 180 |
#: includes/legacy/class-wc-gateway-stripe.php:434
|
| 181 |
msgid "Please enter your card details to make a payment."
|
| 182 |
msgstr ""
|
| 183 |
|
| 184 |
+
#: includes/class-wc-gateway-stripe.php:537
|
| 185 |
#: includes/legacy/class-wc-gateway-stripe.php:435
|
| 186 |
msgid ""
|
| 187 |
"Developers: Please make sure that you are including jQuery and there are no "
|
| 188 |
"JavaScript errors on the page."
|
| 189 |
msgstr ""
|
| 190 |
|
| 191 |
+
#: includes/class-wc-gateway-stripe.php:565
|
| 192 |
msgid "This card is no longer available and has been removed."
|
| 193 |
msgstr ""
|
| 194 |
|
| 195 |
+
#: includes/class-wc-gateway-stripe.php:588
|
| 196 |
#: includes/legacy/class-wc-gateway-stripe.php:481
|
| 197 |
+
#, php-format
|
| 198 |
msgid "Error: %s"
|
| 199 |
msgstr ""
|
| 200 |
|
| 201 |
+
#: includes/class-wc-gateway-stripe.php:634 woocommerce-gateway-stripe.php:345
|
| 202 |
+
#, php-format
|
| 203 |
+
msgid "Stripe charge complete (Charge ID: %s)"
|
| 204 |
+
msgstr ""
|
| 205 |
+
|
| 206 |
+
#: includes/class-wc-gateway-stripe.php:645
|
| 207 |
#: includes/legacy/class-wc-gateway-stripe.php:526
|
| 208 |
+
#, php-format
|
| 209 |
msgid ""
|
| 210 |
"Stripe charge authorized (Charge ID: %s). Process order to take payment, or "
|
| 211 |
"cancel to remove the pre-authorization."
|
| 212 |
msgstr ""
|
| 213 |
|
| 214 |
+
#: includes/class-wc-gateway-stripe.php:659
|
| 215 |
#: includes/legacy/class-wc-gateway-stripe.php:540
|
| 216 |
msgid "There was a problem adding the card."
|
| 217 |
msgstr ""
|
| 218 |
|
| 219 |
+
#: includes/class-wc-gateway-stripe.php:709
|
| 220 |
#: includes/legacy/class-wc-gateway-stripe.php:590
|
| 221 |
+
#, php-format
|
| 222 |
msgid "Refunded %s - Refund ID: %s - Reason: %s"
|
| 223 |
msgstr ""
|
| 224 |
|
| 256 |
msgstr ""
|
| 257 |
|
| 258 |
#: includes/legacy/class-wc-gateway-stripe.php:149
|
| 259 |
+
#, php-format
|
| 260 |
msgid "Stripe error: Please enter your secret key <a href=\"%s\">here</a>"
|
| 261 |
msgstr ""
|
| 262 |
|
| 263 |
#: includes/legacy/class-wc-gateway-stripe.php:153
|
| 264 |
+
#, php-format
|
| 265 |
msgid "Stripe error: Please enter your publishable key <a href=\"%s\">here</a>"
|
| 266 |
msgstr ""
|
| 267 |
|
| 276 |
msgstr ""
|
| 277 |
|
| 278 |
#: includes/legacy/class-wc-gateway-stripe.php:229
|
| 279 |
+
#, php-format
|
| 280 |
msgid "%s card ending in %s (Expires %s/%s)"
|
| 281 |
msgstr ""
|
| 282 |
|
| 297 |
msgstr ""
|
| 298 |
|
| 299 |
#: includes/legacy/templates/saved-cards.php:19
|
| 300 |
+
#, php-format
|
| 301 |
msgid "%s card ending in %s"
|
| 302 |
msgstr ""
|
| 303 |
|
| 306 |
msgstr ""
|
| 307 |
|
| 308 |
#: includes/legacy/templates/saved-cards.php:22
|
| 309 |
+
#, php-format
|
| 310 |
msgid "Expires %s/%s"
|
| 311 |
msgstr ""
|
| 312 |
|
| 335 |
msgstr ""
|
| 336 |
|
| 337 |
#: includes/settings-stripe.php:19
|
| 338 |
+
msgid "Credit Card (Stripe)"
|
| 339 |
msgstr ""
|
| 340 |
|
| 341 |
#: includes/settings-stripe.php:23
|
| 510 |
msgid "Save debug messages to the WooCommerce System Status log."
|
| 511 |
msgstr ""
|
| 512 |
|
| 513 |
+
#: woocommerce-gateway-stripe.php:188
|
| 514 |
+
#, php-format
|
| 515 |
msgid ""
|
| 516 |
"Stripe is almost ready. To get started, <a href=\"%s\">set your Stripe "
|
| 517 |
"account keys</a>."
|
| 518 |
msgstr ""
|
| 519 |
|
| 520 |
+
#: woocommerce-gateway-stripe.php:199
|
| 521 |
+
#, php-format
|
| 522 |
msgid ""
|
| 523 |
"The plugin could not be activated. The minimum PHP version required for this "
|
| 524 |
"plugin is %1$s. You are running %2$s."
|
| 525 |
msgstr ""
|
| 526 |
|
| 527 |
+
#: woocommerce-gateway-stripe.php:201
|
| 528 |
+
#, php-format
|
| 529 |
msgid ""
|
| 530 |
"The WooCommerce Stripe plugin has been deactivated. The minimum PHP version "
|
| 531 |
"required for this plugin is %1$s. You are running %2$s."
|
| 532 |
msgstr ""
|
| 533 |
|
| 534 |
+
#: woocommerce-gateway-stripe.php:207
|
| 535 |
+
msgid "The plugin could not be activated. WooCommerce is not activated."
|
| 536 |
+
msgstr ""
|
| 537 |
+
|
| 538 |
+
#: woocommerce-gateway-stripe.php:212
|
| 539 |
+
#, php-format
|
| 540 |
msgid ""
|
| 541 |
"The plugin could not be activated. The minimum WooCommerce version required "
|
| 542 |
"for this plugin is %1$s. You are running %2$s."
|
| 543 |
msgstr ""
|
| 544 |
|
| 545 |
+
#: woocommerce-gateway-stripe.php:214
|
| 546 |
+
#, php-format
|
| 547 |
msgid ""
|
| 548 |
"The WooCommerce Stripe plugin has been deactivated. The minimum WooCommerce "
|
| 549 |
"version required for this plugin is %1$s. You are running %2$s."
|
| 550 |
msgstr ""
|
| 551 |
|
| 552 |
+
#: woocommerce-gateway-stripe.php:221
|
| 553 |
msgid "The plugin could not be activated. cURL is not installed."
|
| 554 |
msgstr ""
|
| 555 |
|
| 556 |
+
#: woocommerce-gateway-stripe.php:223
|
| 557 |
msgid ""
|
| 558 |
"The WooCommerce Stripe plugin has been deactivated. cURL is not installed."
|
| 559 |
msgstr ""
|
| 560 |
|
| 561 |
+
#: woocommerce-gateway-stripe.php:238
|
| 562 |
msgid "Settings"
|
| 563 |
msgstr ""
|
| 564 |
|
| 565 |
+
#: woocommerce-gateway-stripe.php:239
|
| 566 |
msgid "Docs"
|
| 567 |
msgstr ""
|
| 568 |
|
| 569 |
+
#: woocommerce-gateway-stripe.php:240
|
| 570 |
msgid "Support"
|
| 571 |
msgstr ""
|
| 572 |
|
| 573 |
+
#: woocommerce-gateway-stripe.php:343
|
| 574 |
msgid "Unable to capture charge!"
|
| 575 |
msgstr ""
|
| 576 |
|
| 577 |
+
#: woocommerce-gateway-stripe.php:377
|
|
|
|
|
|
|
|
|
|
|
|
|
| 578 |
msgid "Unable to refund charge!"
|
| 579 |
msgstr ""
|
| 580 |
|
| 581 |
+
#: woocommerce-gateway-stripe.php:379
|
| 582 |
+
#, php-format
|
| 583 |
msgid "Stripe charge refunded (Charge ID: %s)"
|
| 584 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, mikejolley, akeda, royho
|
|
| 3 |
Tags: credit card, stripe, woocommerce
|
| 4 |
Requires at least: 4.4
|
| 5 |
Tested up to: 4.5
|
| 6 |
-
Stable tag: 3.0.
|
| 7 |
License: GPLv3
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
|
@@ -87,6 +87,15 @@ If you get stuck, you can ask for help in the Plugin Forum.
|
|
| 87 |
|
| 88 |
== Changelog ==
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
= 3.0.2 =
|
| 91 |
* Fix - Set empty array as default value for first argument in WC_Stripe_Customer::create_customer
|
| 92 |
* Tweak - Update default title to make it consistent with existing titles
|
|
@@ -100,4 +109,15 @@ If you get stuck, you can ask for help in the Plugin Forum.
|
|
| 100 |
* Refactor for WC 2.6 and above. Legacy support for 2.5.
|
| 101 |
* Improved saved card handling using tokenization API in WooCommerce.
|
| 102 |
|
| 103 |
-
[See changelog for all versions](https://raw.githubusercontent.com/woothemes/woocommerce-gateway-stripe/master/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
Tags: credit card, stripe, woocommerce
|
| 4 |
Requires at least: 4.4
|
| 5 |
Tested up to: 4.5
|
| 6 |
+
Stable tag: 3.0.3
|
| 7 |
License: GPLv3
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
| 87 |
|
| 88 |
== Changelog ==
|
| 89 |
|
| 90 |
+
= 3.0.3 =
|
| 91 |
+
* Fix - Remove bitcoin icon when not using Stripe Checkout mode as it is not supported.
|
| 92 |
+
* Fix - Failed payment order was not sending email to admin.
|
| 93 |
+
* Fix - Saved card option was not being honored.
|
| 94 |
+
* New - Filter for WC_Payment_Gateway_CC::wc_stripe_generate_payment_request return value.
|
| 95 |
+
* New - Filter to disallow prepaid cards. "wc_stripe_allow_prepaid_card".
|
| 96 |
+
* New - Filter to require billing address on Stripe Modal Checkout. "wc_stripe_checkout_require_billing_address".
|
| 97 |
+
* New - Localized Stripe error messages.
|
| 98 |
+
|
| 99 |
= 3.0.2 =
|
| 100 |
* Fix - Set empty array as default value for first argument in WC_Stripe_Customer::create_customer
|
| 101 |
* Tweak - Update default title to make it consistent with existing titles
|
| 109 |
* Refactor for WC 2.6 and above. Legacy support for 2.5.
|
| 110 |
* Improved saved card handling using tokenization API in WooCommerce.
|
| 111 |
|
| 112 |
+
[See changelog for all versions](https://raw.githubusercontent.com/woothemes/woocommerce-gateway-stripe/master/changelog.txt).
|
| 113 |
+
|
| 114 |
+
== Upgrade Notice ==
|
| 115 |
+
|
| 116 |
+
= 3.0.3 =
|
| 117 |
+
* Fix - Remove bitcoin icon when not using Stripe Checkout mode as it is not supported.
|
| 118 |
+
* Fix - Failed payment order was not sending email to admin.
|
| 119 |
+
* Fix - Saved card option was not being honored.
|
| 120 |
+
* New - Filter for WC_Payment_Gateway_CC::wc_stripe_generate_payment_request return value.
|
| 121 |
+
* New - Filter to disallow prepaid cards. "wc_stripe_allow_prepaid_card".
|
| 122 |
+
* New - Filter to require billing address on Stripe Modal Checkout. "wc_stripe_checkout_require_billing_address".
|
| 123 |
+
* New - Localized Stripe error messages.
|
woocommerce-gateway-stripe.php
CHANGED
|
@@ -4,8 +4,8 @@
|
|
| 4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-gateway-stripe/
|
| 5 |
* Description: Take credit card payments on your store using Stripe.
|
| 6 |
* Author: Automattic
|
| 7 |
-
* Author URI:
|
| 8 |
-
* Version: 3.0.
|
| 9 |
* Text Domain: woocommerce-gateway-stripe
|
| 10 |
* Domain Path: /languages
|
| 11 |
*
|
|
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
| 32 |
/**
|
| 33 |
* Required minimums and constants
|
| 34 |
*/
|
| 35 |
-
define( 'WC_STRIPE_VERSION', '3.0.
|
| 36 |
define( 'WC_STRIPE_MIN_PHP_VER', '5.3.0' );
|
| 37 |
define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
|
| 38 |
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
|
|
@@ -80,9 +80,22 @@ class WC_Stripe {
|
|
| 80 |
*/
|
| 81 |
private function __wakeup() {}
|
| 82 |
|
| 83 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
private $subscription_support_enabled = false;
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
/**
|
| 87 |
* Notices (array)
|
| 88 |
* @var array
|
|
@@ -134,32 +147,15 @@ class WC_Stripe {
|
|
| 134 |
);
|
| 135 |
}
|
| 136 |
|
| 137 |
-
/**
|
| 138 |
-
* The primary sanity check, automatically disable the plugin on activation if it doesn't
|
| 139 |
-
* meet minimum requirements.
|
| 140 |
-
*
|
| 141 |
-
* Based on http://wptavern.com/how-to-prevent-wordpress-plugins-from-activating-on-sites-with-incompatible-hosting-environments
|
| 142 |
-
*/
|
| 143 |
-
public static function activation_check() {
|
| 144 |
-
$environment_warning = self::get_environment_warning( true );
|
| 145 |
-
if ( $environment_warning ) {
|
| 146 |
-
deactivate_plugins( plugin_basename( __FILE__ ) );
|
| 147 |
-
wp_die( $environment_warning );
|
| 148 |
-
}
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
/**
|
| 152 |
* The backup sanity check, in case the plugin is activated in a weird way,
|
| 153 |
* or the environment changes after activation.
|
| 154 |
*/
|
| 155 |
public function check_environment() {
|
| 156 |
$environment_warning = self::get_environment_warning();
|
|
|
|
| 157 |
if ( $environment_warning && is_plugin_active( plugin_basename( __FILE__ ) ) ) {
|
| 158 |
-
deactivate_plugins( plugin_basename( __FILE__ ) );
|
| 159 |
$this->add_admin_notice( 'bad_environment', 'error', $environment_warning );
|
| 160 |
-
if ( isset( $_GET['activate'] ) ) {
|
| 161 |
-
unset( $_GET['activate'] );
|
| 162 |
-
}
|
| 163 |
}
|
| 164 |
|
| 165 |
// Check if secret key present. Otherwise prompt, via notice, to go to
|
|
@@ -172,7 +168,7 @@ class WC_Stripe {
|
|
| 172 |
|
| 173 |
if ( empty( $secret ) && ! ( isset( $_GET['page'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'stripe' === $_GET['section'] ) ) {
|
| 174 |
$setting_link = $this->get_setting_link();
|
| 175 |
-
$this->add_admin_notice( 'prompt_connect', 'notice notice-warning', sprintf( __( 'Stripe is almost ready. To get started, <a href="%s">set your Stripe account keys</a>.', '
|
| 176 |
}
|
| 177 |
}
|
| 178 |
|
|
@@ -180,30 +176,25 @@ class WC_Stripe {
|
|
| 180 |
* Checks the environment for compatibility problems. Returns a string with the first incompatibility
|
| 181 |
* found or false if the environment has no problems.
|
| 182 |
*/
|
| 183 |
-
static function get_environment_warning(
|
| 184 |
if ( version_compare( phpversion(), WC_STRIPE_MIN_PHP_VER, '<' ) ) {
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
} else {
|
| 188 |
-
$message = __( 'The WooCommerce Stripe plugin has been deactivated. The minimum PHP version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe' );
|
| 189 |
-
}
|
| 190 |
return sprintf( $message, WC_STRIPE_MIN_PHP_VER, phpversion() );
|
| 191 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) {
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
} else {
|
| 197 |
-
$message = __( 'The WooCommerce Stripe plugin has been deactivated. The minimum WooCommerce version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe' );
|
| 198 |
-
}
|
| 199 |
return sprintf( $message, WC_STRIPE_MIN_WC_VER, WC_VERSION );
|
| 200 |
}
|
| 201 |
|
| 202 |
if ( ! function_exists( 'curl_init' ) ) {
|
| 203 |
-
|
| 204 |
-
return __( 'The plugin could not be activated. cURL is not installed.', 'woocommerce-gateway-stripe' );
|
| 205 |
-
}
|
| 206 |
-
return __( 'The WooCommerce Stripe plugin has been deactivated. cURL is not installed.', 'woocommerce-gateway-stripe' );
|
| 207 |
}
|
| 208 |
|
| 209 |
return false;
|
|
@@ -261,6 +252,10 @@ class WC_Stripe {
|
|
| 261 |
$this->subscription_support_enabled = true;
|
| 262 |
}
|
| 263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
if ( ! class_exists( 'WC_Payment_Gateway' ) ) {
|
| 265 |
return;
|
| 266 |
}
|
|
@@ -275,7 +270,13 @@ class WC_Stripe {
|
|
| 275 |
load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
|
| 276 |
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
|
| 277 |
|
| 278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
require_once( plugin_basename( 'includes/class-wc-gateway-stripe-addons.php' ) );
|
| 280 |
}
|
| 281 |
}
|
|
@@ -286,7 +287,7 @@ class WC_Stripe {
|
|
| 286 |
* @since 1.0.0
|
| 287 |
*/
|
| 288 |
public function add_gateways( $methods ) {
|
| 289 |
-
if ( $this->subscription_support_enabled ) {
|
| 290 |
$methods[] = 'WC_Gateway_Stripe_Addons';
|
| 291 |
} else {
|
| 292 |
$methods[] = 'WC_Gateway_Stripe';
|
|
@@ -433,6 +434,5 @@ class WC_Stripe {
|
|
| 433 |
}
|
| 434 |
|
| 435 |
$GLOBALS['wc_stripe'] = WC_Stripe::get_instance();
|
| 436 |
-
register_activation_hook( __FILE__, array( 'WC_Stripe', 'activation_check' ) );
|
| 437 |
|
| 438 |
}
|
| 4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-gateway-stripe/
|
| 5 |
* Description: Take credit card payments on your store using Stripe.
|
| 6 |
* Author: Automattic
|
| 7 |
+
* Author URI: https://woocommerce.com/
|
| 8 |
+
* Version: 3.0.3
|
| 9 |
* Text Domain: woocommerce-gateway-stripe
|
| 10 |
* Domain Path: /languages
|
| 11 |
*
|
| 32 |
/**
|
| 33 |
* Required minimums and constants
|
| 34 |
*/
|
| 35 |
+
define( 'WC_STRIPE_VERSION', '3.0.3' );
|
| 36 |
define( 'WC_STRIPE_MIN_PHP_VER', '5.3.0' );
|
| 37 |
define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
|
| 38 |
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
|
| 80 |
*/
|
| 81 |
private function __wakeup() {}
|
| 82 |
|
| 83 |
+
/**
|
| 84 |
+
* Flag to indicate whether or not we need to load code for / support subscriptions.
|
| 85 |
+
*
|
| 86 |
+
* @var bool
|
| 87 |
+
*/
|
| 88 |
private $subscription_support_enabled = false;
|
| 89 |
|
| 90 |
+
/**
|
| 91 |
+
* Flag to indicate whether or not we need to load support for pre-orders.
|
| 92 |
+
*
|
| 93 |
+
* @since 3.0.3
|
| 94 |
+
*
|
| 95 |
+
* @var bool
|
| 96 |
+
*/
|
| 97 |
+
private $pre_order_enabled = false;
|
| 98 |
+
|
| 99 |
/**
|
| 100 |
* Notices (array)
|
| 101 |
* @var array
|
| 147 |
);
|
| 148 |
}
|
| 149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
/**
|
| 151 |
* The backup sanity check, in case the plugin is activated in a weird way,
|
| 152 |
* or the environment changes after activation.
|
| 153 |
*/
|
| 154 |
public function check_environment() {
|
| 155 |
$environment_warning = self::get_environment_warning();
|
| 156 |
+
|
| 157 |
if ( $environment_warning && is_plugin_active( plugin_basename( __FILE__ ) ) ) {
|
|
|
|
| 158 |
$this->add_admin_notice( 'bad_environment', 'error', $environment_warning );
|
|
|
|
|
|
|
|
|
|
| 159 |
}
|
| 160 |
|
| 161 |
// Check if secret key present. Otherwise prompt, via notice, to go to
|
| 168 |
|
| 169 |
if ( empty( $secret ) && ! ( isset( $_GET['page'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'stripe' === $_GET['section'] ) ) {
|
| 170 |
$setting_link = $this->get_setting_link();
|
| 171 |
+
$this->add_admin_notice( 'prompt_connect', 'notice notice-warning', sprintf( __( 'Stripe is almost ready. To get started, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ) );
|
| 172 |
}
|
| 173 |
}
|
| 174 |
|
| 176 |
* Checks the environment for compatibility problems. Returns a string with the first incompatibility
|
| 177 |
* found or false if the environment has no problems.
|
| 178 |
*/
|
| 179 |
+
static function get_environment_warning() {
|
| 180 |
if ( version_compare( phpversion(), WC_STRIPE_MIN_PHP_VER, '<' ) ) {
|
| 181 |
+
$message = __( 'WooCommerce Stripe - The minimum PHP version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe', 'woocommerce-gateway-stripe' );
|
| 182 |
+
|
|
|
|
|
|
|
|
|
|
| 183 |
return sprintf( $message, WC_STRIPE_MIN_PHP_VER, phpversion() );
|
| 184 |
}
|
| 185 |
+
|
| 186 |
+
if ( ! defined( 'WC_VERSION' ) ) {
|
| 187 |
+
return __( 'WooCommerce Stripe requires WooCommerce to be activated to work.', 'woocommerce-gateway-stripe' );
|
| 188 |
+
}
|
| 189 |
|
| 190 |
if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) {
|
| 191 |
+
$message = __( 'WooCommerce Stripe - The minimum WooCommerce version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe', 'woocommerce-gateway-stripe' );
|
| 192 |
+
|
|
|
|
|
|
|
|
|
|
| 193 |
return sprintf( $message, WC_STRIPE_MIN_WC_VER, WC_VERSION );
|
| 194 |
}
|
| 195 |
|
| 196 |
if ( ! function_exists( 'curl_init' ) ) {
|
| 197 |
+
return __( 'WooCommerce Stripe - cURL is not installed.', 'woocommerce-gateway-stripe' );
|
|
|
|
|
|
|
|
|
|
| 198 |
}
|
| 199 |
|
| 200 |
return false;
|
| 252 |
$this->subscription_support_enabled = true;
|
| 253 |
}
|
| 254 |
|
| 255 |
+
if ( class_exists( 'WC_Pre_Orders_Order' ) ) {
|
| 256 |
+
$this->pre_order_enabled = true;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
if ( ! class_exists( 'WC_Payment_Gateway' ) ) {
|
| 260 |
return;
|
| 261 |
}
|
| 270 |
load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
|
| 271 |
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
|
| 272 |
|
| 273 |
+
$load_addons = (
|
| 274 |
+
$this->subscription_support_enabled
|
| 275 |
+
||
|
| 276 |
+
$this->pre_order_enabled
|
| 277 |
+
);
|
| 278 |
+
|
| 279 |
+
if ( $load_addons ) {
|
| 280 |
require_once( plugin_basename( 'includes/class-wc-gateway-stripe-addons.php' ) );
|
| 281 |
}
|
| 282 |
}
|
| 287 |
* @since 1.0.0
|
| 288 |
*/
|
| 289 |
public function add_gateways( $methods ) {
|
| 290 |
+
if ( $this->subscription_support_enabled || $this->pre_order_enabled ) {
|
| 291 |
$methods[] = 'WC_Gateway_Stripe_Addons';
|
| 292 |
} else {
|
| 293 |
$methods[] = 'WC_Gateway_Stripe';
|
| 434 |
}
|
| 435 |
|
| 436 |
$GLOBALS['wc_stripe'] = WC_Stripe::get_instance();
|
|
|
|
| 437 |
|
| 438 |
}
|
