Version Description
- Added - Support for right to left (RTL) languages
- Added - WPML gateway country availability compatibility
- Added - WPML product page currency change
- Fixed - Change event for ship_to_different_address
- Fixed - Update required fields on checkout page load
Download this release
Release Info
Developer | mr.clayton |
Plugin | Payment Plugins for Stripe WooCommerce |
Version | 3.2.5 |
Comparing to | |
See all releases |
Code changes from version 3.2.4 to 3.2.5
- assets/css/admin/admin-rtl.css +289 -0
- assets/css/stripe-rtl.css +811 -0
- assets/css/stripe.min-rtl.css +1 -0
- assets/js/frontend/applepay-checkout.js +5 -4
- assets/js/frontend/googlepay-checkout.js +5 -5
- assets/js/frontend/payment-request.js +7 -7
- assets/js/frontend/wc-stripe.js +22 -18
- assets/js/frontend/wc-stripe.min.js +1 -1
- i18n/languages/woo-stripe-payment.pot +55 -55
- includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php +307 -305
- includes/abstract/abstract-wc-payment-gateway-stripe.php +12 -1
- includes/abstract/abstract-wc-payment-token-stripe.php +186 -186
- includes/admin/class-wc-stripe-admin-settings.php +106 -89
- includes/admin/settings/class-wc-stripe-api-settings.php +1 -1
- includes/admin/views/html-settings-local-payments-nav.php +17 -17
- includes/admin/views/html-settings-nav.php +25 -25
- includes/class-stripe.php +1 -1
- includes/class-wc-stripe-field-manager.php +213 -213
- includes/class-wc-stripe-frontend-scripts.php +208 -190
- includes/class-wc-stripe-gateway-conversions.php +43 -43
- includes/class-wc-stripe-payment-charge-local.php +75 -75
- includes/class-wc-stripe-rest-api.php +147 -126
- includes/controllers/class-wc-stripe-controller-checkout.php +4 -4
- includes/gateways/class-wc-payment-gateway-stripe-ach.php +381 -377
- includes/gateways/class-wc-payment-gateway-stripe-applepay.php +118 -114
- includes/gateways/class-wc-payment-gateway-stripe-cc.php +4 -0
- includes/gateways/class-wc-payment-gateway-stripe-googlepay.php +238 -234
- includes/gateways/class-wc-payment-gateway-stripe-klarna.php +281 -281
- includes/gateways/class-wc-payment-gateway-stripe-payment-request.php +102 -98
- includes/gateways/class-wc-payment-gateway-stripe-sepa.php +92 -92
- includes/tokens/class-wc-payment-token-stripe-local-payment.php +43 -43
- includes/traits/wc-stripe-controller-traits.php +104 -98
- readme.txt +7 -1
- stripe-payments.php +2 -2
assets/css/admin/admin-rtl.css
ADDED
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-stripe-settings-container{
|
2 |
+
padding: 0 0.5em;
|
3 |
+
}
|
4 |
+
.wc-stripe-cc-desc{
|
5 |
+
margin: 0;
|
6 |
+
}
|
7 |
+
.wc-stripe-settings-logo {
|
8 |
+
margin: 1.5em 0 0.5em 1em;
|
9 |
+
}
|
10 |
+
.wc-stripe-settings-logo img{
|
11 |
+
width: 150px;
|
12 |
+
max-width: 150px;
|
13 |
+
margin-right: 0.5em;
|
14 |
+
}
|
15 |
+
.wc-stripe-advanced-settings-nav{
|
16 |
+
margin-top: 1em;
|
17 |
+
}
|
18 |
+
.nav-tab-wrapper.woo-nav-tab-wrapper{
|
19 |
+
min-height:35px;
|
20 |
+
}
|
21 |
+
@media(max-width: 690px){
|
22 |
+
.nav-tab-wrapper.woo-nav-tab-wrapper{
|
23 |
+
min-height:70px;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
.wc-stripe-advanced-settings-nav .nav-link:nth-child(n+2){
|
27 |
+
margin-right: 0.5em;
|
28 |
+
}
|
29 |
+
.wc-stripe-advanced-settings-nav .nav-link-active{
|
30 |
+
color: #555;
|
31 |
+
font-weight: 500;
|
32 |
+
}
|
33 |
+
.stripe_cc .wc-stripe-card-icon{
|
34 |
+
width: 36px;
|
35 |
+
vertical-align: middle;
|
36 |
+
}
|
37 |
+
#order_data .order_data_column .transaction-data {
|
38 |
+
|
39 |
+
}
|
40 |
+
#order_data .order_data_column .transaction-data h3{
|
41 |
+
margin-bottom: 5px;
|
42 |
+
}
|
43 |
+
#order_data .order_data_column .transaction-data a{
|
44 |
+
text-decoration: none;
|
45 |
+
border: 2px solid transparent;
|
46 |
+
border-radius: 4px;
|
47 |
+
font-size: 18px;
|
48 |
+
}
|
49 |
+
#order_data .order_data_column .transaction-data a:before{
|
50 |
+
font-family: WooCommerce;
|
51 |
+
content: "\e010";
|
52 |
+
}
|
53 |
+
#order_data .order_data_column .transaction-data .do-transaction-view:hover{
|
54 |
+
border: 2px solid #00a0d2;
|
55 |
+
}
|
56 |
+
.wc-transaction-data .data-container{
|
57 |
+
display: flex;
|
58 |
+
flex-wrap: wrap;
|
59 |
+
}
|
60 |
+
.wc-transaction-data h2{
|
61 |
+
margin: 0 0 1em 0;
|
62 |
+
}
|
63 |
+
.wc-transaction-data .charge-actions{
|
64 |
+
margin-bottom: 0.5em;
|
65 |
+
}
|
66 |
+
.wc-transaction-data .data-container .column-6{
|
67 |
+
width: 50%;
|
68 |
+
margin-bottom: 0.5em;
|
69 |
+
}
|
70 |
+
.wc-transaction-data .data-container .column-6 label{
|
71 |
+
display: inline-block;
|
72 |
+
font-weight: 600;
|
73 |
+
vertical-align: bottom;
|
74 |
+
}
|
75 |
+
.wc-transaction-data .data-container .metadata{
|
76 |
+
margin-bottom: 0.5em;
|
77 |
+
}
|
78 |
+
#wc-stripe-card-container #card-element{
|
79 |
+
margin: 1em 0;
|
80 |
+
border: 1px solid #e8e8e8;
|
81 |
+
}
|
82 |
+
#wc-stripe-card-container #card-element{
|
83 |
+
background-color: #fff;
|
84 |
+
padding: 12px 6px;
|
85 |
+
}
|
86 |
+
.wc-stripe-save-card label{
|
87 |
+
display: block;
|
88 |
+
margin-bottom: 8px;
|
89 |
+
}
|
90 |
+
#pay-order{
|
91 |
+
min-width: 75px;
|
92 |
+
}
|
93 |
+
#wc-stripe-pay-order-form .modal-wide{
|
94 |
+
width: 100%;
|
95 |
+
margin-bottom: 1.5em;
|
96 |
+
}
|
97 |
+
#wc-stripe-pay-order-form .modal-wide label{
|
98 |
+
font-weight: 500;
|
99 |
+
}
|
100 |
+
#wc-stripe-pay-order-form .modal-wide.option label{
|
101 |
+
display: block;
|
102 |
+
margin-bottom: 0.5em;
|
103 |
+
}
|
104 |
+
#wc-stripe-pay-order-form .token-container{
|
105 |
+
margin: 1em 0em;
|
106 |
+
}
|
107 |
+
#wc-stripe-pay-order-form .woocommerce-error{
|
108 |
+
background: #b22222;
|
109 |
+
color: #fff;
|
110 |
+
padding: 1em;
|
111 |
+
margin-bottom: 1em;
|
112 |
+
}
|
113 |
+
.wc-stripe-docs{
|
114 |
+
padding: 0 6px;
|
115 |
+
margin-top: 1em;
|
116 |
+
}
|
117 |
+
.wc-stripe-advanced-settings-nav.local-gateways{
|
118 |
+
margin-right: 0.5em;
|
119 |
+
}
|
120 |
+
.wc-stripe-webhook{
|
121 |
+
font-weight: 500;
|
122 |
+
margin-bottom: 0.75em;
|
123 |
+
}
|
124 |
+
.profile-php .wc-stripe-payment-methods th,
|
125 |
+
.user-edit-php .wc-stripe-payment-methods th{
|
126 |
+
padding: 10px 0;
|
127 |
+
}
|
128 |
+
.profile-php .wc-stripe-payment-methods th,
|
129 |
+
.profile-php .wc-stripe-payment-methods td,
|
130 |
+
.user-edit-php .wc-stripe-payment-methods th,
|
131 |
+
.user-edit-php .wc-stripe-payment-methods td{
|
132 |
+
text-align: right;
|
133 |
+
}
|
134 |
+
.profile-php .wc-stripe-payment-methods th:nth-child(n+2),
|
135 |
+
.user-edit-php .wc-stripe-payment-methods th:nth-child(n+2){
|
136 |
+
padding: 5px 10px;
|
137 |
+
}
|
138 |
+
.profile-php .wc-stripe-payment-methods td:nth-child(n+2),
|
139 |
+
.user-edit-php .wc-stripe-payment-methods td:nth-child(n+2){
|
140 |
+
padding: 5px 10px;
|
141 |
+
}
|
142 |
+
.wc-stripe-user-info{
|
143 |
+
padding: 10px 0;
|
144 |
+
}
|
145 |
+
.woocommerce table.form-table [id="woocommerce_stripe_ach_fee[type]"] + .select2-container{
|
146 |
+
width: 125px !important;
|
147 |
+
min-width: 125px !important;
|
148 |
+
}
|
149 |
+
[id="woocommerce_stripe_ach_fee[type]"] {
|
150 |
+
width: 150px !important;
|
151 |
+
}
|
152 |
+
.wc-stripe-fee-container{
|
153 |
+
display: flex;
|
154 |
+
flex-direction: row;
|
155 |
+
flex-flow: wrap;
|
156 |
+
}
|
157 |
+
.wc-stripe-fee-col{
|
158 |
+
display: flex;
|
159 |
+
flex-direction: column;
|
160 |
+
}
|
161 |
+
.wc-stripe-fee-col{
|
162 |
+
margin-left: 15px;
|
163 |
+
}
|
164 |
+
.wc-stripe-fee-container input{
|
165 |
+
display: block;
|
166 |
+
margin-top: 1px;
|
167 |
+
}
|
168 |
+
.notice .stripe-connect{
|
169 |
+
margin: 7px 3px;
|
170 |
+
}
|
171 |
+
.stripe-connect.light-blue {
|
172 |
+
background: #b5c3d8;
|
173 |
+
background-image: -webkit-linear-gradient(#b5c3d8, #9cabc2);
|
174 |
+
background-image: -moz-linear-gradient(#b5c3d8, #9cabc2);
|
175 |
+
background-image: -ms-linear-gradient(#b5c3d8, #9cabc2);
|
176 |
+
background-image: linear-gradient(#b5c3d8, #9cabc2);
|
177 |
+
-moz-box-shadow: 0 1px 0 rgba(0,0,0,0.1);
|
178 |
+
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
|
179 |
+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
|
180 |
+
}
|
181 |
+
.stripe-connect {
|
182 |
+
display: inline-block;
|
183 |
+
margin-bottom: 1px;
|
184 |
+
background-image: -webkit-linear-gradient(#28A0E5, #015E94);
|
185 |
+
background-image: -moz-linear-gradient(#28A0E5, #015E94);
|
186 |
+
background-image: -ms-linear-gradient(#28A0E5, #015E94);
|
187 |
+
background-image: linear-gradient(#28A0E5, #015E94);
|
188 |
+
-webkit-font-smoothing: antialiased;
|
189 |
+
border: 0;
|
190 |
+
padding: 1px;
|
191 |
+
height: 30px;
|
192 |
+
text-decoration: none;
|
193 |
+
-moz-border-radius: 4px;
|
194 |
+
-webkit-border-radius: 4px;
|
195 |
+
border-radius: 4px;
|
196 |
+
-moz-box-shadow: 0 1px 0 rgba(0,0,0,0.2);
|
197 |
+
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
|
198 |
+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
|
199 |
+
cursor: pointer;
|
200 |
+
-moz-user-select: none;
|
201 |
+
-webkit-user-select: none;
|
202 |
+
-ms-user-select: none;
|
203 |
+
user-select: none;
|
204 |
+
}
|
205 |
+
.stripe-connect.light-blue span {
|
206 |
+
color: #556F88;
|
207 |
+
text-shadow: 0 1px rgba(255, 255, 255, 0.8);
|
208 |
+
background: #f0f5fa;
|
209 |
+
background-image: -webkit-linear-gradient(#f0f5fa, #e4ecf5 85%, #e7eef6);
|
210 |
+
background-image: -moz-linear-gradient(#f0f5fa, #e4ecf5 85%, #e7eef6);
|
211 |
+
background-image: -ms-linear-gradient(#f0f5fa, #e4ecf5 85%, #e7eef6);
|
212 |
+
background-image: linear-gradient(#f0f5fa, #e4ecf5 85%, #e7eef6);
|
213 |
+
-moz-box-shadow: inset 0 1px 0 #fff;
|
214 |
+
-webkit-box-shadow: inset 0 1px 0 #fff;
|
215 |
+
box-shadow: inset 0 1px 0 #fff;
|
216 |
+
}
|
217 |
+
.stripe-connect span {
|
218 |
+
display: block;
|
219 |
+
position: relative;
|
220 |
+
padding: 0 44px 0 12px;
|
221 |
+
height: 30px;
|
222 |
+
background: #1275FF;
|
223 |
+
background-image: -webkit-linear-gradient(#7DC5EE, #008CDD 85%, #30A2E4);
|
224 |
+
background-image: -moz-linear-gradient(#7DC5EE, #008CDD 85%, #30A2E4);
|
225 |
+
background-image: -ms-linear-gradient(#7DC5EE, #008CDD 85%, #30A2E4);
|
226 |
+
background-image: linear-gradient(#7DC5EE, #008CDD 85%, #30A2E4);
|
227 |
+
font-size: 14px;
|
228 |
+
line-height: 30px;
|
229 |
+
color: white;
|
230 |
+
font-weight: bold;
|
231 |
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
232 |
+
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
|
233 |
+
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
|
234 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
|
235 |
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
|
236 |
+
-moz-border-radius: 3px;
|
237 |
+
-webkit-border-radius: 3px;
|
238 |
+
border-radius: 3px;
|
239 |
+
}
|
240 |
+
.stripe-connect span:before {
|
241 |
+
content: '';
|
242 |
+
display: block;
|
243 |
+
position: absolute;
|
244 |
+
right: 11px;
|
245 |
+
top: 50%;
|
246 |
+
width: 23px;
|
247 |
+
height: 24px;
|
248 |
+
margin-top: -12px;
|
249 |
+
background-repeat: no-repeat;
|
250 |
+
background-size: 23px 24px;
|
251 |
+
}
|
252 |
+
.stripe-connect.light-blue span:before {
|
253 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAwCAYAAABuZUjcAAAKRGlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUFNcXx9/MbC+0XZYiZem9twWkLr1IlSYKy+4CS1nWZRewN0QFIoqICFYkKGLAaCgSK6JYCAgW7AEJIkoMRhEVlczGHPX3Oyf5/U7eH3c+8333nnfn3vvOGQAoASECYQ6sAEC2UCKO9PdmxsUnMPG9AAZEgAM2AHC4uaLQKL9ogK5AXzYzF3WS8V8LAuD1LYBaAK5bBIQzmX/p/+9DkSsSSwCAwtEAOx4/l4tyIcpZ+RKRTJ9EmZ6SKWMYI2MxmiDKqjJO+8Tmf/p8Yk8Z87KFPNRHlrOIl82TcRfKG/OkfJSREJSL8gT8fJRvoKyfJc0WoPwGZXo2n5MLAIYi0yV8bjrK1ihTxNGRbJTnAkCgpH3FKV+xhF+A5gkAO0e0RCxIS5cwjbkmTBtnZxYzgJ+fxZdILMI53EyOmMdk52SLOMIlAHz6ZlkUUJLVlokW2dHG2dHRwtYSLf/n9Y+bn73+GWS9/eTxMuLPnkGMni/al9gvWk4tAKwptDZbvmgpOwFoWw+A6t0vmv4+AOQLAWjt++p7GLJ5SZdIRC5WVvn5+ZYCPtdSVtDP6386fPb8e/jqPEvZeZ9rx/Thp3KkWRKmrKjcnKwcqZiZK+Jw+UyL/x7ifx34VVpf5WEeyU/li/lC9KgYdMoEwjS03UKeQCLIETIFwr/r8L8M+yoHGX6aaxRodR8BPckSKPTRAfJrD8DQyABJ3IPuQJ/7FkKMAbKbF6s99mnuUUb3/7T/YeAy9BXOFaQxZTI7MprJlYrzZIzeCZnBAhKQB3SgBrSAHjAGFsAWOAFX4Al8QRAIA9EgHiwCXJAOsoEY5IPlYA0oAiVgC9gOqsFeUAcaQBM4BtrASXAOXARXwTVwE9wDQ2AUPAOT4DWYgSAID1EhGqQGaUMGkBlkC7Egd8gXCoEioXgoGUqDhJAUWg6tg0qgcqga2g81QN9DJ6Bz0GWoH7oDDUPj0O/QOxiBKTAd1oQNYSuYBXvBwXA0vBBOgxfDS+FCeDNcBdfCR+BW+Bx8Fb4JD8HP4CkEIGSEgeggFggLYSNhSAKSioiRlUgxUonUIk1IB9KNXEeGkAnkLQaHoWGYGAuMKyYAMx/DxSzGrMSUYqoxhzCtmC7MdcwwZhLzEUvFamDNsC7YQGwcNg2bjy3CVmLrsS3YC9ib2FHsaxwOx8AZ4ZxwAbh4XAZuGa4UtxvXjDuL68eN4KbweLwa3gzvhg/Dc/ASfBF+J/4I/gx+AD+Kf0MgE7QJtgQ/QgJBSFhLqCQcJpwmDBDGCDNEBaIB0YUYRuQRlxDLiHXEDmIfcZQ4Q1IkGZHcSNGkDNIaUhWpiXSBdJ/0kkwm65KdyRFkAXk1uYp8lHyJPEx+S1GimFLYlESKlLKZcpBylnKH8pJKpRpSPakJVAl1M7WBep76kPpGjiZnKRcox5NbJVcj1yo3IPdcnihvIO8lv0h+qXyl/HH5PvkJBaKCoQJbgaOwUqFG4YTCoMKUIk3RRjFMMVuxVPGw4mXFJ0p4JUMlXyWeUqHSAaXzSiM0hKZHY9O4tHW0OtoF2igdRzeiB9Iz6CX07+i99EllJWV75RjlAuUa5VPKQwyEYcgIZGQxyhjHGLcY71Q0VbxU+CqbVJpUBlSmVeeoeqryVYtVm1Vvqr5TY6r5qmWqbVVrU3ugjlE3VY9Qz1ffo35BfWIOfY7rHO6c4jnH5tzVgDVMNSI1lmkc0OjRmNLU0vTXFGnu1DyvOaHF0PLUytCq0DqtNa5N03bXFmhXaJ/RfspUZnoxs5hVzC7mpI6GToCOVGe/Tq/OjK6R7nzdtbrNug/0SHosvVS9Cr1OvUl9bf1Q/eX6jfp3DYgGLIN0gx0G3QbThkaGsYYbDNsMnxipGgUaLTVqNLpvTDX2MF5sXGt8wwRnwjLJNNltcs0UNnUwTTetMe0zg80czQRmu836zbHmzuZC81rzQQuKhZdFnkWjxbAlwzLEcq1lm+VzK32rBKutVt1WH60drLOs66zv2SjZBNmstemw+d3W1JZrW2N7w45q52e3yq7d7oW9mT3ffo/9bQeaQ6jDBodOhw+OTo5ixybHcSd9p2SnXU6DLDornFXKuuSMdfZ2XuV80vmti6OLxOWYy2+uFq6Zroddn8w1msufWzd3xE3XjeO2323Ineme7L7PfchDx4PjUevxyFPPk+dZ7znmZeKV4XXE67m3tbfYu8V7mu3CXsE+64P4+PsU+/T6KvnO9632fein65fm1+g36e/gv8z/bAA2IDhga8BgoGYgN7AhcDLIKWhFUFcwJTgquDr4UYhpiDikIxQODQrdFnp/nsE84by2MBAWGLYt7EG4Ufji8B8jcBHhETURjyNtIpdHdkfRopKiDke9jvaOLou+N994vnR+Z4x8TGJMQ8x0rE9seexQnFXcirir8erxgvj2BHxCTEJ9wtQC3wXbF4wmOiQWJd5aaLSwYOHlReqLshadSpJP4iQdT8YmxyYfTn7PCePUcqZSAlN2pUxy2dwd3Gc8T14Fb5zvxi/nj6W6pZanPklzS9uWNp7ukV6ZPiFgC6oFLzICMvZmTGeGZR7MnM2KzWrOJmQnZ58QKgkzhV05WjkFOf0iM1GRaGixy+LtiyfFweL6XCh3YW67hI7+TPVIjaXrpcN57nk1eW/yY/KPFygWCAt6lpgu2bRkbKnf0m+XYZZxl3Uu11m+ZvnwCq8V+1dCK1NWdq7SW1W4anS1/+pDa0hrMtf8tNZ6bfnaV+ti13UUahauLhxZ77++sUiuSFw0uMF1w96NmI2Cjb2b7Dbt3PSxmFd8pcS6pLLkfSm39Mo3Nt9UfTO7OXVzb5lj2Z4tuC3CLbe2emw9VK5YvrR8ZFvottYKZkVxxavtSdsvV9pX7t1B2iHdMVQVUtW+U3/nlp3vq9Orb9Z41zTv0ti1adf0bt7ugT2ee5r2au4t2ftun2Df7f3++1trDWsrD+AO5B14XBdT1/0t69uGevX6kvoPB4UHhw5FHupqcGpoOKxxuKwRbpQ2jh9JPHLtO5/v2pssmvY3M5pLjoKj0qNPv0/+/tax4GOdx1nHm34w+GFXC62luBVqXdI62ZbeNtQe395/IuhEZ4drR8uPlj8ePKlzsuaU8qmy06TThadnzyw9M3VWdHbiXNq5kc6kznvn487f6Iro6r0QfOHSRb+L57u9us9ccrt08rLL5RNXWFfarjpebe1x6Gn5yeGnll7H3tY+p772a87XOvrn9p8e8Bg4d93n+sUbgTeu3px3s//W/Fu3BxMHh27zbj+5k3Xnxd28uzP3Vt/H3i9+oPCg8qHGw9qfTX5uHnIcOjXsM9zzKOrRvRHuyLNfcn95P1r4mPq4ckx7rOGJ7ZOT437j154ueDr6TPRsZqLoV8Vfdz03fv7Db56/9UzGTY6+EL+Y/b30pdrLg6/sX3VOhU89fJ39ema6+I3am0NvWW+738W+G5vJf49/X/XB5EPHx+CP92ezZ2f/AAOY8/wRDtFgAAAHH0lEQVRoBdVZ628UVRS/857dme3strvblpaXCiI+WkCkpFAoECAgr0oqxASjiAZMiF9MiI80/AfqB+WD3/xABOMrKCgRJCBSLCACQUEIEai8ywJ97GNm/J3ZbizM7C7trpG9m7N39t5z7/2dM+eec+5dzrZtVoqFL0XQhLlkgYulpnGOYxxhLjngW7Zsdayk5IB3RyJSSWrcMP1aSQJPJfnwoIA3LFhTy3hrAdx+IzbIOMbsGkQAR3pM1Icdcxv1ZZtxf+D5OGPm3vbJo4/YbW0WLVSswglCLc3F5QtAzyx6ZbbA7Hc5jp8hCAIj4nmecTy2NyRwCqShOEZzWZbFTMtkpmky27Ku2Da36cC2j9vSjIV/b93RsZpmybo5n2htlct6yz6SReFlWZaZIitMURRGz6IkMoEXHPAOFAewnQacSrFkMsUSiTgoEU0kk4vBUzTgHM87GvcE3traKgTjxleyT5mvaTrTdY2pqo9JBNjReBp0v0sFLtI4tA2ClqFtIpPF43EIEdcd4Yr0hSWy23hnIvi2T/PPDwaDLBAIMFVRmSACbMY0XCDSImTCsOOvYDr0hqxUQnGxF9AA4/T2Ks2LXwsD9Iby8nIWNIJMVmTGZwWcAwFW4AWIYmfEycE7mC6OZfHjqviCYZT5gobhaIw24VALjRz6aO9Vsdm9I6eu6XN1mIcC8+ALAO0sS28qvY43iiG0csxydOHanJqm1ZFNk8vLp67hVeHjLfMbvx9ZHY7Fbvco17pi2vlL1youXemKXLh8Y8SV610jelPJIcDLP8QFXJHlELm77BsxPaltW6xx4vgDo2uiN6klZOh9RGNG1VzHz1Ogn6j99LkLcaqLXVzA4acRnIS82k6lTLbjx/aqhgmPvglQMZAMItcXAkVAw4nGjKq9hbroxQVcVeVenuN9//po7zUpQp44ffbZOSvWb48nEhv3fr5pBzhJu6TxP0E/g6iUpavifrt8VUXIuEC27eyrHDVFTtoLiqo2SKK4vem5tQebWl5dwW3ceO+c/4nG712EwUaPIhDmRU5RtMwoY5FwhIXg83VNmyxJ6uamY5ePNbWsXVFc/bpncwFfMnvqN4oi3iRTyfXh+zVO0bUyGmXRykpWXkEC6ONlWdo8c/m6L+atWpXJHt0rF9jiAq7rvpPzGuu/hqlYjjskr5mFKDiRB/Ijtw8FQywaibJKCEBvwOf3L032lf0wbcnqQIEYPYe7gIPrRPPU+kONk8Z/jVAPb38fH0gpiiLA+lgwaDgCRMJhJGf6FFXV3vNcucBGL+Am5ty2dM6UjkWzp3ziU+Vb+TZqpp9yGhLADwFCoXKYTgVD3vPSrBXr6wrE6RruBZyYzoK+nT7psdMb1rS8P+Hxh3bKstiT19X0S4CcGSmDzAzkO9gDHHL5510rF9jg8uMD5juC55jfry5aubBpb+xOz8Fd+3+rO3bqr6ndvX0VA/i8HyEEHT4CeoAl4/GFYHrLm3Fordk0npmNNP8haJeh+7uWzW04+M665R9MmzT+S0kU+jImkq2mJE1RFab6fA9nJixWnUvjmTUoS6K84xfQU0i+piya9fRhjrftfR2/L3M8TobToxYFEScnqehu0QW8ufX1eoGXJPNy6Mju3W2pAVgSeO4AHQLV+SR5pIVES+CQ1+QolPeoqlr0RMsFXJTkpXDbbVxVV/eclW+04wjTDod4HGe907aQuiImOV7RfbXVVdWNeqCMCUpu4ORM4Zl6csg2pC4X8GHRsNbdl6BrBs1MpWbh4DuLrhvoEGzZODVJHA7GPOuLJ5iG0ELAchUcn5mh63/n4hlKnwt4bW11uCvW65x+cLXAkgkQDgMpXDtQRkhAydXRKQnJVTqq5liZTv/V0dDJHCyD6rIZT5mU+15Fgk36/X7n/oQ0beGawQTgtMZxT4UP2a1zt4I6n8bxPlLNU+u+GxS6HMwch43lBZzu+tHpXPaIPDRKWi2gPDKi6sDo2sqjBUxx91CbOWdBN6r+hCqfJu+ezfuXEfCdX7lw+k70nvDmGHwr7KSbRrmA9+POa7v5lgwHA2debJn5KSIvxQBnsXxj7qcfwe4a8bmAD4tWnLp6s7uzN2lWw33kdhkeK/lUpat+3Kg9C2ZMPIzuC6A9HmxDbsJeozndwNesXLCf2mO376gnz3TW4Jph2I3Y7cidnr7ynt54MJky/ZZli8jFTZHnE7Ikdmt+9Ua0wjg/bvSwM0+OHXER0ZV2PqULn4EGBjH8LKzgJH+OZnBpHG3kczuNgF7dUD/2DJ6JBlO6wLwP9OtgBt0vr22a3hrHBHQnQkSXlTWgahBlg+WgIMgHIoEpb6cdTvZ7A3QRRFruBDm+FnXRiyhZ3jY+YCXKLwgI0QNTYkKPt1d5YBBmAaJdver48bx/pWQZ/781wx06nq7kgGc0lu8ElOF74OqSBf4P9hj31KSAw4AAAAAASUVORK5CYII=")
|
254 |
+
}
|
255 |
+
.stipe-connect-active{
|
256 |
+
font-size: 30px;
|
257 |
+
color: green;
|
258 |
+
width: 25px;
|
259 |
+
height: 30px;
|
260 |
+
margin-top: -5px;
|
261 |
+
margin-right: -8px;
|
262 |
+
}
|
263 |
+
|
264 |
+
.woocommerce_stripe_panel table{
|
265 |
+
width: 100%;
|
266 |
+
}
|
267 |
+
.wc-stripe-product-table th{
|
268 |
+
text-align: right;
|
269 |
+
}
|
270 |
+
.wc-stripe-product-gateway-enabled{
|
271 |
+
padding-top: 1px;
|
272 |
+
display: block;
|
273 |
+
outline: 0;
|
274 |
+
box-shadow: none;
|
275 |
+
}
|
276 |
+
.wc-stripe-save-product-data.disabled{
|
277 |
+
opactity: 0.6;
|
278 |
+
}
|
279 |
+
#stripe_product_data .wc-stripe-save-product-data + span.spinner{
|
280 |
+
float: none;
|
281 |
+
margin: 0 10px 0 0;
|
282 |
+
}
|
283 |
+
#woocommerce-product-data ul.wc-tabs li.stripe_options a:before{
|
284 |
+
font-family: WooCommerce;
|
285 |
+
content: '\e01e';
|
286 |
+
}
|
287 |
+
#_stripe_button_position{
|
288 |
+
max-width: 200px;
|
289 |
+
}
|
assets/css/stripe-rtl.css
ADDED
@@ -0,0 +1,811 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-stripe-card-icons-container,
|
2 |
+
.wc-stripe-paymentRequest-icons-container {
|
3 |
+
float: left;
|
4 |
+
display: inline-block;
|
5 |
+
}
|
6 |
+
|
7 |
+
ul.payment_methods li[class*=payment_method] {
|
8 |
+
margin: 0;
|
9 |
+
padding: 0;
|
10 |
+
}
|
11 |
+
|
12 |
+
li[class*=payment_method] input[type=radio] {
|
13 |
+
margin: 0 5px 0 10px;
|
14 |
+
}
|
15 |
+
|
16 |
+
li[class*=payment_method] input[type=radio] + label:not(.wc-stripe-label-payment-type) {
|
17 |
+
margin: 0;
|
18 |
+
}
|
19 |
+
|
20 |
+
.woocommerce-checkout #payment ul.payment_methods li[class*=payment_method_stripe_]:nth-child(n + 2),
|
21 |
+
ul.payment_methods li[class*=payment_method_stripe_]:nth-child(n + 2) {
|
22 |
+
margin: 0;
|
23 |
+
}
|
24 |
+
|
25 |
+
li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon,
|
26 |
+
li.payment_method_stripe_payment_request .wc-stripe-paymentRequest-icons-container img {
|
27 |
+
max-width: 44px;
|
28 |
+
max-height: 27px;
|
29 |
+
width: 44px;
|
30 |
+
height: 27px;
|
31 |
+
float: none;
|
32 |
+
display: inline;
|
33 |
+
}
|
34 |
+
|
35 |
+
li.payment_method_stripe_payment_request .wc-stripe-paymentRequest-icons-container img {
|
36 |
+
width: 25px;
|
37 |
+
height: 25px;
|
38 |
+
max-width: 25px;
|
39 |
+
max-height: 25px;
|
40 |
+
}
|
41 |
+
|
42 |
+
ul.payment_methods label[for*="payment_method_stripe"]:after {
|
43 |
+
clear: left;
|
44 |
+
content: "";
|
45 |
+
display: block;
|
46 |
+
}
|
47 |
+
|
48 |
+
li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon:nth-child(2n+2) {
|
49 |
+
margin: 0px 2px;
|
50 |
+
}
|
51 |
+
|
52 |
+
li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon.open.visa {
|
53 |
+
padding-top: 2px;
|
54 |
+
}
|
55 |
+
|
56 |
+
ul.payment_methods li[class*=payment_method_stripe_] label > img:first-of-type {
|
57 |
+
float: left !important;
|
58 |
+
}
|
59 |
+
|
60 |
+
.wc-stripe_cc-new-method-container {
|
61 |
+
margin-bottom: 1em;
|
62 |
+
}
|
63 |
+
|
64 |
+
.wc-stripe_cc-container .StripeElement {
|
65 |
+
box-sizing: border-box;
|
66 |
+
height: 40px;
|
67 |
+
padding: 10px 12px;
|
68 |
+
border-radius: 4px;
|
69 |
+
background-color: white;
|
70 |
+
-webkit-transition: box-shadow 150ms ease;
|
71 |
+
transition: box-shadow 150ms ease;
|
72 |
+
}
|
73 |
+
|
74 |
+
input.wc-stripe-payment-type,
|
75 |
+
input.wc-stripe-klarna-category {
|
76 |
+
display: none !important;
|
77 |
+
}
|
78 |
+
|
79 |
+
body .wfacp_main_form.woocommerce .wc-stripe-save-source label.checkbox {
|
80 |
+
padding: 0 !important;
|
81 |
+
}
|
82 |
+
|
83 |
+
label.wc-stripe-label-payment-type,
|
84 |
+
input[type=radio] + label.wc-stripe-label-payment-type,
|
85 |
+
label.wc-stripe-label-klarna-category {
|
86 |
+
margin-bottom: 1em;
|
87 |
+
display: block;
|
88 |
+
padding: 0 !important;
|
89 |
+
color: #000;
|
90 |
+
}
|
91 |
+
|
92 |
+
.theme-flatsome div.wc-stripe-saved-methods-container {
|
93 |
+
margin: 0 0 1em 0;
|
94 |
+
}
|
95 |
+
|
96 |
+
label.wc-stripe-label-payment-type:before,
|
97 |
+
label.wc-stripe-label-klarna-category:before {
|
98 |
+
content: "";
|
99 |
+
display: inline-block;
|
100 |
+
width: 11px;
|
101 |
+
height: 11px;
|
102 |
+
border: 2px solid #fff;
|
103 |
+
box-shadow: 0 0 0 2px #000;
|
104 |
+
background: #fff;
|
105 |
+
margin-right: 4px;
|
106 |
+
margin-left: .5em;
|
107 |
+
border-radius: 100%;
|
108 |
+
-webkit-transform: translateY(2px);
|
109 |
+
-ms-transform: translateY(2px);
|
110 |
+
transform: translateY(2px);
|
111 |
+
}
|
112 |
+
|
113 |
+
input.wc-stripe-payment-type:checked + label.wc-stripe-label-payment-type:before,
|
114 |
+
input.wc-stripe-klarna-category:checked + label.wc-stripe-label-klarna-category:before {
|
115 |
+
background: #000;
|
116 |
+
}
|
117 |
+
|
118 |
+
label.wc-stripe-label-payment-type:after {
|
119 |
+
content: none !important;
|
120 |
+
display: none !important;
|
121 |
+
}
|
122 |
+
|
123 |
+
.wc-stripe-saved-methods-container .select2-container .select2-selection--single .wc-stripe-select2-container,
|
124 |
+
.select2-results__options li.wc-stripe-select2-container {
|
125 |
+
display: flex;
|
126 |
+
align-items: center;
|
127 |
+
height: 42px;
|
128 |
+
line-height: 42px !important;
|
129 |
+
}
|
130 |
+
|
131 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container:before,
|
132 |
+
.select2-results__options li.wc-stripe-select2-container:before {
|
133 |
+
content: '';
|
134 |
+
background-repeat: no-repeat;
|
135 |
+
background-size: 40px 24px;
|
136 |
+
width: 40px;
|
137 |
+
height: 42px;
|
138 |
+
display: inline-block;
|
139 |
+
margin-left: 8px;
|
140 |
+
background-position: center;
|
141 |
+
}
|
142 |
+
|
143 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.visa:before,
|
144 |
+
.select2-results__options li.wc-stripe-select2-container.visa:before,
|
145 |
+
.select2-results__options li.wc-stripe-select2-container.visa:before {
|
146 |
+
background-image: url(../img/cards/visa.svg);
|
147 |
+
}
|
148 |
+
|
149 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.mastercard:before,
|
150 |
+
.select2-results__options li.wc-stripe-select2-container.mastercard:before,
|
151 |
+
.select2-results__options li.wc-stripe-select2-container.mastercard:before {
|
152 |
+
background-image: url(../img/cards/mastercard.svg);
|
153 |
+
}
|
154 |
+
|
155 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.americanexpress:before,
|
156 |
+
.select2-results__options li.wc-stripe-select2-container.americanexpress:before,
|
157 |
+
.select2-results__options li.wc-stripe-select2-container.americanexpress:before {
|
158 |
+
background-image: url(../img/cards/amex.svg);
|
159 |
+
}
|
160 |
+
|
161 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.amex:before,
|
162 |
+
.select2-results__options li.wc-stripe-select2-container.amex:before,
|
163 |
+
.select2-results__options li.wc-stripe-select2-container.amex:before {
|
164 |
+
background-image: url(../img/cards/amex.svg);
|
165 |
+
}
|
166 |
+
|
167 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.discover:before,
|
168 |
+
.select2-results__options li.wc-stripe-select2-container.discover:before,
|
169 |
+
.select2-results__options li.wc-stripe-select2-container.discover:before {
|
170 |
+
background-image: url(../img/cards/discover.svg);
|
171 |
+
}
|
172 |
+
|
173 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.mastercard:before,
|
174 |
+
.select2-results__options li.wc-stripe-select2-container.mastercard:before,
|
175 |
+
.select2-results__options li.wc-stripe-select2-container.mastercard:before {
|
176 |
+
background-image: url(../img/cards/mastercard.svg);
|
177 |
+
}
|
178 |
+
|
179 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.dinersclub:before,
|
180 |
+
.select2-results__options li.wc-stripe-select2-container.dinersclub:before,
|
181 |
+
.select2-results__options li.wc-stripe-select2-container.dinersclub:before {
|
182 |
+
background-image: url(../img/cards/diners.svg);
|
183 |
+
}
|
184 |
+
|
185 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.diners:before,
|
186 |
+
.select2-results__options li.wc-stripe-select2-container.diners:before,
|
187 |
+
.select2-results__options li.wc-stripe-select2-container.diners:before {
|
188 |
+
background-image: url(../img/cards/diners.svg);
|
189 |
+
}
|
190 |
+
|
191 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.jcb:before,
|
192 |
+
.select2-results__options li.wc-stripe-select2-container.jcb:before,
|
193 |
+
.select2-results__options li.wc-stripe-select2-container.jcb:before {
|
194 |
+
background-image: url(../img/cards/jcb.svg);
|
195 |
+
}
|
196 |
+
|
197 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.stripe_sepa:before,
|
198 |
+
.select2-results__options li.wc-stripe-select2-container.stripe_sepa:before,
|
199 |
+
.select2-results__options li.wc-stripe-select2-container.stripe_sepa:before {
|
200 |
+
background-image: url(../img/sepa.svg);
|
201 |
+
}
|
202 |
+
|
203 |
+
.select2-results__options li.wc-stripe-select2-container.wc-stripe-ach:before {
|
204 |
+
display: none;
|
205 |
+
}
|
206 |
+
|
207 |
+
#wc-stripe-card-element {
|
208 |
+
margin-bottom: 1em;
|
209 |
+
}
|
210 |
+
|
211 |
+
.wc-stripe_cc-container .wc-stripe-save-source .save-source-label {
|
212 |
+
display: block;
|
213 |
+
margin-top: 10px;
|
214 |
+
}
|
215 |
+
|
216 |
+
.wc-stripe_cc-container .wc-stripe-save-source input[type="checkbox"] {
|
217 |
+
opacity: 0;
|
218 |
+
position: absolute;
|
219 |
+
width: 20px;
|
220 |
+
height: 20px;
|
221 |
+
}
|
222 |
+
|
223 |
+
.wc-stripe_cc-container .wc-stripe-save-source label.checkbox {
|
224 |
+
position: relative;
|
225 |
+
}
|
226 |
+
|
227 |
+
.wc-stripe_cc-container .save-source-checkbox {
|
228 |
+
height: 20px;
|
229 |
+
width: 20px;
|
230 |
+
position: relative;
|
231 |
+
background-color: white;
|
232 |
+
display: block;
|
233 |
+
border-radius: 3px;
|
234 |
+
border: 1px solid #bababa;
|
235 |
+
}
|
236 |
+
|
237 |
+
.wc-stripe_cc-container .save-source-checkbox:after {
|
238 |
+
content: "";
|
239 |
+
position: absolute;
|
240 |
+
top: 0;
|
241 |
+
right: 0;
|
242 |
+
}
|
243 |
+
|
244 |
+
.wc-stripe_cc-container .wc-stripe-save-source input[type="checkbox"]:checked + .save-source-checkbox:after {
|
245 |
+
right: 6px;
|
246 |
+
top: 2px;
|
247 |
+
width: 7px;
|
248 |
+
height: 12px;
|
249 |
+
border: solid #2196F3;
|
250 |
+
border-width: 0 0 3px 3px;
|
251 |
+
-webkit-transform: rotate(-45deg);
|
252 |
+
-ms-transform: rotate(-45deg);
|
253 |
+
transform: rotate(-45deg);
|
254 |
+
-webkit-box-sizing: border-box;
|
255 |
+
-moz-box-sizing: border-box;
|
256 |
+
box-sizing: border-box
|
257 |
+
}
|
258 |
+
|
259 |
+
li.payment_method_stripe_googlepay,
|
260 |
+
li.payment_method_stripe_applepay,
|
261 |
+
li.payment_method_stripe_payment_request {
|
262 |
+
display: none;
|
263 |
+
}
|
264 |
+
|
265 |
+
#place_order.wc-stripe-hide,
|
266 |
+
#payment #place_order.wc-stripe-hide,
|
267 |
+
.woocommerce-checkout-review-order #payment #place_order.wc-stripe-hide{
|
268 |
+
position: absolute !important;
|
269 |
+
z-index: -1000 !important;
|
270 |
+
height: 0 !important;
|
271 |
+
padding: 0 !important;
|
272 |
+
opacity: 0 !important;
|
273 |
+
}
|
274 |
+
|
275 |
+
.wc-stripe-product-checkout-container {
|
276 |
+
display: none;
|
277 |
+
width: 100%;
|
278 |
+
}
|
279 |
+
|
280 |
+
.wc-stripe-product-checkout-container.bottom {
|
281 |
+
margin-top: 1em;
|
282 |
+
}
|
283 |
+
|
284 |
+
.wc-stripe-product-checkout-container.top {
|
285 |
+
margin-bottom: 1em;
|
286 |
+
}
|
287 |
+
|
288 |
+
.wc-stripe-product-checkout-container.active {
|
289 |
+
display: block;
|
290 |
+
}
|
291 |
+
|
292 |
+
.wc-stripe-product-checkout-container ul.wc_stripe_product_payment_methods,
|
293 |
+
.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods {
|
294 |
+
list-style: none;
|
295 |
+
margin: 0px;
|
296 |
+
padding: 0px;
|
297 |
+
}
|
298 |
+
|
299 |
+
.wc-stripe-cart-checkout-container {
|
300 |
+
margin: 0;
|
301 |
+
padding: 0;
|
302 |
+
clear: both;
|
303 |
+
}
|
304 |
+
|
305 |
+
.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods {
|
306 |
+
margin-bottom: 1.5em;
|
307 |
+
}
|
308 |
+
|
309 |
+
.wc-stripe-product-checkout-container ul.wc_stripe_product_payment_methods li[class*=payment_method_stripe_],
|
310 |
+
.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods li[class*=payment_method_stripe_] {
|
311 |
+
margin: 0 0 1em 0;
|
312 |
+
}
|
313 |
+
|
314 |
+
.wc_stripe_product_payment_methods .gpay-button,
|
315 |
+
.wc_stripe_cart_payment_methods .gpay-button {
|
316 |
+
width: 100% !important;
|
317 |
+
margin: 0;
|
318 |
+
}
|
319 |
+
|
320 |
+
.wc_stripe_product_payment_methods .disabled {
|
321 |
+
opacity: 0.45;
|
322 |
+
}
|
323 |
+
|
324 |
+
.woocommerce-cart .stripe_cart_gateway_active .wc-proceed-to-checkout .checkout-button,
|
325 |
+
.stripe_cart_gateway_active .checkout-button {
|
326 |
+
margin-bottom: 0px;
|
327 |
+
}
|
328 |
+
|
329 |
+
.wc-stripe-cart-or {
|
330 |
+
margin: 1em 0;
|
331 |
+
text-align: center;
|
332 |
+
}
|
333 |
+
|
334 |
+
li.wc-stripe-payment-method.or {
|
335 |
+
display: none;
|
336 |
+
}
|
337 |
+
|
338 |
+
.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or {
|
339 |
+
display: block;
|
340 |
+
margin: 15px 0;
|
341 |
+
}
|
342 |
+
|
343 |
+
.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or p {
|
344 |
+
margin: 0;
|
345 |
+
}
|
346 |
+
|
347 |
+
li[class*=payment_method_stripe_].active ~ li.wc-stripe-payment-method.or {
|
348 |
+
display: block;
|
349 |
+
margin: 0;
|
350 |
+
}
|
351 |
+
|
352 |
+
li.payment_method_stripe_applepay label:first-of-type img {
|
353 |
+
width: 49px;
|
354 |
+
max-height: 32px;
|
355 |
+
}
|
356 |
+
|
357 |
+
li.payment_method_stripe_googlepay label:first-of-type img {
|
358 |
+
width: 48px;
|
359 |
+
max-height: 35px;
|
360 |
+
}
|
361 |
+
|
362 |
+
li.payment_method_stripe_googlepay label:first-of-type img[src*=googlepay_standard] {
|
363 |
+
width: 60px;
|
364 |
+
max-height: 35px;
|
365 |
+
}
|
366 |
+
|
367 |
+
li.payment_method_stripe_ach label:first-of-type img {
|
368 |
+
width: 32px;
|
369 |
+
height: 32px;
|
370 |
+
min-width: 32px;
|
371 |
+
min-height: 32px;
|
372 |
+
}
|
373 |
+
|
374 |
+
.gpay-button:hover {
|
375 |
+
background-origin: content-box;
|
376 |
+
background-position: center center;
|
377 |
+
background-repeat: no-repeat;
|
378 |
+
background-size: contain;
|
379 |
+
}
|
380 |
+
|
381 |
+
.gpay-button:active {
|
382 |
+
background-origin: content-box;
|
383 |
+
background-position: center center;
|
384 |
+
background-repeat: no-repeat;
|
385 |
+
background-size: contain;
|
386 |
+
}
|
387 |
+
|
388 |
+
.gpay-button:focus {
|
389 |
+
background-origin: content-box;
|
390 |
+
background-position: center center;
|
391 |
+
background-repeat: no-repeat;
|
392 |
+
background-size: contain;
|
393 |
+
}
|
394 |
+
|
395 |
+
@supports (-webkit-appearance: -apple-pay-button) {
|
396 |
+
.apple-pay-button {
|
397 |
+
display: block;
|
398 |
+
-webkit-appearance: -apple-pay-button;
|
399 |
+
width: 100%;
|
400 |
+
max-width: 100%;
|
401 |
+
min-width: 200px;
|
402 |
+
height: 40px;
|
403 |
+
max-height: 40px;
|
404 |
+
}
|
405 |
+
|
406 |
+
.apple-pay-button-black {
|
407 |
+
-apple-pay-button-style: black;
|
408 |
+
}
|
409 |
+
|
410 |
+
.apple-pay-button-white {
|
411 |
+
-apple-pay-button-style: white;
|
412 |
+
}
|
413 |
+
|
414 |
+
.apple-pay-button-white-with-line {
|
415 |
+
-apple-pay-button-style: white-outline;
|
416 |
+
}
|
417 |
+
|
418 |
+
.applepay-top-container .apple-pay-button {
|
419 |
+
max-width: 240px;
|
420 |
+
}
|
421 |
+
|
422 |
+
.woocommerce-checkout-payment .apple-pay-button {
|
423 |
+
max-width: 240px;
|
424 |
+
}
|
425 |
+
|
426 |
+
body.single-product div.product form.cart .wc_stripe_product_payment_methods .apple-pay-button{
|
427 |
+
max-width: 100%;
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
.wc-stripe-banner-checkout {
|
432 |
+
display: none;
|
433 |
+
padding: 20px 15px 0 15px;
|
434 |
+
border: 1px solid #d1d1d1;
|
435 |
+
border-width: 0 0 1px;
|
436 |
+
position: relative;
|
437 |
+
margin: 1em 0;
|
438 |
+
|
439 |
+
}
|
440 |
+
|
441 |
+
.wc-stripe-banner-checkout.active {
|
442 |
+
display: block;
|
443 |
+
}
|
444 |
+
|
445 |
+
.wc-stripe-banner-checkout span.banner-title {
|
446 |
+
position: absolute;
|
447 |
+
display: flex;
|
448 |
+
align-items: center;
|
449 |
+
top: -13px;
|
450 |
+
left: 0;
|
451 |
+
right: 0;
|
452 |
+
background: transparent;
|
453 |
+
white-space: nowrap;
|
454 |
+
font-size: 16px;
|
455 |
+
}
|
456 |
+
|
457 |
+
.wc-stripe-banner-checkout span.banner-title:before,
|
458 |
+
.wc-stripe-banner-checkout span.banner-title:after {
|
459 |
+
content: ' ';
|
460 |
+
height: 1px;
|
461 |
+
background: #d1d1d1;
|
462 |
+
display: block;
|
463 |
+
width: 50%;
|
464 |
+
}
|
465 |
+
|
466 |
+
.wc-stripe-banner-checkout span.banner-title:before {
|
467 |
+
margin-left: 8px;
|
468 |
+
}
|
469 |
+
|
470 |
+
.wc-stripe-banner-checkout span.banner-title:after {
|
471 |
+
margin-right: 8px;
|
472 |
+
}
|
473 |
+
|
474 |
+
.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways {
|
475 |
+
list-style: none;
|
476 |
+
margin: 0;
|
477 |
+
padding: 0;
|
478 |
+
}
|
479 |
+
|
480 |
+
.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway {
|
481 |
+
margin: 0 0 20px 0;
|
482 |
+
display: none;
|
483 |
+
}
|
484 |
+
|
485 |
+
.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway .gpay-button {
|
486 |
+
margin: 0;
|
487 |
+
}
|
488 |
+
|
489 |
+
.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways .gpay-button {
|
490 |
+
width: 100%;
|
491 |
+
}
|
492 |
+
|
493 |
+
.wc_stripe_product_payment_methods .payment_method_stripe_payment_request .StripeElement,
|
494 |
+
.wc_stripe_cart_payment_methods .payment_method_stripe_payment_request .StripeElement {
|
495 |
+
padding: 0px;
|
496 |
+
width: 100%;
|
497 |
+
}
|
498 |
+
|
499 |
+
.woocommerce-checkout #wc-stripe-payment-request-container.StripeElement {
|
500 |
+
width: 240px;
|
501 |
+
padding: 0px;
|
502 |
+
}
|
503 |
+
|
504 |
+
.wc-stripe-checkout-banner-gateway #wc-stripe-payment-request-banner.StripeElement {
|
505 |
+
width: 100%;
|
506 |
+
}
|
507 |
+
|
508 |
+
ul.payment_methods li.payment_method_stripe_p24 img {
|
509 |
+
max-width: 90px;
|
510 |
+
width: 90px;
|
511 |
+
max-height: 45px;
|
512 |
+
}
|
513 |
+
|
514 |
+
ul.payment_methods li.payment_method_stripe_ideal img {
|
515 |
+
max-width: 38px;
|
516 |
+
width: 38px;
|
517 |
+
max-height: 35px;
|
518 |
+
}
|
519 |
+
|
520 |
+
ul.payment_methods li.payment_method_stripe_fpx img {
|
521 |
+
max-width: 75px;
|
522 |
+
width: 75px;
|
523 |
+
max-height: 25px;
|
524 |
+
}
|
525 |
+
|
526 |
+
ul.payment_methods li.payment_method_stripe_klarna img {
|
527 |
+
max-width: 72px;
|
528 |
+
width: 72px;
|
529 |
+
max-height: 20px;
|
530 |
+
}
|
531 |
+
|
532 |
+
ul.payment_methods li.payment_method_stripe_giropay img {
|
533 |
+
max-width: 65px;
|
534 |
+
width: 65px;
|
535 |
+
max-height: 28px;
|
536 |
+
}
|
537 |
+
|
538 |
+
ul.payment_methods li.payment_method_stripe_eps img {
|
539 |
+
max-width: 70px;
|
540 |
+
width: 70px;
|
541 |
+
max-height: 46px;
|
542 |
+
}
|
543 |
+
|
544 |
+
ul.payment_methods li.payment_method_stripe_multibanco img {
|
545 |
+
max-width: 48px;
|
546 |
+
width: 48px;
|
547 |
+
max-height: 48px;
|
548 |
+
}
|
549 |
+
|
550 |
+
ul.payment_methods li.payment_method_stripe_sepa img {
|
551 |
+
max-width: 67px;
|
552 |
+
width: 67px;
|
553 |
+
max-height: 18px;
|
554 |
+
}
|
555 |
+
|
556 |
+
ul.payment_methods li.payment_method_stripe_sofort img {
|
557 |
+
max-width: 70px;
|
558 |
+
width: 70px;
|
559 |
+
max-height: 21px;
|
560 |
+
}
|
561 |
+
|
562 |
+
ul.payment_methods li.payment_method_stripe_bancontact img,
|
563 |
+
label[for=payment_method_stripe_bancontact] img {
|
564 |
+
width: 60px;
|
565 |
+
height: 42px;
|
566 |
+
max-width: 60px;
|
567 |
+
max-height: 42px;
|
568 |
+
}
|
569 |
+
|
570 |
+
ul.payment_methods li.payment_method_stripe_wechat label img {
|
571 |
+
max-width: 82px;
|
572 |
+
width: 82px;
|
573 |
+
max-height: 23px;
|
574 |
+
}
|
575 |
+
|
576 |
+
ul.payment_methods li.payment_method_stripe_alipay img {
|
577 |
+
max-width: 72px;
|
578 |
+
width: 72px;
|
579 |
+
height: 36px;
|
580 |
+
max-height: 36px;
|
581 |
+
}
|
582 |
+
|
583 |
+
ul.payment_methods li.payment_method_stripe_grabpay img {
|
584 |
+
max-width: 95px;
|
585 |
+
width: 95px;
|
586 |
+
max-height: 28px;
|
587 |
+
}
|
588 |
+
|
589 |
+
#wc-stripe-card-element {
|
590 |
+
width: 100%;
|
591 |
+
}
|
592 |
+
|
593 |
+
li.banner_payment_method_stripe_payment_request .StripeElement {
|
594 |
+
padding: 0px;
|
595 |
+
}
|
596 |
+
|
597 |
+
.single-product .blockMsg {
|
598 |
+
border: none !important;
|
599 |
+
background-color: transparent !important;
|
600 |
+
}
|
601 |
+
|
602 |
+
#wc-stripe-card {
|
603 |
+
position: absolute !important;
|
604 |
+
top: 50%;
|
605 |
+
left: 8px;
|
606 |
+
transform: translatey(-50%);
|
607 |
+
width: 23px;
|
608 |
+
height: 15px;
|
609 |
+
padding: 0px;
|
610 |
+
border: none;
|
611 |
+
}
|
612 |
+
|
613 |
+
#wc-stripe-card.active {
|
614 |
+
width: 32px;
|
615 |
+
height: 20px;
|
616 |
+
}
|
617 |
+
|
618 |
+
input[id=stripe-postal-code]:focus {
|
619 |
+
outline: none;
|
620 |
+
background: transparent;
|
621 |
+
border: none;
|
622 |
+
box-shadow: none;
|
623 |
+
}
|
624 |
+
|
625 |
+
div.postalCode:focus {
|
626 |
+
outline: none;
|
627 |
+
border: none;
|
628 |
+
}
|
629 |
+
|
630 |
+
li[class*="payment_method_stripe"] .select2-container .select2-selection--single {
|
631 |
+
height: 42px;
|
632 |
+
padding: 0 5px;
|
633 |
+
}
|
634 |
+
|
635 |
+
li[class*="payment_method_stripe"] .select2-container--default .select2-selection--single .select2-selection__arrow {
|
636 |
+
height: 42px;
|
637 |
+
top: 1px;
|
638 |
+
left: 1px;
|
639 |
+
}
|
640 |
+
|
641 |
+
.blockUI.blockMsg {
|
642 |
+
font-size: 20px;
|
643 |
+
white-space: nowrap;
|
644 |
+
}
|
645 |
+
|
646 |
+
#wc-stripe-payment-request-container.disabled {
|
647 |
+
opactity: 0.45;
|
648 |
+
}
|
649 |
+
|
650 |
+
.wc-stripe-paymentRequest-icons-container img {
|
651 |
+
float: none;
|
652 |
+
}
|
653 |
+
|
654 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.wc-stripe-ach:before {
|
655 |
+
display: none;
|
656 |
+
}
|
657 |
+
|
658 |
+
ul.wc_stripe_cart_payment_methods li.wc-stripe-payment-method button,
|
659 |
+
ul.wc_stripe_product_payment_methods li[class*=payment_method_stripe_] button,
|
660 |
+
ul.wc_stripe_checkout_banner_gateways li button {
|
661 |
+
margin: 0;
|
662 |
+
}
|
663 |
+
|
664 |
+
ul.payment_methods li[class*=payment_method] {
|
665 |
+
margin: 0;
|
666 |
+
padding: 10px 0;
|
667 |
+
}
|
668 |
+
|
669 |
+
ul.payment_methods li[class*=payment_method] input[name=payment_method] {
|
670 |
+
margin: 0 5px 0 10px;
|
671 |
+
float: none;
|
672 |
+
}
|
673 |
+
|
674 |
+
ul.payment_methods li[class*=payment_method] > input[name=payment_method] + label {
|
675 |
+
padding-top: 0;
|
676 |
+
padding-left: 0;
|
677 |
+
padding-bottom: 0;
|
678 |
+
}
|
679 |
+
|
680 |
+
ul.payment_methods {
|
681 |
+
list-style: none;
|
682 |
+
}
|
683 |
+
|
684 |
+
ul.payment_methods li[class*=payment_method_stripe_] .wc-stripe_cc-new-method-container label:before {
|
685 |
+
display: none;
|
686 |
+
}
|
687 |
+
|
688 |
+
.wc-stripe_cc-container .wc-stripe-save-source label.checkbox {
|
689 |
+
padding: 0 !important;
|
690 |
+
margin: 0px;
|
691 |
+
}
|
692 |
+
|
693 |
+
.wc-stripe_cc-container .wc-stripe-save-source .save-source-label {
|
694 |
+
padding: 0;
|
695 |
+
margin-bottom: 5px;
|
696 |
+
}
|
697 |
+
|
698 |
+
div[id*=wc_stripe_local_payment_stripe_].StripeElement {
|
699 |
+
border: 1px solid #eee;
|
700 |
+
border-radius: 4px;
|
701 |
+
}
|
702 |
+
|
703 |
+
.qrcode-message {
|
704 |
+
margin: 10px 0 0 0;
|
705 |
+
}
|
706 |
+
|
707 |
+
#wc_stripe_local_payment_stripe_sepa,
|
708 |
+
#wc_stripe_local_payment_stripe_becs {
|
709 |
+
padding: 10px 12px;
|
710 |
+
box-shadow: 0 1px 3px 0 #e6ebf1;
|
711 |
+
}
|
712 |
+
|
713 |
+
.wc-stripe-local-desc.stripe_sepa,
|
714 |
+
.wc-stripe-local-desc.stripe_becs {
|
715 |
+
margin: 10px 0;
|
716 |
+
}
|
717 |
+
|
718 |
+
.wc-stripe-clear {
|
719 |
+
clear: both;
|
720 |
+
height: 0;
|
721 |
+
visibility: hidden;
|
722 |
+
}
|
723 |
+
|
724 |
+
.wc-stripe-gateway-desc p {
|
725 |
+
margin: 0;
|
726 |
+
}
|
727 |
+
|
728 |
+
div.payment_method_stripe_cc,
|
729 |
+
div.payment_method_stripe_sepa,
|
730 |
+
div.payment_method_stripe_ideal,
|
731 |
+
div.payment_method_stripe_fpx,
|
732 |
+
#wc_stripe_local_payment_stripe_klarna,
|
733 |
+
li[class*=payment_method_stripe_] div.wc-stripe_googlepay-container.has_tokens,
|
734 |
+
li[class*=payment_method_stripe_] div.wc-stripe_applepay-container.has_tokens,
|
735 |
+
li[class*=payment_method_stripe_] div.wc-stripe_payment_request-container.has_tokens {
|
736 |
+
margin-top: 10px;
|
737 |
+
}
|
738 |
+
|
739 |
+
.wc-stripe-gateway-desc {
|
740 |
+
margin-top: 10px;
|
741 |
+
}
|
742 |
+
|
743 |
+
#wc-stripe-card-element.StripeElement--webkit-autofill {
|
744 |
+
background-color: transparent !important;
|
745 |
+
}
|
746 |
+
|
747 |
+
#wc_stripe_local_payment_stripe_klarna .stripe-klarna-categories {
|
748 |
+
list-style: none;
|
749 |
+
margin: 0;
|
750 |
+
padding: 10px;
|
751 |
+
}
|
752 |
+
|
753 |
+
li.payment_method_stripe_klarna,
|
754 |
+
li.payment_method_stripe_alipay,
|
755 |
+
li.payment_method_stripe_bancontact,
|
756 |
+
li.payment_method_stripe_becs,
|
757 |
+
li.payment_method_stripe_eps,
|
758 |
+
li.payment_method_stripe_fpx,
|
759 |
+
li.payment_method_stripe_giropay,
|
760 |
+
li.payment_method_stripe_ideal,
|
761 |
+
li.payment_method_stripe_multibanco,
|
762 |
+
li.payment_method_stripe_p24,
|
763 |
+
li.payment_method_stripe_sepa,
|
764 |
+
li.payment_method_stripe_sofort,
|
765 |
+
li.payment_method_stripe_wechat {
|
766 |
+
display: none;
|
767 |
+
}
|
768 |
+
|
769 |
+
.widget_shopping_cart_content .wc-stripe-mini-cart-payment-methods{
|
770 |
+
list-style: none;
|
771 |
+
margin: 0;
|
772 |
+
padding: 0;
|
773 |
+
}
|
774 |
+
.widget_shopping_cart_content .wc-stripe-mini-cart-payment-methods li{
|
775 |
+
margin: 0;
|
776 |
+
}
|
777 |
+
|
778 |
+
.widget_shopping_cart_content a.wc-stripe-gpay-mini-cart,
|
779 |
+
.widget_shopping_cart_content a.wc-stripe-applepay-mini-cart,
|
780 |
+
.widget_shopping_cart_content a.wc-stripe-payment-request-mini-cart{
|
781 |
+
background: transparent;
|
782 |
+
padding: 0;
|
783 |
+
border: none;
|
784 |
+
}
|
785 |
+
a.wc-stripe-gpay-mini-cart .gpay-button,
|
786 |
+
a.wc-stripe-applepay-mini-cart .apple-pay-button{
|
787 |
+
width: 100%;
|
788 |
+
margin: 0;
|
789 |
+
}
|
790 |
+
.wc-stripe-payment-request-mini-cart.StripeElement{
|
791 |
+
padding: 0;
|
792 |
+
background: transparent;
|
793 |
+
border: none;
|
794 |
+
width: 100%;
|
795 |
+
}
|
796 |
+
.wc-stripe-payment-request-mini-cart.StripeElement .__PrivateStripeElement{
|
797 |
+
width: 100%;
|
798 |
+
}
|
799 |
+
|
800 |
+
.widget_shopping_cart_content .wc-stripe-overlay{
|
801 |
+
display: none !important;
|
802 |
+
position: absolute;
|
803 |
+
background: rgba(255, 255, 255, 0.75);
|
804 |
+
height: 100%;
|
805 |
+
width: 100%;
|
806 |
+
z-index: -1;
|
807 |
+
}
|
808 |
+
.widget_shopping_cart_content .wc-stripe-overlay.active{
|
809 |
+
display: block !important;
|
810 |
+
z-index: 9999;
|
811 |
+
}
|
assets/css/stripe.min-rtl.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.wc-stripe-card-icons-container,.wc-stripe-paymentRequest-icons-container{float:left;display:inline-block}ul.payment_methods li[class*=payment_method]{margin:0;padding:0}li[class*=payment_method] input[type=radio]{margin:0 5px 0 10px}li[class*=payment_method] input[type=radio]+label:not(.wc-stripe-label-payment-type){margin:0}.woocommerce-checkout #payment ul.payment_methods li[class*=payment_method_stripe_]:nth-child(n+2),ul.payment_methods li[class*=payment_method_stripe_]:nth-child(n+2){margin:0}li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon,li.payment_method_stripe_payment_request .wc-stripe-paymentRequest-icons-container img{max-width:44px;max-height:27px;width:44px;height:27px;float:none;display:inline}li.payment_method_stripe_payment_request .wc-stripe-paymentRequest-icons-container img{width:25px;height:25px;max-width:25px;max-height:25px}ul.payment_methods label[for*=payment_method_stripe]:after{clear:left;content:"";display:block}li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon:nth-child(2n+2){margin:0 2px}li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon.open.visa{padding-top:2px}ul.payment_methods li[class*=payment_method_stripe_] label>img:first-of-type{float:left!important}.wc-stripe_cc-new-method-container{margin-bottom:1em}.wc-stripe_cc-container .StripeElement{box-sizing:border-box;height:40px;padding:10px 12px;border-radius:4px;background-color:#fff;-webkit-transition:box-shadow 150ms ease;transition:box-shadow 150ms ease}input.wc-stripe-klarna-category,input.wc-stripe-payment-type{display:none!important}body .wfacp_main_form.woocommerce .wc-stripe-save-source label.checkbox{padding:0!important}input[type=radio]+label.wc-stripe-label-payment-type,label.wc-stripe-label-klarna-category,label.wc-stripe-label-payment-type{margin-bottom:1em;display:block;padding:0!important;color:#000}.theme-flatsome div.wc-stripe-saved-methods-container{margin:0 0 1em 0}label.wc-stripe-label-klarna-category:before,label.wc-stripe-label-payment-type:before{content:"";display:inline-block;width:11px;height:11px;border:2px solid #fff;box-shadow:0 0 0 2px #000;background:#fff;margin-right:4px;margin-left:.5em;border-radius:100%;-webkit-transform:translateY(2px);-ms-transform:translateY(2px);transform:translateY(2px)}input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:before,input.wc-stripe-payment-type:checked+label.wc-stripe-label-payment-type:before{background:#000}label.wc-stripe-label-payment-type:after{content:none!important;display:none!important}.select2-results__options li.wc-stripe-select2-container,.wc-stripe-saved-methods-container .select2-container .select2-selection--single .wc-stripe-select2-container{display:flex;align-items:center;height:42px;line-height:42px!important}.select2-container .select2-selection--single .wc-stripe-select2-container:before,.select2-results__options li.wc-stripe-select2-container:before{content:'';background-repeat:no-repeat;background-size:40px 24px;width:40px;height:42px;display:inline-block;margin-left:8px;background-position:center}.select2-container .select2-selection--single .wc-stripe-select2-container.visa:before,.select2-results__options li.wc-stripe-select2-container.visa:before{background-image:url(../img/cards/visa.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.mastercard:before,.select2-results__options li.wc-stripe-select2-container.mastercard:before{background-image:url(../img/cards/mastercard.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.americanexpress:before,.select2-results__options li.wc-stripe-select2-container.americanexpress:before{background-image:url(../img/cards/amex.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.amex:before,.select2-results__options li.wc-stripe-select2-container.amex:before{background-image:url(../img/cards/amex.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.discover:before,.select2-results__options li.wc-stripe-select2-container.discover:before{background-image:url(../img/cards/discover.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.mastercard:before,.select2-results__options li.wc-stripe-select2-container.mastercard:before{background-image:url(../img/cards/mastercard.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.dinersclub:before,.select2-results__options li.wc-stripe-select2-container.dinersclub:before{background-image:url(../img/cards/diners.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.diners:before,.select2-results__options li.wc-stripe-select2-container.diners:before{background-image:url(../img/cards/diners.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.jcb:before,.select2-results__options li.wc-stripe-select2-container.jcb:before{background-image:url(../img/cards/jcb.svg)}.select2-container .select2-selection--single .wc-stripe-select2-container.stripe_sepa:before,.select2-results__options li.wc-stripe-select2-container.stripe_sepa:before{background-image:url(../img/sepa.svg)}.select2-results__options li.wc-stripe-select2-container.wc-stripe-ach:before{display:none}#wc-stripe-card-element{margin-bottom:1em}.wc-stripe_cc-container .wc-stripe-save-source .save-source-label{display:block;margin-top:10px}.wc-stripe_cc-container .wc-stripe-save-source input[type=checkbox]{opacity:0;position:absolute;width:20px;height:20px}.wc-stripe_cc-container .wc-stripe-save-source label.checkbox{position:relative}.wc-stripe_cc-container .save-source-checkbox{height:20px;width:20px;position:relative;background-color:#fff;display:block;border-radius:3px;border:1px solid #bababa}.wc-stripe_cc-container .save-source-checkbox:after{content:"";position:absolute;top:0;right:0}.wc-stripe_cc-container .wc-stripe-save-source input[type=checkbox]:checked+.save-source-checkbox:after{right:6px;top:2px;width:7px;height:12px;border:solid #2196f3;border-width:0 0 3px 3px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}li.payment_method_stripe_applepay,li.payment_method_stripe_googlepay,li.payment_method_stripe_payment_request{display:none}#payment #place_order.wc-stripe-hide,#place_order.wc-stripe-hide,.woocommerce-checkout-review-order #payment #place_order.wc-stripe-hide{position:absolute!important;z-index:-1000!important;height:0!important;padding:0!important;opacity:0!important}.wc-stripe-product-checkout-container{display:none;width:100%}.wc-stripe-product-checkout-container.bottom{margin-top:1em}.wc-stripe-product-checkout-container.top{margin-bottom:1em}.wc-stripe-product-checkout-container.active{display:block}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods,.wc-stripe-product-checkout-container ul.wc_stripe_product_payment_methods{list-style:none;margin:0;padding:0}.wc-stripe-cart-checkout-container{margin:0;padding:0;clear:both}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods{margin-bottom:1.5em}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods li[class*=payment_method_stripe_],.wc-stripe-product-checkout-container ul.wc_stripe_product_payment_methods li[class*=payment_method_stripe_]{margin:0 0 1em 0}.wc_stripe_cart_payment_methods .gpay-button,.wc_stripe_product_payment_methods .gpay-button{width:100%!important;margin:0}.wc_stripe_product_payment_methods .disabled{opacity:.45}.stripe_cart_gateway_active .checkout-button,.woocommerce-cart .stripe_cart_gateway_active .wc-proceed-to-checkout .checkout-button{margin-bottom:0}.wc-stripe-cart-or{margin:1em 0;text-align:center}li.wc-stripe-payment-method.or{display:none}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or{display:block;margin:15px 0}.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or p{margin:0}li[class*=payment_method_stripe_].active~li.wc-stripe-payment-method.or{display:block;margin:0}li.payment_method_stripe_applepay label:first-of-type img{width:49px;max-height:32px}li.payment_method_stripe_googlepay label:first-of-type img{width:48px;max-height:35px}li.payment_method_stripe_googlepay label:first-of-type img[src*=googlepay_standard]{width:60px;max-height:35px}li.payment_method_stripe_ach label:first-of-type img{width:32px;height:32px;min-width:32px;min-height:32px}.gpay-button:hover{background-origin:content-box;background-position:center center;background-repeat:no-repeat;background-size:contain}.gpay-button:active{background-origin:content-box;background-position:center center;background-repeat:no-repeat;background-size:contain}.gpay-button:focus{background-origin:content-box;background-position:center center;background-repeat:no-repeat;background-size:contain}@supports (-webkit-appearance:-apple-pay-button){.apple-pay-button{display:block;-webkit-appearance:-apple-pay-button;width:100%;max-width:100%;min-width:200px;height:40px;max-height:40px}.apple-pay-button-black{-apple-pay-button-style:#000}.apple-pay-button-white{-apple-pay-button-style:#fff}.apple-pay-button-white-with-line{-apple-pay-button-style:white-outline}.applepay-top-container .apple-pay-button{max-width:240px}.woocommerce-checkout-payment .apple-pay-button{max-width:240px}body.single-product div.product form.cart .wc_stripe_product_payment_methods .apple-pay-button{max-width:100%}}.wc-stripe-banner-checkout{display:none;padding:20px 15px 0 15px;border:1px solid #d1d1d1;border-width:0 0 1px;position:relative;margin:1em 0}.wc-stripe-banner-checkout.active{display:block}.wc-stripe-banner-checkout span.banner-title{position:absolute;display:flex;align-items:center;top:-13px;left:0;right:0;background:0 0;white-space:nowrap;font-size:16px}.wc-stripe-banner-checkout span.banner-title:after,.wc-stripe-banner-checkout span.banner-title:before{content:' ';height:1px;background:#d1d1d1;display:block;width:50%}.wc-stripe-banner-checkout span.banner-title:before{margin-left:8px}.wc-stripe-banner-checkout span.banner-title:after{margin-right:8px}.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways{list-style:none;margin:0;padding:0}.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway{margin:0 0 20px 0;display:none}.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway .gpay-button{margin:0}.wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways .gpay-button{width:100%}.wc_stripe_cart_payment_methods .payment_method_stripe_payment_request .StripeElement,.wc_stripe_product_payment_methods .payment_method_stripe_payment_request .StripeElement{padding:0;width:100%}.woocommerce-checkout #wc-stripe-payment-request-container.StripeElement{width:240px;padding:0}.wc-stripe-checkout-banner-gateway #wc-stripe-payment-request-banner.StripeElement{width:100%}ul.payment_methods li.payment_method_stripe_p24 img{max-width:90px;width:90px;max-height:45px}ul.payment_methods li.payment_method_stripe_ideal img{max-width:38px;width:38px;max-height:35px}ul.payment_methods li.payment_method_stripe_fpx img{max-width:75px;width:75px;max-height:25px}ul.payment_methods li.payment_method_stripe_klarna img{max-width:72px;width:72px;max-height:20px}ul.payment_methods li.payment_method_stripe_giropay img{max-width:65px;width:65px;max-height:28px}ul.payment_methods li.payment_method_stripe_eps img{max-width:70px;width:70px;max-height:46px}ul.payment_methods li.payment_method_stripe_multibanco img{max-width:48px;width:48px;max-height:48px}ul.payment_methods li.payment_method_stripe_sepa img{max-width:67px;width:67px;max-height:18px}ul.payment_methods li.payment_method_stripe_sofort img{max-width:70px;width:70px;max-height:21px}label[for=payment_method_stripe_bancontact] img,ul.payment_methods li.payment_method_stripe_bancontact img{width:60px;height:42px;max-width:60px;max-height:42px}ul.payment_methods li.payment_method_stripe_wechat label img{max-width:82px;width:82px;max-height:23px}ul.payment_methods li.payment_method_stripe_alipay img{max-width:72px;width:72px;height:36px;max-height:36px}ul.payment_methods li.payment_method_stripe_grabpay img{max-width:95px;width:95px;max-height:28px}#wc-stripe-card-element{width:100%}li.banner_payment_method_stripe_payment_request .StripeElement{padding:0}.single-product .blockMsg{border:none!important;background-color:transparent!important}#wc-stripe-card{position:absolute!important;top:50%;left:8px;transform:translatey(-50%);width:23px;height:15px;padding:0;border:none}#wc-stripe-card.active{width:32px;height:20px}input[id=stripe-postal-code]:focus{outline:0;background:0 0;border:none;box-shadow:none}div.postalCode:focus{outline:0;border:none}li[class*=payment_method_stripe] .select2-container .select2-selection--single{height:42px;padding:0 5px}li[class*=payment_method_stripe] .select2-container--default .select2-selection--single .select2-selection__arrow{height:42px;top:1px;left:1px}.blockUI.blockMsg{font-size:20px;white-space:nowrap}#wc-stripe-payment-request-container.disabled{opactity:.45}.wc-stripe-paymentRequest-icons-container img{float:none}.select2-container .select2-selection--single .wc-stripe-select2-container.wc-stripe-ach:before{display:none}ul.wc_stripe_cart_payment_methods li.wc-stripe-payment-method button,ul.wc_stripe_checkout_banner_gateways li button,ul.wc_stripe_product_payment_methods li[class*=payment_method_stripe_] button{margin:0}ul.payment_methods li[class*=payment_method]{margin:0;padding:10px 0}ul.payment_methods li[class*=payment_method] input[name=payment_method]{margin:0 5px 0 10px;float:none}ul.payment_methods li[class*=payment_method]>input[name=payment_method]+label{padding-top:0;padding-left:0;padding-bottom:0}ul.payment_methods{list-style:none}ul.payment_methods li[class*=payment_method_stripe_] .wc-stripe_cc-new-method-container label:before{display:none}.wc-stripe_cc-container .wc-stripe-save-source label.checkbox{padding:0!important;margin:0}.wc-stripe_cc-container .wc-stripe-save-source .save-source-label{padding:0;margin-bottom:5px}div[id*=wc_stripe_local_payment_stripe_].StripeElement{border:1px solid #eee;border-radius:4px}.qrcode-message{margin:10px 0 0 0}#wc_stripe_local_payment_stripe_becs,#wc_stripe_local_payment_stripe_sepa{padding:10px 12px;box-shadow:0 1px 3px 0 #e6ebf1}.wc-stripe-local-desc.stripe_becs,.wc-stripe-local-desc.stripe_sepa{margin:10px 0}.wc-stripe-clear{clear:both;height:0;visibility:hidden}.wc-stripe-gateway-desc p{margin:0}#wc_stripe_local_payment_stripe_klarna,div.payment_method_stripe_cc,div.payment_method_stripe_fpx,div.payment_method_stripe_ideal,div.payment_method_stripe_sepa,li[class*=payment_method_stripe_] div.wc-stripe_applepay-container.has_tokens,li[class*=payment_method_stripe_] div.wc-stripe_googlepay-container.has_tokens,li[class*=payment_method_stripe_] div.wc-stripe_payment_request-container.has_tokens{margin-top:10px}.wc-stripe-gateway-desc{margin-top:10px}#wc-stripe-card-element.StripeElement--webkit-autofill{background-color:transparent!important}#wc_stripe_local_payment_stripe_klarna .stripe-klarna-categories{list-style:none;margin:0;padding:10px}li.payment_method_stripe_alipay,li.payment_method_stripe_bancontact,li.payment_method_stripe_becs,li.payment_method_stripe_eps,li.payment_method_stripe_fpx,li.payment_method_stripe_giropay,li.payment_method_stripe_ideal,li.payment_method_stripe_klarna,li.payment_method_stripe_multibanco,li.payment_method_stripe_p24,li.payment_method_stripe_sepa,li.payment_method_stripe_sofort,li.payment_method_stripe_wechat{display:none}.widget_shopping_cart_content .wc-stripe-mini-cart-payment-methods{list-style:none;margin:0;padding:0}.widget_shopping_cart_content .wc-stripe-mini-cart-payment-methods li{margin:0}.widget_shopping_cart_content a.wc-stripe-applepay-mini-cart,.widget_shopping_cart_content a.wc-stripe-gpay-mini-cart,.widget_shopping_cart_content a.wc-stripe-payment-request-mini-cart{background:0 0;padding:0;border:none}a.wc-stripe-applepay-mini-cart .apple-pay-button,a.wc-stripe-gpay-mini-cart .gpay-button{width:100%;margin:0}.wc-stripe-payment-request-mini-cart.StripeElement{padding:0;background:0 0;border:none;width:100%}.wc-stripe-payment-request-mini-cart.StripeElement .__PrivateStripeElement{width:100%}.widget_shopping_cart_content .wc-stripe-overlay{display:none!important;position:absolute;background:rgba(255,255,255,.75);height:100%;width:100%;z-index:-1}.widget_shopping_cart_content .wc-stripe-overlay.active{display:block!important;z-index:9999}
|
assets/js/frontend/applepay-checkout.js
CHANGED
@@ -15,7 +15,9 @@
|
|
15 |
|
16 |
ApplePay.prototype.initialize = function () {
|
17 |
wc_stripe.CheckoutGateway.call(this);
|
18 |
-
|
|
|
|
|
19 |
}
|
20 |
|
21 |
ApplePay.prototype.canMakePayment = function () {
|
@@ -38,9 +40,8 @@
|
|
38 |
}
|
39 |
|
40 |
ApplePay.prototype.updated_checkout = function () {
|
41 |
-
if (this.
|
42 |
-
|
43 |
-
wc_stripe.ApplePay.prototype.canMakePayment.apply(this, arguments);
|
44 |
}
|
45 |
}
|
46 |
|
15 |
|
16 |
ApplePay.prototype.initialize = function () {
|
17 |
wc_stripe.CheckoutGateway.call(this);
|
18 |
+
if ($(this.container).length) {
|
19 |
+
wc_stripe.ApplePay.prototype.initialize.call(this);
|
20 |
+
}
|
21 |
}
|
22 |
|
23 |
ApplePay.prototype.canMakePayment = function () {
|
40 |
}
|
41 |
|
42 |
ApplePay.prototype.updated_checkout = function () {
|
43 |
+
if ($(this.container).length) {
|
44 |
+
wc_stripe.ApplePay.prototype.initialize.call(this);
|
|
|
45 |
}
|
46 |
}
|
47 |
|
assets/js/frontend/googlepay-checkout.js
CHANGED
@@ -19,6 +19,9 @@
|
|
19 |
* @return {[type]}
|
20 |
*/
|
21 |
GPay.prototype.initialize = function () {
|
|
|
|
|
|
|
22 |
// create payments client
|
23 |
this.createPaymentsClient();
|
24 |
this.isReadyToPay().then(function () {
|
@@ -30,7 +33,7 @@
|
|
30 |
buttonType: this.params.button_style
|
31 |
}));
|
32 |
$(this.banner_container).show().parent().parent().addClass('active');
|
33 |
-
$(this.banner_container).append($button);
|
34 |
}
|
35 |
}.bind(this))
|
36 |
}
|
@@ -48,10 +51,7 @@
|
|
48 |
* @return {[type]}
|
49 |
*/
|
50 |
GPay.prototype.updated_checkout = function () {
|
51 |
-
|
52 |
-
$(this.container).show();
|
53 |
-
this.create_button();
|
54 |
-
}
|
55 |
}
|
56 |
|
57 |
/**
|
19 |
* @return {[type]}
|
20 |
*/
|
21 |
GPay.prototype.initialize = function () {
|
22 |
+
if (!$(this.container).length) {
|
23 |
+
return;
|
24 |
+
}
|
25 |
// create payments client
|
26 |
this.createPaymentsClient();
|
27 |
this.isReadyToPay().then(function () {
|
33 |
buttonType: this.params.button_style
|
34 |
}));
|
35 |
$(this.banner_container).show().parent().parent().addClass('active');
|
36 |
+
$(this.banner_container).empty().append($button);
|
37 |
}
|
38 |
}.bind(this))
|
39 |
}
|
51 |
* @return {[type]}
|
52 |
*/
|
53 |
GPay.prototype.updated_checkout = function () {
|
54 |
+
this.initialize();
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
/**
|
assets/js/frontend/payment-request.js
CHANGED
@@ -176,17 +176,19 @@
|
|
176 |
|
177 |
PaymentRequest.prototype.initialize = function () {
|
178 |
wc_stripe.CheckoutGateway.call(this);
|
179 |
-
|
|
|
|
|
180 |
}
|
181 |
/**
|
182 |
* [canMakePayment description]
|
183 |
* @return {[type]} [description]
|
184 |
*/
|
185 |
PaymentRequest.prototype.canMakePayment = function () {
|
186 |
-
wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function (
|
187 |
if (this.banner_enabled()) {
|
188 |
$(this.banner_container).show().append('<div id="wc-stripe-payment-request-banner"></div>');
|
189 |
-
$(this.banner_container).show().parent().parent().addClass('active');
|
190 |
var elements = this.stripe.elements();
|
191 |
var button = elements.create("paymentRequestButton", {
|
192 |
paymentRequest: this.paymentRequest,
|
@@ -224,10 +226,8 @@
|
|
224 |
* @return {[type]} [description]
|
225 |
*/
|
226 |
PaymentRequest.prototype.updated_checkout = function () {
|
227 |
-
if (this.
|
228 |
-
|
229 |
-
this.createPaymentRequestButton();
|
230 |
-
wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments);
|
231 |
}
|
232 |
}
|
233 |
|
176 |
|
177 |
PaymentRequest.prototype.initialize = function () {
|
178 |
wc_stripe.CheckoutGateway.call(this);
|
179 |
+
if ($(this.container).length) {
|
180 |
+
wc_stripe.PaymentRequest.prototype.initialize.call(this);
|
181 |
+
}
|
182 |
}
|
183 |
/**
|
184 |
* [canMakePayment description]
|
185 |
* @return {[type]} [description]
|
186 |
*/
|
187 |
PaymentRequest.prototype.canMakePayment = function () {
|
188 |
+
wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function () {
|
189 |
if (this.banner_enabled()) {
|
190 |
$(this.banner_container).show().append('<div id="wc-stripe-payment-request-banner"></div>');
|
191 |
+
$(this.banner_container).show().empty().parent().parent().addClass('active');
|
192 |
var elements = this.stripe.elements();
|
193 |
var button = elements.create("paymentRequestButton", {
|
194 |
paymentRequest: this.paymentRequest,
|
226 |
* @return {[type]} [description]
|
227 |
*/
|
228 |
PaymentRequest.prototype.updated_checkout = function () {
|
229 |
+
if ($(this.container).length) {
|
230 |
+
wc_stripe.PaymentRequest.prototype.initialize.call(this);
|
|
|
|
|
231 |
}
|
232 |
}
|
233 |
|
assets/js/frontend/wc-stripe.js
CHANGED
@@ -323,17 +323,16 @@
|
|
323 |
try {
|
324 |
this.payment_request_options = this.get_payment_request_options();
|
325 |
this.paymentRequest = stripe.paymentRequest(this.payment_request_options);
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
} catch (err) {
|
327 |
this.submit_error(err.message);
|
328 |
return;
|
329 |
}
|
330 |
-
|
331 |
-
if (this.payment_request_options.requestShipping) {
|
332 |
-
this.paymentRequest.on('shippingaddresschange', this.update_shipping_address.bind(this));
|
333 |
-
this.paymentRequest.on('shippingoptionchange', this.update_shipping_method.bind(this));
|
334 |
-
}
|
335 |
-
|
336 |
-
this.paymentRequest.on('paymentmethod', this.on_payment_method_received.bind(this));
|
337 |
};
|
338 |
/**
|
339 |
* @return {[Object]}
|
@@ -588,7 +587,8 @@
|
|
588 |
dataType: 'json',
|
589 |
data: $.extend({}, this.serialize_fields(), {
|
590 |
payment_method: this.gateway_id,
|
591 |
-
page_id: this.get_page()
|
|
|
592 |
}),
|
593 |
beforeSend: this.ajax_before_send.bind(this)
|
594 |
}).done(function (result) {
|
@@ -681,7 +681,8 @@
|
|
681 |
data: {
|
682 |
address: this.map_address(ev.shippingAddress),
|
683 |
payment_method: this.gateway_id,
|
684 |
-
page_id: this.get_page()
|
|
|
685 |
},
|
686 |
beforeSend: this.ajax_before_send.bind(this)
|
687 |
}).done(function (response) {
|
@@ -711,6 +712,7 @@
|
|
711 |
data: {
|
712 |
shipping_method: ev.shippingOption.id,
|
713 |
payment_method: this.gateway_id,
|
|
|
714 |
page_id: this.get_page()
|
715 |
},
|
716 |
beforeSend: this.ajax_before_send.bind(this)
|
@@ -1149,6 +1151,7 @@
|
|
1149 |
variation_id: this.is_variable_product() ? $('[name="variation_id"]').val() : 0,
|
1150 |
qty: $('[name="quantity"]').val(),
|
1151 |
payment_method: this.gateway_id,
|
|
|
1152 |
page_id: this.get_page()
|
1153 |
},
|
1154 |
beforeSend: this.ajax_before_send.bind(this)
|
@@ -1181,6 +1184,7 @@
|
|
1181 |
product_id: this.get_product_data().id,
|
1182 |
variation_id: this.is_variable_product() && variation_id ? variation_id : 0,
|
1183 |
qty: $('[name="quantity"]').val(),
|
|
|
1184 |
payment_method: this.gateway_id
|
1185 |
},
|
1186 |
beforeSend: this.ajax_before_send.bind(this)
|
@@ -1278,7 +1282,8 @@
|
|
1278 |
data: {
|
1279 |
shipping_address: this.map_address(data.shippingAddress),
|
1280 |
shipping_method: shipping_method,
|
1281 |
-
page_id: this.get_page()
|
|
|
1282 |
},
|
1283 |
beforeSend: this.ajax_before_send.bind(this)
|
1284 |
})).done(function (response) {
|
@@ -1465,13 +1470,6 @@
|
|
1465 |
};
|
1466 |
|
1467 |
wc_stripe.ApplePay.prototype.initialize = function () {
|
1468 |
-
var selector = '.apple-pay-button';
|
1469 |
-
|
1470 |
-
if (['checkout', 'order_pay'].indexOf(this.get_page()) < 0) {
|
1471 |
-
selector = this.container + ' .apple-pay-button';
|
1472 |
-
}
|
1473 |
-
|
1474 |
-
$(document.body).on('click', selector, this.start.bind(this));
|
1475 |
this.createPaymentRequest();
|
1476 |
this.canMakePayment();
|
1477 |
};
|
@@ -1482,6 +1480,7 @@
|
|
1482 |
}
|
1483 |
|
1484 |
this.$button = $(this.params.button);
|
|
|
1485 |
this.append_button();
|
1486 |
};
|
1487 |
|
@@ -1569,6 +1568,11 @@
|
|
1569 |
$('form.checkout').on('change', '.input-text, select', this.onChange.bind(this));
|
1570 |
$('form.checkout').on('change', '[name="ship_to_different_address"]', this.on_ship_to_address_change.bind(this));
|
1571 |
this.init_i18n();
|
|
|
|
|
|
|
|
|
|
|
1572 |
}
|
1573 |
};
|
1574 |
|
@@ -1612,7 +1616,7 @@
|
|
1612 |
|
1613 |
wc_stripe.CheckoutFields.prototype.on_ship_to_address_change = function (e) {
|
1614 |
if ($(e.currentTarget).is(':checked')) {
|
1615 |
-
this.update_required_fields($('shipping_country'), 'shipping_country');
|
1616 |
}
|
1617 |
};
|
1618 |
|
323 |
try {
|
324 |
this.payment_request_options = this.get_payment_request_options();
|
325 |
this.paymentRequest = stripe.paymentRequest(this.payment_request_options);
|
326 |
+
if (this.payment_request_options.requestShipping) {
|
327 |
+
this.paymentRequest.on('shippingaddresschange', this.update_shipping_address.bind(this));
|
328 |
+
this.paymentRequest.on('shippingoptionchange', this.update_shipping_method.bind(this));
|
329 |
+
}
|
330 |
+
|
331 |
+
this.paymentRequest.on('paymentmethod', this.on_payment_method_received.bind(this));
|
332 |
} catch (err) {
|
333 |
this.submit_error(err.message);
|
334 |
return;
|
335 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
};
|
337 |
/**
|
338 |
* @return {[Object]}
|
587 |
dataType: 'json',
|
588 |
data: $.extend({}, this.serialize_fields(), {
|
589 |
payment_method: this.gateway_id,
|
590 |
+
page_id: this.get_page(),
|
591 |
+
currency: this.get_currency(),
|
592 |
}),
|
593 |
beforeSend: this.ajax_before_send.bind(this)
|
594 |
}).done(function (result) {
|
681 |
data: {
|
682 |
address: this.map_address(ev.shippingAddress),
|
683 |
payment_method: this.gateway_id,
|
684 |
+
page_id: this.get_page(),
|
685 |
+
currency: this.get_currency()
|
686 |
},
|
687 |
beforeSend: this.ajax_before_send.bind(this)
|
688 |
}).done(function (response) {
|
712 |
data: {
|
713 |
shipping_method: ev.shippingOption.id,
|
714 |
payment_method: this.gateway_id,
|
715 |
+
currency: this.get_currency(),
|
716 |
page_id: this.get_page()
|
717 |
},
|
718 |
beforeSend: this.ajax_before_send.bind(this)
|
1151 |
variation_id: this.is_variable_product() ? $('[name="variation_id"]').val() : 0,
|
1152 |
qty: $('[name="quantity"]').val(),
|
1153 |
payment_method: this.gateway_id,
|
1154 |
+
currency: this.get_currency(),
|
1155 |
page_id: this.get_page()
|
1156 |
},
|
1157 |
beforeSend: this.ajax_before_send.bind(this)
|
1184 |
product_id: this.get_product_data().id,
|
1185 |
variation_id: this.is_variable_product() && variation_id ? variation_id : 0,
|
1186 |
qty: $('[name="quantity"]').val(),
|
1187 |
+
currency: this.get_currency(),
|
1188 |
payment_method: this.gateway_id
|
1189 |
},
|
1190 |
beforeSend: this.ajax_before_send.bind(this)
|
1282 |
data: {
|
1283 |
shipping_address: this.map_address(data.shippingAddress),
|
1284 |
shipping_method: shipping_method,
|
1285 |
+
page_id: this.get_page(),
|
1286 |
+
currency: this.get_currency()
|
1287 |
},
|
1288 |
beforeSend: this.ajax_before_send.bind(this)
|
1289 |
})).done(function (response) {
|
1470 |
};
|
1471 |
|
1472 |
wc_stripe.ApplePay.prototype.initialize = function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1473 |
this.createPaymentRequest();
|
1474 |
this.canMakePayment();
|
1475 |
};
|
1480 |
}
|
1481 |
|
1482 |
this.$button = $(this.params.button);
|
1483 |
+
this.$button.on('click', this.start.bind(this));
|
1484 |
this.append_button();
|
1485 |
};
|
1486 |
|
1568 |
$('form.checkout').on('change', '.input-text, select', this.onChange.bind(this));
|
1569 |
$('form.checkout').on('change', '[name="ship_to_different_address"]', this.on_ship_to_address_change.bind(this));
|
1570 |
this.init_i18n();
|
1571 |
+
if ($('[name="ship_to_different_address"]').is(':checked')) {
|
1572 |
+
this.update_required_fields($('#shipping_country').val(), 'shipping_country');
|
1573 |
+
} else {
|
1574 |
+
this.update_required_fields($('#billing_country').val(), 'billing_country');
|
1575 |
+
}
|
1576 |
}
|
1577 |
};
|
1578 |
|
1616 |
|
1617 |
wc_stripe.CheckoutFields.prototype.on_ship_to_address_change = function (e) {
|
1618 |
if ($(e.currentTarget).is(':checked')) {
|
1619 |
+
this.update_required_fields($('#shipping_country').val(), 'shipping_country');
|
1620 |
}
|
1621 |
};
|
1622 |
|
assets/js/frontend/wc-stripe.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(i,o){i.wc_stripe={};var s=null;"undefined"==typeof wc_stripe_checkout_fields&&(i.wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(t,e){this.params=t,this.gateway_id=this.params.gateway_id,this.container=void 0===e?"li.payment_method_".concat(this.gateway_id):e,o(this.container).length||(this.container=".payment_method_".concat(this.gateway_id)),this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=s,this.elements=s.elements(o.extend({},{locale:"auto"},this.get_element_options())),this.fields=r,this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){this.fields.set(this.gateway_id+"_token_key",t),o(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return o('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===o('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return 0<o("#wc_stripe_checkout_error").length&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==(t=this.get_error_message(t)).indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){console.log(t)},wc_stripe.BaseGateway.prototype.get_error_message=function(t){return"object"==typeof t&&t.code&&(t=wc_stripe_messages[t.code]||t.message),t},wc_stripe.BaseGateway.prototype.submit_message=function(t){o(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var e=o(this.message_container);e.closest("form").length&&(e=e.closest("form")),e.prepend(t),e.removeClass("processing").unblock(),e.find(".input-text, select, input:checkbox").blur(),o.scroll_to_notices?o.scroll_to_notices(e):o("html, body").animate({scrollTop:e.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return o("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return o("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_shipping_prefix=function(){return this.needs_shipping()&&0<o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').is(":checked")?"shipping":"billing"},wc_stripe.BaseGateway.prototype.should_save_method=function(){return o("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return"add_payment_method"===this.get_page()||o(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return o(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){return o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway")},wc_stripe.BaseGateway.prototype.set_gateway_data=function(t){o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway",t)},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var e=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],i="",s=0;s<e.length;s++)i+=this.fields.get(t+e[s])+"_";return i},wc_stripe.BaseGateway.prototype.block=function(){o().block&&o.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){o().block&&o.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return o(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(t){var e=this.get_gateway_data();e.total=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){var e=this.get_gateway_data();e.total_cents=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){o('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(this.fields.set("shipping_method",t),t&&o('[name^="shipping_method"]').length)for(var e in t){var i=t[e];o('[name="shipping_method['+e+']"][value="'+i+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.payment_request_options=this.get_payment_request_options(),this.paymentRequest=s.paymentRequest(this.payment_request_options)}catch(t){return void this.submit_error(t.message)}this.payment_request_options.requestShipping&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:this.fields.requestFieldInWallet("billing_email"),requestPayerPhone:this.fields.requestFieldInWallet("billing_phone"),requestShipping:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),t.requestShipping&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var e={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},i=this.get_display_items(),s=this.get_shipping_options();return i&&(e.displayItems=i),this.payment_request_options.requestShipping&&s&&(e.shippingOptions=s),t&&(e=o.extend(!0,{},e,t)),e},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(t){var e=this.get_gateway_data();e.items=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){var e=this.get_gateway_data();e.shipping_options=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(t){try{this.payment_response=t,this.populate_checkout_fields(t),t.complete("success"),this.on_token_received(t.paymentMethod)}catch(e){i.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){this.set_nonce(t.paymentMethod.id),this.update_addresses(t)},wc_stripe.BaseGateway.prototype.update_addresses=function(t){t.payerName&&this.fields.set("name",t.payerName,"billing"),t.payerEmail&&this.fields.set("email",t.payerEmail,"billing"),t.payerPhone&&this.fields.set("phone",t.payerPhone,"billing"),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.paymentMethod.billing_details.address&&this.populate_billing_fields(t.paymentMethod.billing_details.address)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t,e){for(var i in t)null!==t[i]&&this.fields.set(i,t[i],e)},wc_stripe.BaseGateway.prototype.populate_billing_fields=function(t){this.populate_address_fields(t,"billing")},wc_stripe.BaseGateway.prototype.populate_shipping_fields=function(t){this.populate_address_fields(t,"shipping")},wc_stripe.BaseGateway.prototype.get_address_fields=function(){return["first_name","last_name","country","address_1","address_2","city","state","postcode","phone","email"]},wc_stripe.BaseGateway.prototype.get_address_object=function(e){var i={};return this.get_address_fields().forEach(function(t){i[t]=this.fields.get(t,e)}.bind(this)),i},wc_stripe.BaseGateway.prototype.is_current_page=function(t){return this.get_page()===t},wc_stripe.BaseGateway.prototype.is_valid_address=function(t,e,i){if(o.isEmptyObject(t))return!1;var s=this.get_address_fields();void 0!==i&&i.forEach(function(t){-1<s.indexOf(t)&&s.splice(s.indexOf(t),1)});for(var a=0;a<s.length;a++){var n=s[a];if(this.fields.required(e+"_"+n)&&(!t[n]||"undefined"==typeof t[n]||!this.fields.isValid(n,t[n],t)))return!1}return!0},wc_stripe.BaseGateway.prototype.ajax_before_send=function(t){0<this.params.user_id&&t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(){this.block(),o.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:o.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.reload?i.location.reload():"success"===t.result?i.location=t.redirect:(t.messages&&this.submit_error(t.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var e,i=t.find("input").filter(function(t,e){return!o(e).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),s={};for(e in i){var a=i[e];s[a.name]=a.value}return s.payment_method=this.gateway_id,s},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return o.extend({},this.fields.toJson(),o(document.body).triggerHandler("wc_stripe_process_checkout_data",[this,this.fields]))},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};return"default"===t||1<(t=t.match(/^([\w+]):(.+)$/)).length&&(e[t[1]]=t[2]),e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("billing")!==this.get_address_field_hash("shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(s.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(s.updateWith(t.data.newData),this.fields.set("shipping_method",t.data.shipping_method),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:s.shippingOption.id,payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(this.set_selected_shipping_methods(t.data.shipping_methods),s.updateWith(t.data.newData),e(t.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,o(document.body).on("update_checkout",this.update_checkout.bind(this)),o(document.body).on("updated_checkout",this.updated_checkout.bind(this)),o(document.body).on("cfw_updated_checkout",this.updated_checkout.bind(this)),o(document.body).on("checkout_error",this.checkout_error.bind(this)),o(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),o(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),o(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),o(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&o(".woocommerce-billing-fields").length&&o(".wc-stripe-banner-checkout").css("max-width",o(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var t,e=i.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);e&&1<e.length&&(t=e[1],e=e[2],this.gateway_id===t&&(this.payment_token_received=!0,this.set_nonce(e),this.set_use_new_option(!0)))},wc_stripe.CheckoutGateway.prototype.update_shipping_address=function(){return wc_stripe.BaseGateway.prototype.update_shipping_address.apply(this,arguments).then(function(t){this.populate_address_fields(t.address,this.get_shipping_prefix()),this.fields.toFormFields({update_shipping_method:!1})}.bind(this))},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(o('[name="terms"]').length&&!o('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return o('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){o("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){o().block&&o("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){o().block&&o("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){o("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){o("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,o('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if(["checkout","order_pay"].indexOf(this.get_page())<0)return!0;var t=!0;return(t=this.fields.validateFields("billing"))?this.needs_shipping()&&o("#ship-to-different-address-checkbox").is(":checked")?(t=this.fields.validateFields("shipping"))||this.submit_error(this.params.messages.required_field):(t=this.is_valid_checkout())||this.submit_error(this.params.messages.terms):this.submit_error(this.params.messages.required_field),t},wc_stripe.CheckoutGateway.prototype.cart_contains_subscription=function(){return"undefined"!=typeof wc_stripe_cart_contains_subscription&&!0===wc_stripe_cart_contains_subscription},wc_stripe.ProductGateway=function(){this.message_container="div.product",o("form.cart").on("found_variation",this.found_variation.bind(this)),o("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=o("form.cart div.quantity").outerWidth(!0)+o(".single_add_to_cart_button").outerWidth();var t=o(".single_add_to_cart_button").css("marginLeft");t&&(this.buttonWidth+=parseInt(t.replace("px",""))),o(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(o('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_gateway_data();i.product.price=e.display_price,i.needs_shipping=!e.is_virtual,i.product.variation=e,this.set_gateway_data(i)},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var t=this.get_product_data();t.variation=!1,this.set_product_data(t),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return 0<o('[name="variation_id"]').length},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){return!1!==this.get_product_data().variation},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(t){var e=this.get_gateway_data();e.product=t,this.set_gateway_data(e)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(e,i){this.block(),o.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?o('[name="variation_id"]').val():0,qty:o('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){this.unblock(),t.code?(this.submit_error(t.message),i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(e,i){o.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&t?t:0,qty:o('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(this.cart_calculation_error=!0,i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.message_container="div.woocommerce",o(document.body).on("updated_wc_div",this.updated_html.bind(this)),o(document.body).on("updated_cart_totals",this.updated_html.bind(this)),o(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(this.get_error_message(t))},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.cart_emptied=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){o(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};var a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.update_addresses=function(t){this.populate_billing_fields(t.paymentMethodData.info.billingAddress),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.email&&this.fields.set("email",t.email,"billing")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(s){return new Promise(function(e,i){var t="default"==s.shippingOptionData.id?null:s.shippingOptionData.id;o.when(o.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(s.shippingAddress),shipping_method:t,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){t.code?i(t.data.data):e(t.data)}.bind(this)).fail(function(){i()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(i){return new Promise(function(e){this.update_payment_data(i).then(function(t){e(t.paymentRequestUpdate),this.set_selected_shipping_methods(t.shipping_methods),this.payment_data_updated(t,i)}.bind(this))["catch"](function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t,e={environment:this.params.environment,merchantInfo:this.get_merchant_info(),paymentDataCallbacks:{onPaymentAuthorized:function(){return new Promise(function(t){t({transactionState:"SUCCESS"})}.bind(this))}}};return this.needs_shipping()&&(t=this.get_shipping_prefix(),(!this.is_current_page("checkout")||this.is_valid_address(this.get_address_object(t),t,["email","phone"]))&&this.is_current_page("checkout")||(e.paymentDataCallbacks.onPaymentDataChanged=this.on_payment_data_changed.bind(this))),e},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=o.extend({},a,{emailRequired:this.fields.requestFieldInWallet("billing_email"),merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[o.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)(),transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.fields.requestFieldInWallet("billing_phone")},t.shippingAddressRequired?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"],this.payment_request_options=t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var e=o.extend({},a);e.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(e).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this))["catch"](function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.update_addresses(t),this.on_token_received(e)}.bind(this))["catch"](function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&-1<t.statusMessage.indexOf("paymentDataRequest.callbackIntent")?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.message))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){var t=".apple-pay-button";["checkout","order_pay"].indexOf(this.get_page())<0&&(t=this.container+" .apple-pay-button"),o(document.body).on("click",t,this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.createPaymentRequestButton(),this.canMakePayment(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){this.paymentRequestButton&&this.paymentRequestButton.destroy(),this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&!t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")},wc_stripe.CheckoutFields=function(t,e){this.params=t,this.page=e,this.fields=new Map(Object.keys(this.params).map(function(t){return null===this.params[t].value&&(this.params[t].value=""),[t,this.params[t].value]}.bind(this))),"checkout"===e&&(o("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),o("form.checkout").on("change",'[name="ship_to_different_address"]',this.on_ship_to_address_change.bind(this)),this.init_i18n())},wc_stripe.CheckoutFields.prototype.init_i18n=function(){"undefined"!=typeof wc_address_i18n_params?this.locales=o.parseJSON(wc_address_i18n_params.locale.replace(/"/g,'"')):this.locales=null},wc_stripe.CheckoutFields.prototype.onChange=function(t){try{var e=t.currentTarget.name,i=t.currentTarget.value;this.fields.set(e,i),"billing_country"!==e&&"shipping_country"!==e||this.update_required_fields(i,e)}catch(s){console.log(s)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(t,e){if(this.locales){var i,s=-1<e.indexOf("billing_")?"billing_":"shipping_",t="undefined"!=typeof this.locales[t]?this.locales[t]:this.locales["default"],a=o.extend(!0,{},this.locales["default"],t);for(i in a){var n=s+i;this.params[n]&&(this.params[n]=o.extend(!0,{},this.params[n],a[i]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(t){o(t.currentTarget).is(":checked")&&this.update_required_fields(o("shipping_country"),"shipping_country")},wc_stripe.CheckoutFields.prototype.requestFieldInWallet=function(t){return"checkout"===this.page?this.required(t)&&this.isEmpty(t):"order_pay"!==this.page&&this.required(t)},wc_stripe.CheckoutFields.prototype.set=function(t,e,i){this[t]&&"function"==typeof this[t]?this[t]().set.call(this,e,i):this.fields.set(t,e)},wc_stripe.CheckoutFields.prototype.get=function(t,e){var i;return this[t]&&"function"==typeof this[t]?i=this[t]().get.call(this,e):null!=(i=this.fields.get(t))&&""!==i||void 0!==e&&(i=e),void 0===i?"":i},wc_stripe.CheckoutFields.prototype.required=function(t){return!(!this.params[t]||"undefined"==typeof this.params[t].required)&&this.params[t].required},wc_stripe.CheckoutFields.prototype.isEmpty=function(t){if(this.fields.has(t)){t=this.fields.get(t);return null==t||"string"==typeof t&&0===t.trim().length}return!0},wc_stripe.CheckoutFields.prototype.isValid=function(t){if(this[t]&&"function"==typeof this[t])return this[t]().isValid.apply(this,Array.prototype.slice.call(arguments,1))},wc_stripe.CheckoutFields.prototype.first_name=function(){return{set:function(t,e){this.fields.set(e+"_first_name",t)},get:function(t){return this.fields.get(t+"_first_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.last_name=function(){return{set:function(t,e){this.fields.set(e+"_last_name",t)},get:function(t){return this.fields.get(t+"_last_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_1=function(){return{set:function(t,e){this.fields.set(e+"_address_1",t)},get:function(t){return this.fields.get(t+"_address_1")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_2=function(){return{set:function(t,e){this.fields.set(e+"_address_2",t)},get:function(t){return this.fields.get(t+"_address_2")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(t,e){t=t.split(" ");0<t.length&&this.fields.set(e+"_first_name",t[0]),1<t.length&&this.fields.set(e+"_last_name",t[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(t,e){this.fields.set(e+"_email",t)},get:function(t){return this.fields.get(t+"_email")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(t,e){this.fields.set(e+"_phone",t)},get:function(t){return this.fields.get(t+"_phone")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(t,e){this.fields.set(e+"_country",t)},get:function(t){return this.fields.get(t+"_country")},isValid:function(t){return"string"==typeof t&&2===t.length}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(i,t){2<(i=i.toUpperCase()).length&&"checkout"===this.page&&o("#"+t+"_state option").each(function(){var t=o(this),e=t.text().toUpperCase();i===e&&(i=t.val())}),this.fields.set(t+"_state",i)},get:function(t){return this.fields.get(t+"_state")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(t,e){this.fields.set(e+"_city",t)},get:function(t){return this.fields.get(t+"_city")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.postcode=function(){return{set:function(t,e){this.fields.set(e+"_postcode",t)},get:function(t){return this.fields.get(t+"_postcode")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.recipient=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(t,e){0<t.length&&this.fields.set(e+"_address_1",t[0]),1<t.length&&this.fields.set(e+"_address_2",t[1])},get:function(t){return[this.fields.get(t+"_address_1"),this.fields.get(t+"_address_2")]},isValid:function(t){return 0<t.length&&("string"==typeof t[0]&&0<t[0].length)}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var i={};return this.fields.forEach(function(t,e){i[e]=t}),i},wc_stripe.CheckoutFields.prototype.toFormFields=function(t){var i=[];this.fields.forEach(function(t,e){e='[name="'+e+'"]';o(e).length&&""!==t&&(o(e).val()!==t&&o(e).is("select")&&i.push(e),o(e).val(t))}),0<i.length&&o(i.join(",")).trigger("change"),void 0!==t&&o(document.body).trigger("update_checkout",t)},wc_stripe.CheckoutFields.prototype.validateFields=function(t){for(var e in this.params){var i=this.params[e];if(-1<e.indexOf(t)&&i.required&&o("#"+e).length&&o("#"+e).is(":visible")){i=o("#"+e).val();if(null==i||0===i.length)return!1}}return!0};try{s=Stripe(wc_stripe_params_v3.api_key,{stripeAccount:wc_stripe_params_v3.account})}catch(t){return i.alert(t),console.log(t)}var r=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)}(window,jQuery);
|
1 |
+
!function(i,o){i.wc_stripe={};var s=null;"undefined"==typeof wc_stripe_checkout_fields&&(i.wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(t,e){this.params=t,this.gateway_id=this.params.gateway_id,this.container=void 0===e?"li.payment_method_".concat(this.gateway_id):e,o(this.container).length||(this.container=".payment_method_".concat(this.gateway_id)),this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=s,this.elements=s.elements(o.extend({},{locale:"auto"},this.get_element_options())),this.fields=r,this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){this.fields.set(this.gateway_id+"_token_key",t),o(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return o('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===o('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return 0<o("#wc_stripe_checkout_error").length&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==(t=this.get_error_message(t)).indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){console.log(t)},wc_stripe.BaseGateway.prototype.get_error_message=function(t){return"object"==typeof t&&t.code&&(t=wc_stripe_messages[t.code]||t.message),t},wc_stripe.BaseGateway.prototype.submit_message=function(t){o(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var e=o(this.message_container);e.closest("form").length&&(e=e.closest("form")),e.prepend(t),e.removeClass("processing").unblock(),e.find(".input-text, select, input:checkbox").blur(),o.scroll_to_notices?o.scroll_to_notices(e):o("html, body").animate({scrollTop:e.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return o("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return o("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_shipping_prefix=function(){return this.needs_shipping()&&0<o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').is(":checked")?"shipping":"billing"},wc_stripe.BaseGateway.prototype.should_save_method=function(){return o("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return"add_payment_method"===this.get_page()||o(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return o(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){return o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway")},wc_stripe.BaseGateway.prototype.set_gateway_data=function(t){o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway",t)},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var e=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],i="",s=0;s<e.length;s++)i+=this.fields.get(t+e[s])+"_";return i},wc_stripe.BaseGateway.prototype.block=function(){o().block&&o.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){o().block&&o.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return o(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(t){var e=this.get_gateway_data();e.total=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){var e=this.get_gateway_data();e.total_cents=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){o('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(this.fields.set("shipping_method",t),t&&o('[name^="shipping_method"]').length)for(var e in t){var i=t[e];o('[name="shipping_method['+e+']"][value="'+i+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.payment_request_options=this.get_payment_request_options(),this.paymentRequest=s.paymentRequest(this.payment_request_options),this.payment_request_options.requestShipping&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))}catch(t){return void this.submit_error(t.message)}},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:this.fields.requestFieldInWallet("billing_email"),requestPayerPhone:this.fields.requestFieldInWallet("billing_phone"),requestShipping:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),t.requestShipping&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var e={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},i=this.get_display_items(),s=this.get_shipping_options();return i&&(e.displayItems=i),this.payment_request_options.requestShipping&&s&&(e.shippingOptions=s),t&&(e=o.extend(!0,{},e,t)),e},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(t){var e=this.get_gateway_data();e.items=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){var e=this.get_gateway_data();e.shipping_options=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(t){try{this.payment_response=t,this.populate_checkout_fields(t),t.complete("success"),this.on_token_received(t.paymentMethod)}catch(e){i.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){this.set_nonce(t.paymentMethod.id),this.update_addresses(t)},wc_stripe.BaseGateway.prototype.update_addresses=function(t){t.payerName&&this.fields.set("name",t.payerName,"billing"),t.payerEmail&&this.fields.set("email",t.payerEmail,"billing"),t.payerPhone&&this.fields.set("phone",t.payerPhone,"billing"),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.paymentMethod.billing_details.address&&this.populate_billing_fields(t.paymentMethod.billing_details.address)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t,e){for(var i in t)null!==t[i]&&this.fields.set(i,t[i],e)},wc_stripe.BaseGateway.prototype.populate_billing_fields=function(t){this.populate_address_fields(t,"billing")},wc_stripe.BaseGateway.prototype.populate_shipping_fields=function(t){this.populate_address_fields(t,"shipping")},wc_stripe.BaseGateway.prototype.get_address_fields=function(){return["first_name","last_name","country","address_1","address_2","city","state","postcode","phone","email"]},wc_stripe.BaseGateway.prototype.get_address_object=function(e){var i={};return this.get_address_fields().forEach(function(t){i[t]=this.fields.get(t,e)}.bind(this)),i},wc_stripe.BaseGateway.prototype.is_current_page=function(t){return this.get_page()===t},wc_stripe.BaseGateway.prototype.is_valid_address=function(t,e,i){if(o.isEmptyObject(t))return!1;var s=this.get_address_fields();void 0!==i&&i.forEach(function(t){-1<s.indexOf(t)&&s.splice(s.indexOf(t),1)});for(var a=0;a<s.length;a++){var n=s[a];if(this.fields.required(e+"_"+n)&&(!t[n]||"undefined"==typeof t[n]||!this.fields.isValid(n,t[n],t)))return!1}return!0},wc_stripe.BaseGateway.prototype.ajax_before_send=function(t){0<this.params.user_id&&t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(){this.block(),o.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:o.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page(),currency:this.get_currency()}),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.reload?i.location.reload():"success"===t.result?i.location=t.redirect:(t.messages&&this.submit_error(t.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var e,i=t.find("input").filter(function(t,e){return!o(e).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),s={};for(e in i){var a=i[e];s[a.name]=a.value}return s.payment_method=this.gateway_id,s},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return o.extend({},this.fields.toJson(),o(document.body).triggerHandler("wc_stripe_process_checkout_data",[this,this.fields]))},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};return"default"===t||1<(t=t.match(/^([\w+]):(.+)$/)).length&&(e[t[1]]=t[2]),e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("billing")!==this.get_address_field_hash("shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(s.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page(),currency:this.get_currency()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(s.updateWith(t.data.newData),this.fields.set("shipping_method",t.data.shipping_method),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:s.shippingOption.id,payment_method:this.gateway_id,currency:this.get_currency(),page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(this.set_selected_shipping_methods(t.data.shipping_methods),s.updateWith(t.data.newData),e(t.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,o(document.body).on("update_checkout",this.update_checkout.bind(this)),o(document.body).on("updated_checkout",this.updated_checkout.bind(this)),o(document.body).on("cfw_updated_checkout",this.updated_checkout.bind(this)),o(document.body).on("checkout_error",this.checkout_error.bind(this)),o(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),o(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),o(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),o(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&o(".woocommerce-billing-fields").length&&o(".wc-stripe-banner-checkout").css("max-width",o(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var t,e=i.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);e&&1<e.length&&(t=e[1],e=e[2],this.gateway_id===t&&(this.payment_token_received=!0,this.set_nonce(e),this.set_use_new_option(!0)))},wc_stripe.CheckoutGateway.prototype.update_shipping_address=function(){return wc_stripe.BaseGateway.prototype.update_shipping_address.apply(this,arguments).then(function(t){this.populate_address_fields(t.address,this.get_shipping_prefix()),this.fields.toFormFields({update_shipping_method:!1})}.bind(this))},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(o('[name="terms"]').length&&!o('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return o('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){o("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){o().block&&o("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){o().block&&o("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){o("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){o("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,o('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if(["checkout","order_pay"].indexOf(this.get_page())<0)return!0;var t=!0;return(t=this.fields.validateFields("billing"))?this.needs_shipping()&&o("#ship-to-different-address-checkbox").is(":checked")?(t=this.fields.validateFields("shipping"))||this.submit_error(this.params.messages.required_field):(t=this.is_valid_checkout())||this.submit_error(this.params.messages.terms):this.submit_error(this.params.messages.required_field),t},wc_stripe.CheckoutGateway.prototype.cart_contains_subscription=function(){return"undefined"!=typeof wc_stripe_cart_contains_subscription&&!0===wc_stripe_cart_contains_subscription},wc_stripe.ProductGateway=function(){this.message_container="div.product",o("form.cart").on("found_variation",this.found_variation.bind(this)),o("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=o("form.cart div.quantity").outerWidth(!0)+o(".single_add_to_cart_button").outerWidth();var t=o(".single_add_to_cart_button").css("marginLeft");t&&(this.buttonWidth+=parseInt(t.replace("px",""))),o(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(o('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_gateway_data();i.product.price=e.display_price,i.needs_shipping=!e.is_virtual,i.product.variation=e,this.set_gateway_data(i)},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var t=this.get_product_data();t.variation=!1,this.set_product_data(t),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return 0<o('[name="variation_id"]').length},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){return!1!==this.get_product_data().variation},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(t){var e=this.get_gateway_data();e.product=t,this.set_gateway_data(e)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(e,i){this.block(),o.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?o('[name="variation_id"]').val():0,qty:o('[name="quantity"]').val(),payment_method:this.gateway_id,currency:this.get_currency(),page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){this.unblock(),t.code?(this.submit_error(t.message),i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(e,i){o.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&t?t:0,qty:o('[name="quantity"]').val(),currency:this.get_currency(),payment_method:this.gateway_id},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(this.cart_calculation_error=!0,i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.message_container="div.woocommerce",o(document.body).on("updated_wc_div",this.updated_html.bind(this)),o(document.body).on("updated_cart_totals",this.updated_html.bind(this)),o(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(this.get_error_message(t))},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.cart_emptied=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){o(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};var a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.update_addresses=function(t){this.populate_billing_fields(t.paymentMethodData.info.billingAddress),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.email&&this.fields.set("email",t.email,"billing")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(s){return new Promise(function(e,i){var t="default"==s.shippingOptionData.id?null:s.shippingOptionData.id;o.when(o.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(s.shippingAddress),shipping_method:t,page_id:this.get_page(),currency:this.get_currency()},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){t.code?i(t.data.data):e(t.data)}.bind(this)).fail(function(){i()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(i){return new Promise(function(e){this.update_payment_data(i).then(function(t){e(t.paymentRequestUpdate),this.set_selected_shipping_methods(t.shipping_methods),this.payment_data_updated(t,i)}.bind(this))["catch"](function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t,e={environment:this.params.environment,merchantInfo:this.get_merchant_info(),paymentDataCallbacks:{onPaymentAuthorized:function(){return new Promise(function(t){t({transactionState:"SUCCESS"})}.bind(this))}}};return this.needs_shipping()&&(t=this.get_shipping_prefix(),(!this.is_current_page("checkout")||this.is_valid_address(this.get_address_object(t),t,["email","phone"]))&&this.is_current_page("checkout")||(e.paymentDataCallbacks.onPaymentDataChanged=this.on_payment_data_changed.bind(this))),e},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=o.extend({},a,{emailRequired:this.fields.requestFieldInWallet("billing_email"),merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[o.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)(),transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.fields.requestFieldInWallet("billing_phone")},t.shippingAddressRequired?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"],this.payment_request_options=t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var e=o.extend({},a);e.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(e).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this))["catch"](function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.update_addresses(t),this.on_token_received(e)}.bind(this))["catch"](function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&-1<t.statusMessage.indexOf("paymentDataRequest.callbackIntent")?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.message))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.params.button),this.$button.on("click",this.start.bind(this)),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.createPaymentRequestButton(),this.canMakePayment(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){this.paymentRequestButton&&this.paymentRequestButton.destroy(),this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&!t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")},wc_stripe.CheckoutFields=function(t,e){this.params=t,this.page=e,this.fields=new Map(Object.keys(this.params).map(function(t){return null===this.params[t].value&&(this.params[t].value=""),[t,this.params[t].value]}.bind(this))),"checkout"===e&&(o("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),o("form.checkout").on("change",'[name="ship_to_different_address"]',this.on_ship_to_address_change.bind(this)),this.init_i18n(),o('[name="ship_to_different_address"]').is(":checked")?this.update_required_fields(o("#shipping_country").val(),"shipping_country"):this.update_required_fields(o("#billing_country").val(),"billing_country"))},wc_stripe.CheckoutFields.prototype.init_i18n=function(){"undefined"!=typeof wc_address_i18n_params?this.locales=o.parseJSON(wc_address_i18n_params.locale.replace(/"/g,'"')):this.locales=null},wc_stripe.CheckoutFields.prototype.onChange=function(t){try{var e=t.currentTarget.name,i=t.currentTarget.value;this.fields.set(e,i),"billing_country"!==e&&"shipping_country"!==e||this.update_required_fields(i,e)}catch(s){console.log(s)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(t,e){if(this.locales){var i,s=-1<e.indexOf("billing_")?"billing_":"shipping_",t="undefined"!=typeof this.locales[t]?this.locales[t]:this.locales["default"],a=o.extend(!0,{},this.locales["default"],t);for(i in a){var n=s+i;this.params[n]&&(this.params[n]=o.extend(!0,{},this.params[n],a[i]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(t){o(t.currentTarget).is(":checked")&&this.update_required_fields(o("#shipping_country").val(),"shipping_country")},wc_stripe.CheckoutFields.prototype.requestFieldInWallet=function(t){return"checkout"===this.page?this.required(t)&&this.isEmpty(t):"order_pay"!==this.page&&this.required(t)},wc_stripe.CheckoutFields.prototype.set=function(t,e,i){this[t]&&"function"==typeof this[t]?this[t]().set.call(this,e,i):this.fields.set(t,e)},wc_stripe.CheckoutFields.prototype.get=function(t,e){var i;return this[t]&&"function"==typeof this[t]?i=this[t]().get.call(this,e):null!=(i=this.fields.get(t))&&""!==i||void 0!==e&&(i=e),void 0===i?"":i},wc_stripe.CheckoutFields.prototype.required=function(t){return!(!this.params[t]||"undefined"==typeof this.params[t].required)&&this.params[t].required},wc_stripe.CheckoutFields.prototype.isEmpty=function(t){if(this.fields.has(t)){t=this.fields.get(t);return null==t||"string"==typeof t&&0===t.trim().length}return!0},wc_stripe.CheckoutFields.prototype.isValid=function(t){if(this[t]&&"function"==typeof this[t])return this[t]().isValid.apply(this,Array.prototype.slice.call(arguments,1))},wc_stripe.CheckoutFields.prototype.first_name=function(){return{set:function(t,e){this.fields.set(e+"_first_name",t)},get:function(t){return this.fields.get(t+"_first_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.last_name=function(){return{set:function(t,e){this.fields.set(e+"_last_name",t)},get:function(t){return this.fields.get(t+"_last_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_1=function(){return{set:function(t,e){this.fields.set(e+"_address_1",t)},get:function(t){return this.fields.get(t+"_address_1")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_2=function(){return{set:function(t,e){this.fields.set(e+"_address_2",t)},get:function(t){return this.fields.get(t+"_address_2")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(t,e){t=t.split(" ");0<t.length&&this.fields.set(e+"_first_name",t[0]),1<t.length&&this.fields.set(e+"_last_name",t[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(t,e){this.fields.set(e+"_email",t)},get:function(t){return this.fields.get(t+"_email")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(t,e){this.fields.set(e+"_phone",t)},get:function(t){return this.fields.get(t+"_phone")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(t,e){this.fields.set(e+"_country",t)},get:function(t){return this.fields.get(t+"_country")},isValid:function(t){return"string"==typeof t&&2===t.length}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(i,t){2<(i=i.toUpperCase()).length&&"checkout"===this.page&&o("#"+t+"_state option").each(function(){var t=o(this),e=t.text().toUpperCase();i===e&&(i=t.val())}),this.fields.set(t+"_state",i)},get:function(t){return this.fields.get(t+"_state")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(t,e){this.fields.set(e+"_city",t)},get:function(t){return this.fields.get(t+"_city")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.postcode=function(){return{set:function(t,e){this.fields.set(e+"_postcode",t)},get:function(t){return this.fields.get(t+"_postcode")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.recipient=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(t,e){0<t.length&&this.fields.set(e+"_address_1",t[0]),1<t.length&&this.fields.set(e+"_address_2",t[1])},get:function(t){return[this.fields.get(t+"_address_1"),this.fields.get(t+"_address_2")]},isValid:function(t){return 0<t.length&&("string"==typeof t[0]&&0<t[0].length)}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var i={};return this.fields.forEach(function(t,e){i[e]=t}),i},wc_stripe.CheckoutFields.prototype.toFormFields=function(t){var i=[];this.fields.forEach(function(t,e){e='[name="'+e+'"]';o(e).length&&""!==t&&(o(e).val()!==t&&o(e).is("select")&&i.push(e),o(e).val(t))}),0<i.length&&o(i.join(",")).trigger("change"),void 0!==t&&o(document.body).trigger("update_checkout",t)},wc_stripe.CheckoutFields.prototype.validateFields=function(t){for(var e in this.params){var i=this.params[e];if(-1<e.indexOf(t)&&i.required&&o("#"+e).length&&o("#"+e).is(":visible")){i=o("#"+e).val();if(null==i||0===i.length)return!1}}return!0};try{s=Stripe(wc_stripe_params_v3.api_key,{stripeAccount:wc_stripe_params_v3.account})}catch(t){return i.alert(t),console.log(t)}var r=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)}(window,jQuery);
|
i18n/languages/woo-stripe-payment.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the same license as the Stripe For WooCommerce plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Stripe For WooCommerce 3.2.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2020-10-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: woo-stripe-payment\n"
|
@@ -30,7 +30,7 @@ msgstr ""
|
|
30 |
msgid "Payment Plugins, support@paymentplugins.com"
|
31 |
msgstr ""
|
32 |
|
33 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
34 |
#: includes/admin/meta-boxes/views/html-product-data.php:14
|
35 |
#: includes/gateways/settings/ach-settings-v2.php:9
|
36 |
#: includes/gateways/settings/ach-settings.php:9
|
@@ -41,11 +41,11 @@ msgstr ""
|
|
41 |
msgid "Enabled"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
45 |
msgid "If enabled, your site can accept %s payments through Stripe."
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
49 |
#: includes/gateways/settings/ach-settings-v2.php:64
|
50 |
#: includes/gateways/settings/ach-settings.php:66
|
51 |
#: includes/gateways/settings/applepay-settings.php:20
|
@@ -55,7 +55,7 @@ msgstr ""
|
|
55 |
msgid "General Settings"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
59 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:47
|
60 |
#: includes/gateways/settings/ach-settings-v2.php:68
|
61 |
#: includes/gateways/settings/ach-settings.php:70
|
@@ -66,7 +66,7 @@ msgstr ""
|
|
66 |
msgid "Title"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
70 |
#: includes/gateways/settings/ach-settings-v2.php:74
|
71 |
#: includes/gateways/settings/ach-settings.php:76
|
72 |
#: includes/gateways/settings/applepay-settings.php:30
|
@@ -76,7 +76,7 @@ msgstr ""
|
|
76 |
msgid "Description"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
80 |
#: includes/gateways/settings/ach-settings-v2.php:77
|
81 |
#: includes/gateways/settings/ach-settings.php:79
|
82 |
#: includes/gateways/settings/applepay-settings.php:33
|
@@ -86,23 +86,23 @@ msgstr ""
|
|
86 |
msgid "Leave blank if you don't want a description to show for the gateway."
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
90 |
msgid "Order %s"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
94 |
msgid "Gateway will appear when store currency is <strong>%s</strong>"
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:
|
98 |
msgid " & billing country is <strong>%s</strong>"
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
102 |
msgid "Please fill out all required fields."
|
103 |
msgstr ""
|
104 |
|
105 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
106 |
#: includes/controllers/class-wc-stripe-controller-cart.php:136
|
107 |
#: includes/controllers/class-wc-stripe-controller-cart.php:196
|
108 |
#: includes/controllers/class-wc-stripe-controller-googlepay.php:137
|
@@ -110,137 +110,137 @@ msgstr ""
|
|
110 |
msgid "Total"
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
114 |
msgid "User must be logged in."
|
115 |
msgstr ""
|
116 |
|
117 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
118 |
msgid "Error saving your payment method. Reason: %s"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
122 |
msgid "Error saving payment method. Reason: %s"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
126 |
msgid "Order refunded in Stripe. Amount: %s"
|
127 |
msgstr ""
|
128 |
|
129 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
130 |
msgid "Order amount captured in Stripe. Amount: %s"
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
134 |
msgid "Error capturing charge in Stripe. Reason: %s"
|
135 |
msgstr ""
|
136 |
|
137 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
138 |
msgid "Error voiding charge. Reason: %s"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
142 |
msgid "Charge voided in Stripe."
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
146 |
msgid "n/a"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
150 |
#: includes/admin/meta-boxes/views/html-order-pay.php:42
|
151 |
msgid "New Card"
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
155 |
#: includes/admin/meta-boxes/views/html-order-pay.php:30
|
156 |
msgid "Saved Cards"
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
160 |
msgid "Attemp to save payment method failed. Reason: %s"
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
164 |
msgid "We were not able to save your payment method. To prevent billing issues with your subscription, please add a payment method to the subscription."
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
168 |
msgid "We were not able to save your payment method. Reason: %s"
|
169 |
msgstr ""
|
170 |
|
171 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
172 |
msgid "Payment Method Token"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
176 |
msgid "Recurring payment for order failed. Reason: %s"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
180 |
msgid "Recurring payment captured in Stripe. Payment method: %s"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
184 |
msgid "Recurring payment authorized in Stripe. Payment method: %s"
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
188 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
189 |
msgid "Customer must manually complete payment for payment method %s"
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
193 |
msgid "Error saving payment method for subscription. Reason: %s"
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
197 |
#: includes/abstract/abstract-wc-stripe-payment.php:219
|
198 |
msgid "Order %1$s from %2$s"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
202 |
msgid "Pre-order payment for order failed. Reason: %s"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
206 |
msgid "Pre-order payment captured in Stripe. Payment method: %s"
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
210 |
msgid "Pre-order payment authorized in Stripe. Payment method: %s"
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
214 |
msgid "Cannot process payment"
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
218 |
msgid "Increase your conversion rate by offering %1$s on your Product and Cart pages, or at the top of the checkout page. <br/><strong>Note:</strong> you can control which products display %s by going to the product edit page."
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
222 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
223 |
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:189
|
224 |
#: includes/wc-stripe-functions.php:405
|
225 |
#: includes/wc-stripe-functions.php:470
|
226 |
msgid "Shipping"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
230 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
231 |
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:199
|
232 |
#: includes/wc-stripe-functions.php:422
|
233 |
#: includes/wc-stripe-functions.php:478
|
234 |
msgid "Discount"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
238 |
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:221
|
239 |
#: includes/wc-stripe-functions.php:430
|
240 |
msgid "Tax"
|
241 |
msgstr ""
|
242 |
|
243 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
244 |
#: includes/wc-stripe-functions.php:489
|
245 |
msgid "Fees"
|
246 |
msgstr ""
|
@@ -301,19 +301,19 @@ msgid ""
|
|
301 |
" Stripe is requesting that all merchants switch. %1$sUpdate Integration%2$s"
|
302 |
msgstr ""
|
303 |
|
304 |
-
#: includes/admin/class-wc-stripe-admin-settings.php:
|
305 |
msgid "Local Gateways"
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: includes/admin/class-wc-stripe-admin-settings.php:
|
309 |
msgid "Stripe Email Options"
|
310 |
msgstr ""
|
311 |
|
312 |
-
#: includes/admin/class-wc-stripe-admin-settings.php:
|
313 |
msgid "Email Receipt"
|
314 |
msgstr ""
|
315 |
|
316 |
-
#: includes/admin/class-wc-stripe-admin-settings.php:
|
317 |
msgid "If enabled, an email receipt will be sent to the customer by Stripe when the order is processed."
|
318 |
msgstr ""
|
319 |
|
@@ -670,7 +670,7 @@ msgstr ""
|
|
670 |
msgid "Your payment is being processed and your order status will be updated once the funds are received."
|
671 |
msgstr ""
|
672 |
|
673 |
-
#: includes/class-wc-stripe-frontend-scripts.php:
|
674 |
msgid "No matches found"
|
675 |
msgstr ""
|
676 |
|
@@ -690,7 +690,7 @@ msgstr ""
|
|
690 |
msgid "Payment authorization failed."
|
691 |
msgstr ""
|
692 |
|
693 |
-
#: includes/class-wc-stripe-rest-api.php:
|
694 |
msgid "%1$s is an invalid controller name."
|
695 |
msgstr ""
|
696 |
|
@@ -1065,9 +1065,9 @@ msgstr ""
|
|
1065 |
|
1066 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:33
|
1067 |
msgid ""
|
1068 |
-
"By providing your IBAN and confirming this payment, you are\n"
|
1069 |
-
"\t\t\tauthorizing %s and Stripe, our payment service provider, to send instructions to your bank to debit your account\n"
|
1070 |
-
"\t\t\tand your bank to debit your account in accordance with those instructions. You are entitled to a refund from your bank under the\n"
|
1071 |
"\t\t\tterms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited."
|
1072 |
msgstr ""
|
1073 |
|
2 |
# This file is distributed under the same license as the Stripe For WooCommerce plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Stripe For WooCommerce 3.2.5\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2020-10-25T04:28:42+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: woo-stripe-payment\n"
|
30 |
msgid "Payment Plugins, support@paymentplugins.com"
|
31 |
msgstr ""
|
32 |
|
33 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:103
|
34 |
#: includes/admin/meta-boxes/views/html-product-data.php:14
|
35 |
#: includes/gateways/settings/ach-settings-v2.php:9
|
36 |
#: includes/gateways/settings/ach-settings.php:9
|
41 |
msgid "Enabled"
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:108
|
45 |
msgid "If enabled, your site can accept %s payments through Stripe."
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:112
|
49 |
#: includes/gateways/settings/ach-settings-v2.php:64
|
50 |
#: includes/gateways/settings/ach-settings.php:66
|
51 |
#: includes/gateways/settings/applepay-settings.php:20
|
55 |
msgid "General Settings"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:116
|
59 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:47
|
60 |
#: includes/gateways/settings/ach-settings-v2.php:68
|
61 |
#: includes/gateways/settings/ach-settings.php:70
|
66 |
msgid "Title"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:122
|
70 |
#: includes/gateways/settings/ach-settings-v2.php:74
|
71 |
#: includes/gateways/settings/ach-settings.php:76
|
72 |
#: includes/gateways/settings/applepay-settings.php:30
|
76 |
msgid "Description"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:125
|
80 |
#: includes/gateways/settings/ach-settings-v2.php:77
|
81 |
#: includes/gateways/settings/ach-settings.php:79
|
82 |
#: includes/gateways/settings/applepay-settings.php:33
|
86 |
msgid "Leave blank if you don't want a description to show for the gateway."
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:177
|
90 |
msgid "Order %s"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:277
|
94 |
msgid "Gateway will appear when store currency is <strong>%s</strong>"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:280
|
98 |
msgid " & billing country is <strong>%s</strong>"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:407
|
102 |
msgid "Please fill out all required fields."
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:422
|
106 |
#: includes/controllers/class-wc-stripe-controller-cart.php:136
|
107 |
#: includes/controllers/class-wc-stripe-controller-cart.php:196
|
108 |
#: includes/controllers/class-wc-stripe-controller-googlepay.php:137
|
110 |
msgid "Total"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:482
|
114 |
msgid "User must be logged in."
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:494
|
118 |
msgid "Error saving your payment method. Reason: %s"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:509
|
122 |
msgid "Error saving payment method. Reason: %s"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:528
|
126 |
msgid "Order refunded in Stripe. Amount: %s"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:566
|
130 |
msgid "Order amount captured in Stripe. Amount: %s"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:576
|
134 |
msgid "Error capturing charge in Stripe. Reason: %s"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:597
|
138 |
msgid "Error voiding charge. Reason: %s"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:599
|
142 |
msgid "Charge voided in Stripe."
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:769
|
146 |
msgid "n/a"
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:797
|
150 |
#: includes/admin/meta-boxes/views/html-order-pay.php:42
|
151 |
msgid "New Card"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:801
|
155 |
#: includes/admin/meta-boxes/views/html-order-pay.php:30
|
156 |
msgid "Saved Cards"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1008
|
160 |
msgid "Attemp to save payment method failed. Reason: %s"
|
161 |
msgstr ""
|
162 |
|
163 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1030
|
164 |
msgid "We were not able to save your payment method. To prevent billing issues with your subscription, please add a payment method to the subscription."
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1032
|
168 |
msgid "We were not able to save your payment method. Reason: %s"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1066
|
172 |
msgid "Payment Method Token"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1086
|
176 |
msgid "Recurring payment for order failed. Reason: %s"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1099
|
180 |
msgid "Recurring payment captured in Stripe. Payment method: %s"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1101
|
184 |
msgid "Recurring payment authorized in Stripe. Payment method: %s"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1104
|
188 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1363
|
189 |
msgid "Customer must manually complete payment for payment method %s"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1120
|
193 |
msgid "Error saving payment method for subscription. Reason: %s"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1181
|
197 |
#: includes/abstract/abstract-wc-stripe-payment.php:219
|
198 |
msgid "Order %1$s from %2$s"
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1350
|
202 |
msgid "Pre-order payment for order failed. Reason: %s"
|
203 |
msgstr ""
|
204 |
|
205 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1358
|
206 |
msgid "Pre-order payment captured in Stripe. Payment method: %s"
|
207 |
msgstr ""
|
208 |
|
209 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1360
|
210 |
msgid "Pre-order payment authorized in Stripe. Payment method: %s"
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1432
|
214 |
msgid "Cannot process payment"
|
215 |
msgstr ""
|
216 |
|
217 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1440
|
218 |
msgid "Increase your conversion rate by offering %1$s on your Product and Cart pages, or at the top of the checkout page. <br/><strong>Note:</strong> you can control which products display %s by going to the product edit page."
|
219 |
msgstr ""
|
220 |
|
221 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1551
|
222 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1582
|
223 |
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:189
|
224 |
#: includes/wc-stripe-functions.php:405
|
225 |
#: includes/wc-stripe-functions.php:470
|
226 |
msgid "Shipping"
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1559
|
230 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1585
|
231 |
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:199
|
232 |
#: includes/wc-stripe-functions.php:422
|
233 |
#: includes/wc-stripe-functions.php:478
|
234 |
msgid "Discount"
|
235 |
msgstr ""
|
236 |
|
237 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1562
|
238 |
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:221
|
239 |
#: includes/wc-stripe-functions.php:430
|
240 |
msgid "Tax"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1592
|
244 |
#: includes/wc-stripe-functions.php:489
|
245 |
msgid "Fees"
|
246 |
msgstr ""
|
301 |
" Stripe is requesting that all merchants switch. %1$sUpdate Integration%2$s"
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: includes/admin/class-wc-stripe-admin-settings.php:72
|
305 |
msgid "Local Gateways"
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: includes/admin/class-wc-stripe-admin-settings.php:88
|
309 |
msgid "Stripe Email Options"
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: includes/admin/class-wc-stripe-admin-settings.php:92
|
313 |
msgid "Email Receipt"
|
314 |
msgstr ""
|
315 |
|
316 |
+
#: includes/admin/class-wc-stripe-admin-settings.php:95
|
317 |
msgid "If enabled, an email receipt will be sent to the customer by Stripe when the order is processed."
|
318 |
msgstr ""
|
319 |
|
670 |
msgid "Your payment is being processed and your order status will be updated once the funds are received."
|
671 |
msgstr ""
|
672 |
|
673 |
+
#: includes/class-wc-stripe-frontend-scripts.php:77
|
674 |
msgid "No matches found"
|
675 |
msgstr ""
|
676 |
|
690 |
msgid "Payment authorization failed."
|
691 |
msgstr ""
|
692 |
|
693 |
+
#: includes/class-wc-stripe-rest-api.php:42
|
694 |
msgid "%1$s is an invalid controller name."
|
695 |
msgstr ""
|
696 |
|
1065 |
|
1066 |
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:33
|
1067 |
msgid ""
|
1068 |
+
"By providing your IBAN and confirming this payment, you are\r\n"
|
1069 |
+
"\t\t\tauthorizing %s and Stripe, our payment service provider, to send instructions to your bank to debit your account\r\n"
|
1070 |
+
"\t\t\tand your bank to debit your account in accordance with those instructions. You are entitled to a refund from your bank under the\r\n"
|
1071 |
"\t\t\tterms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited."
|
1072 |
msgstr ""
|
1073 |
|
includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php
CHANGED
@@ -1,305 +1,307 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
if ( ! class_exists( 'WC_Payment_Gateway_Stripe' ) ) {
|
5 |
-
return;
|
6 |
-
}
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Local payment method classes should extend this abstract class
|
10 |
-
*
|
11 |
-
* @package Stripe/Abstract
|
12 |
-
* @author Payment Plugins
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gateway_Stripe {
|
16 |
-
|
17 |
-
protected $tab_title = '';
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Currencies this gateway accepts
|
21 |
-
* @var array
|
22 |
-
*/
|
23 |
-
protected $currencies = array();
|
24 |
-
|
25 |
-
protected $local_payment_type = '';
|
26 |
-
|
27 |
-
public $countries = array();
|
28 |
-
|
29 |
-
protected $local_payment_description = '';
|
30 |
-
|
31 |
-
public function __construct() {
|
32 |
-
$this->token_type = 'Stripe_Local';
|
33 |
-
$this->template_name = 'local-payment.php';
|
34 |
-
parent::__construct();
|
35 |
-
$this->settings['method_format'] = 'gateway_title';
|
36 |
-
$this->settings['charge_type'] = 'capture';
|
37 |
-
$this->settings['order_status'] = 'default';
|
38 |
-
}
|
39 |
-
|
40 |
-
public function hooks() {
|
41 |
-
parent::hooks();
|
42 |
-
add_filter( 'wc_stripe_local_gateway_tabs', array( $this, 'local_gateway_tab' ) );
|
43 |
-
remove_filter( 'wc_stripe_settings_nav_tabs', array( $this, 'admin_nav_tab' ) );
|
44 |
-
add_filter( 'wc_stripe_local_gateways_tab', array( $this, 'admin_nav_tab' ) );
|
45 |
-
add_action( '
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
*
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
*
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
'
|
106 |
-
'
|
107 |
-
'
|
108 |
-
'
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
'
|
118 |
-
'
|
119 |
-
'
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
'
|
125 |
-
'
|
126 |
-
'
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
'
|
159 |
-
'
|
160 |
-
'
|
161 |
-
'
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
'
|
177 |
-
'
|
178 |
-
'
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
* @
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
* @
|
199 |
-
*
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
*
|
214 |
-
* @
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
$url =
|
222 |
-
}
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
$
|
239 |
-
|
240 |
-
$
|
241 |
-
|
242 |
-
$
|
243 |
-
$
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
return in_array( $currency, $this->currencies );
|
254 |
-
}
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
$token
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
*
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
*
|
297 |
-
* @
|
298 |
-
*
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
if ( ! class_exists( 'WC_Payment_Gateway_Stripe' ) ) {
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Local payment method classes should extend this abstract class
|
10 |
+
*
|
11 |
+
* @package Stripe/Abstract
|
12 |
+
* @author Payment Plugins
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gateway_Stripe {
|
16 |
+
|
17 |
+
protected $tab_title = '';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Currencies this gateway accepts
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
protected $currencies = array();
|
24 |
+
|
25 |
+
protected $local_payment_type = '';
|
26 |
+
|
27 |
+
public $countries = array();
|
28 |
+
|
29 |
+
protected $local_payment_description = '';
|
30 |
+
|
31 |
+
public function __construct() {
|
32 |
+
$this->token_type = 'Stripe_Local';
|
33 |
+
$this->template_name = 'local-payment.php';
|
34 |
+
parent::__construct();
|
35 |
+
$this->settings['method_format'] = 'gateway_title';
|
36 |
+
$this->settings['charge_type'] = 'capture';
|
37 |
+
$this->settings['order_status'] = 'default';
|
38 |
+
}
|
39 |
+
|
40 |
+
public function hooks() {
|
41 |
+
parent::hooks();
|
42 |
+
add_filter( 'wc_stripe_local_gateway_tabs', array( $this, 'local_gateway_tab' ) );
|
43 |
+
remove_filter( 'wc_stripe_settings_nav_tabs', array( $this, 'admin_nav_tab' ) );
|
44 |
+
add_filter( 'wc_stripe_local_gateways_tab', array( $this, 'admin_nav_tab' ) );
|
45 |
+
add_action( 'woocommerce_update_options_checkout_' . $this->id, array( $this, 'process_admin_options' ) );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param WC_Stripe_Frontend_Scripts $scripts
|
50 |
+
*/
|
51 |
+
public function enqueue_checkout_scripts( $scripts ) {
|
52 |
+
$scripts->enqueue_local_payment_scripts();
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
*
|
57 |
+
* @param \Stripe\Source $source
|
58 |
+
* @param WC_Order $order
|
59 |
+
*/
|
60 |
+
public function get_source_redirect_url( $source, $order ) {
|
61 |
+
return $source->redirect->url;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function output_settings_nav() {
|
65 |
+
parent::output_settings_nav();
|
66 |
+
include wc_stripe()->plugin_path() . 'includes/admin/views/html-settings-local-payments-nav.php';
|
67 |
+
}
|
68 |
+
|
69 |
+
public function init_form_fields() {
|
70 |
+
$this->form_fields = apply_filters( 'wc_stripe_form_fields_' . $this->id, $this->get_local_payment_settings() );
|
71 |
+
}
|
72 |
+
|
73 |
+
public function init_supports() {
|
74 |
+
$this->supports = array( 'tokenization', 'products', 'refunds' );
|
75 |
+
}
|
76 |
+
|
77 |
+
public function process_payment( $order_id ) {
|
78 |
+
$result = parent::process_payment( $order_id );
|
79 |
+
|
80 |
+
if ( defined( WC_Stripe_Constants::WOOCOMMERCE_STRIPE_ORDER_PAY ) && $result['result'] == 'success' ) {
|
81 |
+
wp_send_json( array(
|
82 |
+
'success' => true,
|
83 |
+
'redirect' => $result['redirect']
|
84 |
+
), 200 );
|
85 |
+
exit();
|
86 |
+
}
|
87 |
+
|
88 |
+
return $result;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Return an array of form fields for the gateway.
|
93 |
+
*
|
94 |
+
* @return array
|
95 |
+
*/
|
96 |
+
public function get_local_payment_settings() {
|
97 |
+
return array(
|
98 |
+
'desc' => array(
|
99 |
+
'type' => 'description',
|
100 |
+
'description' => $this->get_payment_description(),
|
101 |
+
),
|
102 |
+
'enabled' => array(
|
103 |
+
'title' => __( 'Enabled', 'woo-stripe-payment' ),
|
104 |
+
'type' => 'checkbox',
|
105 |
+
'default' => 'no',
|
106 |
+
'value' => 'yes',
|
107 |
+
'desc_tip' => true,
|
108 |
+
'description' => sprintf( __( 'If enabled, your site can accept %s payments through Stripe.', 'woo-stripe-payment' ), $this->get_method_title() ),
|
109 |
+
),
|
110 |
+
'general_settings' => array(
|
111 |
+
'type' => 'title',
|
112 |
+
'title' => __( 'General Settings', 'woo-stripe-payment' ),
|
113 |
+
),
|
114 |
+
'title_text' => array(
|
115 |
+
'type' => 'text',
|
116 |
+
'title' => __( 'Title', 'woo-stripe-payment' ),
|
117 |
+
'default' => $this->get_method_title(),
|
118 |
+
'desc_tip' => true,
|
119 |
+
'description' => sprintf( __( 'Title of the %s gateway' ), $this->get_method_title() ),
|
120 |
+
),
|
121 |
+
'description' => array(
|
122 |
+
'title' => __( 'Description', 'woo-stripe-payment' ),
|
123 |
+
'type' => 'text',
|
124 |
+
'default' => '',
|
125 |
+
'description' => __( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
126 |
+
'desc_tip' => true,
|
127 |
+
),
|
128 |
+
);
|
129 |
+
}
|
130 |
+
|
131 |
+
public function get_localized_params() {
|
132 |
+
return array_merge_recursive(
|
133 |
+
parent::get_localized_params(),
|
134 |
+
array(
|
135 |
+
'local_payment_type' => $this->local_payment_type,
|
136 |
+
'return_url' => add_query_arg(
|
137 |
+
array(
|
138 |
+
'_payment_nonce' => wp_create_nonce( 'local-payment' ),
|
139 |
+
'wc-stripe-local-gateway' => $this->id,
|
140 |
+
),
|
141 |
+
wc_get_checkout_url()
|
142 |
+
),
|
143 |
+
'element_params' => $this->get_element_params(),
|
144 |
+
'routes' => array(
|
145 |
+
'order_pay' => wc_stripe()->rest_api->checkout->rest_url( 'order-pay' ),
|
146 |
+
'delete_source' => wc_stripe()->rest_api->checkout->rest_url( 'source' )
|
147 |
+
)
|
148 |
+
)
|
149 |
+
);
|
150 |
+
}
|
151 |
+
|
152 |
+
public function get_element_params() {
|
153 |
+
return array(
|
154 |
+
'style' => array(
|
155 |
+
'base' => array(
|
156 |
+
'padding' => '10px 12px',
|
157 |
+
'color' => '#32325d',
|
158 |
+
'fontFamily' => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
159 |
+
'fontSmoothing' => 'antialiased',
|
160 |
+
'fontSize' => '16px',
|
161 |
+
'::placeholder' => array( 'color' => '#aab7c4' ),
|
162 |
+
),
|
163 |
+
'invalid' => array( 'color' => '#fa755a' ),
|
164 |
+
),
|
165 |
+
);
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
*
|
170 |
+
* @param WC_Order $order
|
171 |
+
*/
|
172 |
+
public function get_source_args( $order ) {
|
173 |
+
$args = array(
|
174 |
+
'type' => $this->local_payment_type,
|
175 |
+
'amount' => wc_stripe_add_number_precision( $order->get_total(), $order->get_currency() ),
|
176 |
+
'currency' => $order->get_currency(),
|
177 |
+
'statement_descriptor' => sprintf( __( 'Order %s', 'woo-stripe-payment' ), $order->get_order_number() ),
|
178 |
+
'owner' => array(
|
179 |
+
'name' => $this->payment_object->get_name_from_order( $order, 'billing' )
|
180 |
+
),
|
181 |
+
'redirect' => array( 'return_url' => $this->get_local_payment_return_url( $order ) ),
|
182 |
+
);
|
183 |
+
if ( ( $email = $order->get_billing_email() ) ) {
|
184 |
+
$args['owner']['email'] = $email;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* @param $args
|
189 |
+
*
|
190 |
+
* @since 3.1.8
|
191 |
+
*/
|
192 |
+
return apply_filters( 'wc_stripe_get_source_args', $args );
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @param WC_Order $order
|
197 |
+
*
|
198 |
+
* @retun array
|
199 |
+
* @since 3.2.4
|
200 |
+
*/
|
201 |
+
public function get_update_source_args( $order ) {
|
202 |
+
return array(
|
203 |
+
'metadata' => array(
|
204 |
+
'order_id' => $order->get_id(),
|
205 |
+
'created' => time(),
|
206 |
+
),
|
207 |
+
);
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
*
|
212 |
+
* @param WC_Order $order
|
213 |
+
*
|
214 |
+
* @return string
|
215 |
+
*/
|
216 |
+
protected function get_local_payment_return_url( $order ) {
|
217 |
+
global $wp;
|
218 |
+
if ( isset( $wp->query_vars['order-pay'] ) ) {
|
219 |
+
$url = $order->get_checkout_payment_url();
|
220 |
+
} else {
|
221 |
+
$url = wc_get_checkout_url();
|
222 |
+
}
|
223 |
+
|
224 |
+
return add_query_arg(
|
225 |
+
array(
|
226 |
+
'_payment_nonce' => wp_create_nonce( 'local-payment' ),
|
227 |
+
'wc-stripe-local-gateway' => $this->id,
|
228 |
+
),
|
229 |
+
$url
|
230 |
+
);
|
231 |
+
}
|
232 |
+
|
233 |
+
public function is_local_payment_available() {
|
234 |
+
global $wp;
|
235 |
+
if ( isset( $wp->query_vars['order-pay'] ) ) {
|
236 |
+
$order = wc_get_order( absint( $wp->query_vars['order-pay'] ) );
|
237 |
+
$currency = $order->get_currency();
|
238 |
+
$billing_country = $order->get_billing_country();
|
239 |
+
} else {
|
240 |
+
$currency = get_woocommerce_currency();
|
241 |
+
$customer = WC()->customer;
|
242 |
+
$billing_country = $customer ? $customer->get_billing_country() : null;
|
243 |
+
if ( ! $billing_country ) {
|
244 |
+
$billing_country = WC()->countries->get_base_country();
|
245 |
+
}
|
246 |
+
}
|
247 |
+
if ( method_exists( $this, 'validate_local_payment_available' ) ) {
|
248 |
+
return $this->validate_local_payment_available( $currency, $billing_country );
|
249 |
+
} else {
|
250 |
+
if ( empty( $this->countries ) ) {
|
251 |
+
return in_array( $currency, $this->currencies );
|
252 |
+
} else {
|
253 |
+
return $billing_country && in_array( $currency, $this->currencies ) && in_array( $billing_country, $this->countries );
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
public function get_payment_token( $method_id, $method_details = array() ) {
|
259 |
+
/**
|
260 |
+
*
|
261 |
+
* @var WC_Payment_Token_Stripe_Local $token
|
262 |
+
*/
|
263 |
+
$token = parent::get_payment_token( $method_id, $method_details );
|
264 |
+
$token->set_gateway_title( $this->title );
|
265 |
+
|
266 |
+
return $token;
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Return a description for (for admin sections) describing the required currency & or billing country(s).
|
271 |
+
*
|
272 |
+
* @return string
|
273 |
+
*/
|
274 |
+
protected function get_payment_description() {
|
275 |
+
$desc = '';
|
276 |
+
if ( $this->currencies ) {
|
277 |
+
$desc .= sprintf( __( 'Gateway will appear when store currency is <strong>%s</strong>', 'woo-stripe-payment' ), implode( ', ', $this->currencies ) );
|
278 |
+
}
|
279 |
+
if ( $this->countries ) {
|
280 |
+
$desc .= sprintf( __( ' & billing country is <strong>%s</strong>', 'woo-stripe-payment' ), implode( ', ', $this->countries ) );
|
281 |
+
}
|
282 |
+
|
283 |
+
return $desc;
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Return a description of the payment method.
|
288 |
+
*/
|
289 |
+
public function get_local_payment_description() {
|
290 |
+
return apply_filters( 'wc_stripe_local_payment_description', $this->local_payment_description, $this );
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
*
|
295 |
+
* @param string $text
|
296 |
+
*
|
297 |
+
* @return string
|
298 |
+
* @since 3.1.3
|
299 |
+
*/
|
300 |
+
public function get_order_button_text( $text ) {
|
301 |
+
return apply_filters( 'wc_stripe_order_button_text', $text, $this );
|
302 |
+
}
|
303 |
+
|
304 |
+
public function has_enqueued_scripts( $scripts ) {
|
305 |
+
return wp_script_is( $scripts->get_handle( 'local-payment' ) );
|
306 |
+
}
|
307 |
+
}
|
includes/abstract/abstract-wc-payment-gateway-stripe.php
CHANGED
@@ -146,7 +146,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
146 |
|
147 |
public function hooks() {
|
148 |
add_filter( 'wc_stripe_settings_nav_tabs', array( $this, 'admin_nav_tab' ) );
|
149 |
-
add_action( '
|
150 |
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
151 |
add_filter( 'woocommerce_payment_methods_list_item', array( $this, 'payment_methods_list_item' ), 10, 2 );
|
152 |
add_action( 'wc_stripe_payment_token_deleted_' . $this->id, array( $this, 'delete_payment_method' ), 10, 2 );
|
@@ -286,6 +286,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
286 |
}
|
287 |
if ( ! empty( wc_stripe()->scripts()->enqueued_scripts ) ) {
|
288 |
wp_enqueue_style( wc_stripe()->scripts()->prefix . 'styles', wc_stripe()->assets_url( 'css/stripe' . wc_stripe()->scripts()->get_min() . '.css' ), array(), wc_stripe()->version() );
|
|
|
289 |
}
|
290 |
}
|
291 |
|
@@ -1727,4 +1728,14 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
1727 |
protected function is_processing_scheduled_payment() {
|
1728 |
return doing_action( 'woocommerce_scheduled_subscription_payment_' . $this->id );
|
1729 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1730 |
}
|
146 |
|
147 |
public function hooks() {
|
148 |
add_filter( 'wc_stripe_settings_nav_tabs', array( $this, 'admin_nav_tab' ) );
|
149 |
+
add_action( 'woocommerce_stripe_settings_checkout_' . $this->id, array( $this, 'enqueue_admin_scripts' ) );
|
150 |
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
151 |
add_filter( 'woocommerce_payment_methods_list_item', array( $this, 'payment_methods_list_item' ), 10, 2 );
|
152 |
add_action( 'wc_stripe_payment_token_deleted_' . $this->id, array( $this, 'delete_payment_method' ), 10, 2 );
|
286 |
}
|
287 |
if ( ! empty( wc_stripe()->scripts()->enqueued_scripts ) ) {
|
288 |
wp_enqueue_style( wc_stripe()->scripts()->prefix . 'styles', wc_stripe()->assets_url( 'css/stripe' . wc_stripe()->scripts()->get_min() . '.css' ), array(), wc_stripe()->version() );
|
289 |
+
wp_style_add_data( wc_stripe()->scripts()->prefix . 'styles', 'rtl', 'replace' );
|
290 |
}
|
291 |
}
|
292 |
|
1728 |
protected function is_processing_scheduled_payment() {
|
1729 |
return doing_action( 'woocommerce_scheduled_subscription_payment_' . $this->id );
|
1730 |
}
|
1731 |
+
|
1732 |
+
/**
|
1733 |
+
* @param WC_Stripe_Frontend_Scripts $scripts
|
1734 |
+
*
|
1735 |
+
* @return bool
|
1736 |
+
* @since 3.2.5
|
1737 |
+
*/
|
1738 |
+
public function has_enqueued_scripts( $scripts ) {
|
1739 |
+
return false;
|
1740 |
+
}
|
1741 |
}
|
includes/abstract/abstract-wc-payment-token-stripe.php
CHANGED
@@ -1,186 +1,186 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
require_once( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/traits/wc-stripe-payment-token-traits.php' );
|
5 |
-
|
6 |
-
/**
|
7 |
-
*
|
8 |
-
* @since 3.0.0
|
9 |
-
* @author PaymentPlugins
|
10 |
-
* @package Stripe/Abstract
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
14 |
-
|
15 |
-
protected $has_expiration = false;
|
16 |
-
|
17 |
-
protected $object_type = 'payment_token';
|
18 |
-
|
19 |
-
/**
|
20 |
-
*
|
21 |
-
* @since 3.1.0
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
protected $stripe_payment_type;
|
25 |
-
|
26 |
-
protected $extra_data = array(
|
27 |
-
'format' => '',
|
28 |
-
'environment' => 'production',
|
29 |
-
'brand' => '',
|
30 |
-
'customer_id' => '',
|
31 |
-
);
|
32 |
-
|
33 |
-
protected $stripe_data = array();
|
34 |
-
|
35 |
-
/**
|
36 |
-
* The format of the payment method
|
37 |
-
*
|
38 |
-
* @var string
|
39 |
-
*/
|
40 |
-
protected $format = '';
|
41 |
-
|
42 |
-
public function __construct( $token = '' ) {
|
43 |
-
// use reflection to merge all extra data keys.
|
44 |
-
$this->extra_data = array_merge( $this->extra_data, $this->get_stripe_data( $this ) );
|
45 |
-
parent::__construct( $token );
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
*
|
50 |
-
* @param mixed $details
|
51 |
-
*/
|
52 |
-
public abstract function details_to_props( $details );
|
53 |
-
|
54 |
-
public function set_format( $value ) {
|
55 |
-
$this->format = $value;
|
56 |
-
}
|
57 |
-
|
58 |
-
public function set_environment( $value ) {
|
59 |
-
$this->set_prop( 'environment', $value );
|
60 |
-
}
|
61 |
-
|
62 |
-
public function set_customer_id( $value ) {
|
63 |
-
$this->set_prop( 'customer_id', $value );
|
64 |
-
}
|
65 |
-
|
66 |
-
public function get_format() {
|
67 |
-
return $this->format;
|
68 |
-
}
|
69 |
-
|
70 |
-
public function get_environment() {
|
71 |
-
return $this->get_prop( 'environment' );
|
72 |
-
}
|
73 |
-
|
74 |
-
public function get_customer_id() {
|
75 |
-
return $this->get_prop( 'customer_id' );
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Return a human readable representation of the payment method.
|
80 |
-
*
|
81 |
-
* @param string $format
|
82 |
-
*
|
83 |
-
* @retun string
|
84 |
-
*/
|
85 |
-
public function get_payment_method_title( $format = '' ) {
|
86 |
-
$format = empty( $format ) ? $this->get_format() : $format;
|
87 |
-
$format = $this->get_formats()[ $format ]['format'];
|
88 |
-
$data = $this->get_props_data();
|
89 |
-
|
90 |
-
return apply_filters( 'wc_stripe_payment_method_title', str_replace( array_keys( $data ), $data, $format ), $this );
|
91 |
-
}
|
92 |
-
|
93 |
-
public function get_props_data() {
|
94 |
-
$data = array();
|
95 |
-
foreach ( $this->extra_data as $k => $v ) {
|
96 |
-
if ( method_exists( $this, "get_{$k}" ) ) {
|
97 |
-
$data[ '{' . $k . '}' ] = $this->{"get_$k"}();
|
98 |
-
} else {
|
99 |
-
$data[ '{' . $k . '}' ] = $this->get_prop( $k );
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
return $data;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Returns an array of merged attributes comprised of the $stripe_data property.
|
108 |
-
*
|
109 |
-
* @param object $instance
|
110 |
-
*/
|
111 |
-
public function get_stripe_data( $instance ) {
|
112 |
-
$data = array();
|
113 |
-
try {
|
114 |
-
$class = new ReflectionClass( $instance );
|
115 |
-
$props = $class->getDefaultProperties();
|
116 |
-
if ( isset( $props['stripe_data'] ) ) {
|
117 |
-
$data = $props['stripe_data'];
|
118 |
-
}
|
119 |
-
if ( is_subclass_of( get_parent_class( $instance ), 'WC_Payment_Token_Stripe' ) ) {
|
120 |
-
$data = array_merge( $this->get_stripe_data( get_parent_class( $instance ) ), $data );
|
121 |
-
}
|
122 |
-
|
123 |
-
return $data;
|
124 |
-
} catch ( Exception $e ) {
|
125 |
-
return array();
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Return a json array of data that represents the object.
|
131 |
-
*
|
132 |
-
* @return array
|
133 |
-
*/
|
134 |
-
public function to_json() {
|
135 |
-
return apply_filters(
|
136 |
-
'wc_stripe_get_' . $this->object_type . '_json',
|
137 |
-
array(
|
138 |
-
'id' => $this->get_id(),
|
139 |
-
'type' => $this->get_type(),
|
140 |
-
'token' => $this->get_token(),
|
141 |
-
'title' => $this->get_payment_method_title(),
|
142 |
-
'gateway' => $this->get_gateway_id(),
|
143 |
-
)
|
144 |
-
);
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Return formats used by the token to display a human readable title.
|
149 |
-
*/
|
150 |
-
public abstract function get_formats();
|
151 |
-
|
152 |
-
public function get_brand( $context = 'view' ) {
|
153 |
-
return wc_get_credit_card_type_label( $this->get_prop( 'brand', $context ) );
|
154 |
-
}
|
155 |
-
|
156 |
-
public function set_brand( $value ) {
|
157 |
-
$this->set_prop( 'brand', $value );
|
158 |
-
}
|
159 |
-
|
160 |
-
public function get_html_classes() {
|
161 |
-
return '';
|
162 |
-
}
|
163 |
-
|
164 |
-
public function has_expiration() {
|
165 |
-
return $this->has_expiration;
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
*
|
170 |
-
* @since 3.1.0
|
171 |
-
*/
|
172 |
-
public abstract function delete_from_stripe();
|
173 |
-
|
174 |
-
/**
|
175 |
-
*
|
176 |
-
* @since 3.1.0
|
177 |
-
*/
|
178 |
-
public abstract function save_payment_method();
|
179 |
-
|
180 |
-
public static function token_exists( $token_id, $user_id ) {
|
181 |
-
global $wpdb;
|
182 |
-
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_payment_tokens WHERE token = %s AND gateway_id LIKE %s AND user_id = %d", $token_id, '%stripe_%', $user_id ) );
|
183 |
-
|
184 |
-
return $count > 0;
|
185 |
-
}
|
186 |
-
}
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
require_once( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/traits/wc-stripe-payment-token-traits.php' );
|
5 |
+
|
6 |
+
/**
|
7 |
+
*
|
8 |
+
* @since 3.0.0
|
9 |
+
* @author PaymentPlugins
|
10 |
+
* @package Stripe/Abstract
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
14 |
+
|
15 |
+
protected $has_expiration = false;
|
16 |
+
|
17 |
+
protected $object_type = 'payment_token';
|
18 |
+
|
19 |
+
/**
|
20 |
+
*
|
21 |
+
* @since 3.1.0
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
protected $stripe_payment_type;
|
25 |
+
|
26 |
+
protected $extra_data = array(
|
27 |
+
'format' => '',
|
28 |
+
'environment' => 'production',
|
29 |
+
'brand' => '',
|
30 |
+
'customer_id' => '',
|
31 |
+
);
|
32 |
+
|
33 |
+
protected $stripe_data = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The format of the payment method
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
protected $format = '';
|
41 |
+
|
42 |
+
public function __construct( $token = '' ) {
|
43 |
+
// use reflection to merge all extra data keys.
|
44 |
+
$this->extra_data = array_merge( $this->extra_data, $this->get_stripe_data( $this ) );
|
45 |
+
parent::__construct( $token );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
*
|
50 |
+
* @param mixed $details
|
51 |
+
*/
|
52 |
+
public abstract function details_to_props( $details );
|
53 |
+
|
54 |
+
public function set_format( $value ) {
|
55 |
+
$this->format = $value;
|
56 |
+
}
|
57 |
+
|
58 |
+
public function set_environment( $value ) {
|
59 |
+
$this->set_prop( 'environment', $value );
|
60 |
+
}
|
61 |
+
|
62 |
+
public function set_customer_id( $value ) {
|
63 |
+
$this->set_prop( 'customer_id', $value );
|
64 |
+
}
|
65 |
+
|
66 |
+
public function get_format() {
|
67 |
+
return $this->format;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function get_environment() {
|
71 |
+
return $this->get_prop( 'environment' );
|
72 |
+
}
|
73 |
+
|
74 |
+
public function get_customer_id() {
|
75 |
+
return $this->get_prop( 'customer_id' );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Return a human readable representation of the payment method.
|
80 |
+
*
|
81 |
+
* @param string $format
|
82 |
+
*
|
83 |
+
* @retun string
|
84 |
+
*/
|
85 |
+
public function get_payment_method_title( $format = '' ) {
|
86 |
+
$format = empty( $format ) ? $this->get_format() : $format;
|
87 |
+
$format = $this->get_formats()[ $format ]['format'];
|
88 |
+
$data = $this->get_props_data();
|
89 |
+
|
90 |
+
return apply_filters( 'wc_stripe_payment_method_title', str_replace( array_keys( $data ), $data, $format ), $this );
|
91 |
+
}
|
92 |
+
|
93 |
+
public function get_props_data() {
|
94 |
+
$data = array();
|
95 |
+
foreach ( $this->extra_data as $k => $v ) {
|
96 |
+
if ( method_exists( $this, "get_{$k}" ) ) {
|
97 |
+
$data[ '{' . $k . '}' ] = $this->{"get_$k"}();
|
98 |
+
} else {
|
99 |
+
$data[ '{' . $k . '}' ] = $this->get_prop( $k );
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
return $data;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Returns an array of merged attributes comprised of the $stripe_data property.
|
108 |
+
*
|
109 |
+
* @param object $instance
|
110 |
+
*/
|
111 |
+
public function get_stripe_data( $instance ) {
|
112 |
+
$data = array();
|
113 |
+
try {
|
114 |
+
$class = new ReflectionClass( $instance );
|
115 |
+
$props = $class->getDefaultProperties();
|
116 |
+
if ( isset( $props['stripe_data'] ) ) {
|
117 |
+
$data = $props['stripe_data'];
|
118 |
+
}
|
119 |
+
if ( is_subclass_of( get_parent_class( $instance ), 'WC_Payment_Token_Stripe' ) ) {
|
120 |
+
$data = array_merge( $this->get_stripe_data( get_parent_class( $instance ) ), $data );
|
121 |
+
}
|
122 |
+
|
123 |
+
return $data;
|
124 |
+
} catch ( Exception $e ) {
|
125 |
+
return array();
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Return a json array of data that represents the object.
|
131 |
+
*
|
132 |
+
* @return array
|
133 |
+
*/
|
134 |
+
public function to_json() {
|
135 |
+
return apply_filters(
|
136 |
+
'wc_stripe_get_' . $this->object_type . '_json',
|
137 |
+
array(
|
138 |
+
'id' => $this->get_id(),
|
139 |
+
'type' => $this->get_type(),
|
140 |
+
'token' => $this->get_token(),
|
141 |
+
'title' => $this->get_payment_method_title(),
|
142 |
+
'gateway' => $this->get_gateway_id(),
|
143 |
+
)
|
144 |
+
);
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Return formats used by the token to display a human readable title.
|
149 |
+
*/
|
150 |
+
public abstract function get_formats();
|
151 |
+
|
152 |
+
public function get_brand( $context = 'view' ) {
|
153 |
+
return wc_get_credit_card_type_label( $this->get_prop( 'brand', $context ) );
|
154 |
+
}
|
155 |
+
|
156 |
+
public function set_brand( $value ) {
|
157 |
+
$this->set_prop( 'brand', $value );
|
158 |
+
}
|
159 |
+
|
160 |
+
public function get_html_classes() {
|
161 |
+
return '';
|
162 |
+
}
|
163 |
+
|
164 |
+
public function has_expiration() {
|
165 |
+
return $this->has_expiration;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
*
|
170 |
+
* @since 3.1.0
|
171 |
+
*/
|
172 |
+
public abstract function delete_from_stripe();
|
173 |
+
|
174 |
+
/**
|
175 |
+
*
|
176 |
+
* @since 3.1.0
|
177 |
+
*/
|
178 |
+
public abstract function save_payment_method();
|
179 |
+
|
180 |
+
public static function token_exists( $token_id, $user_id ) {
|
181 |
+
global $wpdb;
|
182 |
+
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_payment_tokens WHERE token = %s AND gateway_id LIKE %s AND user_id = %d", $token_id, '%stripe_%', $user_id ) );
|
183 |
+
|
184 |
+
return $count > 0;
|
185 |
+
}
|
186 |
+
}
|
includes/admin/class-wc-stripe-admin-settings.php
CHANGED
@@ -1,89 +1,106 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
*
|
6 |
-
* @package Stripe/Admin
|
7 |
-
* @author User
|
8 |
-
*
|
9 |
-
*/
|
10 |
-
class WC_Stripe_Admin_Settings {
|
11 |
-
|
12 |
-
public static function init() {
|
13 |
-
add_action( 'woocommerce_settings_checkout', array( __CLASS__, 'output' ) );
|
14 |
-
add_action( '
|
15 |
-
|
16 |
-
add_action( '
|
17 |
-
add_filter( '
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
$
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @package Stripe/Admin
|
7 |
+
* @author User
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
class WC_Stripe_Admin_Settings {
|
11 |
+
|
12 |
+
public static function init() {
|
13 |
+
add_action( 'woocommerce_settings_checkout', array( __CLASS__, 'output' ) );
|
14 |
+
add_action( 'woocommerce_stripe_settings_checkout_stripe_advanced', array( __CLASS__, 'output_advanced_settings' ) );
|
15 |
+
add_filter( 'wc_stripe_settings_nav_tabs', array( __CLASS__, 'admin_settings_tabs' ), 20 );
|
16 |
+
add_action( 'woocommerce_update_options_checkout', array( __CLASS__, 'save' ) );
|
17 |
+
add_filter( 'woocommerce_get_settings_email', array( __CLASS__, 'get_email_settings' ) );
|
18 |
+
}
|
19 |
+
|
20 |
+
public static function output() {
|
21 |
+
global $current_section;
|
22 |
+
do_action( 'woocommerce_stripe_settings_checkout_' . $current_section );
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @deprecated
|
27 |
+
*/
|
28 |
+
public static function output_advanced_settings() {
|
29 |
+
self::output_custom_section( '' );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @deprecated
|
34 |
+
*/
|
35 |
+
public static function output_local_gateways() {
|
36 |
+
self::output_custom_section( 'stripe_ideal' );
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @deprecated
|
41 |
+
*/
|
42 |
+
public static function output_custom_section( $sub_section = '' ) {
|
43 |
+
global $current_section, $wc_stripe_subsection;
|
44 |
+
$wc_stripe_subsection = isset( $_GET['stripe_sub_section'] ) ? sanitize_title( $_GET['stripe_sub_section'] ) : $sub_section;
|
45 |
+
do_action( 'woocommerce_stripe_settings_checkout_' . $current_section . '_' . $wc_stripe_subsection );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @deprecated
|
50 |
+
*/
|
51 |
+
public static function save_local_gateway() {
|
52 |
+
self::save_custom_section( 'stripe_ideal' );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @deprecated
|
57 |
+
*/
|
58 |
+
public static function save_custom_section( $sub_section = '' ) {
|
59 |
+
global $current_section, $wc_stripe_subsection;
|
60 |
+
$wc_stripe_subsection = isset( $_GET['stripe_sub_section'] ) ? sanitize_title( $_GET['stripe_sub_section'] ) : $sub_section;
|
61 |
+
do_action( 'woocommerce_update_options_checkout_' . $current_section . '_' . $wc_stripe_subsection );
|
62 |
+
}
|
63 |
+
|
64 |
+
public static function save() {
|
65 |
+
global $current_section;
|
66 |
+
if ( $current_section && ! did_action( 'woocommerce_update_options_checkout_' . $current_section ) ) {
|
67 |
+
do_action( 'woocommerce_update_options_checkout_' . $current_section );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
public static function admin_settings_tabs( $tabs ) {
|
72 |
+
$tabs['stripe_ideal'] = __( 'Local Gateways', 'woo-stripe-payment' );
|
73 |
+
|
74 |
+
return $tabs;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @deprecated
|
79 |
+
*/
|
80 |
+
public static function before_options() {
|
81 |
+
global $current_section, $wc_stripe_subsection;
|
82 |
+
do_action( 'wc_stripe_settings_before_options_' . $current_section . '_' . $wc_stripe_subsection );
|
83 |
+
}
|
84 |
+
|
85 |
+
public static function get_email_settings( $settings ) {
|
86 |
+
$settings[] = array(
|
87 |
+
'type' => 'title',
|
88 |
+
'title' => __( 'Stripe Email Options', 'woo-stripe-payment' ),
|
89 |
+
);
|
90 |
+
$settings[] = array(
|
91 |
+
'type' => 'checkbox',
|
92 |
+
'title' => __( 'Email Receipt', 'woo-stripe-payment' ),
|
93 |
+
'id' => 'woocommerce_stripe_email_receipt',
|
94 |
+
'autoload' => false,
|
95 |
+
'desc' => __( 'If enabled, an email receipt will be sent to the customer by Stripe when the order is processed.', 'woo-stripe-payment' ),
|
96 |
+
);
|
97 |
+
$settings[] = array(
|
98 |
+
'type' => 'sectionend',
|
99 |
+
'id' => 'stripe_email',
|
100 |
+
);
|
101 |
+
|
102 |
+
return $settings;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
WC_Stripe_Admin_Settings::init();
|
includes/admin/settings/class-wc-stripe-api-settings.php
CHANGED
@@ -20,7 +20,7 @@ class WC_Stripe_API_Settings extends WC_Stripe_Settings_API {
|
|
20 |
parent::hooks();
|
21 |
add_action( 'woocommerce_update_options_checkout_' . $this->id, array( $this, 'process_admin_options' ) );
|
22 |
add_filter( 'wc_stripe_settings_nav_tabs', array( $this, 'admin_nav_tab' ) );
|
23 |
-
add_action( '
|
24 |
}
|
25 |
|
26 |
public function init_form_fields() {
|
20 |
parent::hooks();
|
21 |
add_action( 'woocommerce_update_options_checkout_' . $this->id, array( $this, 'process_admin_options' ) );
|
22 |
add_filter( 'wc_stripe_settings_nav_tabs', array( $this, 'admin_nav_tab' ) );
|
23 |
+
add_action( 'woocommerce_stripe_settings_checkout_' . $this->id, array( $this, 'admin_options' ) );
|
24 |
}
|
25 |
|
26 |
public function init_form_fields() {
|
includes/admin/views/html-settings-local-payments-nav.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
global $
|
3 |
-
$tabs = apply_filters( 'wc_stripe_local_gateways_tab', array() );
|
4 |
-
?>
|
5 |
-
<div class="wc-stripe-advanced-settings-nav local-gateways">
|
6 |
-
<?php foreach ( $tabs as $id => $tab ) : ?>
|
7 |
-
<a
|
8 |
-
class="nav-link
|
9 |
-
<?php
|
10 |
-
if ( $
|
11 |
-
echo 'nav-link-active';}
|
12 |
-
?>
|
13 |
-
"
|
14 |
-
href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=
|
15 |
-
<?php endforeach; ?>
|
16 |
-
</div>
|
17 |
-
<div class="clear"></div>
|
1 |
+
<?php
|
2 |
+
global $current_section;
|
3 |
+
$tabs = apply_filters( 'wc_stripe_local_gateways_tab', array() );
|
4 |
+
?>
|
5 |
+
<div class="wc-stripe-advanced-settings-nav local-gateways">
|
6 |
+
<?php foreach ( $tabs as $id => $tab ) : ?>
|
7 |
+
<a
|
8 |
+
class="nav-link
|
9 |
+
<?php
|
10 |
+
if ( $current_section === $id ) {
|
11 |
+
echo 'nav-link-active';}
|
12 |
+
?>
|
13 |
+
"
|
14 |
+
href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . $id ); ?>"><?php echo esc_attr( $tab ); ?></a>
|
15 |
+
<?php endforeach; ?>
|
16 |
+
</div>
|
17 |
+
<div class="clear"></div>
|
includes/admin/views/html-settings-nav.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?php
|
2 |
-
global $current_section;
|
3 |
-
$tabs
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
<
|
10 |
-
<?php
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
echo 'nav-tab-active';
|
16 |
-
|
17 |
-
"
|
18 |
-
|
19 |
-
<?php endforeach; ?>
|
20 |
-
</div>
|
21 |
-
<div class="clear"></div>
|
22 |
-
<div class="wc-stripe-docs">
|
23 |
-
|
24 |
-
|
25 |
-
</div>
|
1 |
+
<?php
|
2 |
+
global $current_section;
|
3 |
+
$tabs = apply_filters( 'wc_stripe_settings_nav_tabs', array() );
|
4 |
+
$last = count( $tabs );
|
5 |
+
$idx = 0;
|
6 |
+
$tab_active = false;
|
7 |
+
?>
|
8 |
+
<div class="wc-stripe-settings-logo">
|
9 |
+
<img
|
10 |
+
src="<?php echo wc_stripe()->assets_url() . 'img/stripe_logo.svg'; ?>"/>
|
11 |
+
</div>
|
12 |
+
<div class="stripe-settings-nav">
|
13 |
+
<?php foreach ( $tabs as $id => $tab ) : $idx ++ ?>
|
14 |
+
<a class="nav-tab <?php if ( $current_section === $id || ( ! $tab_active && $last === $idx ) ) {
|
15 |
+
echo 'nav-tab-active';
|
16 |
+
$tab_active = true;
|
17 |
+
} ?>"
|
18 |
+
href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . $id ); ?>"><?php echo esc_attr( $tab ); ?></a>
|
19 |
+
<?php endforeach; ?>
|
20 |
+
</div>
|
21 |
+
<div class="clear"></div>
|
22 |
+
<div class="wc-stripe-docs">
|
23 |
+
<a target="_blank" class="button button-secondary"
|
24 |
+
href="https://docs.paymentplugins.com/wc-stripe/config/#/<?php echo $current_section; ?>"><?php _e( 'Documentation', 'woo-stripe-payment' ); ?></a>
|
25 |
+
</div>
|
includes/class-stripe.php
CHANGED
@@ -25,7 +25,7 @@ class WC_Stripe_Manager {
|
|
25 |
*
|
26 |
* @var string
|
27 |
*/
|
28 |
-
public $version = '3.2.
|
29 |
|
30 |
/**
|
31 |
*
|
25 |
*
|
26 |
* @var string
|
27 |
*/
|
28 |
+
public $version = '3.2.5';
|
29 |
|
30 |
/**
|
31 |
*
|
includes/class-wc-stripe-field-manager.php
CHANGED
@@ -1,213 +1,213 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
*
|
6 |
-
* @since 3.0.0
|
7 |
-
* @package Stripe/Classes
|
8 |
-
* @author Payment Plugins
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
class WC_Stripe_Field_Manager {
|
12 |
-
|
13 |
-
private static $_cart_priority = 30;
|
14 |
-
|
15 |
-
private static $_product_button_position;
|
16 |
-
|
17 |
-
public static $_mini_cart_count = 0;
|
18 |
-
|
19 |
-
public static function init() {
|
20 |
-
add_action( 'woocommerce_checkout_before_customer_details', array( __CLASS__, 'output_banner_checkout_fields' ) );
|
21 |
-
add_action( 'woocommerce_before_add_to_cart_form', array( __CLASS__, 'before_add_to_cart' ) );
|
22 |
-
add_action( 'init', array( __CLASS__, 'init_action' ) );
|
23 |
-
add_action( 'woocommerce_review_order_after_order_total', array( __CLASS__, 'output_checkout_fields' ) );
|
24 |
-
add_action( 'before_woocommerce_add_payment_method', array( __CLASS__, 'add_payment_method_fields' ) );
|
25 |
-
add_action( 'woocommerce_widget_shopping_cart_buttons', array( __CLASS__, 'mini_cart_buttons' ), 5 );
|
26 |
-
}
|
27 |
-
|
28 |
-
public static function init_action() {
|
29 |
-
self::$_cart_priority = apply_filters( 'wc_stripe_cart_buttons_order', 30 );
|
30 |
-
add_action( 'woocommerce_proceed_to_checkout', array( __CLASS__, 'output_cart_fields' ), self::$_cart_priority );
|
31 |
-
}
|
32 |
-
|
33 |
-
public static function output_banner_checkout_fields() {
|
34 |
-
$gateways = array();
|
35 |
-
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $gateway ) {
|
36 |
-
if ( $gateway->supports( 'wc_stripe_banner_checkout' ) && $gateway->banner_checkout_enabled() ) {
|
37 |
-
$gateways[ $gateway->id ] = $gateway;
|
38 |
-
}
|
39 |
-
}
|
40 |
-
if ( $gateways ) {
|
41 |
-
wc_stripe_get_template( 'checkout/checkout-banner.php', array( 'gateways' => $gateways ) );
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
public static function output_checkout_fields() {
|
46 |
-
if ( WC()->cart && wcs_stripe_active() && WC_Subscriptions_Cart::cart_contains_subscription() ) {
|
47 |
-
wp_add_inline_script( 'wc-checkout', 'var wc_stripe_cart_contains_subscription = true;' );
|
48 |
-
}
|
49 |
-
do_action( 'wc_stripe_output_checkout_fields' );
|
50 |
-
}
|
51 |
-
|
52 |
-
public static function before_add_to_cart() {
|
53 |
-
global $product;
|
54 |
-
self::$_product_button_position = $product->get_meta( WC_Stripe_Constants::BUTTON_POSITION );
|
55 |
-
if ( empty( self::$_product_button_position ) ) {
|
56 |
-
self::$_product_button_position = 'bottom';
|
57 |
-
}
|
58 |
-
|
59 |
-
if ( 'bottom' == self::$_product_button_position ) {
|
60 |
-
$action = 'woocommerce_after_add_to_cart_button';
|
61 |
-
} else {
|
62 |
-
$action = 'woocommerce_before_add_to_cart_button';
|
63 |
-
}
|
64 |
-
add_action( $action, array( __CLASS__, 'output_product_checkout_fields' ) );
|
65 |
-
}
|
66 |
-
|
67 |
-
public static function output_product_checkout_fields() {
|
68 |
-
global $product;
|
69 |
-
$gateways = array();
|
70 |
-
$ordering = $product->get_meta( WC_Stripe_Constants::PRODUCT_GATEWAY_ORDER );
|
71 |
-
$ordering = ! $ordering ? array() : $ordering;
|
72 |
-
|
73 |
-
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $id => $gateway ) {
|
74 |
-
/**
|
75 |
-
*
|
76 |
-
* @var WC_Payment_Gateway_Stripe $gateway
|
77 |
-
*/
|
78 |
-
if ( $gateway->supports( 'wc_stripe_product_checkout' ) ) {
|
79 |
-
$option = new WC_Stripe_Product_Gateway_Option( $product, $gateway );
|
80 |
-
if ( $option->enabled() ) {
|
81 |
-
if ( isset( $ordering[ $gateway->id ] ) ) {
|
82 |
-
$gateways[ $ordering[ $gateway->id ] ] = $gateway;
|
83 |
-
} else {
|
84 |
-
$gateways[] = $gateway;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
}
|
88 |
-
}
|
89 |
-
ksort( $gateways );
|
90 |
-
|
91 |
-
if ( count( $gateways ) > 0 ) {
|
92 |
-
wc_stripe_get_template(
|
93 |
-
'product/payment-methods.php',
|
94 |
-
array(
|
95 |
-
'position' => self::$_product_button_position,
|
96 |
-
'gateways' => $gateways,
|
97 |
-
)
|
98 |
-
);
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
public static function output_cart_fields() {
|
103 |
-
$gateways = array();
|
104 |
-
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $id => $gateway ) {
|
105 |
-
/**
|
106 |
-
*
|
107 |
-
* @var WC_Payment_Gateway_Stripe $gateway
|
108 |
-
*/
|
109 |
-
if ( $gateway->supports( 'wc_stripe_cart_checkout' ) && $gateway->cart_checkout_enabled() ) {
|
110 |
-
$gateways[ $gateway->id ] = $gateway;
|
111 |
-
}
|
112 |
-
}
|
113 |
-
if ( ! empty( $gateways ) ) {
|
114 |
-
wc_stripe_get_template(
|
115 |
-
'cart/payment-methods.php',
|
116 |
-
array(
|
117 |
-
'gateways' => $gateways,
|
118 |
-
'after' => self::$_cart_priority > 20,
|
119 |
-
'cart_total' => WC()->cart->total,
|
120 |
-
)
|
121 |
-
);
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
public static function mini_cart_buttons() {
|
126 |
-
$gateways = array();
|
127 |
-
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $id => $gateway ) {
|
128 |
-
/**
|
129 |
-
*
|
130 |
-
* @var WC_Payment_Gateway_Stripe $gateway
|
131 |
-
*/
|
132 |
-
if ( $gateway->supports( 'wc_stripe_mini_cart_checkout' ) && $gateway->mini_cart_enabled() ) {
|
133 |
-
$gateways[ $gateway->id ] = $gateway;
|
134 |
-
}
|
135 |
-
}
|
136 |
-
if ( ! empty( $gateways ) ) {
|
137 |
-
|
138 |
-
wc_stripe_get_template(
|
139 |
-
'mini-cart/payment-methods.php',
|
140 |
-
array(
|
141 |
-
'gateways' => $gateways
|
142 |
-
)
|
143 |
-
);
|
144 |
-
}
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* @deprecated 3.1.8
|
149 |
-
*/
|
150 |
-
public static function change_payment_request() {
|
151 |
-
|
152 |
-
}
|
153 |
-
|
154 |
-
public static function add_payment_method_fields() {
|
155 |
-
wc_stripe_hidden_field( 'billing_first_name', '', WC()->customer->get_first_name() );
|
156 |
-
wc_stripe_hidden_field( 'billing_last_name', '', WC()->customer->get_last_name() );
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* @deprecated 3.1.8
|
161 |
-
*/
|
162 |
-
public static function pay_order_fields() {
|
163 |
-
global $wp;
|
164 |
-
$order = wc_get_order( absint( $wp->query_vars['order-pay'] ) );
|
165 |
-
self::output_required_fields( 'checkout', $order );
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* @param string $page
|
170 |
-
* @param WC_Order $order
|
171 |
-
*/
|
172 |
-
public static function output_required_fields( $page, $order = null ) {
|
173 |
-
if ( in_array( $page, array( 'cart', 'checkout' ) ) ) {
|
174 |
-
|
175 |
-
if ( 'cart' === $page ) {
|
176 |
-
self::output_fields( 'billing' );
|
177 |
-
|
178 |
-
if ( WC()->cart->needs_shipping() ) {
|
179 |
-
self::output_fields( 'shipping' );
|
180 |
-
}
|
181 |
-
}
|
182 |
-
|
183 |
-
} elseif ( 'product' === $page ) {
|
184 |
-
global $product;
|
185 |
-
|
186 |
-
self::output_fields( 'billing' );
|
187 |
-
|
188 |
-
if ( $product->needs_shipping() ) {
|
189 |
-
self::output_fields( 'shipping' );
|
190 |
-
}
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
public static function output_fields( $prefix ) {
|
195 |
-
$fields = WC()->checkout()->get_checkout_fields( $prefix );
|
196 |
-
foreach ( $fields as $key => $field ) {
|
197 |
-
printf( '<input type="hidden" id="%1$s" name="%1$s" value="%2$s"/>', $key, WC()->checkout()->get_value( $key ) );
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
-
* @param bool $needs_shipping
|
203 |
-
*
|
204 |
-
* @deprecated
|
205 |
-
*/
|
206 |
-
public static function output_needs_shipping( $needs_shipping ) {
|
207 |
-
|
208 |
-
}
|
209 |
-
}
|
210 |
-
|
211 |
-
if ( ! is_admin() ) {
|
212 |
-
WC_Stripe_Field_Manager::init();
|
213 |
-
}
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @since 3.0.0
|
7 |
+
* @package Stripe/Classes
|
8 |
+
* @author Payment Plugins
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class WC_Stripe_Field_Manager {
|
12 |
+
|
13 |
+
private static $_cart_priority = 30;
|
14 |
+
|
15 |
+
private static $_product_button_position;
|
16 |
+
|
17 |
+
public static $_mini_cart_count = 0;
|
18 |
+
|
19 |
+
public static function init() {
|
20 |
+
add_action( 'woocommerce_checkout_before_customer_details', array( __CLASS__, 'output_banner_checkout_fields' ) );
|
21 |
+
add_action( 'woocommerce_before_add_to_cart_form', array( __CLASS__, 'before_add_to_cart' ) );
|
22 |
+
add_action( 'init', array( __CLASS__, 'init_action' ) );
|
23 |
+
add_action( 'woocommerce_review_order_after_order_total', array( __CLASS__, 'output_checkout_fields' ) );
|
24 |
+
add_action( 'before_woocommerce_add_payment_method', array( __CLASS__, 'add_payment_method_fields' ) );
|
25 |
+
add_action( 'woocommerce_widget_shopping_cart_buttons', array( __CLASS__, 'mini_cart_buttons' ), 5 );
|
26 |
+
}
|
27 |
+
|
28 |
+
public static function init_action() {
|
29 |
+
self::$_cart_priority = apply_filters( 'wc_stripe_cart_buttons_order', 30 );
|
30 |
+
add_action( 'woocommerce_proceed_to_checkout', array( __CLASS__, 'output_cart_fields' ), self::$_cart_priority );
|
31 |
+
}
|
32 |
+
|
33 |
+
public static function output_banner_checkout_fields() {
|
34 |
+
$gateways = array();
|
35 |
+
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $gateway ) {
|
36 |
+
if ( $gateway->supports( 'wc_stripe_banner_checkout' ) && $gateway->banner_checkout_enabled() ) {
|
37 |
+
$gateways[ $gateway->id ] = $gateway;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
if ( $gateways ) {
|
41 |
+
wc_stripe_get_template( 'checkout/checkout-banner.php', array( 'gateways' => $gateways ) );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
public static function output_checkout_fields() {
|
46 |
+
if ( WC()->cart && wcs_stripe_active() && WC_Subscriptions_Cart::cart_contains_subscription() ) {
|
47 |
+
wp_add_inline_script( 'wc-checkout', 'var wc_stripe_cart_contains_subscription = true;' );
|
48 |
+
}
|
49 |
+
do_action( 'wc_stripe_output_checkout_fields' );
|
50 |
+
}
|
51 |
+
|
52 |
+
public static function before_add_to_cart() {
|
53 |
+
global $product;
|
54 |
+
self::$_product_button_position = $product->get_meta( WC_Stripe_Constants::BUTTON_POSITION );
|
55 |
+
if ( empty( self::$_product_button_position ) ) {
|
56 |
+
self::$_product_button_position = 'bottom';
|
57 |
+
}
|
58 |
+
|
59 |
+
if ( 'bottom' == self::$_product_button_position ) {
|
60 |
+
$action = 'woocommerce_after_add_to_cart_button';
|
61 |
+
} else {
|
62 |
+
$action = 'woocommerce_before_add_to_cart_button';
|
63 |
+
}
|
64 |
+
add_action( $action, array( __CLASS__, 'output_product_checkout_fields' ) );
|
65 |
+
}
|
66 |
+
|
67 |
+
public static function output_product_checkout_fields() {
|
68 |
+
global $product;
|
69 |
+
$gateways = array();
|
70 |
+
$ordering = $product->get_meta( WC_Stripe_Constants::PRODUCT_GATEWAY_ORDER );
|
71 |
+
$ordering = ! $ordering ? array() : $ordering;
|
72 |
+
|
73 |
+
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $id => $gateway ) {
|
74 |
+
/**
|
75 |
+
*
|
76 |
+
* @var WC_Payment_Gateway_Stripe $gateway
|
77 |
+
*/
|
78 |
+
if ( $gateway->supports( 'wc_stripe_product_checkout' ) ) {
|
79 |
+
$option = new WC_Stripe_Product_Gateway_Option( $product, $gateway );
|
80 |
+
if ( $option->enabled() ) {
|
81 |
+
if ( isset( $ordering[ $gateway->id ] ) ) {
|
82 |
+
$gateways[ $ordering[ $gateway->id ] ] = $gateway;
|
83 |
+
} else {
|
84 |
+
$gateways[] = $gateway;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
ksort( $gateways );
|
90 |
+
|
91 |
+
if ( count( $gateways ) > 0 ) {
|
92 |
+
wc_stripe_get_template(
|
93 |
+
'product/payment-methods.php',
|
94 |
+
array(
|
95 |
+
'position' => self::$_product_button_position,
|
96 |
+
'gateways' => $gateways,
|
97 |
+
)
|
98 |
+
);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
public static function output_cart_fields() {
|
103 |
+
$gateways = array();
|
104 |
+
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $id => $gateway ) {
|
105 |
+
/**
|
106 |
+
*
|
107 |
+
* @var WC_Payment_Gateway_Stripe $gateway
|
108 |
+
*/
|
109 |
+
if ( $gateway->supports( 'wc_stripe_cart_checkout' ) && $gateway->cart_checkout_enabled() ) {
|
110 |
+
$gateways[ $gateway->id ] = $gateway;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
if ( ! empty( $gateways ) ) {
|
114 |
+
wc_stripe_get_template(
|
115 |
+
'cart/payment-methods.php',
|
116 |
+
array(
|
117 |
+
'gateways' => $gateways,
|
118 |
+
'after' => self::$_cart_priority > 20,
|
119 |
+
'cart_total' => WC()->cart->total,
|
120 |
+
)
|
121 |
+
);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
public static function mini_cart_buttons() {
|
126 |
+
$gateways = array();
|
127 |
+
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $id => $gateway ) {
|
128 |
+
/**
|
129 |
+
*
|
130 |
+
* @var WC_Payment_Gateway_Stripe $gateway
|
131 |
+
*/
|
132 |
+
if ( $gateway->supports( 'wc_stripe_mini_cart_checkout' ) && $gateway->mini_cart_enabled() ) {
|
133 |
+
$gateways[ $gateway->id ] = $gateway;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
if ( ! empty( $gateways ) ) {
|
137 |
+
|
138 |
+
wc_stripe_get_template(
|
139 |
+
'mini-cart/payment-methods.php',
|
140 |
+
array(
|
141 |
+
'gateways' => $gateways
|
142 |
+
)
|
143 |
+
);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @deprecated 3.1.8
|
149 |
+
*/
|
150 |
+
public static function change_payment_request() {
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
public static function add_payment_method_fields() {
|
155 |
+
wc_stripe_hidden_field( 'billing_first_name', '', WC()->customer->get_first_name() );
|
156 |
+
wc_stripe_hidden_field( 'billing_last_name', '', WC()->customer->get_last_name() );
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @deprecated 3.1.8
|
161 |
+
*/
|
162 |
+
public static function pay_order_fields() {
|
163 |
+
global $wp;
|
164 |
+
$order = wc_get_order( absint( $wp->query_vars['order-pay'] ) );
|
165 |
+
self::output_required_fields( 'checkout', $order );
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @param string $page
|
170 |
+
* @param WC_Order $order
|
171 |
+
*/
|
172 |
+
public static function output_required_fields( $page, $order = null ) {
|
173 |
+
if ( in_array( $page, array( 'cart', 'checkout' ) ) ) {
|
174 |
+
|
175 |
+
if ( 'cart' === $page ) {
|
176 |
+
self::output_fields( 'billing' );
|
177 |
+
|
178 |
+
if ( WC()->cart->needs_shipping() ) {
|
179 |
+
self::output_fields( 'shipping' );
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
} elseif ( 'product' === $page ) {
|
184 |
+
global $product;
|
185 |
+
|
186 |
+
self::output_fields( 'billing' );
|
187 |
+
|
188 |
+
if ( $product->needs_shipping() ) {
|
189 |
+
self::output_fields( 'shipping' );
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
public static function output_fields( $prefix ) {
|
195 |
+
$fields = WC()->checkout()->get_checkout_fields( $prefix );
|
196 |
+
foreach ( $fields as $key => $field ) {
|
197 |
+
printf( '<input type="hidden" id="%1$s" name="%1$s" value="%2$s"/>', $key, WC()->checkout()->get_value( $key ) );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* @param bool $needs_shipping
|
203 |
+
*
|
204 |
+
* @deprecated
|
205 |
+
*/
|
206 |
+
public static function output_needs_shipping( $needs_shipping ) {
|
207 |
+
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
if ( ! is_admin() ) {
|
212 |
+
WC_Stripe_Field_Manager::init();
|
213 |
+
}
|
includes/class-wc-stripe-frontend-scripts.php
CHANGED
@@ -1,190 +1,208 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Handles scrip enqueuement and output of params needed by the plugin.
|
6 |
-
*
|
7 |
-
* @package Stripe/Classes
|
8 |
-
* @author PaymentPlugins
|
9 |
-
*/
|
10 |
-
class WC_Stripe_Frontend_Scripts {
|
11 |
-
|
12 |
-
public $prefix = 'wc-stripe-';
|
13 |
-
|
14 |
-
public $registered_scripts = array();
|
15 |
-
|
16 |
-
public $enqueued_scripts = array();
|
17 |
-
|
18 |
-
public $localized_scripts = array();
|
19 |
-
|
20 |
-
public $localized_data = array();
|
21 |
-
|
22 |
-
public $global_scripts = array(
|
23 |
-
'external' => 'https://js.stripe.com/v3/',
|
24 |
-
'gpay' => 'https://pay.google.com/gp/p/js/pay.js',
|
25 |
-
'plaid' => 'https://cdn.plaid.com/link/v2/stable/link-initialize.js',
|
26 |
-
);
|
27 |
-
|
28 |
-
public function __construct() {
|
29 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
30 |
-
add_action( 'wp_print_scripts', array( $this, 'localize_scripts' ), 5 );
|
31 |
-
add_action( 'wp_print_footer_scripts', array( $this, 'localize_scripts' ), 5 );
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
'
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
'
|
69 |
-
'
|
70 |
-
'
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
'
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
$this->localize_script( 'wc-stripe',
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
if
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
$this->get_handle( '
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
$
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
$
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
*
|
132 |
-
* @param
|
133 |
-
* @param
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
$this->
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
*
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Handles scrip enqueuement and output of params needed by the plugin.
|
6 |
+
*
|
7 |
+
* @package Stripe/Classes
|
8 |
+
* @author PaymentPlugins
|
9 |
+
*/
|
10 |
+
class WC_Stripe_Frontend_Scripts {
|
11 |
+
|
12 |
+
public $prefix = 'wc-stripe-';
|
13 |
+
|
14 |
+
public $registered_scripts = array();
|
15 |
+
|
16 |
+
public $enqueued_scripts = array();
|
17 |
+
|
18 |
+
public $localized_scripts = array();
|
19 |
+
|
20 |
+
public $localized_data = array();
|
21 |
+
|
22 |
+
public $global_scripts = array(
|
23 |
+
'external' => 'https://js.stripe.com/v3/',
|
24 |
+
'gpay' => 'https://pay.google.com/gp/p/js/pay.js',
|
25 |
+
'plaid' => 'https://cdn.plaid.com/link/v2/stable/link-initialize.js',
|
26 |
+
);
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
30 |
+
add_action( 'wp_print_scripts', array( $this, 'localize_scripts' ), 5 );
|
31 |
+
add_action( 'wp_print_footer_scripts', array( $this, 'localize_scripts' ), 5 );
|
32 |
+
add_action( 'wp_print_footer_scripts', array( $this, 'print_footer_scripts' ), 6 );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Enqueue all frontend scripts needed by the plugin
|
37 |
+
*/
|
38 |
+
public function enqueue_scripts() {
|
39 |
+
// register global scripts
|
40 |
+
foreach ( $this->global_scripts as $handle => $src ) {
|
41 |
+
$this->register_script( $handle, $src );
|
42 |
+
}
|
43 |
+
|
44 |
+
$this->register_script( 'form-handler', $this->assets_url( 'js/frontend/form-handler.js' ), array( 'jquery' ) );
|
45 |
+
|
46 |
+
// register scripts that aren't part of gateways
|
47 |
+
$this->register_script( 'wc-stripe', $this->assets_url( 'js/frontend/wc-stripe' . $this->get_min() . '.js' ),
|
48 |
+
array(
|
49 |
+
'jquery',
|
50 |
+
$this->get_handle( 'external' ),
|
51 |
+
'woocommerce',
|
52 |
+
$this->get_handle( 'form-handler' )
|
53 |
+
) );
|
54 |
+
|
55 |
+
// mini cart is not relevant on cart and checkout page.
|
56 |
+
if ( ! is_checkout() && ! is_cart() ) {
|
57 |
+
foreach ( WC()->payment_gateways()->payment_gateways() as $gateway ) {
|
58 |
+
if ( $gateway instanceof WC_Payment_Gateway_Stripe && $gateway->is_available() && $gateway->mini_cart_enabled() ) {
|
59 |
+
$gateway->enqueue_frontend_scripts( 'mini_cart' );
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
public function localize_scripts() {
|
66 |
+
$this->localize_script( 'wc-stripe',
|
67 |
+
array(
|
68 |
+
'api_key' => wc_stripe_get_publishable_key(),
|
69 |
+
'account' => wc_stripe_get_account_id(),
|
70 |
+
'page' => $this->get_page_id(),
|
71 |
+
'version' => wc_stripe()->version()
|
72 |
+
),
|
73 |
+
'wc_stripe_params_v3'
|
74 |
+
);
|
75 |
+
$this->localize_script( 'form-handler',
|
76 |
+
array(
|
77 |
+
'no_results' => __(
|
78 |
+
'No matches found',
|
79 |
+
'woo-stripe-payment'
|
80 |
+
),
|
81 |
+
)
|
82 |
+
);
|
83 |
+
$this->localize_script( 'wc-stripe', wc_stripe_get_error_messages(), 'wc_stripe_messages' );
|
84 |
+
$this->localize_script( 'wc-stripe', wc_stripe_get_checkout_fields(), 'wc_stripe_checkout_fields' );
|
85 |
+
|
86 |
+
// don't need to call localize_scripts twice.
|
87 |
+
if ( doing_action( 'wp_print_scripts' ) ) {
|
88 |
+
remove_action( 'wp_print_footer_scripts', array( $this, 'localize_scripts' ), 5 );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
public function enqueue_checkout_scripts() {
|
93 |
+
$this->enqueue_local_payment_scripts();
|
94 |
+
}
|
95 |
+
|
96 |
+
public function enqueue_local_payment_scripts() {
|
97 |
+
if ( ! in_array( $this->get_handle( 'local-payment' ), $this->enqueued_scripts ) ) {
|
98 |
+
$data = wc_stripe_get_local_payment_params();
|
99 |
+
// only enqueue local payment script if there are local payment gateways that have been enabled.
|
100 |
+
if ( ! empty( $data['gateways'] ) ) {
|
101 |
+
$this->enqueue_script(
|
102 |
+
'local-payment',
|
103 |
+
$this->assets_url( 'js/frontend/local-payment.js' ),
|
104 |
+
array(
|
105 |
+
$this->get_handle( 'external' ),
|
106 |
+
$this->get_handle( 'wc-stripe' ),
|
107 |
+
)
|
108 |
+
);
|
109 |
+
$this->localize_script( 'local-payment', $data );
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
public function register_script( $handle, $src, $deps = array(), $version = '', $footer = true ) {
|
115 |
+
$version = empty( $version ) ? wc_stripe()->version() : $version;
|
116 |
+
$this->registered_scripts[] = $this->get_handle( $handle );
|
117 |
+
wp_register_script( $this->get_handle( $handle ), $src, $deps, $version, $footer );
|
118 |
+
}
|
119 |
+
|
120 |
+
public function enqueue_script( $handle, $src = '', $deps = array(), $version = '', $footer = true ) {
|
121 |
+
$handle = $this->get_handle( $handle );
|
122 |
+
$version = empty( $version ) ? wc_stripe()->version() : $version;
|
123 |
+
if ( ! in_array( $handle, $this->registered_scripts ) ) {
|
124 |
+
$this->register_script( $handle, $src, $deps, $version, $footer );
|
125 |
+
}
|
126 |
+
$this->enqueued_scripts[] = $handle;
|
127 |
+
wp_enqueue_script( $handle );
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
*
|
132 |
+
* @param string $handle
|
133 |
+
* @param array $data
|
134 |
+
* @param string $object_name
|
135 |
+
*/
|
136 |
+
public function localize_script( $handle, $data, $object_name = '' ) {
|
137 |
+
$handle = $this->get_handle( $handle );
|
138 |
+
if ( wp_script_is( $handle, 'registered' ) ) {
|
139 |
+
$name = str_replace( $this->prefix, '', $handle );
|
140 |
+
if ( ! $object_name ) {
|
141 |
+
$object_name = str_replace( '-', '_', $handle ) . '_params';
|
142 |
+
}
|
143 |
+
if ( ! in_array( $object_name, $this->localized_data ) ) {
|
144 |
+
$data = apply_filters( 'wc_stripe_localize_script_' . $name, $data, $object_name );
|
145 |
+
if ( $data ) {
|
146 |
+
$this->localized_scripts[] = $handle;
|
147 |
+
$this->localized_data[] = $object_name;
|
148 |
+
wp_localize_script( $handle, $object_name, $data );
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
public function get_handle( $handle ) {
|
155 |
+
return strpos( $handle, $this->prefix ) === false ? $this->prefix . $handle : $handle;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
*
|
160 |
+
* @param string $uri
|
161 |
+
*/
|
162 |
+
public function assets_url( $uri = '' ) {
|
163 |
+
return untrailingslashit( wc_stripe()->assets_url( $uri ) );
|
164 |
+
}
|
165 |
+
|
166 |
+
public function get_min() {
|
167 |
+
return $suffix = SCRIPT_DEBUG ? '' : '.min';
|
168 |
+
}
|
169 |
+
|
170 |
+
private function get_page_id() {
|
171 |
+
global $wp;
|
172 |
+
if ( is_product() ) {
|
173 |
+
return 'product';
|
174 |
+
}
|
175 |
+
if ( is_cart() ) {
|
176 |
+
return 'cart';
|
177 |
+
}
|
178 |
+
if ( is_checkout() ) {
|
179 |
+
if ( ! empty( $wp->query_vars['order-pay'] ) ) {
|
180 |
+
return 'order_pay';
|
181 |
+
}
|
182 |
+
|
183 |
+
return 'checkout';
|
184 |
+
}
|
185 |
+
if ( is_add_payment_method_page() ) {
|
186 |
+
return 'add_payment_method';
|
187 |
+
}
|
188 |
+
|
189 |
+
return '';
|
190 |
+
}
|
191 |
+
|
192 |
+
public function print_footer_scripts() {
|
193 |
+
if ( is_checkout() && ! isset( $wp->query_vars['order_pay'] ) ) {
|
194 |
+
$available_gateways = array_keys( WC()->payment_gateways()->get_available_payment_gateways() );
|
195 |
+
$gateways = array_filter( WC()->payment_gateways()->payment_gateways(), function ( $gateway ) use ( $available_gateways ) {
|
196 |
+
return $gateway instanceof WC_Payment_Gateway_Stripe && $gateway->is_available() && ( ! in_array( $gateway->id, $available_gateways ) || ! $gateway->has_enqueued_scripts( $this ) );
|
197 |
+
} );
|
198 |
+
// If there are entries in the $gateways array that means some plugin filtered out the gateway.
|
199 |
+
// It still needs to output its scripts
|
200 |
+
foreach ( $gateways as $gateway ) {
|
201 |
+
/**
|
202 |
+
* @var WC_Payment_Gateway_Stripe $gateway
|
203 |
+
*/
|
204 |
+
$gateway->enqueue_frontend_scripts( 'checkout' );
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
includes/class-wc-stripe-gateway-conversions.php
CHANGED
@@ -1,43 +1,43 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
*
|
6 |
-
* @since 3.1.0
|
7 |
-
* @author Payment Plugins
|
8 |
-
*
|
9 |
-
*/
|
10 |
-
class WC_Stripe_Gateway_Conversion {
|
11 |
-
|
12 |
-
public static function init() {
|
13 |
-
add_filter( 'woocommerce_order_get_payment_method', array( __CLASS__, 'convert_payment_method' ), 10, 2 );
|
14 |
-
add_filter( 'woocommerce_subscription_get_payment_method', array( __CLASS__, 'convert_payment_method' ), 10, 2 );
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
*
|
19 |
-
* @param string $payment_method
|
20 |
-
* @param WC_Order $order
|
21 |
-
*/
|
22 |
-
public static function convert_payment_method( $payment_method, $order ) {
|
23 |
-
$old_payment_method = $payment_method;
|
24 |
-
|
25 |
-
switch ( $payment_method ) {
|
26 |
-
case 'stripe':
|
27 |
-
// Another Stripe plugin is active, don't convert $payment_method as that could affect
|
28 |
-
// checkout functionality.
|
29 |
-
if ( did_action( 'woocommerce_checkout_order_processed' ) ) {
|
30 |
-
return $payment_method;
|
31 |
-
}
|
32 |
-
$payment_method = 'stripe_cc';
|
33 |
-
break;
|
34 |
-
}
|
35 |
-
if ( $payment_method != $old_payment_method && ! empty( $payment_method ) ) {
|
36 |
-
update_post_meta( $order->get_id(), '_payment_method', $payment_method );
|
37 |
-
}
|
38 |
-
|
39 |
-
return $payment_method;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
WC_Stripe_Gateway_Conversion::init();
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @since 3.1.0
|
7 |
+
* @author Payment Plugins
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
class WC_Stripe_Gateway_Conversion {
|
11 |
+
|
12 |
+
public static function init() {
|
13 |
+
add_filter( 'woocommerce_order_get_payment_method', array( __CLASS__, 'convert_payment_method' ), 10, 2 );
|
14 |
+
add_filter( 'woocommerce_subscription_get_payment_method', array( __CLASS__, 'convert_payment_method' ), 10, 2 );
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
*
|
19 |
+
* @param string $payment_method
|
20 |
+
* @param WC_Order $order
|
21 |
+
*/
|
22 |
+
public static function convert_payment_method( $payment_method, $order ) {
|
23 |
+
$old_payment_method = $payment_method;
|
24 |
+
|
25 |
+
switch ( $payment_method ) {
|
26 |
+
case 'stripe':
|
27 |
+
// Another Stripe plugin is active, don't convert $payment_method as that could affect
|
28 |
+
// checkout functionality.
|
29 |
+
if ( did_action( 'woocommerce_checkout_order_processed' ) ) {
|
30 |
+
return $payment_method;
|
31 |
+
}
|
32 |
+
$payment_method = 'stripe_cc';
|
33 |
+
break;
|
34 |
+
}
|
35 |
+
if ( $payment_method != $old_payment_method && ! empty( $payment_method ) ) {
|
36 |
+
update_post_meta( $order->get_id(), '_payment_method', $payment_method );
|
37 |
+
}
|
38 |
+
|
39 |
+
return $payment_method;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
WC_Stripe_Gateway_Conversion::init();
|
includes/class-wc-stripe-payment-charge-local.php
CHANGED
@@ -1,75 +1,75 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
*
|
6 |
-
* @author PaymentPlugins
|
7 |
-
* @since 3.1.1
|
8 |
-
* @package Stripe/Classes
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
class WC_Stripe_Payment_Charge_Local extends WC_Stripe_Payment_Charge {
|
12 |
-
|
13 |
-
/**
|
14 |
-
*
|
15 |
-
* @param WC_Order $order
|
16 |
-
*/
|
17 |
-
public function process_payment( $order ) {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* If there is no order lock, then this is not being processed via a webhook
|
21 |
-
*/
|
22 |
-
if ( ! $this->payment_method->has_order_lock( $order ) ) {
|
23 |
-
try {
|
24 |
-
if ( ( $source_id = $this->payment_method->get_new_source_token() ) ) {
|
25 |
-
// source was created client side.
|
26 |
-
$source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->retrieve( $source_id );
|
27 |
-
|
28 |
-
if ( is_wp_error( $source ) ) {
|
29 |
-
return $source;
|
30 |
-
}
|
31 |
-
|
32 |
-
// update the source's metadata with the order id
|
33 |
-
$source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->update( $source_id, $this->payment_method->get_update_source_args( $order ) );
|
34 |
-
} else {
|
35 |
-
// create the source
|
36 |
-
$args = $this->payment_method->get_source_args( $order );
|
37 |
-
$args['metadata']['order_id'] = $order->get_id();
|
38 |
-
$args['metadata']['created'] = time();
|
39 |
-
$source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->create( $args );
|
40 |
-
}
|
41 |
-
|
42 |
-
if ( is_wp_error( $source ) ) {
|
43 |
-
throw new Exception( $source->get_error_message() );
|
44 |
-
}
|
45 |
-
|
46 |
-
$order->update_meta_data( WC_Stripe_Constants::SOURCE_ID, $source->id );
|
47 |
-
$order->update_meta_data( WC_Stripe_Constants::MODE, wc_stripe_mode() );
|
48 |
-
|
49 |
-
$order->save();
|
50 |
-
|
51 |
-
/**
|
52 |
-
* If source is chargeable, then proceed with processing it.
|
53 |
-
*/
|
54 |
-
if ( $source->status === 'chargeable' ) {
|
55 |
-
$this->payment_method->set_order_lock( $order );
|
56 |
-
$this->payment_method->set_new_source_token( $source->id );
|
57 |
-
|
58 |
-
return $this->process_payment( $order );
|
59 |
-
}
|
60 |
-
|
61 |
-
return (object) array(
|
62 |
-
'complete_payment' => false,
|
63 |
-
'redirect' => $this->payment_method->get_source_redirect_url( $source, $order ),
|
64 |
-
);
|
65 |
-
} catch ( Exception $e ) {
|
66 |
-
return new WP_Error( 'source-error', $e->getMessage() );
|
67 |
-
}
|
68 |
-
} else {
|
69 |
-
/**
|
70 |
-
* There is an order lock so this order is ready to be processed.
|
71 |
-
*/
|
72 |
-
return parent::process_payment( $order );
|
73 |
-
}
|
74 |
-
}
|
75 |
-
}
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @author PaymentPlugins
|
7 |
+
* @since 3.1.1
|
8 |
+
* @package Stripe/Classes
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class WC_Stripe_Payment_Charge_Local extends WC_Stripe_Payment_Charge {
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
* @param WC_Order $order
|
16 |
+
*/
|
17 |
+
public function process_payment( $order ) {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* If there is no order lock, then this is not being processed via a webhook
|
21 |
+
*/
|
22 |
+
if ( ! $this->payment_method->has_order_lock( $order ) ) {
|
23 |
+
try {
|
24 |
+
if ( ( $source_id = $this->payment_method->get_new_source_token() ) ) {
|
25 |
+
// source was created client side.
|
26 |
+
$source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->retrieve( $source_id );
|
27 |
+
|
28 |
+
if ( is_wp_error( $source ) ) {
|
29 |
+
return $source;
|
30 |
+
}
|
31 |
+
|
32 |
+
// update the source's metadata with the order id
|
33 |
+
$source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->update( $source_id, $this->payment_method->get_update_source_args( $order ) );
|
34 |
+
} else {
|
35 |
+
// create the source
|
36 |
+
$args = $this->payment_method->get_source_args( $order );
|
37 |
+
$args['metadata']['order_id'] = $order->get_id();
|
38 |
+
$args['metadata']['created'] = time();
|
39 |
+
$source = $this->gateway->sources->mode( wc_stripe_order_mode( $order ) )->create( $args );
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( is_wp_error( $source ) ) {
|
43 |
+
throw new Exception( $source->get_error_message() );
|
44 |
+
}
|
45 |
+
|
46 |
+
$order->update_meta_data( WC_Stripe_Constants::SOURCE_ID, $source->id );
|
47 |
+
$order->update_meta_data( WC_Stripe_Constants::MODE, wc_stripe_mode() );
|
48 |
+
|
49 |
+
$order->save();
|
50 |
+
|
51 |
+
/**
|
52 |
+
* If source is chargeable, then proceed with processing it.
|
53 |
+
*/
|
54 |
+
if ( $source->status === 'chargeable' ) {
|
55 |
+
$this->payment_method->set_order_lock( $order );
|
56 |
+
$this->payment_method->set_new_source_token( $source->id );
|
57 |
+
|
58 |
+
return $this->process_payment( $order );
|
59 |
+
}
|
60 |
+
|
61 |
+
return (object) array(
|
62 |
+
'complete_payment' => false,
|
63 |
+
'redirect' => $this->payment_method->get_source_redirect_url( $source, $order ),
|
64 |
+
);
|
65 |
+
} catch ( Exception $e ) {
|
66 |
+
return new WP_Error( 'source-error', $e->getMessage() );
|
67 |
+
}
|
68 |
+
} else {
|
69 |
+
/**
|
70 |
+
* There is an order lock so this order is ready to be processed.
|
71 |
+
*/
|
72 |
+
return parent::process_payment( $order );
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
includes/class-wc-stripe-rest-api.php
CHANGED
@@ -1,126 +1,147 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
*
|
6 |
-
* @author PaymentPlugins
|
7 |
-
* @package Stripe/Classes
|
8 |
-
* @property WC_Stripe_Rest_Controller $order_actions
|
9 |
-
* @property WC_Stripe_Rest_Controller $cart
|
10 |
-
* @property WC_Stripe_Rest_Controller $checkout
|
11 |
-
* @property WC_Stripe_Rest_Controller $payment_intent
|
12 |
-
* @property WC_Stripe_Rest_Controller $googlepay
|
13 |
-
* @property WC_Stripe_Rest_Controller $settings
|
14 |
-
* @property WC_Stripe_Rest_Controller $webhook
|
15 |
-
* @property WC_Stripe_Rest_Controller $product_data
|
16 |
-
* @property WC_Stripe_Rest_Controller $plaid
|
17 |
-
*/
|
18 |
-
class WC_Stripe_Rest_API {
|
19 |
-
|
20 |
-
/**
|
21 |
-
*
|
22 |
-
* @var array
|
23 |
-
*/
|
24 |
-
private $controllers = array();
|
25 |
-
|
26 |
-
public function __construct() {
|
27 |
-
$this->include_classes();
|
28 |
-
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
|
29 |
-
}
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/
|
54 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-
|
55 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-payment-
|
56 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-
|
57 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-
|
58 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-
|
59 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
'
|
85 |
-
'
|
86 |
-
'
|
87 |
-
'
|
88 |
-
'
|
89 |
-
'
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @author PaymentPlugins
|
7 |
+
* @package Stripe/Classes
|
8 |
+
* @property WC_Stripe_Rest_Controller $order_actions
|
9 |
+
* @property WC_Stripe_Rest_Controller $cart
|
10 |
+
* @property WC_Stripe_Rest_Controller $checkout
|
11 |
+
* @property WC_Stripe_Rest_Controller $payment_intent
|
12 |
+
* @property WC_Stripe_Rest_Controller $googlepay
|
13 |
+
* @property WC_Stripe_Rest_Controller $settings
|
14 |
+
* @property WC_Stripe_Rest_Controller $webhook
|
15 |
+
* @property WC_Stripe_Rest_Controller $product_data
|
16 |
+
* @property WC_Stripe_Rest_Controller $plaid
|
17 |
+
*/
|
18 |
+
class WC_Stripe_Rest_API {
|
19 |
+
|
20 |
+
/**
|
21 |
+
*
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
private $controllers = array();
|
25 |
+
|
26 |
+
public function __construct() {
|
27 |
+
$this->include_classes();
|
28 |
+
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
public static function init() {
|
32 |
+
add_action( 'init', array( __CLASS__, 'add_3rd_party_hooks' ), 1 );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
*
|
37 |
+
* @param WC_Stripe_Rest_Controller $key
|
38 |
+
*/
|
39 |
+
public function __get( $key ) {
|
40 |
+
$controller = isset( $this->controllers[ $key ] ) ? $this->controllers[ $key ] : '';
|
41 |
+
if ( empty( $controller ) ) {
|
42 |
+
wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%1$s is an invalid controller name.', 'woo-stripe-payment' ), $key ), wc_stripe()->version );
|
43 |
+
}
|
44 |
+
|
45 |
+
return $controller;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function __set( $key, $value ) {
|
49 |
+
$this->controllers[ $key ] = $value;
|
50 |
+
}
|
51 |
+
|
52 |
+
private function include_classes() {
|
53 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-stripe-rest-controller.php';
|
54 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-order-actions.php';
|
55 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-payment-intent.php';
|
56 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-cart.php';
|
57 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-checkout.php';
|
58 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-googlepay.php';
|
59 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-payment-method.php';
|
60 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-gateway-settings.php';
|
61 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-webhook.php';
|
62 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-product-data.php';
|
63 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-plaid.php';
|
64 |
+
|
65 |
+
foreach ( $this->get_controllers() as $key => $class_name ) {
|
66 |
+
if ( class_exists( $class_name ) ) {
|
67 |
+
$this->{$key} = new $class_name();
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
public function register_routes() {
|
73 |
+
if ( self::is_rest_api_request() ) {
|
74 |
+
foreach ( $this->controllers as $key => $controller ) {
|
75 |
+
if ( is_callable( array( $controller, 'register_routes' ) ) ) {
|
76 |
+
$controller->register_routes();
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
public function get_controllers() {
|
83 |
+
$controllers = array(
|
84 |
+
'order_actions' => 'WC_Stripe_Controller_Order_Actions',
|
85 |
+
'checkout' => 'WC_Stripe_Controller_Checkout',
|
86 |
+
'cart' => 'WC_Stripe_Controller_Cart',
|
87 |
+
'payment_intent' => 'WC_Stripe_Controller_Payment_Intent',
|
88 |
+
'googlepay' => 'WC_Stripe_Controller_GooglePay',
|
89 |
+
'payment_method' => 'WC_Stripe_Controller_Payment_Method',
|
90 |
+
'settings' => 'WC_Stripe_Controller_Gateway_Settings',
|
91 |
+
'webhook' => 'WC_Stripe_Controller_Webhook',
|
92 |
+
'product_data' => 'WC_Stripe_Controller_Product_Data',
|
93 |
+
'plaid' => 'WC_Stripe_Controller_Plaid'
|
94 |
+
);
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @param string[] $controllers
|
98 |
+
*/
|
99 |
+
return apply_filters( 'wc_stripe_api_controllers', $controllers );
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public function rest_url() {
|
106 |
+
return wc_stripe()->rest_url();
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @return string
|
111 |
+
*/
|
112 |
+
public function rest_uri() {
|
113 |
+
return wc_stripe()->rest_uri();
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* @return bool
|
118 |
+
*/
|
119 |
+
public static function is_rest_api_request() {
|
120 |
+
global $wp;
|
121 |
+
if ( ! empty( $wp->query_vars['rest_route'] ) && strpos( $wp->query_vars['rest_route'], wc_stripe()->rest_uri() ) !== false ) {
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
if ( ! empty( $_SERVER['REQUEST_URI'] ) && strpos( $_SERVER['REQUEST_URI'], wc_stripe()->rest_uri() ) !== false ) {
|
125 |
+
return true;
|
126 |
+
}
|
127 |
+
|
128 |
+
return false;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* @since 3.2.5
|
133 |
+
*/
|
134 |
+
public static function add_3rd_party_hooks() {
|
135 |
+
if ( self::is_rest_api_request() ) {
|
136 |
+
add_filter( 'wcml_load_multi_currency_in_ajax', function ( $bool ) {
|
137 |
+
return true;
|
138 |
+
} );
|
139 |
+
add_filter( 'wcml_client_currency', function ( $currency ) {
|
140 |
+
return isset( $_POST['currency'] ) ? $_POST['currency'] : $currency;
|
141 |
+
} );
|
142 |
+
}
|
143 |
+
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
WC_Stripe_Rest_API::init();
|
includes/controllers/class-wc-stripe-controller-checkout.php
CHANGED
@@ -72,7 +72,7 @@ class WC_Stripe_Controller_Checkout extends WC_Stripe_Rest_Controller {
|
|
72 |
* @return WP_REST_Response
|
73 |
*/
|
74 |
public function process_checkout( $request ) {
|
75 |
-
$this->frontend_includes();
|
76 |
wc_maybe_define_constant( 'DOING_AJAX', true );
|
77 |
$this->actions();
|
78 |
$checkout = WC()->checkout();
|
@@ -121,7 +121,7 @@ class WC_Stripe_Controller_Checkout extends WC_Stripe_Rest_Controller {
|
|
121 |
public function process_payment( $request ) {
|
122 |
wc_maybe_define_constant( 'DOING_AJAX', true );
|
123 |
wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true );
|
124 |
-
$this->frontend_includes();;
|
125 |
try {
|
126 |
if ( ! isset( $request['wp_rest_nonce'] ) || ! wp_verify_nonce( $request['wp_rest_nonce'], 'wp_rest' ) ) {
|
127 |
throw new Exception( 'You are not authorized.' );
|
@@ -156,7 +156,7 @@ class WC_Stripe_Controller_Checkout extends WC_Stripe_Rest_Controller {
|
|
156 |
* @since 3.1.8
|
157 |
*/
|
158 |
public function process_order_pay( $request ) {
|
159 |
-
$this->frontend_includes();
|
160 |
|
161 |
global $wp;
|
162 |
|
@@ -185,7 +185,7 @@ class WC_Stripe_Controller_Checkout extends WC_Stripe_Rest_Controller {
|
|
185 |
* @since 3.1.7
|
186 |
*/
|
187 |
public function delete_source( $request ) {
|
188 |
-
$this->frontend_includes();
|
189 |
$order_id = WC()->session->get( 'order_awaiting_payment', null );
|
190 |
if ( $order_id ) {
|
191 |
$order = wc_get_order( $order_id );
|
72 |
* @return WP_REST_Response
|
73 |
*/
|
74 |
public function process_checkout( $request ) {
|
75 |
+
$this->frontend_includes( $request );
|
76 |
wc_maybe_define_constant( 'DOING_AJAX', true );
|
77 |
$this->actions();
|
78 |
$checkout = WC()->checkout();
|
121 |
public function process_payment( $request ) {
|
122 |
wc_maybe_define_constant( 'DOING_AJAX', true );
|
123 |
wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true );
|
124 |
+
$this->frontend_includes( $request );;
|
125 |
try {
|
126 |
if ( ! isset( $request['wp_rest_nonce'] ) || ! wp_verify_nonce( $request['wp_rest_nonce'], 'wp_rest' ) ) {
|
127 |
throw new Exception( 'You are not authorized.' );
|
156 |
* @since 3.1.8
|
157 |
*/
|
158 |
public function process_order_pay( $request ) {
|
159 |
+
$this->frontend_includes( $request );
|
160 |
|
161 |
global $wp;
|
162 |
|
185 |
* @since 3.1.7
|
186 |
*/
|
187 |
public function delete_source( $request ) {
|
188 |
+
$this->frontend_includes( $request );
|
189 |
$order_id = WC()->session->get( 'order_awaiting_payment', null );
|
190 |
if ( $order_id ) {
|
191 |
$order = wc_get_order( $order_id );
|
includes/gateways/class-wc-payment-gateway-stripe-ach.php
CHANGED
@@ -1,377 +1,381 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Gateway that processes ACH payments.
|
6 |
-
* Only available for U.S. based merchants at this time.
|
7 |
-
*
|
8 |
-
* @since 3.0.5
|
9 |
-
* @author Payment Plugins
|
10 |
-
* @package Stripe/Gateways
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe {
|
14 |
-
|
15 |
-
use WC_Stripe_Payment_Charge_Trait;
|
16 |
-
|
17 |
-
/**
|
18 |
-
*
|
19 |
-
* @var object
|
20 |
-
*/
|
21 |
-
public $metadata_key = '';
|
22 |
-
|
23 |
-
public function __construct() {
|
24 |
-
$this->synchronous = false;
|
25 |
-
$this->id = 'stripe_ach';
|
26 |
-
$this->tab_title = __( 'ACH', 'woo-stripe-payment' );
|
27 |
-
$this->template_name = 'ach.php';
|
28 |
-
$this->token_type = 'Stripe_ACH';
|
29 |
-
$this->method_title = __( 'Stripe ACH', 'woo-stripe-payment' );
|
30 |
-
$this->method_description = __( 'ACH gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
31 |
-
$this->icon = wc_stripe()->assets_url( 'img/ach.svg' );
|
32 |
-
$this->order_button_text = __( 'Bank Payment', 'woo-stripe-payment' );
|
33 |
-
$this->metadata_key = $this->id . '_metadata';
|
34 |
-
parent::__construct();
|
35 |
-
$this->settings['charge_type'] = 'capture';
|
36 |
-
}
|
37 |
-
|
38 |
-
public static function init() {
|
39 |
-
add_action( 'woocommerce_checkout_update_order_review', array( __CLASS__, 'update_order_review' ) );
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
*
|
44 |
-
* {@inheritDoc}
|
45 |
-
*
|
46 |
-
* @see WC_Payment_Gateway::is_available()
|
47 |
-
*/
|
48 |
-
public function is_available() {
|
49 |
-
$is_available = parent::is_available();
|
50 |
-
|
51 |
-
return $is_available && get_woocommerce_currency() == 'USD';
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
*
|
56 |
-
* {@inheritDoc}
|
57 |
-
*
|
58 |
-
* @see WC_Payment_Gateway_Stripe::init_supports()
|
59 |
-
*/
|
60 |
-
public function init_supports() {
|
61 |
-
parent::init_supports();
|
62 |
-
unset( $this->supports['add_payment_method'] );
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
*
|
67 |
-
* {@inheritDoc}
|
68 |
-
*
|
69 |
-
* @see WC_Payment_Gateway_Stripe::enqueue_checkout_scripts()
|
70 |
-
*/
|
71 |
-
public function enqueue_checkout_scripts( $scripts ) {
|
72 |
-
$scripts->enqueue_script(
|
73 |
-
'ach',
|
74 |
-
$scripts->assets_url( 'js/frontend/ach-payments.js' ),
|
75 |
-
array(
|
76 |
-
$scripts->get_handle( 'external' ),
|
77 |
-
$scripts->get_handle( 'wc-stripe' ),
|
78 |
-
$scripts->get_handle( 'plaid' ),
|
79 |
-
)
|
80 |
-
);
|
81 |
-
$scripts->localize_script( 'ach', $this->get_localized_params() );
|
82 |
-
}
|
83 |
-
|
84 |
-
public function get_localized_params() {
|
85 |
-
return array_merge_recursive(
|
86 |
-
parent::get_localized_params(),
|
87 |
-
array(
|
88 |
-
'env' => $this->get_plaid_environment(),
|
89 |
-
'client_name' => $this->get_option( 'client_name' ),
|
90 |
-
'fees_enabled' => $this->fees_enabled(),
|
91 |
-
'routes' => array(
|
92 |
-
'link_token' => wc_stripe()->rest_api->plaid->rest_url( 'link-token' )
|
93 |
-
)
|
94 |
-
)
|
95 |
-
);
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
*
|
100 |
-
* {@inheritDoc}
|
101 |
-
*
|
102 |
-
* @see WC_Payment_Gateway_Stripe_Charge::process_payment()
|
103 |
-
*/
|
104 |
-
public function process_payment( $order_id ) {
|
105 |
-
$order = wc_get_order( $order_id );
|
106 |
-
|
107 |
-
// generate the access token first.
|
108 |
-
if ( ! $this->use_saved_source() ) {
|
109 |
-
try {
|
110 |
-
$result = $this->fetch_access_token( $this->get_public_token() );
|
111 |
-
|
112 |
-
$result = $this->fetch_bank_token( $result->access_token );
|
113 |
-
|
114 |
-
$this->set_new_source_token( $result->stripe_bank_account_token );
|
115 |
-
} catch ( Exception $e ) {
|
116 |
-
wc_add_notice( sprintf( __( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $e->getMessage() ), 'error' );
|
117 |
-
}
|
118 |
-
}
|
119 |
-
add_filter(
|
120 |
-
'wc_stripe_order_meta_data',
|
121 |
-
function ( $metadata ) {
|
122 |
-
$metadata['plaid_id'] = $this->get_option( 'client_id' );
|
123 |
-
|
124 |
-
return $metadata;
|
125 |
-
}
|
126 |
-
);
|
127 |
-
|
128 |
-
return parent::process_payment( $order_id );
|
129 |
-
}
|
130 |
-
|
131 |
-
private function do_api_request( $uri, $body, $method = 'POST' ) {
|
132 |
-
$response = wp_safe_remote_post(
|
133 |
-
$this->get_plaid_url( $uri ),
|
134 |
-
array(
|
135 |
-
'headers' => array( 'Content-Type' => 'application/json' ),
|
136 |
-
'body' => wp_json_encode( $body ),
|
137 |
-
'data_format' => 'body',
|
138 |
-
)
|
139 |
-
);
|
140 |
-
if ( is_wp_error( $response ) ) {
|
141 |
-
throw new Exception( $response->get_error_message() );
|
142 |
-
} else {
|
143 |
-
$body = json_decode( $response['body'] );
|
144 |
-
if ( $response['response']['code'] > 299 ) {
|
145 |
-
throw new Exception( $body->error_message );
|
146 |
-
} else {
|
147 |
-
return $body;
|
148 |
-
}
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
private function fetch_access_token( $public_token ) {
|
153 |
-
$env = $this->get_plaid_environment();
|
154 |
-
|
155 |
-
return $this->do_api_request(
|
156 |
-
'item/public_token/exchange',
|
157 |
-
array(
|
158 |
-
'client_id' => $this->get_option( 'client_id' ),
|
159 |
-
'secret' => $this->get_option( "{$env}_secret" ),
|
160 |
-
'public_token' => $public_token
|
161 |
-
)
|
162 |
-
);
|
163 |
-
}
|
164 |
-
|
165 |
-
private function fetch_bank_token( $access_token ) {
|
166 |
-
$env = $this->get_plaid_environment();
|
167 |
-
|
168 |
-
return $this->do_api_request(
|
169 |
-
'processor/stripe/bank_account_token/create',
|
170 |
-
array(
|
171 |
-
'client_id' => $this->get_option( 'client_id' ),
|
172 |
-
'secret' => $this->get_option( "{$env}_secret" ),
|
173 |
-
'access_token' => $access_token,
|
174 |
-
'account_id' => $this->get_metadata()['account_id'],
|
175 |
-
)
|
176 |
-
);
|
177 |
-
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* @return mixed|null
|
181 |
-
* @throws Exception
|
182 |
-
* @since 3.2.1
|
183 |
-
*/
|
184 |
-
public function fetch_link_token() {
|
185 |
-
$env = $this->get_plaid_environment();
|
186 |
-
|
187 |
-
return $this->do_api_request(
|
188 |
-
'link/token/create',
|
189 |
-
array(
|
190 |
-
'client_id' => $this->get_option( 'client_id' ),
|
191 |
-
'secret' => $this->get_option( "{$env}_secret" ),
|
192 |
-
'client_name' => $this->get_option( 'client_name' ),
|
193 |
-
'language' => 'en',
|
194 |
-
'country_codes' => array( 'US' ),
|
195 |
-
'user' => array(
|
196 |
-
'client_user_id' => WC()->session->get_customer_id()
|
197 |
-
),
|
198 |
-
'products' => array( 'auth' )
|
199 |
-
)
|
200 |
-
);
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Return the base plaid api url.
|
205 |
-
*
|
206 |
-
* @return string
|
207 |
-
*/
|
208 |
-
private function get_base_url() {
|
209 |
-
$url = '';
|
210 |
-
switch ( $this->get_plaid_environment() ) {
|
211 |
-
case 'production':
|
212 |
-
$url = 'https://production.plaid.com/';
|
213 |
-
break;
|
214 |
-
case 'sandbox':
|
215 |
-
$url = 'https://sandbox.plaid.com/';
|
216 |
-
break;
|
217 |
-
case 'development':
|
218 |
-
$url = 'https://development.plaid.com/';
|
219 |
-
break;
|
220 |
-
}
|
221 |
-
|
222 |
-
return $url;
|
223 |
-
}
|
224 |
-
|
225 |
-
private function get_plaid_url( $uri ) {
|
226 |
-
return sprintf( '%s%s', $this->get_base_url(), $uri );
|
227 |
-
}
|
228 |
-
|
229 |
-
public function get_plaid_environment() {
|
230 |
-
return $this->get_option( 'environment' );
|
231 |
-
}
|
232 |
-
|
233 |
-
private function get_metadata() {
|
234 |
-
return isset( $_POST[ $this->metadata_key ] ) ? json_decode( stripslashes( $_POST[ $this->metadata_key ] ), true ) : null;
|
235 |
-
}
|
236 |
-
|
237 |
-
private function get_public_token() {
|
238 |
-
return $this->get_new_source_token();
|
239 |
-
}
|
240 |
-
|
241 |
-
public function get_saved_methods_label() {
|
242 |
-
return __( 'Saved Banks', 'woo-stripe-payment' );
|
243 |
-
}
|
244 |
-
|
245 |
-
public function get_new_method_label() {
|
246 |
-
return __( 'New Bank', 'woo-stripe-payment' );
|
247 |
-
}
|
248 |
-
|
249 |
-
public function generate_ach_fee_html( $key, $data ) {
|
250 |
-
$field_key = $this->get_field_key( $key );
|
251 |
-
$defaults = array(
|
252 |
-
'title' => '',
|
253 |
-
'disabled' => false,
|
254 |
-
'class' => '',
|
255 |
-
'css' => 'max-width: 150px; min-width: 150px;',
|
256 |
-
'placeholder' => '',
|
257 |
-
'type' => 'text',
|
258 |
-
'desc_tip' => false,
|
259 |
-
'description' => '',
|
260 |
-
'custom_attributes' => array(),
|
261 |
-
'options' => array(),
|
262 |
-
);
|
263 |
-
$data = wp_parse_args( $data, $defaults );
|
264 |
-
ob_start();
|
265 |
-
include wc_stripe()->plugin_path() . 'includes/admin/views/html-ach-fee.php';
|
266 |
-
|
267 |
-
return ob_get_clean();
|
268 |
-
}
|
269 |
-
|
270 |
-
public function validate_ach_fee_field( $key, $value ) {
|
271 |
-
$value = empty( $value ) ? array(
|
272 |
-
'type' => 'none',
|
273 |
-
'taxable' => 'no',
|
274 |
-
'value' => '0',
|
275 |
-
) : $value;
|
276 |
-
if ( ! isset( $value['taxable'] ) ) {
|
277 |
-
$value['taxable'] = 'no';
|
278 |
-
}
|
279 |
-
|
280 |
-
return $value;
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
*
|
285 |
-
* @param string $key
|
286 |
-
* @param string $value
|
287 |
-
*/
|
288 |
-
public function validate_environment_field( $key, $value ) {
|
289 |
-
if ( 'test' == wc_stripe_mode() && 'development' == $value ) {
|
290 |
-
WC_Admin_Settings::add_error( __( 'You must set the API mode to live in order to enable the Plaid development environment.', 'woo-stripe-payment' ) );
|
291 |
-
}
|
292 |
-
|
293 |
-
return $value;
|
294 |
-
}
|
295 |
-
|
296 |
-
public function fees_enabled() {
|
297 |
-
$fee = $this->get_option(
|
298 |
-
'fee',
|
299 |
-
array(
|
300 |
-
'type' => 'none',
|
301 |
-
'value' => '0',
|
302 |
-
)
|
303 |
-
);
|
304 |
-
|
305 |
-
return ! empty( $fee ) && $fee['type'] != 'none';
|
306 |
-
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
*
|
310 |
-
* @param WC_Cart $cart
|
311 |
-
*/
|
312 |
-
public function after_calculate_totals( $cart ) {
|
313 |
-
remove_action( 'woocommerce_after_calculate_totals', array( $this, 'after_calculate_totals' ) );
|
314 |
-
|
315 |
-
add_action( 'woocommerce_cart_calculate_fees', array( $this, 'calculate_fees' ) );
|
316 |
-
|
317 |
-
WC()->session->set( 'wc_stripe_cart_total', $cart->total );
|
318 |
-
$cart->calculate_totals();
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
*
|
323 |
-
* @param WC_Cart $cart
|
324 |
-
*/
|
325 |
-
public function calculate_fees( $cart ) {
|
326 |
-
remove_action( 'woocommerce_cart_calculate_fees', array( $this, 'calculate_fees' ) );
|
327 |
-
$fee = $this->get_option( 'fee' );
|
328 |
-
$taxable = $fee['taxable'] == 'yes';
|
329 |
-
switch ( $fee['type'] ) {
|
330 |
-
case 'amount':
|
331 |
-
$cart->add_fee( __( 'ACH Fee' ), $fee['value'], $taxable );
|
332 |
-
break;
|
333 |
-
case 'percent':
|
334 |
-
$cart->add_fee( __( 'ACH Fee' ), $fee['value'] * WC()->session->get( 'wc_stripe_cart_total', 0 ), $taxable );
|
335 |
-
break;
|
336 |
-
}
|
337 |
-
unset( WC()->session->wc_stripe_cart_total );
|
338 |
-
}
|
339 |
-
|
340 |
-
public static function update_order_review() {
|
341 |
-
if ( ! empty( $_POST['payment_method'] ) && $_POST['payment_method'] == 'stripe_ach' ) {
|
342 |
-
$payment_method = new WC_Payment_Gateway_Stripe_ACH();
|
343 |
-
if ( $payment_method->fees_enabled() ) {
|
344 |
-
add_action( 'woocommerce_after_calculate_totals', array( $payment_method, 'after_calculate_totals' ) );
|
345 |
-
}
|
346 |
-
}
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Override so Plaid token can be converted to a Stripe bank token.
|
351 |
-
*
|
352 |
-
* {@inheritDoc}
|
353 |
-
*
|
354 |
-
* @see WC_Payment_Gateway_Stripe::create_payment_method()
|
355 |
-
*/
|
356 |
-
public function create_payment_method( $id, $customer_id ) {
|
357 |
-
if ( $this->is_change_payment_method_request() ) {
|
358 |
-
$result = $this->fetch_access_token( $this->get_public_token() );
|
359 |
-
|
360 |
-
if ( is_wp_error( $result ) ) {
|
361 |
-
return $result;
|
362 |
-
}
|
363 |
-
|
364 |
-
$result = $this->fetch_bank_token( $result->access_token );
|
365 |
-
|
366 |
-
if ( is_wp_error( $result ) ) {
|
367 |
-
return $result;
|
368 |
-
}
|
369 |
-
|
370 |
-
$id = $result->stripe_bank_account_token;
|
371 |
-
}
|
372 |
-
|
373 |
-
return parent::create_payment_method( $id, $customer_id );
|
374 |
-
}
|
375 |
-
|
376 |
-
|
377 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Gateway that processes ACH payments.
|
6 |
+
* Only available for U.S. based merchants at this time.
|
7 |
+
*
|
8 |
+
* @since 3.0.5
|
9 |
+
* @author Payment Plugins
|
10 |
+
* @package Stripe/Gateways
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe {
|
14 |
+
|
15 |
+
use WC_Stripe_Payment_Charge_Trait;
|
16 |
+
|
17 |
+
/**
|
18 |
+
*
|
19 |
+
* @var object
|
20 |
+
*/
|
21 |
+
public $metadata_key = '';
|
22 |
+
|
23 |
+
public function __construct() {
|
24 |
+
$this->synchronous = false;
|
25 |
+
$this->id = 'stripe_ach';
|
26 |
+
$this->tab_title = __( 'ACH', 'woo-stripe-payment' );
|
27 |
+
$this->template_name = 'ach.php';
|
28 |
+
$this->token_type = 'Stripe_ACH';
|
29 |
+
$this->method_title = __( 'Stripe ACH', 'woo-stripe-payment' );
|
30 |
+
$this->method_description = __( 'ACH gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
31 |
+
$this->icon = wc_stripe()->assets_url( 'img/ach.svg' );
|
32 |
+
$this->order_button_text = __( 'Bank Payment', 'woo-stripe-payment' );
|
33 |
+
$this->metadata_key = $this->id . '_metadata';
|
34 |
+
parent::__construct();
|
35 |
+
$this->settings['charge_type'] = 'capture';
|
36 |
+
}
|
37 |
+
|
38 |
+
public static function init() {
|
39 |
+
add_action( 'woocommerce_checkout_update_order_review', array( __CLASS__, 'update_order_review' ) );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
*
|
44 |
+
* {@inheritDoc}
|
45 |
+
*
|
46 |
+
* @see WC_Payment_Gateway::is_available()
|
47 |
+
*/
|
48 |
+
public function is_available() {
|
49 |
+
$is_available = parent::is_available();
|
50 |
+
|
51 |
+
return $is_available && get_woocommerce_currency() == 'USD';
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
*
|
56 |
+
* {@inheritDoc}
|
57 |
+
*
|
58 |
+
* @see WC_Payment_Gateway_Stripe::init_supports()
|
59 |
+
*/
|
60 |
+
public function init_supports() {
|
61 |
+
parent::init_supports();
|
62 |
+
unset( $this->supports['add_payment_method'] );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
*
|
67 |
+
* {@inheritDoc}
|
68 |
+
*
|
69 |
+
* @see WC_Payment_Gateway_Stripe::enqueue_checkout_scripts()
|
70 |
+
*/
|
71 |
+
public function enqueue_checkout_scripts( $scripts ) {
|
72 |
+
$scripts->enqueue_script(
|
73 |
+
'ach',
|
74 |
+
$scripts->assets_url( 'js/frontend/ach-payments.js' ),
|
75 |
+
array(
|
76 |
+
$scripts->get_handle( 'external' ),
|
77 |
+
$scripts->get_handle( 'wc-stripe' ),
|
78 |
+
$scripts->get_handle( 'plaid' ),
|
79 |
+
)
|
80 |
+
);
|
81 |
+
$scripts->localize_script( 'ach', $this->get_localized_params() );
|
82 |
+
}
|
83 |
+
|
84 |
+
public function get_localized_params() {
|
85 |
+
return array_merge_recursive(
|
86 |
+
parent::get_localized_params(),
|
87 |
+
array(
|
88 |
+
'env' => $this->get_plaid_environment(),
|
89 |
+
'client_name' => $this->get_option( 'client_name' ),
|
90 |
+
'fees_enabled' => $this->fees_enabled(),
|
91 |
+
'routes' => array(
|
92 |
+
'link_token' => wc_stripe()->rest_api->plaid->rest_url( 'link-token' )
|
93 |
+
)
|
94 |
+
)
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
*
|
100 |
+
* {@inheritDoc}
|
101 |
+
*
|
102 |
+
* @see WC_Payment_Gateway_Stripe_Charge::process_payment()
|
103 |
+
*/
|
104 |
+
public function process_payment( $order_id ) {
|
105 |
+
$order = wc_get_order( $order_id );
|
106 |
+
|
107 |
+
// generate the access token first.
|
108 |
+
if ( ! $this->use_saved_source() ) {
|
109 |
+
try {
|
110 |
+
$result = $this->fetch_access_token( $this->get_public_token() );
|
111 |
+
|
112 |
+
$result = $this->fetch_bank_token( $result->access_token );
|
113 |
+
|
114 |
+
$this->set_new_source_token( $result->stripe_bank_account_token );
|
115 |
+
} catch ( Exception $e ) {
|
116 |
+
wc_add_notice( sprintf( __( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $e->getMessage() ), 'error' );
|
117 |
+
}
|
118 |
+
}
|
119 |
+
add_filter(
|
120 |
+
'wc_stripe_order_meta_data',
|
121 |
+
function ( $metadata ) {
|
122 |
+
$metadata['plaid_id'] = $this->get_option( 'client_id' );
|
123 |
+
|
124 |
+
return $metadata;
|
125 |
+
}
|
126 |
+
);
|
127 |
+
|
128 |
+
return parent::process_payment( $order_id );
|
129 |
+
}
|
130 |
+
|
131 |
+
private function do_api_request( $uri, $body, $method = 'POST' ) {
|
132 |
+
$response = wp_safe_remote_post(
|
133 |
+
$this->get_plaid_url( $uri ),
|
134 |
+
array(
|
135 |
+
'headers' => array( 'Content-Type' => 'application/json' ),
|
136 |
+
'body' => wp_json_encode( $body ),
|
137 |
+
'data_format' => 'body',
|
138 |
+
)
|
139 |
+
);
|
140 |
+
if ( is_wp_error( $response ) ) {
|
141 |
+
throw new Exception( $response->get_error_message() );
|
142 |
+
} else {
|
143 |
+
$body = json_decode( $response['body'] );
|
144 |
+
if ( $response['response']['code'] > 299 ) {
|
145 |
+
throw new Exception( $body->error_message );
|
146 |
+
} else {
|
147 |
+
return $body;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
private function fetch_access_token( $public_token ) {
|
153 |
+
$env = $this->get_plaid_environment();
|
154 |
+
|
155 |
+
return $this->do_api_request(
|
156 |
+
'item/public_token/exchange',
|
157 |
+
array(
|
158 |
+
'client_id' => $this->get_option( 'client_id' ),
|
159 |
+
'secret' => $this->get_option( "{$env}_secret" ),
|
160 |
+
'public_token' => $public_token
|
161 |
+
)
|
162 |
+
);
|
163 |
+
}
|
164 |
+
|
165 |
+
private function fetch_bank_token( $access_token ) {
|
166 |
+
$env = $this->get_plaid_environment();
|
167 |
+
|
168 |
+
return $this->do_api_request(
|
169 |
+
'processor/stripe/bank_account_token/create',
|
170 |
+
array(
|
171 |
+
'client_id' => $this->get_option( 'client_id' ),
|
172 |
+
'secret' => $this->get_option( "{$env}_secret" ),
|
173 |
+
'access_token' => $access_token,
|
174 |
+
'account_id' => $this->get_metadata()['account_id'],
|
175 |
+
)
|
176 |
+
);
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* @return mixed|null
|
181 |
+
* @throws Exception
|
182 |
+
* @since 3.2.1
|
183 |
+
*/
|
184 |
+
public function fetch_link_token() {
|
185 |
+
$env = $this->get_plaid_environment();
|
186 |
+
|
187 |
+
return $this->do_api_request(
|
188 |
+
'link/token/create',
|
189 |
+
array(
|
190 |
+
'client_id' => $this->get_option( 'client_id' ),
|
191 |
+
'secret' => $this->get_option( "{$env}_secret" ),
|
192 |
+
'client_name' => $this->get_option( 'client_name' ),
|
193 |
+
'language' => 'en',
|
194 |
+
'country_codes' => array( 'US' ),
|
195 |
+
'user' => array(
|
196 |
+
'client_user_id' => WC()->session->get_customer_id()
|
197 |
+
),
|
198 |
+
'products' => array( 'auth' )
|
199 |
+
)
|
200 |
+
);
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Return the base plaid api url.
|
205 |
+
*
|
206 |
+
* @return string
|
207 |
+
*/
|
208 |
+
private function get_base_url() {
|
209 |
+
$url = '';
|
210 |
+
switch ( $this->get_plaid_environment() ) {
|
211 |
+
case 'production':
|
212 |
+
$url = 'https://production.plaid.com/';
|
213 |
+
break;
|
214 |
+
case 'sandbox':
|
215 |
+
$url = 'https://sandbox.plaid.com/';
|
216 |
+
break;
|
217 |
+
case 'development':
|
218 |
+
$url = 'https://development.plaid.com/';
|
219 |
+
break;
|
220 |
+
}
|
221 |
+
|
222 |
+
return $url;
|
223 |
+
}
|
224 |
+
|
225 |
+
private function get_plaid_url( $uri ) {
|
226 |
+
return sprintf( '%s%s', $this->get_base_url(), $uri );
|
227 |
+
}
|
228 |
+
|
229 |
+
public function get_plaid_environment() {
|
230 |
+
return $this->get_option( 'environment' );
|
231 |
+
}
|
232 |
+
|
233 |
+
private function get_metadata() {
|
234 |
+
return isset( $_POST[ $this->metadata_key ] ) ? json_decode( stripslashes( $_POST[ $this->metadata_key ] ), true ) : null;
|
235 |
+
}
|
236 |
+
|
237 |
+
private function get_public_token() {
|
238 |
+
return $this->get_new_source_token();
|
239 |
+
}
|
240 |
+
|
241 |
+
public function get_saved_methods_label() {
|
242 |
+
return __( 'Saved Banks', 'woo-stripe-payment' );
|
243 |
+
}
|
244 |
+
|
245 |
+
public function get_new_method_label() {
|
246 |
+
return __( 'New Bank', 'woo-stripe-payment' );
|
247 |
+
}
|
248 |
+
|
249 |
+
public function generate_ach_fee_html( $key, $data ) {
|
250 |
+
$field_key = $this->get_field_key( $key );
|
251 |
+
$defaults = array(
|
252 |
+
'title' => '',
|
253 |
+
'disabled' => false,
|
254 |
+
'class' => '',
|
255 |
+
'css' => 'max-width: 150px; min-width: 150px;',
|
256 |
+
'placeholder' => '',
|
257 |
+
'type' => 'text',
|
258 |
+
'desc_tip' => false,
|
259 |
+
'description' => '',
|
260 |
+
'custom_attributes' => array(),
|
261 |
+
'options' => array(),
|
262 |
+
);
|
263 |
+
$data = wp_parse_args( $data, $defaults );
|
264 |
+
ob_start();
|
265 |
+
include wc_stripe()->plugin_path() . 'includes/admin/views/html-ach-fee.php';
|
266 |
+
|
267 |
+
return ob_get_clean();
|
268 |
+
}
|
269 |
+
|
270 |
+
public function validate_ach_fee_field( $key, $value ) {
|
271 |
+
$value = empty( $value ) ? array(
|
272 |
+
'type' => 'none',
|
273 |
+
'taxable' => 'no',
|
274 |
+
'value' => '0',
|
275 |
+
) : $value;
|
276 |
+
if ( ! isset( $value['taxable'] ) ) {
|
277 |
+
$value['taxable'] = 'no';
|
278 |
+
}
|
279 |
+
|
280 |
+
return $value;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
*
|
285 |
+
* @param string $key
|
286 |
+
* @param string $value
|
287 |
+
*/
|
288 |
+
public function validate_environment_field( $key, $value ) {
|
289 |
+
if ( 'test' == wc_stripe_mode() && 'development' == $value ) {
|
290 |
+
WC_Admin_Settings::add_error( __( 'You must set the API mode to live in order to enable the Plaid development environment.', 'woo-stripe-payment' ) );
|
291 |
+
}
|
292 |
+
|
293 |
+
return $value;
|
294 |
+
}
|
295 |
+
|
296 |
+
public function fees_enabled() {
|
297 |
+
$fee = $this->get_option(
|
298 |
+
'fee',
|
299 |
+
array(
|
300 |
+
'type' => 'none',
|
301 |
+
'value' => '0',
|
302 |
+
)
|
303 |
+
);
|
304 |
+
|
305 |
+
return ! empty( $fee ) && $fee['type'] != 'none';
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
*
|
310 |
+
* @param WC_Cart $cart
|
311 |
+
*/
|
312 |
+
public function after_calculate_totals( $cart ) {
|
313 |
+
remove_action( 'woocommerce_after_calculate_totals', array( $this, 'after_calculate_totals' ) );
|
314 |
+
|
315 |
+
add_action( 'woocommerce_cart_calculate_fees', array( $this, 'calculate_fees' ) );
|
316 |
+
|
317 |
+
WC()->session->set( 'wc_stripe_cart_total', $cart->total );
|
318 |
+
$cart->calculate_totals();
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
*
|
323 |
+
* @param WC_Cart $cart
|
324 |
+
*/
|
325 |
+
public function calculate_fees( $cart ) {
|
326 |
+
remove_action( 'woocommerce_cart_calculate_fees', array( $this, 'calculate_fees' ) );
|
327 |
+
$fee = $this->get_option( 'fee' );
|
328 |
+
$taxable = $fee['taxable'] == 'yes';
|
329 |
+
switch ( $fee['type'] ) {
|
330 |
+
case 'amount':
|
331 |
+
$cart->add_fee( __( 'ACH Fee' ), $fee['value'], $taxable );
|
332 |
+
break;
|
333 |
+
case 'percent':
|
334 |
+
$cart->add_fee( __( 'ACH Fee' ), $fee['value'] * WC()->session->get( 'wc_stripe_cart_total', 0 ), $taxable );
|
335 |
+
break;
|
336 |
+
}
|
337 |
+
unset( WC()->session->wc_stripe_cart_total );
|
338 |
+
}
|
339 |
+
|
340 |
+
public static function update_order_review() {
|
341 |
+
if ( ! empty( $_POST['payment_method'] ) && $_POST['payment_method'] == 'stripe_ach' ) {
|
342 |
+
$payment_method = new WC_Payment_Gateway_Stripe_ACH();
|
343 |
+
if ( $payment_method->fees_enabled() ) {
|
344 |
+
add_action( 'woocommerce_after_calculate_totals', array( $payment_method, 'after_calculate_totals' ) );
|
345 |
+
}
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Override so Plaid token can be converted to a Stripe bank token.
|
351 |
+
*
|
352 |
+
* {@inheritDoc}
|
353 |
+
*
|
354 |
+
* @see WC_Payment_Gateway_Stripe::create_payment_method()
|
355 |
+
*/
|
356 |
+
public function create_payment_method( $id, $customer_id ) {
|
357 |
+
if ( $this->is_change_payment_method_request() ) {
|
358 |
+
$result = $this->fetch_access_token( $this->get_public_token() );
|
359 |
+
|
360 |
+
if ( is_wp_error( $result ) ) {
|
361 |
+
return $result;
|
362 |
+
}
|
363 |
+
|
364 |
+
$result = $this->fetch_bank_token( $result->access_token );
|
365 |
+
|
366 |
+
if ( is_wp_error( $result ) ) {
|
367 |
+
return $result;
|
368 |
+
}
|
369 |
+
|
370 |
+
$id = $result->stripe_bank_account_token;
|
371 |
+
}
|
372 |
+
|
373 |
+
return parent::create_payment_method( $id, $customer_id );
|
374 |
+
}
|
375 |
+
|
376 |
+
public function has_enqueued_scripts( $scripts ) {
|
377 |
+
return wp_script_is( $scripts->get_handle( 'ach' ) );
|
378 |
+
}
|
379 |
+
}
|
380 |
+
|
381 |
+
WC_Payment_Gateway_Stripe_ACH::init();
|
includes/gateways/class-wc-payment-gateway-stripe-applepay.php
CHANGED
@@ -1,114 +1,118 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
if ( ! class_exists( 'WC_Payment_Gateway_Stripe' ) ) {
|
5 |
-
return;
|
6 |
-
}
|
7 |
-
|
8 |
-
/**
|
9 |
-
*
|
10 |
-
* @package Stripe/Gateways
|
11 |
-
* @author PaymentPlugins
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
class WC_Payment_Gateway_Stripe_ApplePay extends WC_Payment_Gateway_Stripe {
|
15 |
-
|
16 |
-
use WC_Stripe_Payment_Intent_Trait;
|
17 |
-
|
18 |
-
protected $payment_method_type = 'card';
|
19 |
-
|
20 |
-
public function __construct() {
|
21 |
-
$this->id = 'stripe_applepay';
|
22 |
-
$this->tab_title = __( 'Apple Pay', 'woo-stripe-payment' );
|
23 |
-
$this->template_name = 'applepay.php';
|
24 |
-
$this->token_type = 'Stripe_ApplePay';
|
25 |
-
$this->method_title = __( 'Stripe Apple Pay', 'woo-stripe-payment' );
|
26 |
-
$this->method_description = __( 'Apple Pay gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
27 |
-
$this->has_digital_wallet = true;
|
28 |
-
parent::__construct();
|
29 |
-
$this->icon = wc_stripe()->assets_url( 'img/applepay.svg' );
|
30 |
-
}
|
31 |
-
|
32 |
-
public function init_supports() {
|
33 |
-
parent::init_supports();
|
34 |
-
$this->supports[] = 'wc_stripe_cart_checkout';
|
35 |
-
$this->supports[] = 'wc_stripe_product_checkout';
|
36 |
-
$this->supports[] = 'wc_stripe_banner_checkout';
|
37 |
-
$this->supports[] = 'wc_stripe_mini_cart_checkout';
|
38 |
-
}
|
39 |
-
|
40 |
-
public function enqueue_product_scripts( $scripts ) {
|
41 |
-
$scripts->enqueue_script(
|
42 |
-
'applepay-product',
|
43 |
-
$scripts->assets_url( 'js/frontend/applepay-product.js' ),
|
44 |
-
array(
|
45 |
-
$scripts->get_handle( 'wc-stripe' )
|
46 |
-
),
|
47 |
-
wc_stripe()->version(),
|
48 |
-
true
|
49 |
-
);
|
50 |
-
$scripts->localize_script( 'applepay-product', $this->get_localized_params() );
|
51 |
-
}
|
52 |
-
|
53 |
-
public function enqueue_cart_scripts( $scripts ) {
|
54 |
-
$scripts->enqueue_script(
|
55 |
-
'applepay-cart',
|
56 |
-
$scripts->assets_url( 'js/frontend/applepay-cart.js' ),
|
57 |
-
array(
|
58 |
-
$scripts->get_handle( 'wc-stripe' )
|
59 |
-
),
|
60 |
-
wc_stripe()->version(),
|
61 |
-
true
|
62 |
-
);
|
63 |
-
$scripts->localize_script( 'applepay-cart', $this->get_localized_params() );
|
64 |
-
}
|
65 |
-
|
66 |
-
public function enqueue_checkout_scripts( $scripts ) {
|
67 |
-
$scripts->enqueue_script(
|
68 |
-
'applepay-checkout',
|
69 |
-
$scripts->assets_url( 'js/frontend/applepay-checkout.js' ),
|
70 |
-
array(
|
71 |
-
$scripts->get_handle( 'wc-stripe' )
|
72 |
-
),
|
73 |
-
wc_stripe()->version(),
|
74 |
-
true
|
75 |
-
);
|
76 |
-
$scripts->localize_script( 'applepay-checkout', $this->get_localized_params() );
|
77 |
-
}
|
78 |
-
|
79 |
-
public function get_localized_params() {
|
80 |
-
return array_merge_recursive(
|
81 |
-
parent::get_localized_params(),
|
82 |
-
array(
|
83 |
-
'messages' => array(
|
84 |
-
'invalid_amount' => __( 'Please update you product quantity before using Apple Pay.', 'woo-stripe-payment' ),
|
85 |
-
'choose_product' => __( 'Please select a product option before updating quantity.', 'woo-stripe-payment' ),
|
86 |
-
),
|
87 |
-
'button' => wc_stripe_get_template_html(
|
88 |
-
'applepay-button.php',
|
89 |
-
array(
|
90 |
-
'style' => $this->get_option( 'button_style' ),
|
91 |
-
'type' => $this->get_button_type(),
|
92 |
-
)
|
93 |
-
),
|
94 |
-
)
|
95 |
-
);
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Returns the Apple Pay button type based on the current page.
|
100 |
-
*
|
101 |
-
* @return string
|
102 |
-
*/
|
103 |
-
protected function get_button_type() {
|
104 |
-
if ( is_checkout() ) {
|
105 |
-
return $this->get_option( 'button_type_checkout' );
|
106 |
-
}
|
107 |
-
if ( is_cart() ) {
|
108 |
-
return $this->get_option( 'button_type_cart' );
|
109 |
-
}
|
110 |
-
if ( is_product() ) {
|
111 |
-
return $this->get_option( 'button_type_product' );
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
if ( ! class_exists( 'WC_Payment_Gateway_Stripe' ) ) {
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
*
|
10 |
+
* @package Stripe/Gateways
|
11 |
+
* @author PaymentPlugins
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
class WC_Payment_Gateway_Stripe_ApplePay extends WC_Payment_Gateway_Stripe {
|
15 |
+
|
16 |
+
use WC_Stripe_Payment_Intent_Trait;
|
17 |
+
|
18 |
+
protected $payment_method_type = 'card';
|
19 |
+
|
20 |
+
public function __construct() {
|
21 |
+
$this->id = 'stripe_applepay';
|
22 |
+
$this->tab_title = __( 'Apple Pay', 'woo-stripe-payment' );
|
23 |
+
$this->template_name = 'applepay.php';
|
24 |
+
$this->token_type = 'Stripe_ApplePay';
|
25 |
+
$this->method_title = __( 'Stripe Apple Pay', 'woo-stripe-payment' );
|
26 |
+
$this->method_description = __( 'Apple Pay gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
27 |
+
$this->has_digital_wallet = true;
|
28 |
+
parent::__construct();
|
29 |
+
$this->icon = wc_stripe()->assets_url( 'img/applepay.svg' );
|
30 |
+
}
|
31 |
+
|
32 |
+
public function init_supports() {
|
33 |
+
parent::init_supports();
|
34 |
+
$this->supports[] = 'wc_stripe_cart_checkout';
|
35 |
+
$this->supports[] = 'wc_stripe_product_checkout';
|
36 |
+
$this->supports[] = 'wc_stripe_banner_checkout';
|
37 |
+
$this->supports[] = 'wc_stripe_mini_cart_checkout';
|
38 |
+
}
|
39 |
+
|
40 |
+
public function enqueue_product_scripts( $scripts ) {
|
41 |
+
$scripts->enqueue_script(
|
42 |
+
'applepay-product',
|
43 |
+
$scripts->assets_url( 'js/frontend/applepay-product.js' ),
|
44 |
+
array(
|
45 |
+
$scripts->get_handle( 'wc-stripe' )
|
46 |
+
),
|
47 |
+
wc_stripe()->version(),
|
48 |
+
true
|
49 |
+
);
|
50 |
+
$scripts->localize_script( 'applepay-product', $this->get_localized_params() );
|
51 |
+
}
|
52 |
+
|
53 |
+
public function enqueue_cart_scripts( $scripts ) {
|
54 |
+
$scripts->enqueue_script(
|
55 |
+
'applepay-cart',
|
56 |
+
$scripts->assets_url( 'js/frontend/applepay-cart.js' ),
|
57 |
+
array(
|
58 |
+
$scripts->get_handle( 'wc-stripe' )
|
59 |
+
),
|
60 |
+
wc_stripe()->version(),
|
61 |
+
true
|
62 |
+
);
|
63 |
+
$scripts->localize_script( 'applepay-cart', $this->get_localized_params() );
|
64 |
+
}
|
65 |
+
|
66 |
+
public function enqueue_checkout_scripts( $scripts ) {
|
67 |
+
$scripts->enqueue_script(
|
68 |
+
'applepay-checkout',
|
69 |
+
$scripts->assets_url( 'js/frontend/applepay-checkout.js' ),
|
70 |
+
array(
|
71 |
+
$scripts->get_handle( 'wc-stripe' )
|
72 |
+
),
|
73 |
+
wc_stripe()->version(),
|
74 |
+
true
|
75 |
+
);
|
76 |
+
$scripts->localize_script( 'applepay-checkout', $this->get_localized_params() );
|
77 |
+
}
|
78 |
+
|
79 |
+
public function get_localized_params() {
|
80 |
+
return array_merge_recursive(
|
81 |
+
parent::get_localized_params(),
|
82 |
+
array(
|
83 |
+
'messages' => array(
|
84 |
+
'invalid_amount' => __( 'Please update you product quantity before using Apple Pay.', 'woo-stripe-payment' ),
|
85 |
+
'choose_product' => __( 'Please select a product option before updating quantity.', 'woo-stripe-payment' ),
|
86 |
+
),
|
87 |
+
'button' => wc_stripe_get_template_html(
|
88 |
+
'applepay-button.php',
|
89 |
+
array(
|
90 |
+
'style' => $this->get_option( 'button_style' ),
|
91 |
+
'type' => $this->get_button_type(),
|
92 |
+
)
|
93 |
+
),
|
94 |
+
)
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Returns the Apple Pay button type based on the current page.
|
100 |
+
*
|
101 |
+
* @return string
|
102 |
+
*/
|
103 |
+
protected function get_button_type() {
|
104 |
+
if ( is_checkout() ) {
|
105 |
+
return $this->get_option( 'button_type_checkout' );
|
106 |
+
}
|
107 |
+
if ( is_cart() ) {
|
108 |
+
return $this->get_option( 'button_type_cart' );
|
109 |
+
}
|
110 |
+
if ( is_product() ) {
|
111 |
+
return $this->get_option( 'button_type_product' );
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
public function has_enqueued_scripts( $scripts ) {
|
116 |
+
return wp_script_is( $scripts->get_handle( 'applepay-checkout' ) );
|
117 |
+
}
|
118 |
+
}
|
includes/gateways/class-wc-payment-gateway-stripe-cc.php
CHANGED
@@ -173,4 +173,8 @@ class WC_Payment_Gateway_Stripe_CC extends WC_Payment_Gateway_Stripe {
|
|
173 |
$args['payment_method_options']['card']['request_three_d_secure'] = 'any';
|
174 |
}
|
175 |
}
|
|
|
|
|
|
|
|
|
176 |
}
|
173 |
$args['payment_method_options']['card']['request_three_d_secure'] = 'any';
|
174 |
}
|
175 |
}
|
176 |
+
|
177 |
+
public function has_enqueued_scripts( $scripts ) {
|
178 |
+
return wp_script_is( $scripts->get_handle( 'credit-card' ) );
|
179 |
+
}
|
180 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-googlepay.php
CHANGED
@@ -1,234 +1,238 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
if ( ! class_exists( 'WC_Payment_Gateway_Stripe' ) ) {
|
5 |
-
return;
|
6 |
-
}
|
7 |
-
|
8 |
-
/**
|
9 |
-
*
|
10 |
-
* @author PaymentPlugins
|
11 |
-
* @since 3.0.0
|
12 |
-
* @package Stripe/Gateways
|
13 |
-
*/
|
14 |
-
class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe {
|
15 |
-
|
16 |
-
use WC_Stripe_Payment_Charge_Trait;
|
17 |
-
|
18 |
-
public function __construct() {
|
19 |
-
$this->id = 'stripe_googlepay';
|
20 |
-
$this->tab_title = __( 'Google Pay', 'woo-stripe-payment' );
|
21 |
-
$this->template_name = 'googlepay.php';
|
22 |
-
$this->token_type = 'Stripe_GooglePay';
|
23 |
-
$this->method_title = __( 'Stripe Google Pay', 'woo-stripe-payment' );
|
24 |
-
$this->method_description = __( 'Google Pay gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
25 |
-
$this->has_digital_wallet = true;
|
26 |
-
parent::__construct();
|
27 |
-
$this->icon = wc_stripe()->assets_url( 'img/' . $this->get_option( 'icon' ) . '.svg' );
|
28 |
-
}
|
29 |
-
|
30 |
-
public function init_supports() {
|
31 |
-
parent::init_supports();
|
32 |
-
$this->supports[] = 'wc_stripe_cart_checkout';
|
33 |
-
$this->supports[] = 'wc_stripe_product_checkout';
|
34 |
-
$this->supports[] = 'wc_stripe_banner_checkout';
|
35 |
-
$this->supports[] = 'wc_stripe_mini_cart_checkout';
|
36 |
-
}
|
37 |
-
|
38 |
-
public function enqueue_checkout_scripts( $scripts ) {
|
39 |
-
$scripts->enqueue_script(
|
40 |
-
'googlepay-checkout',
|
41 |
-
$scripts->assets_url( 'js/frontend/googlepay-checkout.js' ),
|
42 |
-
array(
|
43 |
-
$scripts->get_handle( 'wc-stripe' ),
|
44 |
-
$scripts->get_handle( 'gpay' ),
|
45 |
-
),
|
46 |
-
wc_stripe()->version(),
|
47 |
-
true
|
48 |
-
);
|
49 |
-
$scripts->localize_script( 'googlepay-checkout', $this->get_localized_params() );
|
50 |
-
}
|
51 |
-
|
52 |
-
public function enqueue_product_scripts( $scripts ) {
|
53 |
-
$scripts->enqueue_script(
|
54 |
-
'googlepay-product',
|
55 |
-
$scripts->assets_url( 'js/frontend/googlepay-product.js' ),
|
56 |
-
array(
|
57 |
-
$scripts->get_handle( 'wc-stripe' ),
|
58 |
-
$scripts->get_handle( 'gpay' ),
|
59 |
-
),
|
60 |
-
wc_stripe()->version(),
|
61 |
-
true
|
62 |
-
);
|
63 |
-
$scripts->localize_script( 'googlepay-product', $this->get_localized_params() );
|
64 |
-
}
|
65 |
-
|
66 |
-
public function enqueue_cart_scripts( $scripts ) {
|
67 |
-
$scripts->enqueue_script(
|
68 |
-
'googlepay-cart',
|
69 |
-
$scripts->assets_url( 'js/frontend/googlepay-cart.js' ),
|
70 |
-
array(
|
71 |
-
$scripts->get_handle( 'wc-stripe' ),
|
72 |
-
$scripts->get_handle( 'gpay' ),
|
73 |
-
),
|
74 |
-
wc_stripe()->version(),
|
75 |
-
true
|
76 |
-
);
|
77 |
-
$scripts->localize_script( 'googlepay-cart', $this->get_localized_params() );
|
78 |
-
}
|
79 |
-
|
80 |
-
public function enqueue_admin_scripts() {
|
81 |
-
wp_register_script( 'gpay-external', wc_stripe()->scripts()->global_scripts['gpay'], array(), wc_stripe()->version(), true );
|
82 |
-
wp_enqueue_script(
|
83 |
-
'wc-stripe-gpay-admin',
|
84 |
-
wc_stripe()->assets_url( 'js/admin/googlepay.js' ),
|
85 |
-
array(
|
86 |
-
'gpay-external',
|
87 |
-
'wc-stripe-admin-settings',
|
88 |
-
),
|
89 |
-
wc_stripe()->version(),
|
90 |
-
true
|
91 |
-
);
|
92 |
-
}
|
93 |
-
|
94 |
-
public function get_localized_params() {
|
95 |
-
$data = array_merge_recursive(
|
96 |
-
parent::get_localized_params(),
|
97 |
-
array(
|
98 |
-
'environment' => wc_stripe_mode() === 'test' ? 'TEST' : 'PRODUCTION',
|
99 |
-
'merchant_id' => wc_stripe_mode() === 'test' ? '' : $this->get_option( 'merchant_id' ),
|
100 |
-
'merchant_name' => $this->get_option( 'merchant_name' ),
|
101 |
-
'button_color' => $this->get_option( 'button_color' ),
|
102 |
-
'button_style' => $this->get_option( 'button_style' ),
|
103 |
-
'total_price_label' => __( 'Total', 'woo-stripe-payment' ),
|
104 |
-
'routes' => array( 'payment_data' => wc_stripe()->rest_api->googlepay->rest_url( 'shipping-data' ) ),
|
105 |
-
'messages' => array( 'invalid_amount' => __( 'Please update you product quantity before using Google Pay.', 'woo-stripe-payment' ) )
|
106 |
-
)
|
107 |
-
);
|
108 |
-
|
109 |
-
return $data;
|
110 |
-
}
|
111 |
-
|
112 |
-
protected function get_display_item_for_cart( $price, $label, $type, ...$args ) {
|
113 |
-
switch ( $type ) {
|
114 |
-
case 'tax':
|
115 |
-
$type = 'TAX';
|
116 |
-
break;
|
117 |
-
default:
|
118 |
-
$type = 'LINE_ITEM';
|
119 |
-
break;
|
120 |
-
}
|
121 |
-
|
122 |
-
return array(
|
123 |
-
'label' => $label,
|
124 |
-
'type' => $type,
|
125 |
-
'price' => strval( round( $price, 2 ) )
|
126 |
-
);
|
127 |
-
}
|
128 |
-
|
129 |
-
protected function get_display_item_for_product( $product ) {
|
130 |
-
return array(
|
131 |
-
'label' => esc_attr( $product->get_name() ),
|
132 |
-
'type' => 'SUBTOTAL',
|
133 |
-
'price' => strval( round( $product->get_price(), 2 ) )
|
134 |
-
);
|
135 |
-
}
|
136 |
-
|
137 |
-
protected function get_display_item_for_order( $price, $label, $order, $type, ...$args ) {
|
138 |
-
switch ( $type ) {
|
139 |
-
case 'tax':
|
140 |
-
$type = 'TAX';
|
141 |
-
break;
|
142 |
-
default:
|
143 |
-
$type = 'LINE_ITEM';
|
144 |
-
break;
|
145 |
-
}
|
146 |
-
|
147 |
-
return array(
|
148 |
-
'label' => $label,
|
149 |
-
'type' => $type,
|
150 |
-
'price' => strval( round( $price, 2 ) )
|
151 |
-
);
|
152 |
-
}
|
153 |
-
|
154 |
-
public function get_formatted_shipping_methods( $methods = array() ) {
|
155 |
-
$methods = parent::get_formatted_shipping_methods( $methods );
|
156 |
-
if ( empty( $methods ) ) {
|
157 |
-
// GPay does not like empty shipping methods. Make a temporary one;
|
158 |
-
$methods[] = array(
|
159 |
-
'id' => 'default',
|
160 |
-
'label' => __( 'Waiting...', 'woo-stripe-payment' ),
|
161 |
-
'description' => __( 'loading shipping methods...', 'woo-stripe-payment' ),
|
162 |
-
);
|
163 |
-
}
|
164 |
-
|
165 |
-
return $methods;
|
166 |
-
}
|
167 |
-
|
168 |
-
public function get_formatted_shipping_method( $price, $rate, $i, $package, $incl_tax ) {
|
169 |
-
return array(
|
170 |
-
'id' => $this->get_shipping_method_id( $rate->id, $i ),
|
171 |
-
'label' => $this->get_formatted_shipping_label( $price, $rate, $incl_tax ),
|
172 |
-
'description' => ''
|
173 |
-
);
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* @param float $price
|
178 |
-
* @param WC_Shipping_Rate $rate
|
179 |
-
* @param bool $incl_tax
|
180 |
-
*
|
181 |
-
* @return string|void
|
182 |
-
*/
|
183 |
-
protected function get_formatted_shipping_label( $price, $rate, $incl_tax ) {
|
184 |
-
$label = sprintf( '%s: %s %s', esc_attr( $rate->get_label() ), number_format( $price, 2 ), get_woocommerce_currency() );
|
185 |
-
if ( $incl_tax ) {
|
186 |
-
if ( $rate->get_shipping_tax() > 0 && ! wc_prices_include_tax() ) {
|
187 |
-
$label .= ' ' . WC()->countries->inc_tax_or_vat();
|
188 |
-
}
|
189 |
-
} else {
|
190 |
-
if ( $rate->get_shipping_tax() > 0 && wc_prices_include_tax() ) {
|
191 |
-
$label .= ' ' . WC()->countries->ex_tax_or_vat();
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
return $label;
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Return a formatted shipping method label.
|
200 |
-
* <strong>Example</strong> 5 Day shipping: 5 USD
|
201 |
-
*
|
202 |
-
* @param WC_Shipping_Rate $rate
|
203 |
-
*
|
204 |
-
* @return
|
205 |
-
* @deprecated
|
206 |
-
*
|
207 |
-
*/
|
208 |
-
public function get_shipping_method_label( $rate ) {
|
209 |
-
$incl_tax = wc_stripe_display_prices_including_tax();
|
210 |
-
$price = $incl_tax ? $rate->cost + $rate->get_shipping_tax() : $rate->cost;
|
211 |
-
|
212 |
-
return $this->get_formatted_shipping_label( $price, $rate, $incl_tax );
|
213 |
-
}
|
214 |
-
|
215 |
-
public function add_to_cart_response( $data ) {
|
216 |
-
$data['googlepay']['displayItems'] = $this->get_display_items();
|
217 |
-
|
218 |
-
return $data;
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* @param array $deps
|
223 |
-
* @param $scripts
|
224 |
-
*
|
225 |
-
* @return array
|
226 |
-
*/
|
227 |
-
public function get_mini_cart_dependencies( $deps, $scripts ) {
|
228 |
-
if ( $this->mini_cart_enabled() ) {
|
229 |
-
$deps[] = $scripts->get_handle( 'gpay' );
|
230 |
-
}
|
231 |
-
|
232 |
-
return $deps;
|
233 |
-
}
|
234 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
if ( ! class_exists( 'WC_Payment_Gateway_Stripe' ) ) {
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
*
|
10 |
+
* @author PaymentPlugins
|
11 |
+
* @since 3.0.0
|
12 |
+
* @package Stripe/Gateways
|
13 |
+
*/
|
14 |
+
class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe {
|
15 |
+
|
16 |
+
use WC_Stripe_Payment_Charge_Trait;
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
$this->id = 'stripe_googlepay';
|
20 |
+
$this->tab_title = __( 'Google Pay', 'woo-stripe-payment' );
|
21 |
+
$this->template_name = 'googlepay.php';
|
22 |
+
$this->token_type = 'Stripe_GooglePay';
|
23 |
+
$this->method_title = __( 'Stripe Google Pay', 'woo-stripe-payment' );
|
24 |
+
$this->method_description = __( 'Google Pay gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
25 |
+
$this->has_digital_wallet = true;
|
26 |
+
parent::__construct();
|
27 |
+
$this->icon = wc_stripe()->assets_url( 'img/' . $this->get_option( 'icon' ) . '.svg' );
|
28 |
+
}
|
29 |
+
|
30 |
+
public function init_supports() {
|
31 |
+
parent::init_supports();
|
32 |
+
$this->supports[] = 'wc_stripe_cart_checkout';
|
33 |
+
$this->supports[] = 'wc_stripe_product_checkout';
|
34 |
+
$this->supports[] = 'wc_stripe_banner_checkout';
|
35 |
+
$this->supports[] = 'wc_stripe_mini_cart_checkout';
|
36 |
+
}
|
37 |
+
|
38 |
+
public function enqueue_checkout_scripts( $scripts ) {
|
39 |
+
$scripts->enqueue_script(
|
40 |
+
'googlepay-checkout',
|
41 |
+
$scripts->assets_url( 'js/frontend/googlepay-checkout.js' ),
|
42 |
+
array(
|
43 |
+
$scripts->get_handle( 'wc-stripe' ),
|
44 |
+
$scripts->get_handle( 'gpay' ),
|
45 |
+
),
|
46 |
+
wc_stripe()->version(),
|
47 |
+
true
|
48 |
+
);
|
49 |
+
$scripts->localize_script( 'googlepay-checkout', $this->get_localized_params() );
|
50 |
+
}
|
51 |
+
|
52 |
+
public function enqueue_product_scripts( $scripts ) {
|
53 |
+
$scripts->enqueue_script(
|
54 |
+
'googlepay-product',
|
55 |
+
$scripts->assets_url( 'js/frontend/googlepay-product.js' ),
|
56 |
+
array(
|
57 |
+
$scripts->get_handle( 'wc-stripe' ),
|
58 |
+
$scripts->get_handle( 'gpay' ),
|
59 |
+
),
|
60 |
+
wc_stripe()->version(),
|
61 |
+
true
|
62 |
+
);
|
63 |
+
$scripts->localize_script( 'googlepay-product', $this->get_localized_params() );
|
64 |
+
}
|
65 |
+
|
66 |
+
public function enqueue_cart_scripts( $scripts ) {
|
67 |
+
$scripts->enqueue_script(
|
68 |
+
'googlepay-cart',
|
69 |
+
$scripts->assets_url( 'js/frontend/googlepay-cart.js' ),
|
70 |
+
array(
|
71 |
+
$scripts->get_handle( 'wc-stripe' ),
|
72 |
+
$scripts->get_handle( 'gpay' ),
|
73 |
+
),
|
74 |
+
wc_stripe()->version(),
|
75 |
+
true
|
76 |
+
);
|
77 |
+
$scripts->localize_script( 'googlepay-cart', $this->get_localized_params() );
|
78 |
+
}
|
79 |
+
|
80 |
+
public function enqueue_admin_scripts() {
|
81 |
+
wp_register_script( 'gpay-external', wc_stripe()->scripts()->global_scripts['gpay'], array(), wc_stripe()->version(), true );
|
82 |
+
wp_enqueue_script(
|
83 |
+
'wc-stripe-gpay-admin',
|
84 |
+
wc_stripe()->assets_url( 'js/admin/googlepay.js' ),
|
85 |
+
array(
|
86 |
+
'gpay-external',
|
87 |
+
'wc-stripe-admin-settings',
|
88 |
+
),
|
89 |
+
wc_stripe()->version(),
|
90 |
+
true
|
91 |
+
);
|
92 |
+
}
|
93 |
+
|
94 |
+
public function get_localized_params() {
|
95 |
+
$data = array_merge_recursive(
|
96 |
+
parent::get_localized_params(),
|
97 |
+
array(
|
98 |
+
'environment' => wc_stripe_mode() === 'test' ? 'TEST' : 'PRODUCTION',
|
99 |
+
'merchant_id' => wc_stripe_mode() === 'test' ? '' : $this->get_option( 'merchant_id' ),
|
100 |
+
'merchant_name' => $this->get_option( 'merchant_name' ),
|
101 |
+
'button_color' => $this->get_option( 'button_color' ),
|
102 |
+
'button_style' => $this->get_option( 'button_style' ),
|
103 |
+
'total_price_label' => __( 'Total', 'woo-stripe-payment' ),
|
104 |
+
'routes' => array( 'payment_data' => wc_stripe()->rest_api->googlepay->rest_url( 'shipping-data' ) ),
|
105 |
+
'messages' => array( 'invalid_amount' => __( 'Please update you product quantity before using Google Pay.', 'woo-stripe-payment' ) )
|
106 |
+
)
|
107 |
+
);
|
108 |
+
|
109 |
+
return $data;
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function get_display_item_for_cart( $price, $label, $type, ...$args ) {
|
113 |
+
switch ( $type ) {
|
114 |
+
case 'tax':
|
115 |
+
$type = 'TAX';
|
116 |
+
break;
|
117 |
+
default:
|
118 |
+
$type = 'LINE_ITEM';
|
119 |
+
break;
|
120 |
+
}
|
121 |
+
|
122 |
+
return array(
|
123 |
+
'label' => $label,
|
124 |
+
'type' => $type,
|
125 |
+
'price' => strval( round( $price, 2 ) )
|
126 |
+
);
|
127 |
+
}
|
128 |
+
|
129 |
+
protected function get_display_item_for_product( $product ) {
|
130 |
+
return array(
|
131 |
+
'label' => esc_attr( $product->get_name() ),
|
132 |
+
'type' => 'SUBTOTAL',
|
133 |
+
'price' => strval( round( $product->get_price(), 2 ) )
|
134 |
+
);
|
135 |
+
}
|
136 |
+
|
137 |
+
protected function get_display_item_for_order( $price, $label, $order, $type, ...$args ) {
|
138 |
+
switch ( $type ) {
|
139 |
+
case 'tax':
|
140 |
+
$type = 'TAX';
|
141 |
+
break;
|
142 |
+
default:
|
143 |
+
$type = 'LINE_ITEM';
|
144 |
+
break;
|
145 |
+
}
|
146 |
+
|
147 |
+
return array(
|
148 |
+
'label' => $label,
|
149 |
+
'type' => $type,
|
150 |
+
'price' => strval( round( $price, 2 ) )
|
151 |
+
);
|
152 |
+
}
|
153 |
+
|
154 |
+
public function get_formatted_shipping_methods( $methods = array() ) {
|
155 |
+
$methods = parent::get_formatted_shipping_methods( $methods );
|
156 |
+
if ( empty( $methods ) ) {
|
157 |
+
// GPay does not like empty shipping methods. Make a temporary one;
|
158 |
+
$methods[] = array(
|
159 |
+
'id' => 'default',
|
160 |
+
'label' => __( 'Waiting...', 'woo-stripe-payment' ),
|
161 |
+
'description' => __( 'loading shipping methods...', 'woo-stripe-payment' ),
|
162 |
+
);
|
163 |
+
}
|
164 |
+
|
165 |
+
return $methods;
|
166 |
+
}
|
167 |
+
|
168 |
+
public function get_formatted_shipping_method( $price, $rate, $i, $package, $incl_tax ) {
|
169 |
+
return array(
|
170 |
+
'id' => $this->get_shipping_method_id( $rate->id, $i ),
|
171 |
+
'label' => $this->get_formatted_shipping_label( $price, $rate, $incl_tax ),
|
172 |
+
'description' => ''
|
173 |
+
);
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param float $price
|
178 |
+
* @param WC_Shipping_Rate $rate
|
179 |
+
* @param bool $incl_tax
|
180 |
+
*
|
181 |
+
* @return string|void
|
182 |
+
*/
|
183 |
+
protected function get_formatted_shipping_label( $price, $rate, $incl_tax ) {
|
184 |
+
$label = sprintf( '%s: %s %s', esc_attr( $rate->get_label() ), number_format( $price, 2 ), get_woocommerce_currency() );
|
185 |
+
if ( $incl_tax ) {
|
186 |
+
if ( $rate->get_shipping_tax() > 0 && ! wc_prices_include_tax() ) {
|
187 |
+
$label .= ' ' . WC()->countries->inc_tax_or_vat();
|
188 |
+
}
|
189 |
+
} else {
|
190 |
+
if ( $rate->get_shipping_tax() > 0 && wc_prices_include_tax() ) {
|
191 |
+
$label .= ' ' . WC()->countries->ex_tax_or_vat();
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
return $label;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Return a formatted shipping method label.
|
200 |
+
* <strong>Example</strong> 5 Day shipping: 5 USD
|
201 |
+
*
|
202 |
+
* @param WC_Shipping_Rate $rate
|
203 |
+
*
|
204 |
+
* @return
|
205 |
+
* @deprecated
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
public function get_shipping_method_label( $rate ) {
|
209 |
+
$incl_tax = wc_stripe_display_prices_including_tax();
|
210 |
+
$price = $incl_tax ? $rate->cost + $rate->get_shipping_tax() : $rate->cost;
|
211 |
+
|
212 |
+
return $this->get_formatted_shipping_label( $price, $rate, $incl_tax );
|
213 |
+
}
|
214 |
+
|
215 |
+
public function add_to_cart_response( $data ) {
|
216 |
+
$data['googlepay']['displayItems'] = $this->get_display_items();
|
217 |
+
|
218 |
+
return $data;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* @param array $deps
|
223 |
+
* @param $scripts
|
224 |
+
*
|
225 |
+
* @return array
|
226 |
+
*/
|
227 |
+
public function get_mini_cart_dependencies( $deps, $scripts ) {
|
228 |
+
if ( $this->mini_cart_enabled() ) {
|
229 |
+
$deps[] = $scripts->get_handle( 'gpay' );
|
230 |
+
}
|
231 |
+
|
232 |
+
return $deps;
|
233 |
+
}
|
234 |
+
|
235 |
+
public function has_enqueued_scripts( $scripts ) {
|
236 |
+
return wp_script_is( $scripts->get_handle( 'googlepay-checkout' ) );
|
237 |
+
}
|
238 |
+
}
|
includes/gateways/class-wc-payment-gateway-stripe-klarna.php
CHANGED
@@ -1,281 +1,281 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
if ( ! class_exists( 'WC_Payment_Gateway_Stripe_Local_Payment' ) ) {
|
5 |
-
return;
|
6 |
-
}
|
7 |
-
|
8 |
-
/**
|
9 |
-
*
|
10 |
-
* @package Stripe/Gateways
|
11 |
-
* @author PaymentPlugins
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_Payment {
|
15 |
-
|
16 |
-
use WC_Stripe_Local_Payment_Charge_Trait;
|
17 |
-
|
18 |
-
public function __construct() {
|
19 |
-
$this->local_payment_type = 'klarna';
|
20 |
-
$this->currencies = array( 'EUR', 'SEK', 'NOK', 'DKK', 'GBP', 'USD' );
|
21 |
-
$this->id = 'stripe_klarna';
|
22 |
-
$this->tab_title = __( 'Klarna', 'woo-stripe-payment' );
|
23 |
-
$this->template_name = 'local-payment.php';
|
24 |
-
$this->token_type = 'Stripe_Local';
|
25 |
-
$this->method_title = __( 'Klarna', 'woo-stripe-payment' );
|
26 |
-
$this->method_description = __( 'Klarna gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
27 |
-
$this->icon = wc_stripe()->assets_url( 'img/klarna.svg' );
|
28 |
-
$this->order_button_text = $this->get_order_button_text( __( 'Klarna', 'woo-stripe-payment' ) );
|
29 |
-
parent::__construct();
|
30 |
-
$this->template_name = 'klarna.php';
|
31 |
-
}
|
32 |
-
|
33 |
-
public function get_required_parameters() {
|
34 |
-
return array(
|
35 |
-
'USD' => array( 'US' ),
|
36 |
-
'EUR' => array( 'AT', 'FI', 'DE', 'NL' ),
|
37 |
-
'DKK' => array( 'DK' ),
|
38 |
-
'NOK' => array( 'NO' ),
|
39 |
-
'SEK' => array( 'SE' ),
|
40 |
-
'GBP' => array( 'GB' ),
|
41 |
-
);
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @param string $currency
|
46 |
-
* @param string $billing_country
|
47 |
-
*
|
48 |
-
* @return bool
|
49 |
-
*/
|
50 |
-
public function validate_local_payment_available( $currency, $billing_country ) {
|
51 |
-
if ( $billing_country ) {
|
52 |
-
$params = $this->get_required_parameters();
|
53 |
-
|
54 |
-
return isset( $params[ $currency ] ) && array_search( $billing_country, $params[ $currency ] ) !== false;
|
55 |
-
}
|
56 |
-
|
57 |
-
return false;
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
*
|
62 |
-
* {@inheritDoc}
|
63 |
-
*
|
64 |
-
* @see WC_Payment_Gateway_Stripe::payment_fields()
|
65 |
-
*/
|
66 |
-
public function payment_fields() {
|
67 |
-
// this might be an update checkout request. If so, update the source if it exists
|
68 |
-
if ( is_ajax() && ( $order_id = absint( WC()->session->get( 'order_awaiting_payment' ) ) ) ) {
|
69 |
-
$order = wc_get_order( $order_id );
|
70 |
-
if ( $order->get_payment_method() === $this->id && ( $source_id = $order->get_meta( WC_Stripe_Constants::SOURCE_ID, true ) ) ) {
|
71 |
-
$this->payment_object->get_gateway()->sources->mode( wc_stripe_order_mode( $order ) )->update( $source_id, $this->get_update_source_args( $order ) );
|
72 |
-
}
|
73 |
-
}
|
74 |
-
parent::payment_fields();
|
75 |
-
}
|
76 |
-
|
77 |
-
public function enqueue_checkout_scripts( $scripts ) {
|
78 |
-
wc_stripe()->scripts()->enqueue_script( 'klarna', 'https://x.klarnacdn.net/kp/lib/v1/api.js', array(), wc_stripe()->version(), true );
|
79 |
-
parent::enqueue_checkout_scripts( $scripts );
|
80 |
-
}
|
81 |
-
|
82 |
-
public function get_local_payment_settings() {
|
83 |
-
return wp_parse_args(
|
84 |
-
array(
|
85 |
-
'payment_categories' => array(
|
86 |
-
'title' => __( 'Payment Categories', 'woo-stripe-payment' ),
|
87 |
-
'type' => 'multiselect',
|
88 |
-
'class' => 'wc-enhanced-select',
|
89 |
-
'options' => $this->get_payment_categories(),
|
90 |
-
'default' => array_keys( $this->get_payment_categories() ),
|
91 |
-
'desc_tip' => true,
|
92 |
-
'description' => __(
|
93 |
-
'These are the payment categories that will be displayed on the checkout page if they are supported. Note, depending on the customer\'s billing country, not all enabled options may show.',
|
94 |
-
'woo-stripe-payment'
|
95 |
-
),
|
96 |
-
),
|
97 |
-
),
|
98 |
-
parent::get_local_payment_settings()
|
99 |
-
);
|
100 |
-
}
|
101 |
-
|
102 |
-
public function get_update_source_args( $order ) {
|
103 |
-
$args = $this->get_source_args( $order, true );
|
104 |
-
unset( $args['type'], $args['currency'], $args['statement_descriptor'], $args['redirect'], $args['klarna']['product'], $args['klarna']['locale'], $args['klarna']['custom_payment_methods'] );
|
105 |
-
|
106 |
-
return $args;
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
*
|
111 |
-
* {@inheritDoc}
|
112 |
-
*
|
113 |
-
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_args()
|
114 |
-
*/
|
115 |
-
public function get_source_args( $order, $update = false ) {
|
116 |
-
if ( $update ) {
|
117 |
-
/*
|
118 |
-
* Use customer if this is an update since customer object has been updated
|
119 |
-
* with all checkout form data in the update_order_review process.
|
120 |
-
*/
|
121 |
-
$object = WC()->customer;
|
122 |
-
} else {
|
123 |
-
$object = $order;
|
124 |
-
}
|
125 |
-
|
126 |
-
$args = array_merge_recursive(
|
127 |
-
parent::get_source_args( $order ),
|
128 |
-
array(
|
129 |
-
'klarna' => array(
|
130 |
-
'product' => 'payment',
|
131 |
-
'purchase_country' => $object->get_billing_country(),
|
132 |
-
'first_name' => $object->get_billing_first_name(),
|
133 |
-
'last_name' => $object->get_billing_last_name(),
|
134 |
-
),
|
135 |
-
'owner' => array(
|
136 |
-
'address' => array(
|
137 |
-
'city' => $object->get_billing_city(),
|
138 |
-
'country' => $object->get_billing_country(),
|
139 |
-
'line1' => $object->get_billing_address_1(),
|
140 |
-
'line2' => $object->get_billing_address_2(),
|
141 |
-
'postal_code' => $object->get_billing_postcode(),
|
142 |
-
'state' => $object->get_billing_state(),
|
143 |
-
),
|
144 |
-
),
|
145 |
-
)
|
146 |
-
);
|
147 |
-
if ( 'US' === $object->get_billing_country() ) {
|
148 |
-
$args['klarna']['custom_payment_methods'] = 'payin4,installments';
|
149 |
-
}
|
150 |
-
$args['source_order'] = array();
|
151 |
-
|
152 |
-
if ( ( $locale = get_locale() ) ) {
|
153 |
-
$args['klarna']['locale'] = str_replace( '_', '-', $locale );
|
154 |
-
}
|
155 |
-
|
156 |
-
if ( $order->get_shipping_address_1() ) {
|
157 |
-
$args['klarna']['shipping_first_name'] = $object->get_shipping_first_name();
|
158 |
-
$args['klarna']['shipping_last_name'] = $object->get_shipping_last_name();
|
159 |
-
$args['source_order']['shipping']['address'] = array(
|
160 |
-
'city' => $object->get_billing_city(),
|
161 |
-
'country' => $object->get_shipping_country(),
|
162 |
-
'line1' => $object->get_shipping_address_1(),
|
163 |
-
'line2' => $object->get_shipping_address_2(),
|
164 |
-
'postal_code' => $object->get_shipping_postcode(),
|
165 |
-
'state' => $object->get_shipping_state(),
|
166 |
-
);
|
167 |
-
}
|
168 |
-
|
169 |
-
foreach ( $order->get_items( 'line_item' ) as $item ) {
|
170 |
-
/**
|
171 |
-
*
|
172 |
-
* @var WC_Order_Item_Product $item
|
173 |
-
*/
|
174 |
-
$args['source_order']['items'][] = array(
|
175 |
-
'type' => 'sku',
|
176 |
-
'amount' => wc_stripe_add_number_precision( $item->get_subtotal(), $order->get_currency() ),
|
177 |
-
'currency' => $order->get_currency(),
|
178 |
-
'quantity' => $item->get_quantity(),
|
179 |
-
'description' => $item->get_name(),
|
180 |
-
);
|
181 |
-
}
|
182 |
-
// shipping
|
183 |
-
if ( $order->get_shipping_total() ) {
|
184 |
-
$args['source_order']['items'][] = array(
|
185 |
-
'type' => 'shipping',
|
186 |
-
'amount' => wc_stripe_add_number_precision( $order->get_shipping_total(), $order->get_currency() ),
|
187 |
-
'currency' => $order->get_currency(),
|
188 |
-
'quantity' => 1,
|
189 |
-
'description' => __( 'Shipping', 'woo-stripe-payment' ),
|
190 |
-
);
|
191 |
-
}
|
192 |
-
// discount
|
193 |
-
if ( $order->get_discount_total() ) {
|
194 |
-
$args['source_order']['items'][] = array(
|
195 |
-
'type' => 'discount',
|
196 |
-
'amount' => - 1 * wc_stripe_add_number_precision( $order->get_discount_total(), $order->get_currency() ),
|
197 |
-
'currency' => $order->get_currency(),
|
198 |
-
'quantity' => 1,
|
199 |
-
'description' => __( 'Discount', 'woo-stripe-payment' ),
|
200 |
-
);
|
201 |
-
}
|
202 |
-
// fees
|
203 |
-
if ( $order->get_fees() ) {
|
204 |
-
$fee_total = 0;
|
205 |
-
foreach ( $order->get_fees() as $fee ) {
|
206 |
-
$fee_total += wc_stripe_add_number_precision( $fee->get_total(), $order->get_currency() );
|
207 |
-
}
|
208 |
-
$args['source_order']['items'][] = array(
|
209 |
-
'type' => 'sku',
|
210 |
-
'amount' => $fee_total,
|
211 |
-
'currency' => $order->get_currency(),
|
212 |
-
'quantity' => 1,
|
213 |
-
'description' => __( 'Fee', 'woo-stripe-payment' ),
|
214 |
-
);
|
215 |
-
}
|
216 |
-
// tax
|
217 |
-
if ( $order->get_total_tax() ) {
|
218 |
-
$args['source_order']['items'][] = array(
|
219 |
-
'type' => 'tax',
|
220 |
-
'amount' => wc_stripe_add_number_precision( $order->get_total_tax() ),
|
221 |
-
'description' => __( 'Tax', 'woo-stripe-payment' ),
|
222 |
-
'quantity' => 1,
|
223 |
-
'currency' => $order->get_currency(),
|
224 |
-
);
|
225 |
-
}
|
226 |
-
|
227 |
-
return $args;
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
*
|
232 |
-
* {@inheritDoc}
|
233 |
-
*
|
234 |
-
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_redirect_url()
|
235 |
-
*/
|
236 |
-
public function get_source_redirect_url( $source, $order ) {
|
237 |
-
$klarna_categories = explode( ',', $source['klarna']['payment_method_categories'] );
|
238 |
-
$klarna_categories = array_intersect( $klarna_categories, $this->get_option( 'payment_categories' ) );
|
239 |
-
$source['klarna']['payment_method_categories'] = implode( $klarna_categories, ',' );
|
240 |
-
$source['redirect'] = add_query_arg( 'source', $order->get_meta( WC_Stripe_Constants::SOURCE_ID ), $this->get_local_payment_return_url( $order ) );
|
241 |
-
|
242 |
-
return '#response=' . base64_encode( wp_json_encode( $source ) );
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
*
|
247 |
-
* @return mixed
|
248 |
-
*/
|
249 |
-
public function get_payment_categories() {
|
250 |
-
return apply_filters(
|
251 |
-
'wc_stripe_klarna_payment_categries',
|
252 |
-
array(
|
253 |
-
'pay_now' => __( 'Pay Now', 'woo-stripe-payment' ),
|
254 |
-
'pay_later' => __( 'Pay Later', 'woo-stripe-payment' ),
|
255 |
-
'pay_over_time' => __(
|
256 |
-
'Pay Over Time',
|
257 |
-
'woo-stripe-payment'
|
258 |
-
),
|
259 |
-
)
|
260 |
-
);
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
*
|
265 |
-
* {@inheritDoc}
|
266 |
-
*
|
267 |
-
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_payment_description()
|
268 |
-
*/
|
269 |
-
public function get_payment_description() {
|
270 |
-
return '<p>' .
|
271 |
-
sprintf( __( 'Click %1$shere%2$s for Klarna test payment methods.', 'woo-stripe-payment' ), '<a target="_blank" href="https://stripe.com/docs/sources/klarna#testing-klarna-payments">', '</a>' ) .
|
272 |
-
'</p>' . parent::get_payment_description();
|
273 |
-
}
|
274 |
-
|
275 |
-
public function get_localized_params() {
|
276 |
-
$params = parent::get_localized_params();
|
277 |
-
$params['messages']['klarna_error'] = __( 'Your purchase is not approved.', 'woo-stripe-payment' );
|
278 |
-
|
279 |
-
return $params;
|
280 |
-
}
|
281 |
-
}
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
if ( ! class_exists( 'WC_Payment_Gateway_Stripe_Local_Payment' ) ) {
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
*
|
10 |
+
* @package Stripe/Gateways
|
11 |
+
* @author PaymentPlugins
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_Payment {
|
15 |
+
|
16 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
$this->local_payment_type = 'klarna';
|
20 |
+
$this->currencies = array( 'EUR', 'SEK', 'NOK', 'DKK', 'GBP', 'USD' );
|
21 |
+
$this->id = 'stripe_klarna';
|
22 |
+
$this->tab_title = __( 'Klarna', 'woo-stripe-payment' );
|
23 |
+
$this->template_name = 'local-payment.php';
|
24 |
+
$this->token_type = 'Stripe_Local';
|
25 |
+
$this->method_title = __( 'Klarna', 'woo-stripe-payment' );
|
26 |
+
$this->method_description = __( 'Klarna gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
27 |
+
$this->icon = wc_stripe()->assets_url( 'img/klarna.svg' );
|
28 |
+
$this->order_button_text = $this->get_order_button_text( __( 'Klarna', 'woo-stripe-payment' ) );
|
29 |
+
parent::__construct();
|
30 |
+
$this->template_name = 'klarna.php';
|
31 |
+
}
|
32 |
+
|
33 |
+
public function get_required_parameters() {
|
34 |
+
return array(
|
35 |
+
'USD' => array( 'US' ),
|
36 |
+
'EUR' => array( 'AT', 'FI', 'DE', 'NL' ),
|
37 |
+
'DKK' => array( 'DK' ),
|
38 |
+
'NOK' => array( 'NO' ),
|
39 |
+
'SEK' => array( 'SE' ),
|
40 |
+
'GBP' => array( 'GB' ),
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param string $currency
|
46 |
+
* @param string $billing_country
|
47 |
+
*
|
48 |
+
* @return bool
|
49 |
+
*/
|
50 |
+
public function validate_local_payment_available( $currency, $billing_country ) {
|
51 |
+
if ( $billing_country ) {
|
52 |
+
$params = $this->get_required_parameters();
|
53 |
+
|
54 |
+
return isset( $params[ $currency ] ) && array_search( $billing_country, $params[ $currency ] ) !== false;
|
55 |
+
}
|
56 |
+
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
*
|
62 |
+
* {@inheritDoc}
|
63 |
+
*
|
64 |
+
* @see WC_Payment_Gateway_Stripe::payment_fields()
|
65 |
+
*/
|
66 |
+
public function payment_fields() {
|
67 |
+
// this might be an update checkout request. If so, update the source if it exists
|
68 |
+
if ( is_ajax() && ( $order_id = absint( WC()->session->get( 'order_awaiting_payment' ) ) ) ) {
|
69 |
+
$order = wc_get_order( $order_id );
|
70 |
+
if ( $order->get_payment_method() === $this->id && ( $source_id = $order->get_meta( WC_Stripe_Constants::SOURCE_ID, true ) ) ) {
|
71 |
+
$this->payment_object->get_gateway()->sources->mode( wc_stripe_order_mode( $order ) )->update( $source_id, $this->get_update_source_args( $order ) );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
parent::payment_fields();
|
75 |
+
}
|
76 |
+
|
77 |
+
public function enqueue_checkout_scripts( $scripts ) {
|
78 |
+
wc_stripe()->scripts()->enqueue_script( 'klarna', 'https://x.klarnacdn.net/kp/lib/v1/api.js', array(), wc_stripe()->version(), true );
|
79 |
+
parent::enqueue_checkout_scripts( $scripts );
|
80 |
+
}
|
81 |
+
|
82 |
+
public function get_local_payment_settings() {
|
83 |
+
return wp_parse_args(
|
84 |
+
array(
|
85 |
+
'payment_categories' => array(
|
86 |
+
'title' => __( 'Payment Categories', 'woo-stripe-payment' ),
|
87 |
+
'type' => 'multiselect',
|
88 |
+
'class' => 'wc-enhanced-select',
|
89 |
+
'options' => $this->get_payment_categories(),
|
90 |
+
'default' => array_keys( $this->get_payment_categories() ),
|
91 |
+
'desc_tip' => true,
|
92 |
+
'description' => __(
|
93 |
+
'These are the payment categories that will be displayed on the checkout page if they are supported. Note, depending on the customer\'s billing country, not all enabled options may show.',
|
94 |
+
'woo-stripe-payment'
|
95 |
+
),
|
96 |
+
),
|
97 |
+
),
|
98 |
+
parent::get_local_payment_settings()
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
public function get_update_source_args( $order ) {
|
103 |
+
$args = $this->get_source_args( $order, true );
|
104 |
+
unset( $args['type'], $args['currency'], $args['statement_descriptor'], $args['redirect'], $args['klarna']['product'], $args['klarna']['locale'], $args['klarna']['custom_payment_methods'] );
|
105 |
+
|
106 |
+
return $args;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
*
|
111 |
+
* {@inheritDoc}
|
112 |
+
*
|
113 |
+
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_args()
|
114 |
+
*/
|
115 |
+
public function get_source_args( $order, $update = false ) {
|
116 |
+
if ( $update ) {
|
117 |
+
/*
|
118 |
+
* Use customer if this is an update since customer object has been updated
|
119 |
+
* with all checkout form data in the update_order_review process.
|
120 |
+
*/
|
121 |
+
$object = WC()->customer;
|
122 |
+
} else {
|
123 |
+
$object = $order;
|
124 |
+
}
|
125 |
+
|
126 |
+
$args = array_merge_recursive(
|
127 |
+
parent::get_source_args( $order ),
|
128 |
+
array(
|
129 |
+
'klarna' => array(
|
130 |
+
'product' => 'payment',
|
131 |
+
'purchase_country' => $object->get_billing_country(),
|
132 |
+
'first_name' => $object->get_billing_first_name(),
|
133 |
+
'last_name' => $object->get_billing_last_name(),
|
134 |
+
),
|
135 |
+
'owner' => array(
|
136 |
+
'address' => array(
|
137 |
+
'city' => $object->get_billing_city(),
|
138 |
+
'country' => $object->get_billing_country(),
|
139 |
+
'line1' => $object->get_billing_address_1(),
|
140 |
+
'line2' => $object->get_billing_address_2(),
|
141 |
+
'postal_code' => $object->get_billing_postcode(),
|
142 |
+
'state' => $object->get_billing_state(),
|
143 |
+
),
|
144 |
+
),
|
145 |
+
)
|
146 |
+
);
|
147 |
+
if ( 'US' === $object->get_billing_country() ) {
|
148 |
+
$args['klarna']['custom_payment_methods'] = 'payin4,installments';
|
149 |
+
}
|
150 |
+
$args['source_order'] = array();
|
151 |
+
|
152 |
+
if ( ( $locale = get_locale() ) ) {
|
153 |
+
$args['klarna']['locale'] = str_replace( '_', '-', $locale );
|
154 |
+
}
|
155 |
+
|
156 |
+
if ( $order->get_shipping_address_1() ) {
|
157 |
+
$args['klarna']['shipping_first_name'] = $object->get_shipping_first_name();
|
158 |
+
$args['klarna']['shipping_last_name'] = $object->get_shipping_last_name();
|
159 |
+
$args['source_order']['shipping']['address'] = array(
|
160 |
+
'city' => $object->get_billing_city(),
|
161 |
+
'country' => $object->get_shipping_country(),
|
162 |
+
'line1' => $object->get_shipping_address_1(),
|
163 |
+
'line2' => $object->get_shipping_address_2(),
|
164 |
+
'postal_code' => $object->get_shipping_postcode(),
|
165 |
+
'state' => $object->get_shipping_state(),
|
166 |
+
);
|
167 |
+
}
|
168 |
+
|
169 |
+
foreach ( $order->get_items( 'line_item' ) as $item ) {
|
170 |
+
/**
|
171 |
+
*
|
172 |
+
* @var WC_Order_Item_Product $item
|
173 |
+
*/
|
174 |
+
$args['source_order']['items'][] = array(
|
175 |
+
'type' => 'sku',
|
176 |
+
'amount' => wc_stripe_add_number_precision( $item->get_subtotal(), $order->get_currency() ),
|
177 |
+
'currency' => $order->get_currency(),
|
178 |
+
'quantity' => $item->get_quantity(),
|
179 |
+
'description' => $item->get_name(),
|
180 |
+
);
|
181 |
+
}
|
182 |
+
// shipping
|
183 |
+
if ( $order->get_shipping_total() ) {
|
184 |
+
$args['source_order']['items'][] = array(
|
185 |
+
'type' => 'shipping',
|
186 |
+
'amount' => wc_stripe_add_number_precision( $order->get_shipping_total(), $order->get_currency() ),
|
187 |
+
'currency' => $order->get_currency(),
|
188 |
+
'quantity' => 1,
|
189 |
+
'description' => __( 'Shipping', 'woo-stripe-payment' ),
|
190 |
+
);
|
191 |
+
}
|
192 |
+
// discount
|
193 |
+
if ( $order->get_discount_total() ) {
|
194 |
+
$args['source_order']['items'][] = array(
|
195 |
+
'type' => 'discount',
|
196 |
+
'amount' => - 1 * wc_stripe_add_number_precision( $order->get_discount_total(), $order->get_currency() ),
|
197 |
+
'currency' => $order->get_currency(),
|
198 |
+
'quantity' => 1,
|
199 |
+
'description' => __( 'Discount', 'woo-stripe-payment' ),
|
200 |
+
);
|
201 |
+
}
|
202 |
+
// fees
|
203 |
+
if ( $order->get_fees() ) {
|
204 |
+
$fee_total = 0;
|
205 |
+
foreach ( $order->get_fees() as $fee ) {
|
206 |
+
$fee_total += wc_stripe_add_number_precision( $fee->get_total(), $order->get_currency() );
|
207 |
+
}
|
208 |
+
$args['source_order']['items'][] = array(
|
209 |
+
'type' => 'sku',
|
210 |
+
'amount' => $fee_total,
|
211 |
+
'currency' => $order->get_currency(),
|
212 |
+
'quantity' => 1,
|
213 |
+
'description' => __( 'Fee', 'woo-stripe-payment' ),
|
214 |
+
);
|
215 |
+
}
|
216 |
+
// tax
|
217 |
+
if ( $order->get_total_tax() ) {
|
218 |
+
$args['source_order']['items'][] = array(
|
219 |
+
'type' => 'tax',
|
220 |
+
'amount' => wc_stripe_add_number_precision( $order->get_total_tax() ),
|
221 |
+
'description' => __( 'Tax', 'woo-stripe-payment' ),
|
222 |
+
'quantity' => 1,
|
223 |
+
'currency' => $order->get_currency(),
|
224 |
+
);
|
225 |
+
}
|
226 |
+
|
227 |
+
return $args;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
*
|
232 |
+
* {@inheritDoc}
|
233 |
+
*
|
234 |
+
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_redirect_url()
|
235 |
+
*/
|
236 |
+
public function get_source_redirect_url( $source, $order ) {
|
237 |
+
$klarna_categories = explode( ',', $source['klarna']['payment_method_categories'] );
|
238 |
+
$klarna_categories = array_intersect( $klarna_categories, $this->get_option( 'payment_categories' ) );
|
239 |
+
$source['klarna']['payment_method_categories'] = implode( $klarna_categories, ',' );
|
240 |
+
$source['redirect'] = add_query_arg( 'source', $order->get_meta( WC_Stripe_Constants::SOURCE_ID ), $this->get_local_payment_return_url( $order ) );
|
241 |
+
|
242 |
+
return '#response=' . base64_encode( wp_json_encode( $source ) );
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
*
|
247 |
+
* @return mixed
|
248 |
+
*/
|
249 |
+
public function get_payment_categories() {
|
250 |
+
return apply_filters(
|
251 |
+
'wc_stripe_klarna_payment_categries',
|
252 |
+
array(
|
253 |
+
'pay_now' => __( 'Pay Now', 'woo-stripe-payment' ),
|
254 |
+
'pay_later' => __( 'Pay Later', 'woo-stripe-payment' ),
|
255 |
+
'pay_over_time' => __(
|
256 |
+
'Pay Over Time',
|
257 |
+
'woo-stripe-payment'
|
258 |
+
),
|
259 |
+
)
|
260 |
+
);
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
*
|
265 |
+
* {@inheritDoc}
|
266 |
+
*
|
267 |
+
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_payment_description()
|
268 |
+
*/
|
269 |
+
public function get_payment_description() {
|
270 |
+
return '<p>' .
|
271 |
+
sprintf( __( 'Click %1$shere%2$s for Klarna test payment methods.', 'woo-stripe-payment' ), '<a target="_blank" href="https://stripe.com/docs/sources/klarna#testing-klarna-payments">', '</a>' ) .
|
272 |
+
'</p>' . parent::get_payment_description();
|
273 |
+
}
|
274 |
+
|
275 |
+
public function get_localized_params() {
|
276 |
+
$params = parent::get_localized_params();
|
277 |
+
$params['messages']['klarna_error'] = __( 'Your purchase is not approved.', 'woo-stripe-payment' );
|
278 |
+
|
279 |
+
return $params;
|
280 |
+
}
|
281 |
+
}
|
includes/gateways/class-wc-payment-gateway-stripe-payment-request.php
CHANGED
@@ -1,98 +1,102 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
if ( ! class_exists( 'WC_Payment_Gateway_Stripe' ) ) {
|
5 |
-
return;
|
6 |
-
}
|
7 |
-
|
8 |
-
/**
|
9 |
-
* This gateway is provided so merchants can accept Chrome Payments, Microsoft Pay, etc.
|
10 |
-
*
|
11 |
-
* @author PaymentPlugins
|
12 |
-
* @package Stripe/Gateways
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
class WC_Payment_Gateway_Stripe_Payment_Request extends WC_Payment_Gateway_Stripe {
|
16 |
-
|
17 |
-
use WC_Stripe_Payment_Intent_Trait;
|
18 |
-
|
19 |
-
protected $payment_method_type = 'card';
|
20 |
-
|
21 |
-
public function __construct() {
|
22 |
-
$this->id = 'stripe_payment_request';
|
23 |
-
$this->tab_title = __( 'PaymentRequest Gateway', 'woo-stripe-payment' );
|
24 |
-
$this->template_name = 'payment-request.php';
|
25 |
-
$this->token_type = 'Stripe_CC';
|
26 |
-
$this->method_title = __( 'Stripe Payment Request', 'woo-stripe-payment' );
|
27 |
-
$this->method_description = __( 'Gateway that renders based on the user\'s browser. Chrome payment methods, Microsoft pay, etc.', 'woo-stripe-payment' );
|
28 |
-
$this->has_digital_wallet = true;
|
29 |
-
parent::__construct();
|
30 |
-
}
|
31 |
-
|
32 |
-
public function init_supports() {
|
33 |
-
parent::init_supports();
|
34 |
-
$this->supports[] = 'wc_stripe_cart_checkout';
|
35 |
-
$this->supports[] = 'wc_stripe_product_checkout';
|
36 |
-
$this->supports[] = 'wc_stripe_banner_checkout';
|
37 |
-
$this->supports[] = 'wc_stripe_mini_cart_checkout';
|
38 |
-
}
|
39 |
-
|
40 |
-
public function get_icon() {
|
41 |
-
return wc_stripe_get_template( 'payment-request-icons.php' );
|
42 |
-
}
|
43 |
-
|
44 |
-
public function enqueue_product_scripts( $scripts ) {
|
45 |
-
$this->enqueue_checkout_scripts( $scripts );
|
46 |
-
}
|
47 |
-
|
48 |
-
public function enqueue_cart_scripts( $scripts ) {
|
49 |
-
$this->enqueue_checkout_scripts( $scripts );
|
50 |
-
}
|
51 |
-
|
52 |
-
public function enqueue_checkout_scripts( $scripts ) {
|
53 |
-
$scripts->enqueue_script(
|
54 |
-
'payment-request',
|
55 |
-
$scripts->assets_url( 'js/frontend/payment-request.js' ),
|
56 |
-
array(
|
57 |
-
$scripts->get_handle( 'wc-stripe' ),
|
58 |
-
$scripts->get_handle( 'external' ),
|
59 |
-
),
|
60 |
-
wc_stripe()->version(),
|
61 |
-
true
|
62 |
-
);
|
63 |
-
|
64 |
-
$scripts->localize_script( 'payment-request', $this->get_localized_params() );
|
65 |
-
}
|
66 |
-
|
67 |
-
public function get_localized_params() {
|
68 |
-
return array_merge_recursive(
|
69 |
-
parent::get_localized_params(),
|
70 |
-
array(
|
71 |
-
'button' => array(
|
72 |
-
'type' => $this->get_option( 'button_type' ),
|
73 |
-
'theme' => $this->get_option( 'button_theme' ),
|
74 |
-
'height' => $this->get_button_height(),
|
75 |
-
),
|
76 |
-
'icons' => array( 'chrome' => wc_stripe()->assets_url( 'img/chrome.svg' ) ),
|
77 |
-
'messages' => array(
|
78 |
-
'invalid_amount' => __( 'Please update you product quantity before paying.', 'woo-stripe-payment' ),
|
79 |
-
'add_to_cart' => __( 'Adding to cart...', 'woo-stripe-payment' ),
|
80 |
-
'choose_product' => __( 'Please select a product option before updating quantity.', 'woo-stripe-payment' ),
|
81 |
-
),
|
82 |
-
)
|
83 |
-
);
|
84 |
-
}
|
85 |
-
|
86 |
-
private function get_button_height() {
|
87 |
-
$value = $this->get_option( 'button_height' );
|
88 |
-
$value .= strpos( $value, 'px' ) === false ? 'px' : '';
|
89 |
-
|
90 |
-
return $value;
|
91 |
-
}
|
92 |
-
|
93 |
-
private function get_icon_for_payment_request() {
|
94 |
-
$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
95 |
-
if ( ! empty( $user_agent ) ) {
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
if ( ! class_exists( 'WC_Payment_Gateway_Stripe' ) ) {
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
* This gateway is provided so merchants can accept Chrome Payments, Microsoft Pay, etc.
|
10 |
+
*
|
11 |
+
* @author PaymentPlugins
|
12 |
+
* @package Stripe/Gateways
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
class WC_Payment_Gateway_Stripe_Payment_Request extends WC_Payment_Gateway_Stripe {
|
16 |
+
|
17 |
+
use WC_Stripe_Payment_Intent_Trait;
|
18 |
+
|
19 |
+
protected $payment_method_type = 'card';
|
20 |
+
|
21 |
+
public function __construct() {
|
22 |
+
$this->id = 'stripe_payment_request';
|
23 |
+
$this->tab_title = __( 'PaymentRequest Gateway', 'woo-stripe-payment' );
|
24 |
+
$this->template_name = 'payment-request.php';
|
25 |
+
$this->token_type = 'Stripe_CC';
|
26 |
+
$this->method_title = __( 'Stripe Payment Request', 'woo-stripe-payment' );
|
27 |
+
$this->method_description = __( 'Gateway that renders based on the user\'s browser. Chrome payment methods, Microsoft pay, etc.', 'woo-stripe-payment' );
|
28 |
+
$this->has_digital_wallet = true;
|
29 |
+
parent::__construct();
|
30 |
+
}
|
31 |
+
|
32 |
+
public function init_supports() {
|
33 |
+
parent::init_supports();
|
34 |
+
$this->supports[] = 'wc_stripe_cart_checkout';
|
35 |
+
$this->supports[] = 'wc_stripe_product_checkout';
|
36 |
+
$this->supports[] = 'wc_stripe_banner_checkout';
|
37 |
+
$this->supports[] = 'wc_stripe_mini_cart_checkout';
|
38 |
+
}
|
39 |
+
|
40 |
+
public function get_icon() {
|
41 |
+
return wc_stripe_get_template( 'payment-request-icons.php' );
|
42 |
+
}
|
43 |
+
|
44 |
+
public function enqueue_product_scripts( $scripts ) {
|
45 |
+
$this->enqueue_checkout_scripts( $scripts );
|
46 |
+
}
|
47 |
+
|
48 |
+
public function enqueue_cart_scripts( $scripts ) {
|
49 |
+
$this->enqueue_checkout_scripts( $scripts );
|
50 |
+
}
|
51 |
+
|
52 |
+
public function enqueue_checkout_scripts( $scripts ) {
|
53 |
+
$scripts->enqueue_script(
|
54 |
+
'payment-request',
|
55 |
+
$scripts->assets_url( 'js/frontend/payment-request.js' ),
|
56 |
+
array(
|
57 |
+
$scripts->get_handle( 'wc-stripe' ),
|
58 |
+
$scripts->get_handle( 'external' ),
|
59 |
+
),
|
60 |
+
wc_stripe()->version(),
|
61 |
+
true
|
62 |
+
);
|
63 |
+
|
64 |
+
$scripts->localize_script( 'payment-request', $this->get_localized_params() );
|
65 |
+
}
|
66 |
+
|
67 |
+
public function get_localized_params() {
|
68 |
+
return array_merge_recursive(
|
69 |
+
parent::get_localized_params(),
|
70 |
+
array(
|
71 |
+
'button' => array(
|
72 |
+
'type' => $this->get_option( 'button_type' ),
|
73 |
+
'theme' => $this->get_option( 'button_theme' ),
|
74 |
+
'height' => $this->get_button_height(),
|
75 |
+
),
|
76 |
+
'icons' => array( 'chrome' => wc_stripe()->assets_url( 'img/chrome.svg' ) ),
|
77 |
+
'messages' => array(
|
78 |
+
'invalid_amount' => __( 'Please update you product quantity before paying.', 'woo-stripe-payment' ),
|
79 |
+
'add_to_cart' => __( 'Adding to cart...', 'woo-stripe-payment' ),
|
80 |
+
'choose_product' => __( 'Please select a product option before updating quantity.', 'woo-stripe-payment' ),
|
81 |
+
),
|
82 |
+
)
|
83 |
+
);
|
84 |
+
}
|
85 |
+
|
86 |
+
private function get_button_height() {
|
87 |
+
$value = $this->get_option( 'button_height' );
|
88 |
+
$value .= strpos( $value, 'px' ) === false ? 'px' : '';
|
89 |
+
|
90 |
+
return $value;
|
91 |
+
}
|
92 |
+
|
93 |
+
private function get_icon_for_payment_request() {
|
94 |
+
$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
95 |
+
if ( ! empty( $user_agent ) ) {
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
public function has_enqueued_scripts( $scripts ) {
|
100 |
+
return wp_script_is( $scripts->get_handle( 'payment-request' ) );
|
101 |
+
}
|
102 |
+
}
|
includes/gateways/class-wc-payment-gateway-stripe-sepa.php
CHANGED
@@ -1,93 +1,93 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
if ( ! class_exists( 'WC_Payment_Gateway_Stripe_Local_Payment' ) ) {
|
5 |
-
return;
|
6 |
-
}
|
7 |
-
|
8 |
-
/**
|
9 |
-
*
|
10 |
-
* @package Stripe/Gateways
|
11 |
-
* @author PaymentPlugins
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
class WC_Payment_Gateway_Stripe_Sepa extends WC_Payment_Gateway_Stripe_Local_Payment {
|
15 |
-
|
16 |
-
use WC_Stripe_Local_Payment_Charge_Trait;
|
17 |
-
|
18 |
-
public function __construct() {
|
19 |
-
$this->synchronous = false;
|
20 |
-
$this->local_payment_type = 'sepa_debit';
|
21 |
-
$this->currencies = array( 'EUR' );
|
22 |
-
$this->id = 'stripe_sepa';
|
23 |
-
$this->tab_title = __( 'SEPA', 'woo-stripe-payment' );
|
24 |
-
$this->template_name = 'local-payment.php';
|
25 |
-
$this->method_title = __( 'Sepa', 'woo-stripe-payment' );
|
26 |
-
$this->method_description = __( 'Sepa gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
27 |
-
$this->icon = wc_stripe()->assets_url( 'img/sepa.svg' );
|
28 |
-
$this->order_button_text = $this->get_order_button_text( __( 'SEPA', 'woo-stripe-payment' ) );
|
29 |
-
parent::__construct();
|
30 |
-
$this->token_type = 'Stripe_Sepa';
|
31 |
-
|
32 |
-
$this->local_payment_description = sprintf(
|
33 |
-
__(
|
34 |
-
'By providing your IBAN and confirming this payment, you are
|
35 |
-
authorizing %s and Stripe, our payment service provider, to send instructions to your bank to debit your account
|
36 |
-
and your bank to debit your account in accordance with those instructions. You are entitled to a refund from your bank under the
|
37 |
-
terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited.',
|
38 |
-
'woo-stripe-payment'
|
39 |
-
),
|
40 |
-
$this->get_option( 'company_name' )
|
41 |
-
);
|
42 |
-
}
|
43 |
-
|
44 |
-
public function init_supports() {
|
45 |
-
parent::init_supports();
|
46 |
-
$this->supports[] = 'subscriptions';
|
47 |
-
$this->supports[] = 'subscription_cancellation';
|
48 |
-
$this->supports[] = 'multiple_subscriptions';
|
49 |
-
$this->supports[] = 'subscription_reactivation';
|
50 |
-
$this->supports[] = 'subscription_suspension';
|
51 |
-
$this->supports[] = 'subscription_date_changes';
|
52 |
-
$this->supports[] = 'subscription_payment_method_change_admin';
|
53 |
-
}
|
54 |
-
|
55 |
-
public function get_element_params() {
|
56 |
-
return array_merge( parent::get_element_params(), array( 'supportedCountries' => array( 'SEPA' ) ) );
|
57 |
-
}
|
58 |
-
|
59 |
-
public function get_local_payment_settings() {
|
60 |
-
return parent::get_local_payment_settings() + array(
|
61 |
-
'company_name' => array(
|
62 |
-
'title' => __( 'Company Name', 'woo-stripe-payment' ),
|
63 |
-
'type' => 'text',
|
64 |
-
'default' => get_bloginfo( 'name' ),
|
65 |
-
'desc_tip' => true,
|
66 |
-
'description' => __( 'The name of your company that will appear in the SEPA mandate.', 'woo-stripe-payment' ),
|
67 |
-
),
|
68 |
-
);
|
69 |
-
}
|
70 |
-
|
71 |
-
public function get_payment_description() {
|
72 |
-
return parent::get_payment_description() .
|
73 |
-
sprintf( '<p><a target="_blank" href="https://stripe.com/docs/sources/sepa-debit#testing">%s</a></p>', __( 'SEPA Test Accounts', 'woo-stripe-payment' ) );
|
74 |
-
}
|
75 |
-
|
76 |
-
public function get_new_method_label() {
|
77 |
-
return __( 'New Account', 'woo-stripe-payment' );
|
78 |
-
}
|
79 |
-
|
80 |
-
public function get_saved_methods_label() {
|
81 |
-
return __( 'Saved Accounts', 'woo-stripe-payment' );
|
82 |
-
}
|
83 |
-
|
84 |
-
public function get_tokens() {
|
85 |
-
// always return an empty array if this is the checkout page because
|
86 |
-
// saved SEPA src's can only be used for the amount specified at source creation.
|
87 |
-
if ( is_checkout() ) {
|
88 |
-
return array();
|
89 |
-
}
|
90 |
-
|
91 |
-
return parent::get_tokens();
|
92 |
-
}
|
93 |
}
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
if ( ! class_exists( 'WC_Payment_Gateway_Stripe_Local_Payment' ) ) {
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
*
|
10 |
+
* @package Stripe/Gateways
|
11 |
+
* @author PaymentPlugins
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
class WC_Payment_Gateway_Stripe_Sepa extends WC_Payment_Gateway_Stripe_Local_Payment {
|
15 |
+
|
16 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
$this->synchronous = false;
|
20 |
+
$this->local_payment_type = 'sepa_debit';
|
21 |
+
$this->currencies = array( 'EUR' );
|
22 |
+
$this->id = 'stripe_sepa';
|
23 |
+
$this->tab_title = __( 'SEPA', 'woo-stripe-payment' );
|
24 |
+
$this->template_name = 'local-payment.php';
|
25 |
+
$this->method_title = __( 'Sepa', 'woo-stripe-payment' );
|
26 |
+
$this->method_description = __( 'Sepa gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
27 |
+
$this->icon = wc_stripe()->assets_url( 'img/sepa.svg' );
|
28 |
+
$this->order_button_text = $this->get_order_button_text( __( 'SEPA', 'woo-stripe-payment' ) );
|
29 |
+
parent::__construct();
|
30 |
+
$this->token_type = 'Stripe_Sepa';
|
31 |
+
|
32 |
+
$this->local_payment_description = sprintf(
|
33 |
+
__(
|
34 |
+
'By providing your IBAN and confirming this payment, you are
|
35 |
+
authorizing %s and Stripe, our payment service provider, to send instructions to your bank to debit your account
|
36 |
+
and your bank to debit your account in accordance with those instructions. You are entitled to a refund from your bank under the
|
37 |
+
terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited.',
|
38 |
+
'woo-stripe-payment'
|
39 |
+
),
|
40 |
+
$this->get_option( 'company_name' )
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
public function init_supports() {
|
45 |
+
parent::init_supports();
|
46 |
+
$this->supports[] = 'subscriptions';
|
47 |
+
$this->supports[] = 'subscription_cancellation';
|
48 |
+
$this->supports[] = 'multiple_subscriptions';
|
49 |
+
$this->supports[] = 'subscription_reactivation';
|
50 |
+
$this->supports[] = 'subscription_suspension';
|
51 |
+
$this->supports[] = 'subscription_date_changes';
|
52 |
+
$this->supports[] = 'subscription_payment_method_change_admin';
|
53 |
+
}
|
54 |
+
|
55 |
+
public function get_element_params() {
|
56 |
+
return array_merge( parent::get_element_params(), array( 'supportedCountries' => array( 'SEPA' ) ) );
|
57 |
+
}
|
58 |
+
|
59 |
+
public function get_local_payment_settings() {
|
60 |
+
return parent::get_local_payment_settings() + array(
|
61 |
+
'company_name' => array(
|
62 |
+
'title' => __( 'Company Name', 'woo-stripe-payment' ),
|
63 |
+
'type' => 'text',
|
64 |
+
'default' => get_bloginfo( 'name' ),
|
65 |
+
'desc_tip' => true,
|
66 |
+
'description' => __( 'The name of your company that will appear in the SEPA mandate.', 'woo-stripe-payment' ),
|
67 |
+
),
|
68 |
+
);
|
69 |
+
}
|
70 |
+
|
71 |
+
public function get_payment_description() {
|
72 |
+
return parent::get_payment_description() .
|
73 |
+
sprintf( '<p><a target="_blank" href="https://stripe.com/docs/sources/sepa-debit#testing">%s</a></p>', __( 'SEPA Test Accounts', 'woo-stripe-payment' ) );
|
74 |
+
}
|
75 |
+
|
76 |
+
public function get_new_method_label() {
|
77 |
+
return __( 'New Account', 'woo-stripe-payment' );
|
78 |
+
}
|
79 |
+
|
80 |
+
public function get_saved_methods_label() {
|
81 |
+
return __( 'Saved Accounts', 'woo-stripe-payment' );
|
82 |
+
}
|
83 |
+
|
84 |
+
public function get_tokens() {
|
85 |
+
// always return an empty array if this is the checkout page because
|
86 |
+
// saved SEPA src's can only be used for the amount specified at source creation.
|
87 |
+
if ( is_checkout() ) {
|
88 |
+
return array();
|
89 |
+
}
|
90 |
+
|
91 |
+
return parent::get_tokens();
|
92 |
+
}
|
93 |
}
|
includes/tokens/class-wc-payment-token-stripe-local-payment.php
CHANGED
@@ -1,43 +1,43 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
*
|
6 |
-
* @since 3.0.0
|
7 |
-
* @package Stripe/Tokens
|
8 |
-
* @author PaymentPlugins
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
class WC_Payment_Token_Stripe_Local extends WC_Payment_Token_Stripe {
|
12 |
-
|
13 |
-
use WC_Payment_Token_Source_Trait;
|
14 |
-
|
15 |
-
protected $type = 'Stripe_Local';
|
16 |
-
|
17 |
-
protected $stripe_data = array( 'gateway_title' => '' );
|
18 |
-
|
19 |
-
public function details_to_props( $details ) {
|
20 |
-
}
|
21 |
-
|
22 |
-
public function set_gateway_title( $value ) {
|
23 |
-
$this->set_prop( 'gateway_title', $value );
|
24 |
-
}
|
25 |
-
|
26 |
-
public function get_gateway_title( $context = 'view' ) {
|
27 |
-
return $this->get_prop( 'gateway_title', $context );
|
28 |
-
}
|
29 |
-
|
30 |
-
public function get_formats() {
|
31 |
-
return apply_filters( 'wc_stripe_get_local_token_formats', array(
|
32 |
-
'gateway_title' => array(
|
33 |
-
'label' => __( 'Gateway Title', 'woo-stripe-payment' ),
|
34 |
-
'example' => 'P24',
|
35 |
-
'format' => '{gateway_title}',
|
36 |
-
)
|
37 |
-
), $this );
|
38 |
-
}
|
39 |
-
|
40 |
-
public function get_html_classes() {
|
41 |
-
return $this->get_gateway_id();
|
42 |
-
}
|
43 |
-
}
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @since 3.0.0
|
7 |
+
* @package Stripe/Tokens
|
8 |
+
* @author PaymentPlugins
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class WC_Payment_Token_Stripe_Local extends WC_Payment_Token_Stripe {
|
12 |
+
|
13 |
+
use WC_Payment_Token_Source_Trait;
|
14 |
+
|
15 |
+
protected $type = 'Stripe_Local';
|
16 |
+
|
17 |
+
protected $stripe_data = array( 'gateway_title' => '' );
|
18 |
+
|
19 |
+
public function details_to_props( $details ) {
|
20 |
+
}
|
21 |
+
|
22 |
+
public function set_gateway_title( $value ) {
|
23 |
+
$this->set_prop( 'gateway_title', $value );
|
24 |
+
}
|
25 |
+
|
26 |
+
public function get_gateway_title( $context = 'view' ) {
|
27 |
+
return $this->get_prop( 'gateway_title', $context );
|
28 |
+
}
|
29 |
+
|
30 |
+
public function get_formats() {
|
31 |
+
return apply_filters( 'wc_stripe_get_local_token_formats', array(
|
32 |
+
'gateway_title' => array(
|
33 |
+
'label' => __( 'Gateway Title', 'woo-stripe-payment' ),
|
34 |
+
'example' => 'P24',
|
35 |
+
'format' => '{gateway_title}',
|
36 |
+
)
|
37 |
+
), $this );
|
38 |
+
}
|
39 |
+
|
40 |
+
public function get_html_classes() {
|
41 |
+
return $this->get_gateway_id();
|
42 |
+
}
|
43 |
+
}
|
includes/traits/wc-stripe-controller-traits.php
CHANGED
@@ -1,98 +1,104 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit();
|
3 |
-
|
4 |
-
/**
|
5 |
-
*
|
6 |
-
* @since 3.1.0
|
7 |
-
* @author Payment Plugins
|
8 |
-
*/
|
9 |
-
trait WC_Stripe_Controller_Cart_Trait {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Method that hooks in to the woocommerce_cart_ready_to_calc_shipping filter.
|
13 |
-
* Purpose is to ensure
|
14 |
-
* true is returned so shipping packages are calculated. Some 3rd party plugins and themes return false
|
15 |
-
* if the current page is the cart because they don't want to display the shipping calculator.
|
16 |
-
*
|
17 |
-
* @since 3.1.0
|
18 |
-
*/
|
19 |
-
public function add_ready_to_calc_shipping() {
|
20 |
-
add_filter(
|
21 |
-
'woocommerce_cart_ready_to_calc_shipping',
|
22 |
-
function ( $show_shipping ) {
|
23 |
-
return true;
|
24 |
-
},
|
25 |
-
1000
|
26 |
-
);
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @param WP_Rest_Request $request
|
31 |
-
*
|
32 |
-
* @return array
|
33 |
-
* @throws Exception
|
34 |
-
* @since 3.1.8
|
35 |
-
*/
|
36 |
-
private function get_shipping_method_from_request( $request ) {
|
37 |
-
if ( ( $method = $request->get_param( 'shipping_method' ) ) ) {
|
38 |
-
if ( ! preg_match( '/^(?P<index>[\w]+)\:(?P<id>.+)$/', $method, $shipping_method ) ) {
|
39 |
-
throw new Exception( __( 'Invalid shipping method format. Expected: index:id', 'woo-stripe-payment' ) );
|
40 |
-
}
|
41 |
-
|
42 |
-
return array( $shipping_method['index'] => $shipping_method['id'] );
|
43 |
-
}
|
44 |
-
|
45 |
-
return array();
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @param array $address
|
50 |
-
* @param WP_REST_Request $request
|
51 |
-
*/
|
52 |
-
public function validate_shipping_address( $address, $request ) {
|
53 |
-
if ( isset( $address['state'], $address['country'] ) ) {
|
54 |
-
$address['state'] = wc_stripe_filter_address_state( $address['state'], $address['country'] );
|
55 |
-
$request['address'] = $address;
|
56 |
-
}
|
57 |
-
|
58 |
-
return true;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Trait WC_Stripe_Controller_Frontend_Trait
|
64 |
-
* @since 3.1.8
|
65 |
-
*/
|
66 |
-
trait WC_Stripe_Controller_Frontend_Trait {
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
WC()->
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit();
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @since 3.1.0
|
7 |
+
* @author Payment Plugins
|
8 |
+
*/
|
9 |
+
trait WC_Stripe_Controller_Cart_Trait {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Method that hooks in to the woocommerce_cart_ready_to_calc_shipping filter.
|
13 |
+
* Purpose is to ensure
|
14 |
+
* true is returned so shipping packages are calculated. Some 3rd party plugins and themes return false
|
15 |
+
* if the current page is the cart because they don't want to display the shipping calculator.
|
16 |
+
*
|
17 |
+
* @since 3.1.0
|
18 |
+
*/
|
19 |
+
public function add_ready_to_calc_shipping() {
|
20 |
+
add_filter(
|
21 |
+
'woocommerce_cart_ready_to_calc_shipping',
|
22 |
+
function ( $show_shipping ) {
|
23 |
+
return true;
|
24 |
+
},
|
25 |
+
1000
|
26 |
+
);
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @param WP_Rest_Request $request
|
31 |
+
*
|
32 |
+
* @return array
|
33 |
+
* @throws Exception
|
34 |
+
* @since 3.1.8
|
35 |
+
*/
|
36 |
+
private function get_shipping_method_from_request( $request ) {
|
37 |
+
if ( ( $method = $request->get_param( 'shipping_method' ) ) ) {
|
38 |
+
if ( ! preg_match( '/^(?P<index>[\w]+)\:(?P<id>.+)$/', $method, $shipping_method ) ) {
|
39 |
+
throw new Exception( __( 'Invalid shipping method format. Expected: index:id', 'woo-stripe-payment' ) );
|
40 |
+
}
|
41 |
+
|
42 |
+
return array( $shipping_method['index'] => $shipping_method['id'] );
|
43 |
+
}
|
44 |
+
|
45 |
+
return array();
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param array $address
|
50 |
+
* @param WP_REST_Request $request
|
51 |
+
*/
|
52 |
+
public function validate_shipping_address( $address, $request ) {
|
53 |
+
if ( isset( $address['state'], $address['country'] ) ) {
|
54 |
+
$address['state'] = wc_stripe_filter_address_state( $address['state'], $address['country'] );
|
55 |
+
$request['address'] = $address;
|
56 |
+
}
|
57 |
+
|
58 |
+
return true;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Trait WC_Stripe_Controller_Frontend_Trait
|
64 |
+
* @since 3.1.8
|
65 |
+
*/
|
66 |
+
trait WC_Stripe_Controller_Frontend_Trait {
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @var WP_REST_Request
|
70 |
+
* @since 3.2.5
|
71 |
+
*/
|
72 |
+
private $request;
|
73 |
+
|
74 |
+
protected function cart_includes() {
|
75 |
+
include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
|
76 |
+
include_once WC_ABSPATH . 'includes/wc-notice-functions.php';
|
77 |
+
wc_load_cart();
|
78 |
+
// loads cart from session
|
79 |
+
WC()->cart->get_cart();
|
80 |
+
WC()->payment_gateways();
|
81 |
+
}
|
82 |
+
|
83 |
+
protected function frontend_includes() {
|
84 |
+
WC()->frontend_includes();
|
85 |
+
wc_load_cart();
|
86 |
+
WC()->cart->get_cart();
|
87 |
+
WC()->payment_gateways();
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @param $request
|
92 |
+
*
|
93 |
+
* @return bool|WP_Error
|
94 |
+
* @since 3.2.2
|
95 |
+
*/
|
96 |
+
public function validate_rest_nonce( $request ) {
|
97 |
+
$this->frontend_includes( $request );
|
98 |
+
if ( ! isset( $request['wp_rest_nonce'] ) || ! wp_verify_nonce( $request['wp_rest_nonce'], 'wp_rest' ) ) {
|
99 |
+
return new WP_Error( 'rest_cookie_invalid_nonce', __( 'Cookie nonce is invalid' ), array( 'status' => 403 ) );
|
100 |
+
}
|
101 |
+
|
102 |
+
return true;
|
103 |
+
}
|
104 |
+
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofo
|
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 3.2.
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -58,6 +58,12 @@ If you're site is not loading over https, then Stripe won't render the Payment R
|
|
58 |
8. Edit payment gateways on the product page
|
59 |
|
60 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
= 3.2.4 =
|
62 |
* Fixed - Payment request button disappearing on variable product page
|
63 |
* Updated - Only validate visible fields on checkout page
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 3.2.5
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
58 |
8. Edit payment gateways on the product page
|
59 |
|
60 |
== Changelog ==
|
61 |
+
= 3.2.5 =
|
62 |
+
* Added - Support for right to left (RTL) languages
|
63 |
+
* Added - WPML gateway country availability compatibility
|
64 |
+
* Added - WPML product page currency change
|
65 |
+
* Fixed - Change event for ship_to_different_address
|
66 |
+
* Fixed - Update required fields on checkout page load
|
67 |
= 3.2.4 =
|
68 |
* Fixed - Payment request button disappearing on variable product page
|
69 |
* Updated - Only validate visible fields on checkout page
|
stripe-payments.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
* Plugin Name: Stripe For WooCommerce
|
4 |
* Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
|
5 |
* Description: Accept credit cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
|
6 |
-
* Version: 3.2.
|
7 |
* Author: Payment Plugins, support@paymentplugins.com
|
8 |
* Text Domain: woo-stripe-payment
|
9 |
* Domain Path: /i18n/languages/
|
10 |
* Tested up to: 5.5
|
11 |
* WC requires at least: 3.0.0
|
12 |
-
* WC tested up to: 4.6.
|
13 |
*/
|
14 |
defined( 'ABSPATH' ) || exit ();
|
15 |
|
3 |
* Plugin Name: Stripe For WooCommerce
|
4 |
* Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
|
5 |
* Description: Accept credit cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
|
6 |
+
* Version: 3.2.5
|
7 |
* Author: Payment Plugins, support@paymentplugins.com
|
8 |
* Text Domain: woo-stripe-payment
|
9 |
* Domain Path: /i18n/languages/
|
10 |
* Tested up to: 5.5
|
11 |
* WC requires at least: 3.0.0
|
12 |
+
* WC tested up to: 4.6.1
|
13 |
*/
|
14 |
defined( 'ABSPATH' ) || exit ();
|
15 |
|