Version Description
- Added - Klarna payments now supported
- Added - Bancontact
- Updated - Local payments webhook
Download this release
Release Info
Developer | mr.clayton |
Plugin | Payment Plugins for Stripe WooCommerce |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- apple-developer-merchantid-domain-association +1 -1
- assets/css/stripe.css +15 -4
- assets/js/frontend/local-payment.js +104 -2
- assets/js/frontend/wc-stripe.js +8 -0
- assets/js/frontend/wc-stripe.min.js +1 -1
- i18n/languages/woo-stripe-payment.pot +133 -99
- includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php +43 -19
- includes/class-stripe.php +47 -45
- includes/class-wc-stripe-frontend-scripts.php +11 -0
- includes/class-wc-stripe-gateway.php +16 -0
- includes/class-wc-stripe-redirect-handler.php +12 -19
- includes/class-wc-stripe-rest-api.php +10 -10
- includes/controllers/class-wc-stripe-controller-gateway-settings.php +4 -4
- includes/gateways/class-wc-payment-gateway-stripe-bancontact.php +61 -0
- includes/gateways/class-wc-payment-gateway-stripe-eps.php +5 -2
- includes/gateways/class-wc-payment-gateway-stripe-ideal.php +5 -2
- includes/gateways/class-wc-payment-gateway-stripe-klarna.php +132 -11
- includes/gateways/class-wc-payment-gateway-stripe-multibanco.php +3 -1
- includes/gateways/class-wc-payment-gateway-stripe-p24.php +5 -2
- includes/gateways/class-wc-payment-gateway-stripe-wechat.php +4 -2
- includes/wc-stripe-webhook-functions.php +5 -1
- readme.txt +11 -5
- stripe-payments.php +6 -6
- templates/checkout/klarna.php +20 -0
apple-developer-merchantid-domain-association
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
7B227073704964223A2239373943394538343346343131343044463144313834343232393232313734313034353044314339464446394437384337313531303944334643463542433731222C2276657273696F6E223A312C22637265617465644F6E223A313536363233343735303036312C227369676E6174757265223A22333038303036303932613836343838366637306430313037303261303830333038303032303130313331306633303064303630393630383634383031363530333034303230313035303033303830303630393261383634383836663730643031303730313030303061303830333038323033653333303832303338386130303330323031303230323038346333303431343935313964353433363330306130363038326138363438636533643034303330323330376133313265333032633036303335353034303330633235343137303730366336353230343137303730366336393633363137343639366636653230343936653734363536373732363137343639366636653230343334313230326432303437333333313236333032343036303335353034306230633164343137303730366336353230343336353732373436393636363936333631373436393666366532303431373537343638366637323639373437393331313333303131303630333535303430613063306134313730373036633635323034393665363332653331306233303039303630333535303430363133303235353533333031653137306433313339333033353331333833303331333333323335333735613137306433323334333033353331333633303331333333323335333735613330356633313235333032333036303335353034303330633163363536333633326437333664373032643632373236663662363537323264373336393637366535663535343333343264353035323466343433313134333031323036303335353034306230633062363934663533323035333739373337343635366437333331313333303131303630333535303430613063306134313730373036633635323034393665363332653331306233303039303630333535303430363133303235353533333035393330313330363037326138363438636533643032303130363038326138363438636533643033303130373033343230303034633231353737656465626436633762323231386636386464373039306131323138646337623062643666326332383364383436303935643934616634613534313162383334323065643831316633343037653833333331663163353463336637656233323230643662616435643465666634393238393839336537633066313361333832303231313330383230323064333030633036303335353164313330313031666630343032333030303330316630363033353531643233303431383330313638303134323366323439633434663933653465663237653663346636323836633366613262626664326534623330343530363038326230363031303530353037303130313034333933303337333033353036303832623036303130353035303733303031383632393638373437343730336132663266366636333733373032653631373037303663363532653633366636643266366636333733373033303334326436313730373036633635363136393633363133333330333233303832303131643036303335353164323030343832303131343330383230313130333038323031306330363039326138363438383666373633363430353031333038316665333038316333303630383262303630313035303530373032303233303831623630633831623335323635366336393631366536333635323036663665323037343638363937333230363336353732373436393636363936333631373436353230363237393230363136653739323037303631373237343739323036313733373337353664363537333230363136333633363537303734363136653633363532303666363632303734363836353230373436383635366532303631373037303663363936333631363236633635323037333734363136653634363137323634323037343635373236643733323036313665363432303633366636653634363937343639366636653733323036663636323037353733363532633230363336353732373436393636363936333631373436353230373036663663363936333739323036313665363432303633363537323734363936363639363336313734363936663665323037303732363136333734363936333635323037333734363137343635366436353665373437333265333033363036303832623036303130353035303730323031313632613638373437343730336132663266373737373737326536313730373036633635326536333666366432663633363537323734363936363639363336313734363536313735373436383666373236393734373932663330333430363033353531643166303432643330326233303239613032376130323538363233363837343734373033613266326636333732366332653631373037303663363532653633366636643266363137303730366336353631363936333631333332653633373236633330316430363033353531643065303431363034313439343537646236666435373438313836383938393736326637653537383530376537396235383234333030653036303335353164306630313031666630343034303330323037383033303066303630393261383634383836663736333634303631643034303230353030333030613036303832613836343863653364303430333032303334393030333034363032323130306265303935373166653731653165373335623535653561666163623463373266656234343566333031383532323263373235313030326236316562643666353530323231303064313862333530613564643664643665623137343630333562313165623263653837636661336536616636636264383338303839306463383263646461613633333038323032656533303832303237356130303330323031303230323038343936643266626633613938646139373330306130363038326138363438636533643034303330323330363733313162333031393036303335353034303330633132343137303730366336353230353236663666373432303433343132303264323034373333333132363330323430363033353530343062306331643431373037303663363532303433363537323734363936363639363336313734363936663665323034313735373436383666373236393734373933313133333031313036303335353034306130633061343137303730366336353230343936653633326533313062333030393036303335353034303631333032353535333330316531373064333133343330333533303336333233333334333633333330356131373064333233393330333533303336333233333334333633333330356133303761333132653330326330363033353530343033306332353431373037303663363532303431373037303663363936333631373436393666366532303439366537343635363737323631373436393666366532303433343132303264323034373333333132363330323430363033353530343062306331643431373037303663363532303433363537323734363936363639363336313734363936663665323034313735373436383666373236393734373933313133333031313036303335353034306130633061343137303730366336353230343936653633326533313062333030393036303335353034303631333032353535333330353933303133303630373261383634386365336430323031303630383261383634386365336430333031303730333432303030346630313731313834313964373634383564353161356532353831303737366538383061326566646537626165346465303864666334623933653133333536643536363562333561653232643039373736306432323465376262613038666437363137636538386362373662623636373062656338653832393834666635343435613338316637333038316634333034363036303832623036303130353035303730313031303433613330333833303336303630383262303630313035303530373330303138363261363837343734373033613266326636663633373337303265363137303730366336353265363336663664326636663633373337303330333432643631373037303663363537323666366637343633363136373333333031643036303335353164306530343136303431343233663234396334346639336534656632376536633466363238366333666132626266643265346233303066303630333535316431333031303166663034303533303033303130316666333031663036303335353164323330343138333031363830313462626230646561313538333338383961613438613939646562656264656261666461636232346162333033373036303335353164316630343330333032653330326361303261613032383836323636383734373437303361326632663633373236633265363137303730366336353265363336663664326636313730373036633635373236663666373436333631363733333265363337323663333030653036303335353164306630313031666630343034303330323031303633303130303630613261383634383836663736333634303630323065303430323035303033303061303630383261383634386365336430343033303230333637303033303634303233303361636637323833353131363939623138366662333563333536636136326266663431376564643930663735346461323865626566313963383135653432623738396638393866373962353939663938643534313064386639646539633266653032333033323264643534343231623061333035373736633564663333383362393036376664313737633263323136643936346663363732363938323132366635346638376137643162393963623962303938393231363130363939306630393932316430303030333138323031386233303832303138373032303130313330383138363330376133313265333032633036303335353034303330633235343137303730366336353230343137303730366336393633363137343639366636653230343936653734363536373732363137343639366636653230343334313230326432303437333333313236333032343036303335353034306230633164343137303730366336353230343336353732373436393636363936333631373436393666366532303431373537343638366637323639373437393331313333303131303630333535303430613063306134313730373036633635323034393665363332653331306233303039303630333535303430363133303235353533303230383463333034313439353139643534333633303064303630393630383634383031363530333034303230313035303061303831393533303138303630393261383634383836663730643031303930333331306230363039326138363438383666373064303130373031333031633036303932613836343838366637306430313039303533313066313730643331333933303338333133393331333733313332333333303561333032613036303932613836343838366637306430313039333433313164333031623330306430363039363038363438303136353033303430323031303530306131306130363038326138363438636533643034303330323330326630363039326138363438383666373064303130393034333132323034323062303731303365313430613462386231376262613230316130336163643036396234653431366232613263383066383661383338313435633239373566633131333030613036303832613836343863653364303430333032303434363330343430323230343639306264636637626461663833636466343934396534633035313039656463663334373665303564373261313264376335666538633033303033343464663032323032363764353863393365626233353031333836363062353730373938613064643731313734316262353864626436613138363633353038353431656565393035303030303030303030303030227D
|
assets/css/stripe.css
CHANGED
@@ -49,14 +49,17 @@ ul.payment_methods li[class*=payment_method_stripe_] label>img:first-of-type{
|
|
49 |
-webkit-transition: box-shadow 150ms ease;
|
50 |
transition: box-shadow 150ms ease;
|
51 |
}
|
52 |
-
input.wc-stripe-payment-type
|
|
|
53 |
display: none;
|
54 |
}
|
55 |
-
label.wc-stripe-label-payment-type
|
|
|
56 |
margin-bottom: 1em;
|
57 |
display: block;
|
58 |
}
|
59 |
-
label.wc-stripe-label-payment-type:before
|
|
|
60 |
content: "";
|
61 |
display: inline-block;
|
62 |
width: 14px;
|
@@ -71,7 +74,8 @@ label.wc-stripe-label-payment-type:before{
|
|
71 |
-ms-transform: translateY(2px);
|
72 |
transform: translateY(2px);
|
73 |
}
|
74 |
-
input.wc-stripe-payment-type:checked+label.wc-stripe-label-payment-type:before
|
|
|
75 |
background: #000;
|
76 |
}
|
77 |
.select2-container .select2-selection--single .wc-stripe-select2-container,
|
@@ -329,6 +333,13 @@ ul.payment_methods li.payment_method_stripe_sofort img{
|
|
329 |
width: 70px;
|
330 |
max-height: 21px;
|
331 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
ul.payment_methods li.payment_method_stripe_wechat img{
|
333 |
max-width: 82px;
|
334 |
width: 82px;
|
49 |
-webkit-transition: box-shadow 150ms ease;
|
50 |
transition: box-shadow 150ms ease;
|
51 |
}
|
52 |
+
input.wc-stripe-payment-type,
|
53 |
+
input.wc-stripe-klarna-category{
|
54 |
display: none;
|
55 |
}
|
56 |
+
label.wc-stripe-label-payment-type,
|
57 |
+
label.wc-stripe-label-klarna-category{
|
58 |
margin-bottom: 1em;
|
59 |
display: block;
|
60 |
}
|
61 |
+
label.wc-stripe-label-payment-type:before,
|
62 |
+
label.wc-stripe-label-klarna-category:before{
|
63 |
content: "";
|
64 |
display: inline-block;
|
65 |
width: 14px;
|
74 |
-ms-transform: translateY(2px);
|
75 |
transform: translateY(2px);
|
76 |
}
|
77 |
+
input.wc-stripe-payment-type:checked+label.wc-stripe-label-payment-type:before,
|
78 |
+
input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:before{
|
79 |
background: #000;
|
80 |
}
|
81 |
.select2-container .select2-selection--single .wc-stripe-select2-container,
|
333 |
width: 70px;
|
334 |
max-height: 21px;
|
335 |
}
|
336 |
+
ul.payment_methods li.payment_method_stripe_bancontact img,
|
337 |
+
label[for=payment_method_braintree_bancontact] img{
|
338 |
+
width: 60px;
|
339 |
+
height: 42px;
|
340 |
+
max-width: 60px;
|
341 |
+
max-height: 42px;
|
342 |
+
}
|
343 |
ul.payment_methods li.payment_method_stripe_wechat img{
|
344 |
max-width: 82px;
|
345 |
width: 82px;
|
assets/js/frontend/local-payment.js
CHANGED
@@ -111,22 +111,124 @@
|
|
111 |
}
|
112 |
|
113 |
/******* Sepa *******/
|
114 |
-
function Sepa() {
|
115 |
this.elementType = 'iban';
|
116 |
LocalPayment.call(this, params);
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
IDEAL.prototype = $.extend({}, LocalPayment.prototype, IDEAL.prototype);
|
120 |
|
121 |
Sepa.prototype = $.extend({}, LocalPayment.prototype, Sepa.prototype);
|
122 |
|
|
|
|
|
123 |
/**
|
124 |
* Local payment types that require JS integration
|
125 |
* @type {Object}
|
126 |
*/
|
127 |
const types = {
|
128 |
'ideal': IDEAL,
|
129 |
-
'sepa_debit': Sepa
|
|
|
130 |
}
|
131 |
|
132 |
for (var i in wc_stripe_local_payment_params.gateways) {
|
111 |
}
|
112 |
|
113 |
/******* Sepa *******/
|
114 |
+
function Sepa(params) {
|
115 |
this.elementType = 'iban';
|
116 |
LocalPayment.call(this, params);
|
117 |
}
|
118 |
|
119 |
+
/****** Klarna ******/
|
120 |
+
function Klarna(params) {
|
121 |
+
LocalPayment.call(this, params);
|
122 |
+
$(document.body).on('change', '.wc-stripe-klarna-category', this.category_change.bind(this));
|
123 |
+
window.addEventListener('hashchange', this.hashChange.bind(this));
|
124 |
+
}
|
125 |
+
|
126 |
+
Klarna.prototype.category_change = function(e) {
|
127 |
+
$('[id^="klarna-instance-"]').hide();
|
128 |
+
var category = $('[name="klarna_category"]:checked').val();
|
129 |
+
$('#klarna-instance-' + category).show();
|
130 |
+
}
|
131 |
+
|
132 |
+
Klarna.prototype.hashChange = function(e) {
|
133 |
+
if (this.is_gateway_selected()) {
|
134 |
+
var matches = e.newURL.match(/(local_payment=klarna).+redirect=(.+).+encoded_source=(\w+)/);
|
135 |
+
if (matches) {
|
136 |
+
e.preventDefault();
|
137 |
+
var $form = $(this.token_selector).closest('form');
|
138 |
+
$form.unblock().removeClass('processing');
|
139 |
+
this.checkout_redirect = matches[2];
|
140 |
+
// get the source
|
141 |
+
var source = JSON.parse(window.atob(matches[3]));
|
142 |
+
window.Klarna.Payments.init({
|
143 |
+
client_token: source.klarna.client_token
|
144 |
+
}, function(response) {
|
145 |
+
|
146 |
+
}.bind(this));
|
147 |
+
this.payment_categories = source.klarna.payment_method_categories.split(",");
|
148 |
+
this.render_ui();
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
Klarna.prototype.render_ui = function() {
|
154 |
+
if (this.payment_categories.length > 0) {
|
155 |
+
$('#wc_stripe_local_payment_stripe_klarna').show();
|
156 |
+
for (var i = 0; i < this.payment_categories.length; i++) {
|
157 |
+
var container = '#klarna-instance-' + this.payment_categories[i];
|
158 |
+
if ($('#klarna-category-' + this.payment_categories[i]).length) {
|
159 |
+
$('#klarna-category-' + this.payment_categories[i]).show();
|
160 |
+
try {
|
161 |
+
window.Klarna.Payments.load({
|
162 |
+
container: container,
|
163 |
+
payment_method_category: this.payment_categories[i], //source.klarna.payment_method_categories
|
164 |
+
instance_id: 'klarna-instance-' + this.payment_categories[i]
|
165 |
+
}, function(response) {
|
166 |
+
|
167 |
+
}.bind(this));
|
168 |
+
} catch (e) {
|
169 |
+
window.alert(e);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
$('[name="klarna_category"]').first().prop('checked', true).trigger('change');
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
Klarna.prototype.place_order = function(e) {
|
178 |
+
if (this.is_gateway_selected()) {
|
179 |
+
e.preventDefault();
|
180 |
+
this.payment_token_received = true;
|
181 |
+
if (this.payment_categories) {
|
182 |
+
window.Klarna.Payments.authorize({
|
183 |
+
instance_id: 'klarna-instance-' + $('[name="klarna_category"]:checked').val()
|
184 |
+
}, function(res) {
|
185 |
+
if (res.approved) {
|
186 |
+
this.block();
|
187 |
+
this.payment_token_received = true;
|
188 |
+
window.location = this.checkout_redirect;
|
189 |
+
} else {
|
190 |
+
if (res.error) {
|
191 |
+
this.submit_error(res.error);
|
192 |
+
} else {
|
193 |
+
this.submit_error('Klarna error');
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}.bind(this));
|
197 |
+
} else {
|
198 |
+
// let checkout process so we can get back client secret
|
199 |
+
$(this.container).closest('form').submit();
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
Klarna.prototype.initialize = function() {
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
Klarna.prototype.createSource = function() {
|
209 |
+
this.block();
|
210 |
+
}
|
211 |
+
|
212 |
+
Klarna.prototype.updated_checkout = function() {
|
213 |
+
if (this.payment_categories) {
|
214 |
+
this.render_ui();
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
IDEAL.prototype = $.extend({}, LocalPayment.prototype, IDEAL.prototype);
|
219 |
|
220 |
Sepa.prototype = $.extend({}, LocalPayment.prototype, Sepa.prototype);
|
221 |
|
222 |
+
Klarna.prototype = $.extend({}, LocalPayment.prototype, Klarna.prototype);
|
223 |
+
|
224 |
/**
|
225 |
* Local payment types that require JS integration
|
226 |
* @type {Object}
|
227 |
*/
|
228 |
const types = {
|
229 |
'ideal': IDEAL,
|
230 |
+
'sepa_debit': Sepa,
|
231 |
+
'klarna': Klarna
|
232 |
}
|
233 |
|
234 |
for (var i in wc_stripe_local_payment_params.gateways) {
|
assets/js/frontend/wc-stripe.js
CHANGED
@@ -99,6 +99,14 @@
|
|
99 |
}, 1000);
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Return true if the source should be saved.
|
104 |
*
|
99 |
}, 1000);
|
100 |
}
|
101 |
|
102 |
+
wc_stripe.BaseGateway.prototype.get_first_name = function(prefix) {
|
103 |
+
return $('#' + prefix + '_first_name').val();
|
104 |
+
}
|
105 |
+
|
106 |
+
wc_stripe.BaseGateway.prototype.get_last_name = function(prefix) {
|
107 |
+
return $('#' + prefix + '_last_name').val();
|
108 |
+
}
|
109 |
+
|
110 |
/**
|
111 |
* Return true if the source should be saved.
|
112 |
*
|
assets/js/frontend/wc-stripe.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t,e){t.wc_stripe={};var i=Stripe(wc_stripe_params.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.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.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}),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},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},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("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(this.banner_container).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.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.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,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},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.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.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},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.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.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}),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},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},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("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(this.banner_container).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.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.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,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},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.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.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},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: 2019-10-
|
6 |
"PO-Revision-Date: 2019-08-16 14:27-0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
@@ -99,19 +99,19 @@ msgstr ""
|
|
99 |
msgid "Error creating payment source. Reason: %s"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
103 |
#, php-format
|
104 |
msgid "Order %s"
|
105 |
msgstr ""
|
106 |
|
107 |
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:211
|
108 |
#, php-format
|
109 |
-
msgid "Gateway will appear when store currency is <strong>%s</strong
|
110 |
msgstr ""
|
111 |
|
112 |
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:214
|
113 |
#, php-format
|
114 |
-
msgid "& billing country is <strong>%s</strong>"
|
115 |
msgstr ""
|
116 |
|
117 |
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:86
|
@@ -306,15 +306,16 @@ msgid "Payment Method"
|
|
306 |
msgstr ""
|
307 |
|
308 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:47
|
309 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
|
|
310 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:46
|
311 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
312 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
313 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
314 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
315 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:46
|
316 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:49
|
317 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
318 |
#: includes/gateways/settings/applepay-settings.php:16
|
319 |
#: includes/gateways/settings/cc-settings.php:16
|
320 |
#: includes/gateways/settings/googlepay-settings.php:30
|
@@ -560,16 +561,16 @@ msgstr ""
|
|
560 |
msgid "Error capturing charge. Reason: %s"
|
561 |
msgstr ""
|
562 |
|
563 |
-
#: includes/class-wc-stripe-redirect-handler.php:
|
564 |
#, php-format
|
565 |
msgid "Error retrieving payment source. Reason: %s"
|
566 |
msgstr ""
|
567 |
|
568 |
-
#: includes/class-wc-stripe-redirect-handler.php:
|
569 |
msgid "Payment authorization failed. Please select another payment method."
|
570 |
msgstr ""
|
571 |
|
572 |
-
#: includes/class-wc-stripe-redirect-handler.php:
|
573 |
msgid ""
|
574 |
"Status updated to on hold. Charge will be created when source.chargeable "
|
575 |
"webhook received."
|
@@ -657,40 +658,27 @@ msgstr ""
|
|
657 |
msgid "Please update you product quantity before using Apple Pay."
|
658 |
msgstr ""
|
659 |
|
660 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
661 |
-
#: includes/gateways/
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:15
|
666 |
-
msgid "Stripe Credit Cards"
|
667 |
-
msgstr ""
|
668 |
-
|
669 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:16
|
670 |
-
msgid "Credit card gateway that integrates with your Stripe account."
|
671 |
-
msgstr ""
|
672 |
-
|
673 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:17
|
674 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:20
|
675 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:23
|
676 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:45
|
677 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:21
|
678 |
-
msgid "EPS"
|
679 |
msgstr ""
|
680 |
|
681 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
682 |
-
msgid "
|
683 |
msgstr ""
|
684 |
|
685 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
|
|
686 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:35
|
687 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
688 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
689 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
690 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
691 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:35
|
692 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:38
|
693 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
694 |
#: includes/gateways/settings/applepay-settings.php:7
|
695 |
#: includes/gateways/settings/cc-settings.php:4
|
696 |
#: includes/gateways/settings/googlepay-settings.php:10
|
@@ -698,22 +686,20 @@ msgstr ""
|
|
698 |
msgid "Enabled"
|
699 |
msgstr ""
|
700 |
|
701 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
702 |
-
|
703 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:39
|
704 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:39
|
705 |
-
msgid "If enabled, your site can accept P24 payments through Stripe."
|
706 |
msgstr ""
|
707 |
|
708 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
|
|
709 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:43
|
710 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
711 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
712 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
713 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
714 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:43
|
715 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:46
|
716 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
717 |
#: includes/gateways/settings/applepay-settings.php:13
|
718 |
#: includes/gateways/settings/cc-settings.php:13
|
719 |
#: includes/gateways/settings/googlepay-settings.php:16
|
@@ -721,20 +707,21 @@ msgstr ""
|
|
721 |
msgid "General Settings"
|
722 |
msgstr ""
|
723 |
|
724 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
725 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
726 |
-
msgid "Title of the
|
727 |
msgstr ""
|
728 |
|
729 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
|
|
730 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:52
|
731 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
732 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
733 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
734 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
735 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:52
|
736 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:55
|
737 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
738 |
#: includes/gateways/settings/applepay-settings.php:22
|
739 |
#: includes/gateways/settings/cc-settings.php:22
|
740 |
#: includes/gateways/settings/googlepay-settings.php:36
|
@@ -742,15 +729,16 @@ msgstr ""
|
|
742 |
msgid "Description"
|
743 |
msgstr ""
|
744 |
|
745 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
|
|
746 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:54
|
747 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
748 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
749 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
750 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
751 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:54
|
752 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:57
|
753 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
754 |
#: includes/gateways/settings/applepay-settings.php:24
|
755 |
#: includes/gateways/settings/cc-settings.php:24
|
756 |
#: includes/gateways/settings/googlepay-settings.php:38
|
@@ -758,6 +746,43 @@ msgstr ""
|
|
758 |
msgid "Leave blank if you don't want a description to show for the gateway."
|
759 |
msgstr ""
|
760 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
761 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:19
|
762 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:22
|
763 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:25
|
@@ -805,6 +830,7 @@ msgid "Shipping"
|
|
805 |
msgstr ""
|
806 |
|
807 |
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:114
|
|
|
808 |
#: includes/wc-stripe-functions.php:351
|
809 |
msgid "Tax"
|
810 |
msgstr ""
|
@@ -819,74 +845,86 @@ msgstr ""
|
|
819 |
msgid "loading shipping methods..."
|
820 |
msgstr ""
|
821 |
|
822 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
823 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:18
|
824 |
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:21
|
825 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
|
|
826 |
msgid "iDEAL"
|
827 |
msgstr ""
|
828 |
|
829 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
830 |
msgid "Ideal gateway that integrates with your Stripe account."
|
831 |
msgstr ""
|
832 |
|
833 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
834 |
#: includes/gateways/settings/cc-settings.php:7
|
835 |
msgid "If enabled, your site can accept credit card payments through Stripe."
|
836 |
msgstr ""
|
837 |
|
838 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
839 |
msgid "Title of the iDEAL gateway"
|
840 |
msgstr ""
|
841 |
|
842 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
843 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
844 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
845 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
846 |
msgid "Klarna"
|
847 |
msgstr ""
|
848 |
|
849 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
850 |
msgid "Klarna gateway that integrates with your Stripe account."
|
851 |
msgstr ""
|
852 |
|
853 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
854 |
msgid "If enabled, your site can accept Klarna payments through Stripe."
|
855 |
msgstr ""
|
856 |
|
857 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
858 |
msgid "Title of the Klarna gateway"
|
859 |
msgstr ""
|
860 |
|
861 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
862 |
-
|
863 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
864 |
msgid "Multibanco"
|
865 |
msgstr ""
|
866 |
|
867 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
868 |
msgid "Multibanco gateway that integrates with your Stripe account."
|
869 |
msgstr ""
|
870 |
|
871 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
872 |
msgid "If enabled, your site can accept Multibanco payments through Stripe."
|
873 |
msgstr ""
|
874 |
|
875 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
876 |
msgid "Title of the Multibanco gateway"
|
877 |
msgstr ""
|
878 |
|
879 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:17
|
880 |
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:20
|
|
|
881 |
msgid "Przelewy24"
|
882 |
msgstr ""
|
883 |
|
884 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
885 |
msgid "P24 gateway that integrates with your Stripe account."
|
886 |
msgstr ""
|
887 |
|
888 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
889 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
890 |
msgid "P24"
|
891 |
msgstr ""
|
892 |
|
@@ -951,22 +989,18 @@ msgstr ""
|
|
951 |
msgid "If enabled, your site can accept Sofort payments through Stripe."
|
952 |
msgstr ""
|
953 |
|
954 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:19
|
959 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:22
|
960 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:25
|
961 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:47
|
962 |
msgid "WeChat"
|
963 |
msgstr ""
|
964 |
|
965 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
966 |
msgid "WeChat gateway that integrates with your Stripe account."
|
967 |
msgstr ""
|
968 |
|
969 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
970 |
msgid "Title of the WeChat gateway"
|
971 |
msgstr ""
|
972 |
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: woo-stripe-payment\n"
|
5 |
+
"POT-Creation-Date: 2019-10-22 13:13-0700\n"
|
6 |
"PO-Revision-Date: 2019-08-16 14:27-0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
99 |
msgid "Error creating payment source. Reason: %s"
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:165
|
103 |
#, php-format
|
104 |
msgid "Order %s"
|
105 |
msgstr ""
|
106 |
|
107 |
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:211
|
108 |
#, php-format
|
109 |
+
msgid "Gateway will appear when store currency is <strong>%s</strong>"
|
110 |
msgstr ""
|
111 |
|
112 |
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:214
|
113 |
#, php-format
|
114 |
+
msgid " & billing country is <strong>%s</strong>"
|
115 |
msgstr ""
|
116 |
|
117 |
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:86
|
306 |
msgstr ""
|
307 |
|
308 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:47
|
309 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:48
|
310 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:47
|
311 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:46
|
312 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:45
|
313 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:60
|
314 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:47
|
315 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:47
|
316 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:46
|
317 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:49
|
318 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:48
|
319 |
#: includes/gateways/settings/applepay-settings.php:16
|
320 |
#: includes/gateways/settings/cc-settings.php:16
|
321 |
#: includes/gateways/settings/googlepay-settings.php:30
|
561 |
msgid "Error capturing charge. Reason: %s"
|
562 |
msgstr ""
|
563 |
|
564 |
+
#: includes/class-wc-stripe-redirect-handler.php:50
|
565 |
#, php-format
|
566 |
msgid "Error retrieving payment source. Reason: %s"
|
567 |
msgstr ""
|
568 |
|
569 |
+
#: includes/class-wc-stripe-redirect-handler.php:54
|
570 |
msgid "Payment authorization failed. Please select another payment method."
|
571 |
msgstr ""
|
572 |
|
573 |
+
#: includes/class-wc-stripe-redirect-handler.php:61
|
574 |
msgid ""
|
575 |
"Status updated to on hold. Charge will be created when source.chargeable "
|
576 |
"webhook received."
|
658 |
msgid "Please update you product quantity before using Apple Pay."
|
659 |
msgstr ""
|
660 |
|
661 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:21
|
662 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:24
|
663 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:27
|
664 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:49
|
665 |
+
msgid "Bancontact"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
msgstr ""
|
667 |
|
668 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:25
|
669 |
+
msgid "Bancontact gateway that integrates with your Stripe account."
|
670 |
msgstr ""
|
671 |
|
672 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:37
|
673 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:36
|
674 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:35
|
675 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:34
|
676 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:49
|
677 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:36
|
678 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:36
|
679 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:35
|
680 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:38
|
681 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:37
|
682 |
#: includes/gateways/settings/applepay-settings.php:7
|
683 |
#: includes/gateways/settings/cc-settings.php:4
|
684 |
#: includes/gateways/settings/googlepay-settings.php:10
|
686 |
msgid "Enabled"
|
687 |
msgstr ""
|
688 |
|
689 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:41
|
690 |
+
msgid "If enabled, your site can accept Bancontact payments through Stripe."
|
|
|
|
|
|
|
691 |
msgstr ""
|
692 |
|
693 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:45
|
694 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:44
|
695 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:43
|
696 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:42
|
697 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:57
|
698 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:44
|
699 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:44
|
700 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:43
|
701 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:46
|
702 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:45
|
703 |
#: includes/gateways/settings/applepay-settings.php:13
|
704 |
#: includes/gateways/settings/cc-settings.php:13
|
705 |
#: includes/gateways/settings/googlepay-settings.php:16
|
707 |
msgid "General Settings"
|
708 |
msgstr ""
|
709 |
|
710 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:51
|
711 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:52
|
712 |
+
msgid "Title of the Sofort gateway"
|
713 |
msgstr ""
|
714 |
|
715 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:54
|
716 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:53
|
717 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:52
|
718 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:51
|
719 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:66
|
720 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:53
|
721 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:53
|
722 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:52
|
723 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:55
|
724 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:54
|
725 |
#: includes/gateways/settings/applepay-settings.php:22
|
726 |
#: includes/gateways/settings/cc-settings.php:22
|
727 |
#: includes/gateways/settings/googlepay-settings.php:36
|
729 |
msgid "Description"
|
730 |
msgstr ""
|
731 |
|
732 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:56
|
733 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:55
|
734 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:54
|
735 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:53
|
736 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:68
|
737 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:55
|
738 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:55
|
739 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:54
|
740 |
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:57
|
741 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:56
|
742 |
#: includes/gateways/settings/applepay-settings.php:24
|
743 |
#: includes/gateways/settings/cc-settings.php:24
|
744 |
#: includes/gateways/settings/googlepay-settings.php:38
|
746 |
msgid "Leave blank if you don't want a description to show for the gateway."
|
747 |
msgstr ""
|
748 |
|
749 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:12
|
750 |
+
#: includes/gateways/settings/cc-settings.php:17
|
751 |
+
msgid "Credit Cards"
|
752 |
+
msgstr ""
|
753 |
+
|
754 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:15
|
755 |
+
msgid "Stripe Credit Cards"
|
756 |
+
msgstr ""
|
757 |
+
|
758 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:16
|
759 |
+
msgid "Credit card gateway that integrates with your Stripe account."
|
760 |
+
msgstr ""
|
761 |
+
|
762 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:20
|
763 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:23
|
764 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:26
|
765 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:48
|
766 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:23
|
767 |
+
msgid "EPS"
|
768 |
+
msgstr ""
|
769 |
+
|
770 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:24
|
771 |
+
msgid "EPS gateway that integrates with your Stripe account."
|
772 |
+
msgstr ""
|
773 |
+
|
774 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:40
|
775 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:40
|
776 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:39
|
777 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:41
|
778 |
+
msgid "If enabled, your site can accept P24 payments through Stripe."
|
779 |
+
msgstr ""
|
780 |
+
|
781 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:50
|
782 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:50
|
783 |
+
msgid "Title of the p24 gateway"
|
784 |
+
msgstr ""
|
785 |
+
|
786 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:19
|
787 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:22
|
788 |
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:25
|
830 |
msgstr ""
|
831 |
|
832 |
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:114
|
833 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:194
|
834 |
#: includes/wc-stripe-functions.php:351
|
835 |
msgid "Tax"
|
836 |
msgstr ""
|
845 |
msgid "loading shipping methods..."
|
846 |
msgstr ""
|
847 |
|
848 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:20
|
|
|
849 |
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:21
|
850 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:24
|
851 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:46
|
852 |
msgid "iDEAL"
|
853 |
msgstr ""
|
854 |
|
855 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:22
|
856 |
msgid "Ideal gateway that integrates with your Stripe account."
|
857 |
msgstr ""
|
858 |
|
859 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:38
|
860 |
#: includes/gateways/settings/cc-settings.php:7
|
861 |
msgid "If enabled, your site can accept credit card payments through Stripe."
|
862 |
msgstr ""
|
863 |
|
864 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:48
|
865 |
msgid "Title of the iDEAL gateway"
|
866 |
msgstr ""
|
867 |
|
868 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:19
|
869 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:22
|
870 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:25
|
871 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:61
|
872 |
msgid "Klarna"
|
873 |
msgstr ""
|
874 |
|
875 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:23
|
876 |
msgid "Klarna gateway that integrates with your Stripe account."
|
877 |
msgstr ""
|
878 |
|
879 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:53
|
880 |
msgid "If enabled, your site can accept Klarna payments through Stripe."
|
881 |
msgstr ""
|
882 |
|
883 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:63
|
884 |
msgid "Title of the Klarna gateway"
|
885 |
msgstr ""
|
886 |
|
887 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:221
|
888 |
+
msgid "Pay Now"
|
889 |
+
msgstr ""
|
890 |
+
|
891 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:222
|
892 |
+
msgid "Pay Later"
|
893 |
+
msgstr ""
|
894 |
+
|
895 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:223
|
896 |
+
msgid "Pay Over Time"
|
897 |
+
msgstr ""
|
898 |
+
|
899 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:20
|
900 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:26
|
901 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:48
|
902 |
msgid "Multibanco"
|
903 |
msgstr ""
|
904 |
|
905 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:24
|
906 |
msgid "Multibanco gateway that integrates with your Stripe account."
|
907 |
msgstr ""
|
908 |
|
909 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:40
|
910 |
msgid "If enabled, your site can accept Multibanco payments through Stripe."
|
911 |
msgstr ""
|
912 |
|
913 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:50
|
914 |
msgid "Title of the Multibanco gateway"
|
915 |
msgstr ""
|
916 |
|
|
|
917 |
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:20
|
918 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:23
|
919 |
msgid "Przelewy24"
|
920 |
msgstr ""
|
921 |
|
922 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:24
|
923 |
msgid "P24 gateway that integrates with your Stripe account."
|
924 |
msgstr ""
|
925 |
|
926 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:26
|
927 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:48
|
928 |
msgid "P24"
|
929 |
msgstr ""
|
930 |
|
989 |
msgid "If enabled, your site can accept Sofort payments through Stripe."
|
990 |
msgstr ""
|
991 |
|
992 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:21
|
993 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:24
|
994 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:27
|
995 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:49
|
|
|
|
|
|
|
|
|
996 |
msgid "WeChat"
|
997 |
msgstr ""
|
998 |
|
999 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:25
|
1000 |
msgid "WeChat gateway that integrates with your Stripe account."
|
1001 |
msgstr ""
|
1002 |
|
1003 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:51
|
1004 |
msgid "Title of the WeChat gateway"
|
1005 |
msgstr ""
|
1006 |
|
includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php
CHANGED
@@ -83,7 +83,7 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
83 |
$order->save ();
|
84 |
|
85 |
return [ 'result' => 'success',
|
86 |
-
'redirect' => $this->get_source_redirect_url ( $source )
|
87 |
];
|
88 |
} else {
|
89 |
return parent::process_payment ( $order_id );
|
@@ -93,8 +93,9 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
93 |
/**
|
94 |
*
|
95 |
* @param \Stripe\Source $source
|
|
|
96 |
*/
|
97 |
-
protected function get_source_redirect_url($source) {
|
98 |
return $source->redirect->url;
|
99 |
}
|
100 |
|
@@ -122,16 +123,6 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
122 |
return [];
|
123 |
}
|
124 |
|
125 |
-
public function enqueue_checkout_scripts($scripts) {
|
126 |
-
if (! wp_script_is ( $scripts->get_handle ( 'local-payment' ) )) {
|
127 |
-
$scripts->enqueue_script ( 'local-payment', $scripts->assets_url ( 'js/frontend/local-payment.js' ), [
|
128 |
-
$scripts->get_handle ( 'external' ),
|
129 |
-
$scripts->get_handle ( 'wc-stripe' )
|
130 |
-
], wc_stripe ()->version (), true );
|
131 |
-
$scripts->localize_script ( 'local-payment', wc_stripe_get_local_payment_params () );
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
public function get_localized_params() {
|
136 |
return array_merge_recursive ( parent::get_localized_params (), [
|
137 |
'local_payment_type' => $this->local_payment_type,
|
@@ -177,15 +168,24 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
177 |
'email' => $order->get_billing_email ()
|
178 |
],
|
179 |
'redirect' => [
|
180 |
-
'return_url' =>
|
181 |
-
'_payment_nonce' => wp_create_nonce ( 'local-payment-' . $order->get_id () ),
|
182 |
-
'order_id' => $order->get_id (),
|
183 |
-
'wc-stripe-local-gateway' => $this->id
|
184 |
-
], wc_get_checkout_url () )
|
185 |
]
|
186 |
];
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
public function is_local_payment_available() {
|
190 |
if (empty ( $this->countries )) {
|
191 |
return in_array ( get_woocommerce_currency (), $this->currencies );
|
@@ -208,11 +208,35 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
208 |
protected function get_payment_description() {
|
209 |
$desc = '';
|
210 |
if ($this->currencies) {
|
211 |
-
$desc .= sprintf ( __ ( 'Gateway will appear when store currency is <strong>%s</strong
|
212 |
}
|
213 |
if ($this->countries) {
|
214 |
-
$desc .=
|
215 |
}
|
216 |
return $desc;
|
217 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
}
|
83 |
$order->save ();
|
84 |
|
85 |
return [ 'result' => 'success',
|
86 |
+
'redirect' => $this->get_source_redirect_url ( $source, $order )
|
87 |
];
|
88 |
} else {
|
89 |
return parent::process_payment ( $order_id );
|
93 |
/**
|
94 |
*
|
95 |
* @param \Stripe\Source $source
|
96 |
+
* @param WC_Order $order
|
97 |
*/
|
98 |
+
protected function get_source_redirect_url($source, $order) {
|
99 |
return $source->redirect->url;
|
100 |
}
|
101 |
|
123 |
return [];
|
124 |
}
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
public function get_localized_params() {
|
127 |
return array_merge_recursive ( parent::get_localized_params (), [
|
128 |
'local_payment_type' => $this->local_payment_type,
|
168 |
'email' => $order->get_billing_email ()
|
169 |
],
|
170 |
'redirect' => [
|
171 |
+
'return_url' => $this->get_local_payment_return_url ( $order )
|
|
|
|
|
|
|
|
|
172 |
]
|
173 |
];
|
174 |
}
|
175 |
|
176 |
+
/**
|
177 |
+
*
|
178 |
+
* @param WC_Order $order
|
179 |
+
* @return string
|
180 |
+
*/
|
181 |
+
protected function get_local_payment_return_url($order) {
|
182 |
+
return add_query_arg ( [
|
183 |
+
'_payment_nonce' => wp_create_nonce ( 'local-payment-' . $order->get_id () ),
|
184 |
+
'order_id' => $order->get_id (),
|
185 |
+
'wc-stripe-local-gateway' => $this->id
|
186 |
+
], wc_get_checkout_url () );
|
187 |
+
}
|
188 |
+
|
189 |
public function is_local_payment_available() {
|
190 |
if (empty ( $this->countries )) {
|
191 |
return in_array ( get_woocommerce_currency (), $this->currencies );
|
208 |
protected function get_payment_description() {
|
209 |
$desc = '';
|
210 |
if ($this->currencies) {
|
211 |
+
$desc .= sprintf ( __ ( 'Gateway will appear when store currency is <strong>%s</strong>', 'woo-stripe-payment' ), implode ( ', ', $this->currencies ) );
|
212 |
}
|
213 |
if ($this->countries) {
|
214 |
+
$desc .= sprintf ( __ ( ' & billing country is <strong>%s</strong>', 'woo-stripe-payment' ), implode ( ', ', $this->countries ) );
|
215 |
}
|
216 |
return $desc;
|
217 |
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
*
|
221 |
+
* @param WC_Order $order
|
222 |
+
*/
|
223 |
+
public function set_order_lock($order) {
|
224 |
+
update_post_meta ( $order->get_id (), '_stripe_lock', true );
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
*
|
229 |
+
* @param WC_Order $order
|
230 |
+
*/
|
231 |
+
public function release_order_lock($order) {
|
232 |
+
delete_post_meta ( $order->get_id (), '_stripe_lock' );
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
*
|
237 |
+
* @param WC_Order $order
|
238 |
+
*/
|
239 |
+
public function has_order_lock($order) {
|
240 |
+
return get_post_meta ( $order->get_id (), '_stripe_lock', true );
|
241 |
+
}
|
242 |
}
|
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 |
*
|
@@ -90,7 +90,7 @@ class WC_Stripe_Manager {
|
|
90 |
* @return string
|
91 |
*/
|
92 |
public function plugin_path() {
|
93 |
-
return
|
94 |
}
|
95 |
|
96 |
public function plugins_loaded() {
|
@@ -103,15 +103,15 @@ class WC_Stripe_Manager {
|
|
103 |
public function init() {}
|
104 |
|
105 |
public function includes() {
|
106 |
-
include_once
|
107 |
-
include_once
|
108 |
|
109 |
if (is_admin ()) {
|
110 |
-
include_once
|
111 |
-
include_once
|
112 |
-
include_once
|
113 |
-
include_once
|
114 |
-
include_once
|
115 |
}
|
116 |
}
|
117 |
|
@@ -122,48 +122,49 @@ class WC_Stripe_Manager {
|
|
122 |
|
123 |
public function woocommerce_dependencies() {
|
124 |
// load functions
|
125 |
-
include_once
|
126 |
-
include_once
|
127 |
-
include_once
|
128 |
|
129 |
// load gateways
|
130 |
-
include_once
|
131 |
-
include_once
|
132 |
-
include_once
|
133 |
-
include_once
|
134 |
-
include_once
|
135 |
-
include_once
|
136 |
-
include_once
|
137 |
-
include_once
|
138 |
-
include_once
|
139 |
-
include_once
|
140 |
-
include_once
|
141 |
-
include_once
|
142 |
-
include_once
|
143 |
-
include_once
|
144 |
-
include_once
|
145 |
-
include_once
|
146 |
-
include_once
|
|
|
147 |
|
148 |
// tokens
|
149 |
-
include_once
|
150 |
-
include_once
|
151 |
-
include_once
|
152 |
-
include_once
|
153 |
-
include_once
|
154 |
|
155 |
// main classes
|
156 |
-
include_once
|
157 |
-
include_once
|
158 |
-
include_once
|
159 |
-
include_once
|
160 |
-
include_once
|
161 |
-
include_once
|
162 |
-
include_once
|
163 |
|
164 |
// settings
|
165 |
-
include_once
|
166 |
-
include_once
|
167 |
|
168 |
$this->payment_gateways = apply_filters ( 'wc_stripe_payment_gateways', array(
|
169 |
'WC_Payment_Gateway_Stripe_CC',
|
@@ -172,7 +173,8 @@ class WC_Stripe_Manager {
|
|
172 |
'WC_Payment_Gateway_Stripe_Payment_Request',
|
173 |
'WC_Payment_Gateway_Stripe_Ideal',
|
174 |
'WC_Payment_Gateway_Stripe_P24',
|
175 |
-
|
|
|
176 |
'WC_Payment_Gateway_Stripe_Giropay',
|
177 |
'WC_Payment_Gateway_Stripe_EPS',
|
178 |
'WC_Payment_Gateway_Stripe_Multibanco',
|
@@ -207,7 +209,7 @@ class WC_Stripe_Manager {
|
|
207 |
* Return the plguins default directory path for template files.
|
208 |
*/
|
209 |
public function default_template_path() {
|
210 |
-
return
|
211 |
}
|
212 |
|
213 |
/**
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
+
public $version = '3.0.2';
|
25 |
|
26 |
/**
|
27 |
*
|
90 |
* @return string
|
91 |
*/
|
92 |
public function plugin_path() {
|
93 |
+
return WC_STRIPE_PLUGIN_FILE_PATH;
|
94 |
}
|
95 |
|
96 |
public function plugins_loaded() {
|
103 |
public function init() {}
|
104 |
|
105 |
public function includes() {
|
106 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-install.php';
|
107 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-rest-api.php';
|
108 |
|
109 |
if (is_admin ()) {
|
110 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-menus.php';
|
111 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-assets.php';
|
112 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-settings.php';
|
113 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/meta-boxes/class-wc-stripe-admin-order-metaboxes.php';
|
114 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-user-edit.php';
|
115 |
}
|
116 |
}
|
117 |
|
122 |
|
123 |
public function woocommerce_dependencies() {
|
124 |
// load functions
|
125 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/wc-stripe-functions.php';
|
126 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/wc-stripe-webhook-functions.php';
|
127 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/wc-stripe-hooks.php';
|
128 |
|
129 |
// load gateways
|
130 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe.php';
|
131 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe-charge.php';
|
132 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php';
|
133 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php';
|
134 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-cc.php';
|
135 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-applepay.php';
|
136 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-googlepay.php';
|
137 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-payment-request.php';
|
138 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-ideal.php';
|
139 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-p24.php';
|
140 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-klarna.php';
|
141 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-giropay.php';
|
142 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-eps.php';
|
143 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-multibanco.php';
|
144 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-sepa.php';
|
145 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-sofort.php';
|
146 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-wechat.php';
|
147 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-bancontact.php';
|
148 |
|
149 |
// tokens
|
150 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-token-stripe.php';
|
151 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-cc.php';
|
152 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-applepay.php';
|
153 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-googlepay.php';
|
154 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/tokens/class-wc-payment-token-stripe-local-payment.php';
|
155 |
|
156 |
// main classes
|
157 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-frontend-scripts.php';
|
158 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-field-manager.php';
|
159 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-rest-api.php';
|
160 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway.php';
|
161 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-customer-manager.php';
|
162 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-frontend-notices.php';
|
163 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-redirect-handler.php';
|
164 |
|
165 |
// settings
|
166 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-stripe-settings.php';
|
167 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/settings/class-wc-stripe-api-settings.php';
|
168 |
|
169 |
$this->payment_gateways = apply_filters ( 'wc_stripe_payment_gateways', array(
|
170 |
'WC_Payment_Gateway_Stripe_CC',
|
173 |
'WC_Payment_Gateway_Stripe_Payment_Request',
|
174 |
'WC_Payment_Gateway_Stripe_Ideal',
|
175 |
'WC_Payment_Gateway_Stripe_P24',
|
176 |
+
'WC_Payment_Gateway_Stripe_Klarna',
|
177 |
+
'WC_Payment_Gateway_Stripe_Bancontact',
|
178 |
'WC_Payment_Gateway_Stripe_Giropay',
|
179 |
'WC_Payment_Gateway_Stripe_EPS',
|
180 |
'WC_Payment_Gateway_Stripe_Multibanco',
|
209 |
* Return the plguins default directory path for template files.
|
210 |
*/
|
211 |
public function default_template_path() {
|
212 |
+
return WC_STRIPE_PLUGIN_FILE_PATH . 'templates/';
|
213 |
}
|
214 |
|
215 |
/**
|
includes/class-wc-stripe-frontend-scripts.php
CHANGED
@@ -24,6 +24,9 @@ class WC_Stripe_Frontend_Scripts {
|
|
24 |
add_action ( 'wp_enqueue_scripts', array( $this,
|
25 |
'enqueue_scripts'
|
26 |
) );
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
/**
|
@@ -49,6 +52,14 @@ class WC_Stripe_Frontend_Scripts {
|
|
49 |
] );
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
public function register_script($handle, $src, $deps = array(), $version = '', $footer = true) {
|
53 |
$version = empty ( $version ) ? wc_stripe ()->version () : $version;
|
54 |
$this->registered_scripts[] = $this->get_handle ( $handle );
|
24 |
add_action ( 'wp_enqueue_scripts', array( $this,
|
25 |
'enqueue_scripts'
|
26 |
) );
|
27 |
+
add_action ( 'woocommerce_review_order_before_payment', array(
|
28 |
+
$this, 'enqueue_checkout_scripts'
|
29 |
+
) );
|
30 |
}
|
31 |
|
32 |
/**
|
52 |
] );
|
53 |
}
|
54 |
|
55 |
+
public function enqueue_checkout_scripts() {
|
56 |
+
$this->enqueue_script ( 'local-payment', $this->assets_url ( 'js/frontend/local-payment.js' ), [
|
57 |
+
$this->get_handle ( 'external' ),
|
58 |
+
$this->get_handle ( 'wc-stripe' )
|
59 |
+
] );
|
60 |
+
$this->localize_script ( 'local-payment', wc_stripe_get_local_payment_params () );
|
61 |
+
}
|
62 |
+
|
63 |
public function register_script($handle, $src, $deps = array(), $version = '', $footer = true) {
|
64 |
$version = empty ( $version ) ? wc_stripe ()->version () : $version;
|
65 |
$this->registered_scripts[] = $this->get_handle ( $handle );
|
includes/class-wc-stripe-gateway.php
CHANGED
@@ -327,6 +327,22 @@ class WC_Stripe_Gateway {
|
|
327 |
}
|
328 |
}
|
329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
public function fetch_customer($customer_id, $mode = '') {
|
331 |
try {
|
332 |
return \Stripe\Customer::retrieve ( $customer_id, $this->get_api_options ( $mode ) );
|
327 |
}
|
328 |
}
|
329 |
|
330 |
+
/**
|
331 |
+
*
|
332 |
+
* @since 3.0.2
|
333 |
+
* @param string $source_id
|
334 |
+
* @param array $args
|
335 |
+
* @param string $mode
|
336 |
+
*/
|
337 |
+
public function update_source($source_id, $args, $mode = '') {
|
338 |
+
try {
|
339 |
+
return \Stripe\Source::update ( $source_id, $args, $this->get_api_options ( $mode ) );
|
340 |
+
} catch ( \Stripe\Error\Base $e ) {
|
341 |
+
$err = $e->getJsonBody ()[ 'error' ];
|
342 |
+
return new WP_Error ( 'source-error', $err[ 'message' ] );
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
public function fetch_customer($customer_id, $mode = '') {
|
347 |
try {
|
348 |
return \Stripe\Customer::retrieve ( $customer_id, $this->get_api_options ( $mode ) );
|
includes/class-wc-stripe-redirect-handler.php
CHANGED
@@ -31,7 +31,17 @@ class WC_Stripe_Redirect_Handler {
|
|
31 |
*/
|
32 |
public static function process_redirect($order_id) {
|
33 |
$order = wc_get_order ( $order_id );
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
// first do some validations on the source
|
36 |
$stripe_gateway = new WC_Stripe_Gateway ();
|
37 |
|
@@ -47,28 +57,11 @@ class WC_Stripe_Redirect_Handler {
|
|
47 |
}
|
48 |
$transaction_id = $order->get_transaction_id ();
|
49 |
// if there is no transaction ID then the order hasn't been processed via webhooks yet.
|
50 |
-
if (!
|
51 |
$order->update_status ( 'on-hold', __ ( 'Status updated to on hold. Charge will be created when source.chargeable webhook received.', 'woo-stripe-payment' ) );
|
52 |
}
|
53 |
wp_safe_redirect ( $order->get_checkout_order_received_url () );
|
54 |
exit ();
|
55 |
-
|
56 |
-
/**
|
57 |
-
*
|
58 |
-
* @var WC_Payment_Gateway_Stripe_Local_Payment $gateway
|
59 |
-
*/
|
60 |
-
/*
|
61 |
-
* $gateway = WC ()->payment_gateways ()->payment_gateways ()[ $payment_method ];
|
62 |
-
* $gateway->processing_payment = true;
|
63 |
-
* $_POST[ $gateway->token_key ] = wc_clean ( $_GET[ 'source' ] );
|
64 |
-
*
|
65 |
-
* $result = $gateway->process_payment ( $order_id );
|
66 |
-
*
|
67 |
-
* if (isset ( $result[ 'result' ] ) && 'success' === $result[ 'result' ]) {
|
68 |
-
* wp_safe_redirect ( $result[ 'redirect' ] );
|
69 |
-
* exit ();
|
70 |
-
* }
|
71 |
-
*/
|
72 |
}
|
73 |
}
|
74 |
WC_Stripe_Redirect_Handler::init ();
|
31 |
*/
|
32 |
public static function process_redirect($order_id) {
|
33 |
$order = wc_get_order ( $order_id );
|
34 |
+
/**
|
35 |
+
*
|
36 |
+
* @var WC_Payment_Gateway_Stripe_Local_Payment $payment_method
|
37 |
+
*/
|
38 |
+
$payment_method = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
|
39 |
+
|
40 |
+
if ($payment_method->has_order_lock ( $order )) {
|
41 |
+
wp_safe_redirect ( $order->get_checkout_order_received_url () );
|
42 |
+
exit ();
|
43 |
+
}
|
44 |
+
// $payment_method = wc_clean ( $_GET[ 'wc-stripe-local-gateway' ] );
|
45 |
// first do some validations on the source
|
46 |
$stripe_gateway = new WC_Stripe_Gateway ();
|
47 |
|
57 |
}
|
58 |
$transaction_id = $order->get_transaction_id ();
|
59 |
// if there is no transaction ID then the order hasn't been processed via webhooks yet.
|
60 |
+
if (! $transaction_id) {
|
61 |
$order->update_status ( 'on-hold', __ ( 'Status updated to on hold. Charge will be created when source.chargeable webhook received.', 'woo-stripe-payment' ) );
|
62 |
}
|
63 |
wp_safe_redirect ( $order->get_checkout_order_received_url () );
|
64 |
exit ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
}
|
67 |
WC_Stripe_Redirect_Handler::init ();
|
includes/class-wc-stripe-rest-api.php
CHANGED
@@ -49,15 +49,15 @@ class WC_Stripe_Rest_API {
|
|
49 |
}
|
50 |
|
51 |
private function include_classes() {
|
52 |
-
include_once
|
53 |
-
include_once
|
54 |
-
include_once
|
55 |
-
include_once
|
56 |
-
include_once
|
57 |
-
include_once
|
58 |
-
include_once
|
59 |
-
include_once
|
60 |
-
include_once
|
61 |
|
62 |
foreach ( $this->get_controllers () as $key => $class_name ) {
|
63 |
if (class_exists ( $class_name )) {
|
@@ -100,7 +100,7 @@ class WC_Stripe_Rest_API {
|
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
-
* Added after WC 3.6 so
|
104 |
*
|
105 |
* @param bool $bool
|
106 |
*/
|
49 |
}
|
50 |
|
51 |
private function include_classes() {
|
52 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-stripe-rest-controller.php';
|
53 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-order-actions.php';
|
54 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-payment-intent.php';
|
55 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-cart.php';
|
56 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-checkout.php';
|
57 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-googlepay.php';
|
58 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-payment-method.php';
|
59 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-gateway-settings.php';
|
60 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-webhook.php';
|
61 |
|
62 |
foreach ( $this->get_controllers () as $key => $class_name ) {
|
63 |
if (class_exists ( $class_name )) {
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
+
* Added after WC 3.6 so WC_STRIPE_PLUGIN_FILE_PATH, and Session are loaded for Stripe rest requests.
|
104 |
*
|
105 |
* @param bool $bool
|
106 |
*/
|
includes/controllers/class-wc-stripe-controller-gateway-settings.php
CHANGED
@@ -28,9 +28,9 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
|
|
28 |
public function register_apple_domain($request) {
|
29 |
$gateway = new WC_Stripe_Gateway ();
|
30 |
// try to add domain association file.
|
31 |
-
if (
|
32 |
-
$path =
|
33 |
-
$file = $path . '
|
34 |
if (! file_exists ( $file )) {
|
35 |
require_once ( ABSPATH . '/wp-admin/includes/file.php' );
|
36 |
if (function_exists ( 'WP_Filesystem' ) && ( WP_Filesystem () )) {
|
@@ -42,7 +42,7 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
|
|
42 |
if (! $wp_filesystem->is_dir ( $path )) {
|
43 |
$wp_filesystem->mkdir ( $path );
|
44 |
}
|
45 |
-
$contents = $wp_filesystem->get_contents (
|
46 |
$wp_filesystem->put_contents ( $file, $contents, 0755 );
|
47 |
}
|
48 |
}
|
28 |
public function register_apple_domain($request) {
|
29 |
$gateway = new WC_Stripe_Gateway ();
|
30 |
// try to add domain association file.
|
31 |
+
if (isset ( $_SERVER[ 'DOCUMENT_ROOT' ] )) {
|
32 |
+
$path = $_SERVER[ 'DOCUMENT_ROOT' ] . DIRECTORY_SEPARATOR . '.well-known';
|
33 |
+
$file = $path . DIRECTORY_SEPARATOR . 'apple-developer-merchantid-domain-association';
|
34 |
if (! file_exists ( $file )) {
|
35 |
require_once ( ABSPATH . '/wp-admin/includes/file.php' );
|
36 |
if (function_exists ( 'WP_Filesystem' ) && ( WP_Filesystem () )) {
|
42 |
if (! $wp_filesystem->is_dir ( $path )) {
|
43 |
$wp_filesystem->mkdir ( $path );
|
44 |
}
|
45 |
+
$contents = $wp_filesystem->get_contents ( WC_STRIPE_PLUGIN_FILE_PATH . 'apple-developer-merchantid-domain-association' );
|
46 |
$wp_filesystem->put_contents ( $file, $contents, 0755 );
|
47 |
}
|
48 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-bancontact.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
3 |
+
return;
|
4 |
+
}
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @package Stripe/Gateways
|
8 |
+
* @author PaymentPlugins
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class WC_Payment_Gateway_Stripe_Bancontact extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
+
|
13 |
+
public function __construct() {
|
14 |
+
$this->synchronous = false;
|
15 |
+
$this->local_payment_type = 'bancontact';
|
16 |
+
$this->currencies = [ 'EUR'
|
17 |
+
];
|
18 |
+
$this->countries = [ 'BE'
|
19 |
+
];
|
20 |
+
$this->id = 'stripe_bancontact';
|
21 |
+
$this->tab_title = __ ( 'Bancontact', 'woo-stripe-payment' );
|
22 |
+
$this->template_name = 'local-payment.php';
|
23 |
+
$this->token_type = 'Stripe_Local';
|
24 |
+
$this->method_title = __ ( 'Bancontact', 'woo-stripe-payment' );
|
25 |
+
$this->method_description = __ ( 'Bancontact gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
26 |
+
$this->icon = wc_stripe ()->assets_url ( 'img/bancontact.svg' );
|
27 |
+
$this->order_button_text = __ ( 'Bancontact', 'woo-stripe-payment' );
|
28 |
+
parent::__construct ();
|
29 |
+
}
|
30 |
+
|
31 |
+
public function get_local_payment_settings() {
|
32 |
+
return [
|
33 |
+
'desc' => array( 'type' => 'description',
|
34 |
+
'description' => $this->get_payment_description ()
|
35 |
+
),
|
36 |
+
'enabled' => array(
|
37 |
+
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
38 |
+
'type' => 'checkbox',
|
39 |
+
'default' => 'no', 'value' => 'yes',
|
40 |
+
'desc_tip' => true,
|
41 |
+
'description' => __ ( 'If enabled, your site can accept Bancontact payments through Stripe.', 'woo-stripe-payment' )
|
42 |
+
),
|
43 |
+
'general_settings' => array(
|
44 |
+
'type' => 'title',
|
45 |
+
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
46 |
+
),
|
47 |
+
'title_text' => array( 'type' => 'text',
|
48 |
+
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
49 |
+
'default' => __ ( 'Bancontact', 'woo-stripe-payment' ),
|
50 |
+
'desc_tip' => true,
|
51 |
+
'description' => __ ( 'Title of the Sofort gateway' )
|
52 |
+
),
|
53 |
+
'description' => array(
|
54 |
+
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
55 |
+
'type' => 'text', 'default' => '',
|
56 |
+
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
57 |
+
'desc_tip' => true
|
58 |
+
)
|
59 |
+
];
|
60 |
+
}
|
61 |
+
}
|
includes/gateways/class-wc-payment-gateway-stripe-eps.php
CHANGED
@@ -3,9 +3,10 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
3 |
return;
|
4 |
}
|
5 |
/**
|
|
|
6 |
* @package Stripe/Gateways
|
7 |
* @author PaymentPlugins
|
8 |
-
*
|
9 |
*/
|
10 |
class WC_Payment_Gateway_Stripe_EPS extends WC_Payment_Gateway_Stripe_Local_Payment {
|
11 |
|
@@ -13,6 +14,8 @@ class WC_Payment_Gateway_Stripe_EPS extends WC_Payment_Gateway_Stripe_Local_Paym
|
|
13 |
$this->local_payment_type = 'eps';
|
14 |
$this->currencies = [ 'EUR'
|
15 |
];
|
|
|
|
|
16 |
$this->id = 'stripe_eps';
|
17 |
$this->tab_title = __ ( 'EPS', 'woo-stripe-payment' );
|
18 |
$this->template_name = 'local-payment.php';
|
@@ -27,7 +30,7 @@ class WC_Payment_Gateway_Stripe_EPS extends WC_Payment_Gateway_Stripe_Local_Paym
|
|
27 |
public function get_local_payment_settings() {
|
28 |
return [
|
29 |
'desc' => array( 'type' => 'description',
|
30 |
-
'description' => $this->get_payment_description()
|
31 |
),
|
32 |
'enabled' => array(
|
33 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
3 |
return;
|
4 |
}
|
5 |
/**
|
6 |
+
*
|
7 |
* @package Stripe/Gateways
|
8 |
* @author PaymentPlugins
|
9 |
+
*
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_EPS extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
14 |
$this->local_payment_type = 'eps';
|
15 |
$this->currencies = [ 'EUR'
|
16 |
];
|
17 |
+
$this->countries = [ 'AT'
|
18 |
+
];
|
19 |
$this->id = 'stripe_eps';
|
20 |
$this->tab_title = __ ( 'EPS', 'woo-stripe-payment' );
|
21 |
$this->template_name = 'local-payment.php';
|
30 |
public function get_local_payment_settings() {
|
31 |
return [
|
32 |
'desc' => array( 'type' => 'description',
|
33 |
+
'description' => $this->get_payment_description ()
|
34 |
),
|
35 |
'enabled' => array(
|
36 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
includes/gateways/class-wc-payment-gateway-stripe-ideal.php
CHANGED
@@ -3,9 +3,10 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
3 |
return;
|
4 |
}
|
5 |
/**
|
|
|
6 |
* @package Stripe/Gateways
|
7 |
* @author PaymentPlugins
|
8 |
-
*
|
9 |
*/
|
10 |
class WC_Payment_Gateway_Stripe_Ideal extends WC_Payment_Gateway_Stripe_Local_Payment {
|
11 |
|
@@ -13,6 +14,8 @@ class WC_Payment_Gateway_Stripe_Ideal extends WC_Payment_Gateway_Stripe_Local_Pa
|
|
13 |
$this->local_payment_type = 'ideal';
|
14 |
$this->currencies = [ 'EUR'
|
15 |
];
|
|
|
|
|
16 |
$this->id = 'stripe_ideal';
|
17 |
$this->tab_title = __ ( 'iDEAL', 'woo-stripe-payment' );
|
18 |
$this->method_title = __ ( 'iDEAL', 'woo-stripe-payment' );
|
@@ -25,7 +28,7 @@ class WC_Payment_Gateway_Stripe_Ideal extends WC_Payment_Gateway_Stripe_Local_Pa
|
|
25 |
public function get_local_payment_settings() {
|
26 |
return [
|
27 |
'desc' => array( 'type' => 'description',
|
28 |
-
'description' => $this->get_payment_description()
|
29 |
),
|
30 |
'enabled' => array(
|
31 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
3 |
return;
|
4 |
}
|
5 |
/**
|
6 |
+
*
|
7 |
* @package Stripe/Gateways
|
8 |
* @author PaymentPlugins
|
9 |
+
*
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Ideal extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
14 |
$this->local_payment_type = 'ideal';
|
15 |
$this->currencies = [ 'EUR'
|
16 |
];
|
17 |
+
$this->countries = [ 'NL'
|
18 |
+
];
|
19 |
$this->id = 'stripe_ideal';
|
20 |
$this->tab_title = __ ( 'iDEAL', 'woo-stripe-payment' );
|
21 |
$this->method_title = __ ( 'iDEAL', 'woo-stripe-payment' );
|
28 |
public function get_local_payment_settings() {
|
29 |
return [
|
30 |
'desc' => array( 'type' => 'description',
|
31 |
+
'description' => $this->get_payment_description ()
|
32 |
),
|
33 |
'enabled' => array(
|
34 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
includes/gateways/class-wc-payment-gateway-stripe-klarna.php
CHANGED
@@ -3,9 +3,10 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
3 |
return;
|
4 |
}
|
5 |
/**
|
|
|
6 |
* @package Stripe/Gateways
|
7 |
* @author PaymentPlugins
|
8 |
-
*
|
9 |
*/
|
10 |
class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_Payment {
|
11 |
|
@@ -23,12 +24,26 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
|
|
23 |
$this->icon = wc_stripe ()->assets_url ( 'img/klarna.svg' );
|
24 |
$this->order_button_text = __ ( 'Klarna', 'woo-stripe-payment' );
|
25 |
parent::__construct ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
public function get_local_payment_settings() {
|
29 |
return [
|
30 |
'desc' => array( 'type' => 'description',
|
31 |
-
'description' => $this->get_payment_description()
|
32 |
),
|
33 |
'enabled' => array(
|
34 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
@@ -77,18 +92,40 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
|
|
77 |
return false;
|
78 |
}
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
public function get_source_args($order) {
|
89 |
-
|
90 |
'klarna' => [ 'product' => 'payment',
|
91 |
-
'purchase_country' => $order->get_billing_country ()
|
|
|
|
|
92 |
],
|
93 |
'owner' => [
|
94 |
'address' => [
|
@@ -99,7 +136,91 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
|
|
99 |
'postal_code' => $order->get_billing_postcode (),
|
100 |
'state' => $order->get_billing_state ()
|
101 |
]
|
102 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
] );
|
104 |
}
|
105 |
}
|
3 |
return;
|
4 |
}
|
5 |
/**
|
6 |
+
*
|
7 |
* @package Stripe/Gateways
|
8 |
* @author PaymentPlugins
|
9 |
+
*
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
24 |
$this->icon = wc_stripe ()->assets_url ( 'img/klarna.svg' );
|
25 |
$this->order_button_text = __ ( 'Klarna', 'woo-stripe-payment' );
|
26 |
parent::__construct ();
|
27 |
+
$this->template_name = 'klarna.php';
|
28 |
+
}
|
29 |
+
|
30 |
+
public function hooks() {
|
31 |
+
parent::hooks ();
|
32 |
+
add_action ( 'woocommerce_review_order_before_payment', array(
|
33 |
+
$this, 'enqueue_klarna'
|
34 |
+
) );
|
35 |
+
}
|
36 |
+
|
37 |
+
public function enqueue_klarna() {
|
38 |
+
if ($this->is_available ()) {
|
39 |
+
wc_stripe ()->scripts ()->enqueue_script ( 'klarna', 'https://x.klarnacdn.net/kp/lib/v1/api.js', [], wc_stripe ()->version (), true );
|
40 |
+
}
|
41 |
}
|
42 |
|
43 |
public function get_local_payment_settings() {
|
44 |
return [
|
45 |
'desc' => array( 'type' => 'description',
|
46 |
+
'description' => $this->get_payment_description ()
|
47 |
),
|
48 |
'enabled' => array(
|
49 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
92 |
return false;
|
93 |
}
|
94 |
|
95 |
+
/**
|
96 |
+
*
|
97 |
+
* {@inheritDoc}
|
98 |
+
*
|
99 |
+
* @see WC_Payment_Gateway_Stripe::payment_fields()
|
100 |
+
*/
|
101 |
+
public function payment_fields() {
|
102 |
+
// this might be an update checkout request. If so, update the source if it exists
|
103 |
+
if (is_ajax () && ( $order_id = absint ( WC ()->session->get ( 'order_awaiting_payment' ) ) )) {
|
104 |
+
$order = wc_get_order ( $order_id );
|
105 |
+
$source_id = $order->get_meta ( '_stripe_source_id', true );
|
106 |
+
$this->gateway->update_source ( $source_id, $this->get_update_source_args ( $order ) );
|
107 |
+
}
|
108 |
+
parent::payment_fields ();
|
109 |
+
}
|
110 |
+
|
111 |
+
private function get_update_source_args($order) {
|
112 |
+
$args = $this->get_source_args ( $order );
|
113 |
+
unset ( $args[ 'type' ], $args[ 'currency' ], $args[ 'statement_descriptor' ], $args[ 'redirect' ], $args[ 'klarna' ][ 'product' ] );
|
114 |
+
return $args;
|
115 |
}
|
116 |
|
117 |
+
/**
|
118 |
+
*
|
119 |
+
* {@inheritDoc}
|
120 |
+
*
|
121 |
+
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_args()
|
122 |
+
*/
|
123 |
public function get_source_args($order) {
|
124 |
+
$args = array_merge_recursive ( parent::get_source_args ( $order ), [
|
125 |
'klarna' => [ 'product' => 'payment',
|
126 |
+
'purchase_country' => $order->get_billing_country (),
|
127 |
+
'first_name' => $order->get_billing_first_name (),
|
128 |
+
'last_name' => $order->get_billing_last_name ()
|
129 |
],
|
130 |
'owner' => [
|
131 |
'address' => [
|
136 |
'postal_code' => $order->get_billing_postcode (),
|
137 |
'state' => $order->get_billing_state ()
|
138 |
]
|
139 |
+
]
|
140 |
+
] );
|
141 |
+
$args[ 'source_order' ] = [];
|
142 |
+
/**
|
143 |
+
* Stripe's Klarna integration appears to have a bug where the shipping_first_name, and shipping_last_name always
|
144 |
+
* have to be populated.
|
145 |
+
*/
|
146 |
+
if ($order->get_shipping_address_1 ()) {
|
147 |
+
unset ( $args[ 'owner' ][ 'name' ] );
|
148 |
+
$args[ 'klarna' ][ 'shipping_first_name' ] = $order->get_shipping_first_name ();
|
149 |
+
$args[ 'klarna' ][ 'shipping_last_name' ] = $order->get_shipping_last_name ();
|
150 |
+
$args[ 'source_order' ][ 'shipping' ][ 'address' ] = [
|
151 |
+
'city' => $order->get_billing_city (),
|
152 |
+
'country' => $order->get_shipping_country (),
|
153 |
+
'line1' => $order->get_shipping_address_1 (),
|
154 |
+
'line2' => $order->get_shipping_address_2 (),
|
155 |
+
'postal_code' => $order->get_shipping_postcode (),
|
156 |
+
'state' => $order->get_shipping_state ()
|
157 |
+
];
|
158 |
+
} else {
|
159 |
+
$args[ 'klarna' ][ 'shipping_first_name' ] = $order->get_billing_first_name ();
|
160 |
+
$args[ 'klarna' ][ 'shipping_last_name' ] = $order->get_billing_last_name ();
|
161 |
+
}
|
162 |
+
$types = [ 'line_item', 'tax', 'shipping',
|
163 |
+
'fee', 'coupon'
|
164 |
+
];
|
165 |
+
foreach ( $order->get_items ( $types ) as $item ) {
|
166 |
+
/**
|
167 |
+
*
|
168 |
+
* @var WC_Order_Item $item
|
169 |
+
*/
|
170 |
+
$source_item = [
|
171 |
+
'description' => $item->get_name (),
|
172 |
+
'quantity' => $item->get_quantity (),
|
173 |
+
'currency' => $order->get_currency ()
|
174 |
+
];
|
175 |
+
|
176 |
+
if ($item instanceof WC_Order_Item_Product) {
|
177 |
+
$source_item[ 'type' ] = 'sku';
|
178 |
+
// $source_item[ 'parent' ] = $item->get_id ();
|
179 |
+
$source_item[ 'amount' ] = wc_stripe_add_number_precision ( $order->get_item_subtotal ( $item, false ) );
|
180 |
+
} elseif ($item instanceof WC_Order_Item_Shipping) {
|
181 |
+
$source_item[ 'type' ] = 'shipping';
|
182 |
+
$source_item[ 'amount' ] = wc_stripe_add_number_precision ( $item->get_total () );
|
183 |
+
} elseif ($item instanceof WC_Order_Item_Coupon) {
|
184 |
+
// $source_item[ 'type' ] = 'discount';
|
185 |
+
$source_item[ 'amount' ] = - 1 * wc_stripe_add_number_precision ( $item->get_discount () );
|
186 |
+
} else {
|
187 |
+
continue;
|
188 |
+
}
|
189 |
+
$args[ 'source_order' ][ 'items' ][] = $source_item;
|
190 |
+
}
|
191 |
+
$args[ 'source_order' ][ 'items' ][] = [
|
192 |
+
'type' => 'tax',
|
193 |
+
'amount' => wc_stripe_add_number_precision ( $order->get_total_tax () ),
|
194 |
+
'description' => __ ( 'Tax', 'woo-stripe-payment' ),
|
195 |
+
'quantity' => 1,
|
196 |
+
'currency' => $order->get_currency ()
|
197 |
+
];
|
198 |
+
return $args;
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
*
|
203 |
+
* {@inheritDoc}
|
204 |
+
*
|
205 |
+
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_redirect_url()
|
206 |
+
*/
|
207 |
+
protected function get_source_redirect_url($source, $order) {
|
208 |
+
return '#local_payment=klarna&redirect=' . $this->get_local_payment_return_url ( $order ) . '&encoded_source=' . base64_encode ( wp_json_encode ( $source ) );
|
209 |
+
}
|
210 |
+
|
211 |
+
protected function get_local_payment_return_url($order) {
|
212 |
+
return add_query_arg ( 'source', $order->get_meta ( '_stripe_source_id', true ), parent::get_local_payment_return_url ( $order ) );
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
*
|
217 |
+
* @return mixed
|
218 |
+
*/
|
219 |
+
public function get_payment_categories() {
|
220 |
+
return apply_filters ( 'wc_stripe_klarna_payment_categries', [
|
221 |
+
'pay_now' => __ ( 'Pay Now', 'woo-stripe-payment' ),
|
222 |
+
'pay_later' => __ ( 'Pay Later', 'woo-stripe-payment' ),
|
223 |
+
'pay_over_time' => __ ( 'Pay Over Time', 'woo-stripe-payment' )
|
224 |
] );
|
225 |
}
|
226 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-multibanco.php
CHANGED
@@ -14,6 +14,8 @@ class WC_Payment_Gateway_Stripe_Multibanco extends WC_Payment_Gateway_Stripe_Loc
|
|
14 |
$this->local_payment_type = 'multibanco';
|
15 |
$this->currencies = [ 'EUR'
|
16 |
];
|
|
|
|
|
17 |
$this->id = 'stripe_multibanco';
|
18 |
$this->tab_title = __ ( 'Multibanco', 'woo-stripe-payment' );
|
19 |
$this->template_name = 'local-payment.php';
|
@@ -28,7 +30,7 @@ class WC_Payment_Gateway_Stripe_Multibanco extends WC_Payment_Gateway_Stripe_Loc
|
|
28 |
public function get_local_payment_settings() {
|
29 |
return [
|
30 |
'desc' => array( 'type' => 'description',
|
31 |
-
'description' => $this->get_payment_description()
|
32 |
),
|
33 |
'enabled' => array(
|
34 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
14 |
$this->local_payment_type = 'multibanco';
|
15 |
$this->currencies = [ 'EUR'
|
16 |
];
|
17 |
+
$this->countries = [ 'PT'
|
18 |
+
];
|
19 |
$this->id = 'stripe_multibanco';
|
20 |
$this->tab_title = __ ( 'Multibanco', 'woo-stripe-payment' );
|
21 |
$this->template_name = 'local-payment.php';
|
30 |
public function get_local_payment_settings() {
|
31 |
return [
|
32 |
'desc' => array( 'type' => 'description',
|
33 |
+
'description' => $this->get_payment_description ()
|
34 |
),
|
35 |
'enabled' => array(
|
36 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
includes/gateways/class-wc-payment-gateway-stripe-p24.php
CHANGED
@@ -3,9 +3,10 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
3 |
return;
|
4 |
}
|
5 |
/**
|
|
|
6 |
* @package Stripe/Gateways
|
7 |
* @author PaymentPlugins
|
8 |
-
*
|
9 |
*/
|
10 |
class WC_Payment_Gateway_Stripe_P24 extends WC_Payment_Gateway_Stripe_Local_Payment {
|
11 |
|
@@ -13,6 +14,8 @@ class WC_Payment_Gateway_Stripe_P24 extends WC_Payment_Gateway_Stripe_Local_Paym
|
|
13 |
$this->local_payment_type = 'p24';
|
14 |
$this->currencies = [ 'EUR', 'PLN'
|
15 |
];
|
|
|
|
|
16 |
$this->id = 'stripe_p24';
|
17 |
$this->tab_title = __ ( 'Przelewy24', 'woo-stripe-payment' );
|
18 |
$this->template_name = 'local-payment.php';
|
@@ -27,7 +30,7 @@ class WC_Payment_Gateway_Stripe_P24 extends WC_Payment_Gateway_Stripe_Local_Paym
|
|
27 |
public function get_local_payment_settings() {
|
28 |
return [
|
29 |
'desc' => array( 'type' => 'description',
|
30 |
-
'description' => $this->get_payment_description()
|
31 |
),
|
32 |
'enabled' => array(
|
33 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
3 |
return;
|
4 |
}
|
5 |
/**
|
6 |
+
*
|
7 |
* @package Stripe/Gateways
|
8 |
* @author PaymentPlugins
|
9 |
+
*
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_P24 extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
14 |
$this->local_payment_type = 'p24';
|
15 |
$this->currencies = [ 'EUR', 'PLN'
|
16 |
];
|
17 |
+
$this->countries = [ 'PL'
|
18 |
+
];
|
19 |
$this->id = 'stripe_p24';
|
20 |
$this->tab_title = __ ( 'Przelewy24', 'woo-stripe-payment' );
|
21 |
$this->template_name = 'local-payment.php';
|
30 |
public function get_local_payment_settings() {
|
31 |
return [
|
32 |
'desc' => array( 'type' => 'description',
|
33 |
+
'description' => $this->get_payment_description ()
|
34 |
),
|
35 |
'enabled' => array(
|
36 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
includes/gateways/class-wc-payment-gateway-stripe-wechat.php
CHANGED
@@ -15,6 +15,8 @@ class WC_Payment_Gateway_Stripe_WeChat extends WC_Payment_Gateway_Stripe_Local_P
|
|
15 |
$this->currencies = [ 'AUD', 'CAD', 'EUR',
|
16 |
'GBP', 'HKD', 'JPY', 'SGD', 'USD'
|
17 |
];
|
|
|
|
|
18 |
$this->id = 'stripe_wechat';
|
19 |
$this->tab_title = __ ( 'WeChat', 'woo-stripe-payment' );
|
20 |
$this->template_name = 'local-payment.php';
|
@@ -29,7 +31,7 @@ class WC_Payment_Gateway_Stripe_WeChat extends WC_Payment_Gateway_Stripe_Local_P
|
|
29 |
public function get_local_payment_settings() {
|
30 |
return [
|
31 |
'desc' => array( 'type' => 'description',
|
32 |
-
'description' => $this->get_payment_description()
|
33 |
),
|
34 |
'enabled' => array(
|
35 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
@@ -57,7 +59,7 @@ class WC_Payment_Gateway_Stripe_WeChat extends WC_Payment_Gateway_Stripe_Local_P
|
|
57 |
];
|
58 |
}
|
59 |
|
60 |
-
protected function get_source_redirect_url($source) {
|
61 |
return $source->wechat->qr_code_url;
|
62 |
}
|
63 |
}
|
15 |
$this->currencies = [ 'AUD', 'CAD', 'EUR',
|
16 |
'GBP', 'HKD', 'JPY', 'SGD', 'USD'
|
17 |
];
|
18 |
+
$this->countries = [ 'CN'
|
19 |
+
];
|
20 |
$this->id = 'stripe_wechat';
|
21 |
$this->tab_title = __ ( 'WeChat', 'woo-stripe-payment' );
|
22 |
$this->template_name = 'local-payment.php';
|
31 |
public function get_local_payment_settings() {
|
32 |
return [
|
33 |
'desc' => array( 'type' => 'description',
|
34 |
+
'description' => $this->get_payment_description ()
|
35 |
),
|
36 |
'enabled' => array(
|
37 |
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
59 |
];
|
60 |
}
|
61 |
|
62 |
+
protected function get_source_redirect_url($source, $order) {
|
63 |
return $source->wechat->qr_code_url;
|
64 |
}
|
65 |
}
|
includes/wc-stripe-webhook-functions.php
CHANGED
@@ -14,7 +14,7 @@ function wc_stripe_process_source_chargeable($source, $request) {
|
|
14 |
|
15 |
$order_id = $wpdb->get_var ( $wpdb->prepare ( "SELECT ID FROM {$wpdb->posts} AS posts LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id WHERE meta.meta_key = %s AND meta.meta_value = %s LIMIT 1", '_stripe_source_id', $source->id ) );
|
16 |
if (! $order_id) {
|
17 |
-
wc_stripe_log_error ( sprintf ( 'Could not create a charge for source %s. No order ID was found in your Wordpress database.'
|
18 |
return;
|
19 |
}
|
20 |
// get the gateway
|
@@ -39,7 +39,11 @@ function wc_stripe_process_source_chargeable($source, $request) {
|
|
39 |
if ($gateway instanceof WC_Payment_Gateway_Stripe_Local_Payment) {
|
40 |
$gateway->processing_payment = true;
|
41 |
|
|
|
|
|
42 |
// if the payment fails, then should rety be performed?
|
43 |
$gateway->process_payment ( $order_id );
|
|
|
|
|
44 |
}
|
45 |
}
|
14 |
|
15 |
$order_id = $wpdb->get_var ( $wpdb->prepare ( "SELECT ID FROM {$wpdb->posts} AS posts LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id WHERE meta.meta_key = %s AND meta.meta_value = %s LIMIT 1", '_stripe_source_id', $source->id ) );
|
16 |
if (! $order_id) {
|
17 |
+
wc_stripe_log_error ( sprintf ( 'Could not create a charge for source %s. No order ID was found in your Wordpress database.', $source->id ) );
|
18 |
return;
|
19 |
}
|
20 |
// get the gateway
|
39 |
if ($gateway instanceof WC_Payment_Gateway_Stripe_Local_Payment) {
|
40 |
$gateway->processing_payment = true;
|
41 |
|
42 |
+
$gateway->set_order_lock ( $order );
|
43 |
+
|
44 |
// if the payment fails, then should rety be performed?
|
45 |
$gateway->process_payment ( $order_id );
|
46 |
+
|
47 |
+
$gateway->release_order_lock ( $order );
|
48 |
}
|
49 |
}
|
readme.txt
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
=== Stripe For WooCommerce ===
|
2 |
Contributors: mr.clayton
|
3 |
-
Tags: stripe, credit
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.2.2
|
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
|
11 |
|
12 |
== Description ==
|
13 |
-
Accept Credit Cards, Google Pay, ApplePay, P24, iDEAL and more all in one plugin for free!
|
14 |
|
15 |
= Boost conversion by offering product and cart page checkout =
|
16 |
Stripe for WooCommerce is made to supercharge your conversion rate by decreasing payment friction for your customer.
|
@@ -45,10 +45,16 @@ If you're site is not loading over https, then Stripe won't render the Payment R
|
|
45 |
1. Let customers pay directly from product pages
|
46 |
2. Apple pay on the cart page
|
47 |
3. Custom credit card forms
|
48 |
-
4.
|
49 |
-
5.
|
|
|
|
|
50 |
|
51 |
== Changelog ==
|
|
|
|
|
|
|
|
|
52 |
= 3.0.1 =
|
53 |
* Updated - Google Pay paymentDataCallbacks in JavaScript
|
54 |
* Updated - Text domain to match plugin slug
|
1 |
=== Stripe For WooCommerce ===
|
2 |
Contributors: mr.clayton
|
3 |
+
Tags: stripe, klarna, credit card, apple pay, google pay, ideal, sepa, sofort
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.2.2
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 3.0.2
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
== Description ==
|
13 |
+
Accept Credit Cards, Google Pay, ApplePay, P24, Klarna, iDEAL and more all in one plugin for free!
|
14 |
|
15 |
= Boost conversion by offering product and cart page checkout =
|
16 |
Stripe for WooCommerce is made to supercharge your conversion rate by decreasing payment friction for your customer.
|
45 |
1. Let customers pay directly from product pages
|
46 |
2. Apple pay on the cart page
|
47 |
3. Custom credit card forms
|
48 |
+
4. Klarna on checkout page
|
49 |
+
5. Local payment methods like iDEAL and P24
|
50 |
+
6. Configuration pages
|
51 |
+
7. Payment options at top of checkout page for easy one click checkout
|
52 |
|
53 |
== Changelog ==
|
54 |
+
= 3.0.2 =
|
55 |
+
* Added - Klarna payments now supported
|
56 |
+
* Added - Bancontact
|
57 |
+
* Updated - Local payments webhook
|
58 |
= 3.0.1 =
|
59 |
* Updated - Google Pay paymentDataCallbacks in JavaScript
|
60 |
* Updated - Text domain to match plugin slug
|
stripe-payments.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
/**
|
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 using Stripe.
|
7 |
-
* Version: 3.0.
|
8 |
* Author: Payment Plugins, support@paymentplugins.com
|
9 |
* Text Domain: woo-stripe-payment
|
10 |
* Domain Path: /i18n/languages/
|
11 |
-
* Tested up to: 5.2
|
12 |
* WC requires at least: 3.0.0
|
13 |
* WC tested up to: 3.7.1
|
14 |
*/
|
@@ -22,11 +22,11 @@ if (version_compare ( PHP_VERSION, '5.4', '<' )) {
|
|
22 |
return;
|
23 |
}
|
24 |
|
25 |
-
define ( '
|
26 |
define ( 'WC_STRIPE_ASSETS', plugin_dir_url ( __FILE__ ) . 'assets/' );
|
27 |
define ( 'WC_STRIPE_PLUGIN_NAME', plugin_basename ( __FILE__ ) );
|
28 |
define ( 'WC_STRIPE_CLASS_VERSION', '6.40.0' );
|
29 |
// include main plugin file.
|
30 |
-
require_once (
|
31 |
// load Stripe classes
|
32 |
-
require_once (
|
3 |
/**
|
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, Klarna and more using Stripe.
|
7 |
+
* Version: 3.0.2
|
8 |
* Author: Payment Plugins, support@paymentplugins.com
|
9 |
* Text Domain: woo-stripe-payment
|
10 |
* Domain Path: /i18n/languages/
|
11 |
+
* Tested up to: 5.2.4
|
12 |
* WC requires at least: 3.0.0
|
13 |
* WC tested up to: 3.7.1
|
14 |
*/
|
22 |
return;
|
23 |
}
|
24 |
|
25 |
+
define ( 'WC_STRIPE_PLUGIN_FILE_PATH', plugin_dir_path ( __FILE__ ) );
|
26 |
define ( 'WC_STRIPE_ASSETS', plugin_dir_url ( __FILE__ ) . 'assets/' );
|
27 |
define ( 'WC_STRIPE_PLUGIN_NAME', plugin_basename ( __FILE__ ) );
|
28 |
define ( 'WC_STRIPE_CLASS_VERSION', '6.40.0' );
|
29 |
// include main plugin file.
|
30 |
+
require_once ( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-stripe.php' );
|
31 |
// load Stripe classes
|
32 |
+
require_once ( WC_STRIPE_PLUGIN_FILE_PATH . 'stripe-php-' . WC_STRIPE_CLASS_VERSION . '/init.php' );
|
templates/checkout/klarna.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @version 3.0.2
|
4 |
+
*
|
5 |
+
* @var WC_Payment_Gateway_Stripe_Klarna $gateway
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div id="wc_stripe_local_payment_<?php echo $gateway->id?>" style="display: none">
|
9 |
+
<ul class="stripe-klarna-categories">
|
10 |
+
<?php foreach ($gateway->get_payment_categories() as $category => $label):?>
|
11 |
+
<li id="klarna-category-<?php echo $category?>" style="display:none">
|
12 |
+
<input type="radio" id="klarna_<?php echo $category?>"
|
13 |
+
class="wc-stripe-klarna-category" name="klarna_category"
|
14 |
+
value="<?php echo $category?>" />
|
15 |
+
<label for="klarna_<?php echo $category?>" class="wc-stripe-label-klarna-category"><?php echo $label?></label>
|
16 |
+
<div id="klarna-instance-<?php echo $category?>" class="klarna-instance-<?php echo $category?>" style="display: none"></div>
|
17 |
+
</li>
|
18 |
+
<?php endforeach;?>
|
19 |
+
</ul>
|
20 |
+
</div>
|