Version Description
- Added - FPX payment method
- Added - Alipay payment method
- Updated - Stripe connect integration
- Updated - WeChat support for other countries besides CN
- Updated - CSS so prevent theme overrides
- Fixed - WeChat QR code
Download this release
Release Info
Developer | mr.clayton |
Plugin | Payment Plugins for Stripe WooCommerce |
Version | 3.1.0 |
Comparing to | |
See all releases |
Code changes from version 3.0.10 to 3.1.0
- assets/css/admin/admin.css +96 -2
- assets/css/stripe.css +65 -30
- assets/img/fpx.svg +39 -0
- assets/js/admin/admin-settings.js +11 -3
- assets/js/frontend/applepay-product.js +1 -2
- assets/js/frontend/credit-card.js +36 -3
- assets/js/frontend/form-handler.js +9 -4
- assets/js/frontend/googlepay-checkout.js +0 -1
- assets/js/frontend/googlepay-product.js +1 -0
- assets/js/frontend/local-payment.js +111 -2
- assets/js/frontend/payment-request.js +1 -0
- assets/js/frontend/qrcode.js +1 -0
- assets/js/frontend/wc-stripe.js +11 -5
- assets/js/frontend/wc-stripe.min.js +1 -1
- i18n/languages/woo-stripe-payment.pot +548 -504
- includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php +32 -40
- includes/abstract/abstract-wc-payment-gateway-stripe.php +330 -195
- includes/abstract/abstract-wc-payment-token-stripe.php +74 -11
- includes/abstract/abstract-wc-stripe-payment.php +222 -0
- includes/abstract/abstract-wc-stripe-rest-controller.php +2 -1
- includes/abstract/abstract-wc-stripe-settings.php +2 -85
- includes/admin/class-wc-stripe-admin-notices.php +59 -0
- includes/admin/class-wc-stripe-admin-user-edit.php +3 -24
- includes/admin/meta-boxes/views/html-order-charge-data.php +1 -4
- includes/admin/settings/class-wc-stripe-api-settings.php +90 -66
- includes/admin/views/html-stripe-connect.php +14 -0
- includes/class-stripe.php +29 -4
- includes/class-wc-stripe-constants.php +20 -0
- includes/class-wc-stripe-customer-manager.php +60 -7
- includes/class-wc-stripe-field-manager.php +41 -29
- includes/class-wc-stripe-frontend-scripts.php +20 -12
- includes/class-wc-stripe-gateway-ach.php +96 -0
- includes/class-wc-stripe-gateway-conversions.php +37 -0
- includes/class-wc-stripe-gateway.php +47 -8
- includes/class-wc-stripe-payment-charge.php +159 -0
- includes/class-wc-stripe-payment-intent.php +279 -0
- includes/class-wc-stripe-redirect-handler.php +26 -7
- includes/class-wc-stripe-update.php +2 -1
- includes/controllers/class-wc-stripe-controller-cart.php +6 -0
- includes/controllers/class-wc-stripe-controller-gateway-settings.php +6 -16
- includes/controllers/class-wc-stripe-controller-googlepay.php +4 -0
- includes/controllers/class-wc-stripe-controller-order-actions.php +4 -1
- includes/controllers/class-wc-stripe-controller-payment-intent.php +46 -2
- includes/controllers/class-wc-stripe-controller-payment-method.php +1 -2
- includes/controllers/class-wc-stripe-controller-webhook.php +2 -2
- includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php +231 -0
- includes/gateways/class-wc-payment-gateway-stripe-ach.php +48 -5
- includes/gateways/class-wc-payment-gateway-stripe-alipay.php +32 -0
- includes/gateways/class-wc-payment-gateway-stripe-applepay.php +5 -1
- includes/gateways/class-wc-payment-gateway-stripe-bancontact.php +3 -32
- includes/gateways/class-wc-payment-gateway-stripe-cc.php +5 -5
- includes/gateways/class-wc-payment-gateway-stripe-eps.php +3 -32
- includes/gateways/class-wc-payment-gateway-stripe-fpx.php +37 -0
- includes/gateways/class-wc-payment-gateway-stripe-giropay.php +3 -32
- includes/gateways/class-wc-payment-gateway-stripe-googlepay.php +4 -2
- includes/gateways/class-wc-payment-gateway-stripe-ideal.php +7 -32
- includes/gateways/class-wc-payment-gateway-stripe-klarna.php +56 -61
- includes/gateways/class-wc-payment-gateway-stripe-multibanco.php +3 -32
- includes/gateways/class-wc-payment-gateway-stripe-p24.php +3 -32
- includes/gateways/class-wc-payment-gateway-stripe-payment-request.php +5 -1
- includes/gateways/class-wc-payment-gateway-stripe-sepa.php +3 -32
- includes/gateways/class-wc-payment-gateway-stripe-sofort.php +3 -32
- includes/gateways/class-wc-payment-gateway-stripe-wechat.php +34 -34
- includes/gateways/settings/ach-settings-v2.php +101 -0
- includes/gateways/settings/ach-settings.php +17 -7
- includes/gateways/settings/googlepay-settings.php +3 -3
- includes/tokens/class-wc-payment-token-stripe-ach.php +2 -0
- includes/tokens/class-wc-payment-token-stripe-applepay.php +0 -10
- includes/tokens/class-wc-payment-token-stripe-cc.php +10 -13
- includes/tokens/class-wc-payment-token-stripe-googlepay.php +1 -9
- includes/traits/wc-stripe-controller-cart-trait.php +22 -0
- includes/traits/wc-stripe-payment-traits.php +134 -0
- includes/traits/wc-stripe-settings-trait.php +158 -0
- includes/updates/update-3.1.0.php +58 -0
- includes/wc-stripe-functions.php +55 -15
- includes/wc-stripe-hooks.php +4 -1
- includes/wc-stripe-webhook-functions.php +42 -2
- readme.txt +12 -5
- stripe-payments.php +3 -3
- templates/cc-forms/bootstrap.php +18 -12
- templates/cc-forms/inline.php +24 -24
- templates/cc-forms/round.php +1 -1
- templates/cc-forms/simple.php +7 -3
assets/css/admin/admin.css
CHANGED
@@ -44,12 +44,11 @@
|
|
44 |
text-decoration: none;
|
45 |
border: 2px solid transparent;
|
46 |
border-radius: 4px;
|
|
|
47 |
}
|
48 |
#order_data .order_data_column .transaction-data a:before{
|
49 |
font-family: WooCommerce;
|
50 |
content: "\e010";
|
51 |
-
font-size: 18px;
|
52 |
-
width: 16px;
|
53 |
}
|
54 |
#order_data .order_data_column .transaction-data .do-transaction-view:hover{
|
55 |
border: 2px solid #00a0d2;
|
@@ -165,4 +164,99 @@
|
|
165 |
.wc-stripe-fee-container input{
|
166 |
display: block;
|
167 |
margin-top: 1px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
}
|
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;
|
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 12px 0 44px;
|
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 |
+
left: 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-left: -8px;
|
262 |
}
|
assets/css/stripe.css
CHANGED
@@ -49,14 +49,12 @@ ul.payment_methods li[class*=payment_method_stripe_] label>img:first-of-type{
|
|
49 |
.wc-stripe_cc-new-method-container{
|
50 |
margin-bottom: 1em;
|
51 |
}
|
52 |
-
.StripeElement {
|
53 |
box-sizing: border-box;
|
54 |
height: 40px;
|
55 |
padding: 10px 12px;
|
56 |
-
border: 1px solid transparent;
|
57 |
border-radius: 4px;
|
58 |
background-color: white;
|
59 |
-
box-shadow: 0 1px 3px 0 #e6ebf1;
|
60 |
-webkit-transition: box-shadow 150ms ease;
|
61 |
transition: box-shadow 150ms ease;
|
62 |
}
|
@@ -73,6 +71,7 @@ label.wc-stripe-label-klarna-category{
|
|
73 |
margin-bottom: 1em;
|
74 |
display: block;
|
75 |
padding: 0 !important;
|
|
|
76 |
}
|
77 |
.theme-flatsome div.wc-stripe-saved-methods-container{
|
78 |
margin: 0 0 1em 0;
|
@@ -84,8 +83,8 @@ label.wc-stripe-label-payment-type:before,
|
|
84 |
label.wc-stripe-label-klarna-category:before{
|
85 |
content: "";
|
86 |
display: inline-block;
|
87 |
-
width:
|
88 |
-
height:
|
89 |
border: 2px solid #fff;
|
90 |
box-shadow: 0 0 0 2px #000;
|
91 |
background: #fff;
|
@@ -100,6 +99,9 @@ input.wc-stripe-payment-type:checked+label.wc-stripe-label-payment-type:before,
|
|
100 |
input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:before{
|
101 |
background: #000;
|
102 |
}
|
|
|
|
|
|
|
103 |
.select2-container .select2-selection--single .wc-stripe-select2-container,
|
104 |
.select2-results__options li.wc-stripe-select2-container{
|
105 |
display: flex;
|
@@ -117,39 +119,49 @@ input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:be
|
|
117 |
margin-right: 8px;
|
118 |
background-position: center;
|
119 |
}
|
120 |
-
.select2-container .select2-selection--single .wc-stripe-select2-container.
|
121 |
-
.select2-results__options li.wc-stripe-select2-container.
|
122 |
-
.select2-results__options li.wc-stripe-select2-container.
|
123 |
background-image: url(../img/cards/visa.svg);
|
124 |
}
|
125 |
-
.select2-container .select2-selection--single .wc-stripe-select2-container.
|
126 |
-
.select2-results__options li.wc-stripe-select2-container.
|
127 |
-
.select2-results__options li.wc-stripe-select2-container.
|
128 |
background-image: url(../img/cards/mastercard.svg);
|
129 |
}
|
130 |
-
.select2-container .select2-selection--single .wc-stripe-select2-container.
|
131 |
-
.select2-results__options li.wc-stripe-select2-container.
|
132 |
-
.select2-results__options li.wc-stripe-select2-container.
|
|
|
|
|
|
|
|
|
|
|
133 |
background-image: url(../img/cards/amex.svg);
|
134 |
}
|
135 |
-
.select2-container .select2-selection--single .wc-stripe-select2-container.
|
136 |
-
.select2-results__options li.wc-stripe-select2-container.
|
137 |
-
.select2-results__options li.wc-stripe-select2-container.
|
138 |
background-image: url(../img/cards/discover.svg);
|
139 |
}
|
140 |
-
.select2-container .select2-selection--single .wc-stripe-select2-container.
|
141 |
-
.select2-results__options li.wc-stripe-select2-container.
|
142 |
-
.select2-results__options li.wc-stripe-select2-container.
|
143 |
background-image: url(../img/cards/mastercard.svg);
|
144 |
}
|
145 |
-
.select2-container .select2-selection--single .wc-stripe-select2-container.
|
146 |
-
.select2-results__options li.wc-stripe-select2-container.
|
147 |
-
.select2-results__options li.wc-stripe-select2-container.
|
|
|
|
|
|
|
|
|
|
|
148 |
background-image: url(../img/cards/diners.svg);
|
149 |
}
|
150 |
-
.select2-container .select2-selection--single .wc-stripe-select2-container.
|
151 |
-
.select2-results__options li.wc-stripe-select2-container.
|
152 |
-
.select2-results__options li.wc-stripe-select2-container.
|
153 |
background-image: url(../img/cards/jcb.svg);
|
154 |
}
|
155 |
#wc-stripe-card-element{
|
@@ -207,9 +219,13 @@ li.payment_method_stripe_payment_request{
|
|
207 |
display: none !important;
|
208 |
}
|
209 |
.wc-stripe-product-checkout-container{
|
|
|
210 |
width: 100%;
|
211 |
margin-top: 1em;
|
212 |
}
|
|
|
|
|
|
|
213 |
.wc-stripe-product-checkout-container ul.wc_stripe_product_payment_methods,
|
214 |
.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods{
|
215 |
list-style: none;
|
@@ -315,6 +331,9 @@ li.payment_method_stripe_ach label:first-of-type img{
|
|
315 |
.applepay-top-container .apple-pay-button{
|
316 |
max-width: 240px;
|
317 |
}
|
|
|
|
|
|
|
318 |
}
|
319 |
.wc-stripe-banner-checkout{
|
320 |
display: none;
|
@@ -378,9 +397,6 @@ li.payment_method_stripe_ach label:first-of-type img{
|
|
378 |
width: 240px;
|
379 |
padding: 0px;
|
380 |
}
|
381 |
-
#wc_stripe_local_payment_stripe_ideal{
|
382 |
-
padding: 0px;
|
383 |
-
}
|
384 |
.wc-stripe-checkout-banner-gateway #wc-stripe-payment-request-banner.StripeElement{
|
385 |
width: 100%;
|
386 |
}
|
@@ -394,6 +410,11 @@ ul.payment_methods li.payment_method_stripe_ideal img{
|
|
394 |
width: 38px;
|
395 |
max-height: 35px;
|
396 |
}
|
|
|
|
|
|
|
|
|
|
|
397 |
ul.payment_methods li.payment_method_stripe_klarna img{
|
398 |
max-width: 72px;
|
399 |
width: 72px;
|
@@ -431,11 +452,17 @@ label[for=payment_method_braintree_bancontact] img{
|
|
431 |
max-width: 60px;
|
432 |
max-height: 42px;
|
433 |
}
|
434 |
-
ul.payment_methods li.payment_method_stripe_wechat img{
|
435 |
max-width: 82px;
|
436 |
width: 82px;
|
437 |
max-height: 23px;
|
438 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
#wc-stripe-card-element{
|
440 |
width: 100%;
|
441 |
}
|
@@ -464,6 +491,7 @@ input[id=stripe-postal-code]:focus{
|
|
464 |
outline: none;
|
465 |
background: transparent;
|
466 |
border: none;
|
|
|
467 |
}
|
468 |
div.postalCode:focus{
|
469 |
outline: none;
|
@@ -525,4 +553,11 @@ ul.payment_methods li[class*=payment_method_stripe_] .wc-stripe_cc-new-method-co
|
|
525 |
.wc-stripe_cc-container .wc-stripe-save-source .save-source-label{
|
526 |
padding: 0;
|
527 |
margin-bottom: 5px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
}
|
49 |
.wc-stripe_cc-new-method-container{
|
50 |
margin-bottom: 1em;
|
51 |
}
|
52 |
+
.wc-stripe_cc-container .StripeElement {
|
53 |
box-sizing: border-box;
|
54 |
height: 40px;
|
55 |
padding: 10px 12px;
|
|
|
56 |
border-radius: 4px;
|
57 |
background-color: white;
|
|
|
58 |
-webkit-transition: box-shadow 150ms ease;
|
59 |
transition: box-shadow 150ms ease;
|
60 |
}
|
71 |
margin-bottom: 1em;
|
72 |
display: block;
|
73 |
padding: 0 !important;
|
74 |
+
color: #000;
|
75 |
}
|
76 |
.theme-flatsome div.wc-stripe-saved-methods-container{
|
77 |
margin: 0 0 1em 0;
|
83 |
label.wc-stripe-label-klarna-category:before{
|
84 |
content: "";
|
85 |
display: inline-block;
|
86 |
+
width: 11px;
|
87 |
+
height: 11px;
|
88 |
border: 2px solid #fff;
|
89 |
box-shadow: 0 0 0 2px #000;
|
90 |
background: #fff;
|
99 |
input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:before{
|
100 |
background: #000;
|
101 |
}
|
102 |
+
label.wc-stripe-label-payment-type:after{
|
103 |
+
content: none !important;
|
104 |
+
}
|
105 |
.select2-container .select2-selection--single .wc-stripe-select2-container,
|
106 |
.select2-results__options li.wc-stripe-select2-container{
|
107 |
display: flex;
|
119 |
margin-right: 8px;
|
120 |
background-position: center;
|
121 |
}
|
122 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.visa:before,
|
123 |
+
.select2-results__options li.wc-stripe-select2-container.visa:before,
|
124 |
+
.select2-results__options li.wc-stripe-select2-container.visa:before{
|
125 |
background-image: url(../img/cards/visa.svg);
|
126 |
}
|
127 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.mastercard:before,
|
128 |
+
.select2-results__options li.wc-stripe-select2-container.mastercard:before,
|
129 |
+
.select2-results__options li.wc-stripe-select2-container.mastercard:before{
|
130 |
background-image: url(../img/cards/mastercard.svg);
|
131 |
}
|
132 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.americanexpress:before,
|
133 |
+
.select2-results__options li.wc-stripe-select2-container.americanexpress:before,
|
134 |
+
.select2-results__options li.wc-stripe-select2-container.americanexpress:before{
|
135 |
+
background-image: url(../img/cards/amex.svg);
|
136 |
+
}
|
137 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.amex:before,
|
138 |
+
.select2-results__options li.wc-stripe-select2-container.amex:before,
|
139 |
+
.select2-results__options li.wc-stripe-select2-container.amex:before{
|
140 |
background-image: url(../img/cards/amex.svg);
|
141 |
}
|
142 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.discover:before,
|
143 |
+
.select2-results__options li.wc-stripe-select2-container.discover:before,
|
144 |
+
.select2-results__options li.wc-stripe-select2-container.discover:before{
|
145 |
background-image: url(../img/cards/discover.svg);
|
146 |
}
|
147 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.mastercard:before,
|
148 |
+
.select2-results__options li.wc-stripe-select2-container.mastercard:before,
|
149 |
+
.select2-results__options li.wc-stripe-select2-container.mastercard:before{
|
150 |
background-image: url(../img/cards/mastercard.svg);
|
151 |
}
|
152 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.dinersclub:before,
|
153 |
+
.select2-results__options li.wc-stripe-select2-container.dinersclub:before,
|
154 |
+
.select2-results__options li.wc-stripe-select2-container.dinersclub:before{
|
155 |
+
background-image: url(../img/cards/diners.svg);
|
156 |
+
}
|
157 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.diners:before,
|
158 |
+
.select2-results__options li.wc-stripe-select2-container.diners:before,
|
159 |
+
.select2-results__options li.wc-stripe-select2-container.diners:before{
|
160 |
background-image: url(../img/cards/diners.svg);
|
161 |
}
|
162 |
+
.select2-container .select2-selection--single .wc-stripe-select2-container.jcb:before,
|
163 |
+
.select2-results__options li.wc-stripe-select2-container.jcb:before,
|
164 |
+
.select2-results__options li.wc-stripe-select2-container.jcb:before{
|
165 |
background-image: url(../img/cards/jcb.svg);
|
166 |
}
|
167 |
#wc-stripe-card-element{
|
219 |
display: none !important;
|
220 |
}
|
221 |
.wc-stripe-product-checkout-container{
|
222 |
+
display: none;
|
223 |
width: 100%;
|
224 |
margin-top: 1em;
|
225 |
}
|
226 |
+
.wc-stripe-product-checkout-container.active{
|
227 |
+
display: block;
|
228 |
+
}
|
229 |
.wc-stripe-product-checkout-container ul.wc_stripe_product_payment_methods,
|
230 |
.wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods{
|
231 |
list-style: none;
|
331 |
.applepay-top-container .apple-pay-button{
|
332 |
max-width: 240px;
|
333 |
}
|
334 |
+
.woocommerce-checkout-payment .apple-pay-button{
|
335 |
+
max-width: 240px;
|
336 |
+
}
|
337 |
}
|
338 |
.wc-stripe-banner-checkout{
|
339 |
display: none;
|
397 |
width: 240px;
|
398 |
padding: 0px;
|
399 |
}
|
|
|
|
|
|
|
400 |
.wc-stripe-checkout-banner-gateway #wc-stripe-payment-request-banner.StripeElement{
|
401 |
width: 100%;
|
402 |
}
|
410 |
width: 38px;
|
411 |
max-height: 35px;
|
412 |
}
|
413 |
+
ul.payment_methods li.payment_method_stripe_fpx img{
|
414 |
+
max-width: 75px;
|
415 |
+
width: 75px;
|
416 |
+
max-height: 25px;
|
417 |
+
}
|
418 |
ul.payment_methods li.payment_method_stripe_klarna img{
|
419 |
max-width: 72px;
|
420 |
width: 72px;
|
452 |
max-width: 60px;
|
453 |
max-height: 42px;
|
454 |
}
|
455 |
+
ul.payment_methods li.payment_method_stripe_wechat label img{
|
456 |
max-width: 82px;
|
457 |
width: 82px;
|
458 |
max-height: 23px;
|
459 |
}
|
460 |
+
ul.payment_methods li.payment_method_stripe_alipay img{
|
461 |
+
max-width: 72px;
|
462 |
+
width: 72px;
|
463 |
+
height: 36px;
|
464 |
+
max-height: 36px;
|
465 |
+
}
|
466 |
#wc-stripe-card-element{
|
467 |
width: 100%;
|
468 |
}
|
491 |
outline: none;
|
492 |
background: transparent;
|
493 |
border: none;
|
494 |
+
box-shadow: none;
|
495 |
}
|
496 |
div.postalCode:focus{
|
497 |
outline: none;
|
553 |
.wc-stripe_cc-container .wc-stripe-save-source .save-source-label{
|
554 |
padding: 0;
|
555 |
margin-bottom: 5px;
|
556 |
+
}
|
557 |
+
div[id*=wc_stripe_local_payment_stripe_].StripeElement{
|
558 |
+
border: 1px solid #eee;
|
559 |
+
border-radius: 4px;
|
560 |
+
}
|
561 |
+
.qrcode-message{
|
562 |
+
margin: 10px 0 0 0;
|
563 |
}
|
assets/img/fpx.svg
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4 |
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5 |
+
width="367px" height="120px" viewBox="70 98 367 124" enable-background="new 0 0 500 318" xml:space="preserve">
|
6 |
+
<g>
|
7 |
+
<path fill-rule="evenodd" clip-rule="evenodd" fill="#1F2C5C" d="M176.598,150.476c-11.586-15.857-23.323-31.609-35.117-47.313
|
8 |
+
c-1.869-2.491-4.601-5.473-7.783-3.781c-2.154,1.14-4.112,4.531-4.332,7.076c-0.725,8.339-0.666,16.749-0.752,25.133
|
9 |
+
c-0.008,0.951,0.901,1.984,1.549,2.858c4.905,6.642,9.894,13.219,14.768,19.88c1.357,1.854,2.121,3.357,2.361,4.804
|
10 |
+
c-0.24,2.014-1.004,3.027-2.361,4.882c-4.874,6.661-9.862,13.275-14.768,19.916c-0.647,0.875-1.557,1.942-1.549,2.895
|
11 |
+
c0.086,8.384,0.027,16.789,0.752,25.128c0.22,2.545,2.178,5.927,4.332,7.066c3.183,1.691,5.914-1.309,7.783-3.8
|
12 |
+
c11.794-15.704,23.531-31.495,35.117-47.354c2.059-2.816,3.154-4.706,3.355-8.732C179.752,156.205,178.656,153.294,176.598,150.476
|
13 |
+
z"/>
|
14 |
+
<path fill-rule="evenodd" clip-rule="evenodd" fill="#1A8ACB" d="M69.552,150.476c11.587-15.857,23.323-31.609,35.117-47.313
|
15 |
+
c1.87-2.491,4.601-5.473,7.784-3.781c2.153,1.14,4.111,4.531,4.332,7.076c0.723,8.339,0.666,16.749,0.75,25.133
|
16 |
+
c0.008,0.951-0.9,1.984-1.547,2.858c-4.905,6.642-9.895,13.219-14.768,19.88c-1.357,1.854-2.122,3.357-2.361,4.804
|
17 |
+
c0.239,2.014,1.004,3.027,2.361,4.882c4.873,6.661,9.862,13.275,14.768,19.916c0.646,0.875,1.555,1.942,1.547,2.895
|
18 |
+
c-0.084,8.384-0.027,16.789-0.75,25.128c-0.221,2.545-2.179,5.927-4.332,7.066c-3.184,1.691-5.914-1.309-7.784-3.8
|
19 |
+
c-11.794-15.704-23.53-31.495-35.117-47.354c-2.06-2.816-3.153-4.706-3.354-8.732C66.398,156.205,67.492,153.294,69.552,150.476z"
|
20 |
+
/>
|
21 |
+
<path fill-rule="evenodd" clip-rule="evenodd" fill="#1F2C5C" d="M276.23,112.717c15.473,0.591,30.891,0.199,46.033,2.046
|
22 |
+
c13.785,1.682,20.209,12.316,19.428,28.014c-0.66,13.321-8.98,21.915-23.133,23.332c-7.48,0.747-15.025,0.816-23.258,1.228
|
23 |
+
c0,5.478,0,11.104,0,16.731c0,5.513,0,11.026,0,16.795c-6.537,0-12.598,0-19.07,0C276.23,171.931,276.23,142.987,276.23,112.717z
|
24 |
+
M295.602,129.124c0,7.601,0,14.206,0,21.465c6.23-0.325,12.217-0.148,18.029-1.079c5.639-0.899,8.131-4.638,7.986-9.906
|
25 |
+
c-0.131-4.798-3.07-8.466-8.404-9.217C307.506,129.583,301.693,129.527,295.602,129.124z"/>
|
26 |
+
<path fill-rule="evenodd" clip-rule="evenodd" fill="#1F2C5C" d="M202.858,200.983c5.495,0,13.356,0.124,19.315,0.124
|
27 |
+
c0-11.604,0-22.64,0-34.136c12.344,0,24.222,0,36.344,0c0-6.203,0-11.926,0-18.19c-12.197,0-24.081,0-36.104,0
|
28 |
+
c0-6.146,0-11.746,0-17.758c13.215,0,26.107,0,39.318,0c0-6.221,0-11.716,0-17.431c-19.623,0-39.014,0-58.874,0
|
29 |
+
c0,2.139,0,3.96,0,5.782c0,23.62-0.002,47.235,0,70.854V200.983z"/>
|
30 |
+
<path fill-rule="evenodd" clip-rule="evenodd" fill="#1F2C5C" d="M401.502,155.153c9.298-13.65,18.542-27.219,28.248-41.464
|
31 |
+
c-7.869,0-14.812-0.099-21.747,0.104c-1.069,0.031-2.441,1.231-3.09,2.259c-2.87,4.575-5.53,9.284-8.266,13.943
|
32 |
+
c-2.562,4.362-5.128,8.738-7.951,13.545c-2.014-4.807-5.264-9.183-7.826-13.545c-2.734-4.659-5.269-9.368-8.141-13.943
|
33 |
+
c-0.646-1.027-2.019-2.228-3.088-2.259c-6.936-0.203-13.878-0.104-21.747-0.104c9.705,14.245,18.948,27.813,28.246,41.464
|
34 |
+
c-10.479,15.296-20.851,30.408-31.755,46.319c8.385,0,15.95,0.105,23.523-0.133c0.959-0.032,2.023-1.759,2.727-2.904
|
35 |
+
c5.735-9.328,11.324-18.709,17.015-28.067c0.363-0.596,1.046-1.185,1.046-1.834c0.427,0.649,0.808,1.238,1.172,1.834
|
36 |
+
c5.69,9.358,11.341,18.739,17.077,28.067c0.704,1.146,1.799,2.872,2.758,2.904c7.572,0.238,15.154,0.133,23.538,0.133
|
37 |
+
C422.338,185.562,411.982,170.449,401.502,155.153z"/>
|
38 |
+
</g>
|
39 |
+
</svg>
|
assets/js/admin/admin-settings.js
CHANGED
@@ -21,6 +21,10 @@ jQuery(function($) {
|
|
21 |
|
22 |
$('.wc-stripe-connection-test').on('click', this.do_connection_test.bind(this));
|
23 |
|
|
|
|
|
|
|
|
|
24 |
this.display_children();
|
25 |
}
|
26 |
|
@@ -131,9 +135,7 @@ jQuery(function($) {
|
|
131 |
method: 'POST',
|
132 |
data: {
|
133 |
_wpnonce: this.params.rest_nonce,
|
134 |
-
mode: mode
|
135 |
-
secret_key: $('#woocommerce_stripe_api_secret_key_' + mode).val(),
|
136 |
-
publishable_key: $('#woocommerce_stripe_api_publishable_key_' + mode).val()
|
137 |
}
|
138 |
}).done(function(response) {
|
139 |
this.unblock();
|
@@ -148,6 +150,12 @@ jQuery(function($) {
|
|
148 |
}.bind(this))
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
/**
|
152 |
* [block description]
|
153 |
* @param {[type]} $el [description]
|
21 |
|
22 |
$('.wc-stripe-connection-test').on('click', this.do_connection_test.bind(this));
|
23 |
|
24 |
+
if (typeof(wc_stripe_admin_notices) != 'undefined') {
|
25 |
+
this.display_notices();
|
26 |
+
}
|
27 |
+
|
28 |
this.display_children();
|
29 |
}
|
30 |
|
135 |
method: 'POST',
|
136 |
data: {
|
137 |
_wpnonce: this.params.rest_nonce,
|
138 |
+
mode: mode
|
|
|
|
|
139 |
}
|
140 |
}).done(function(response) {
|
141 |
this.unblock();
|
150 |
}.bind(this))
|
151 |
}
|
152 |
|
153 |
+
Settings.prototype.display_notices = function() {
|
154 |
+
$.each(wc_stripe_admin_notices, function(idx, notice) {
|
155 |
+
$('.woo-nav-tab-wrapper').after(notice);
|
156 |
+
}.bind(this))
|
157 |
+
}
|
158 |
+
|
159 |
/**
|
160 |
* [block description]
|
161 |
* @param {[type]} $el [description]
|
assets/js/frontend/applepay-product.js
CHANGED
@@ -17,9 +17,8 @@
|
|
17 |
*/
|
18 |
ApplePay.prototype.canMakePayment = function() {
|
19 |
wc_stripe.ApplePay.prototype.canMakePayment.call(this).then(function() {
|
20 |
-
//$('[name="quantity"]').val(0);
|
21 |
-
// Apple Pay is enable, so add to cart each time the user updates quantity.
|
22 |
$(document.body).on('change', '[name="quantity"]', this.add_to_cart.bind(this));
|
|
|
23 |
if (!this.is_variable_product()) {
|
24 |
this.cart_calculation().then(function() {
|
25 |
this.paymentRequest.update(this.get_payment_request_update({
|
17 |
*/
|
18 |
ApplePay.prototype.canMakePayment = function() {
|
19 |
wc_stripe.ApplePay.prototype.canMakePayment.call(this).then(function() {
|
|
|
|
|
20 |
$(document.body).on('change', '[name="quantity"]', this.add_to_cart.bind(this));
|
21 |
+
$(this.container).parent().parent().addClass('active');
|
22 |
if (!this.is_variable_product()) {
|
23 |
this.cart_calculation().then(function() {
|
24 |
this.paymentRequest.update(this.get_payment_request_update({
|
assets/js/frontend/credit-card.js
CHANGED
@@ -178,12 +178,16 @@
|
|
178 |
*/
|
179 |
CC.prototype.hashChange = function(e) {
|
180 |
if (this.is_gateway_selected()) {
|
181 |
-
var
|
182 |
-
if (
|
183 |
-
|
|
|
184 |
if (result.error) {
|
185 |
this.payment_token_received = false;
|
186 |
this.submit_error(result.error.message);
|
|
|
|
|
|
|
187 |
return;
|
188 |
}
|
189 |
var $form = $(this.token_selector).closest('form');
|
@@ -237,6 +241,35 @@
|
|
237 |
}
|
238 |
}
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
/**
|
241 |
*
|
242 |
*/
|
178 |
*/
|
179 |
CC.prototype.hashChange = function(e) {
|
180 |
if (this.is_gateway_selected()) {
|
181 |
+
var match = e.newURL.match(/response=(.*)/);
|
182 |
+
if (match) {
|
183 |
+
var obj = JSON.parse(window.atob(match[1]));
|
184 |
+
this.stripe.handleCardAction(obj.client_secret).then(function(result) {
|
185 |
if (result.error) {
|
186 |
this.payment_token_received = false;
|
187 |
this.submit_error(result.error.message);
|
188 |
+
this.sync_payment_intent(obj.order_id, obj.client_secret).catch(function(response) {
|
189 |
+
this.submit_error(response.message);
|
190 |
+
}.bind(this));
|
191 |
return;
|
192 |
}
|
193 |
var $form = $(this.token_selector).closest('form');
|
241 |
}
|
242 |
}
|
243 |
|
244 |
+
/**
|
245 |
+
* [sync_payment_intent description]
|
246 |
+
* @param {[type]} order_id [description]
|
247 |
+
* @param {[type]} client_secret [description]
|
248 |
+
* @return {[type]} [description]
|
249 |
+
*/
|
250 |
+
CC.prototype.sync_payment_intent = function(order_id, client_secret) {
|
251 |
+
return new Promise(function(resolve, reject) {
|
252 |
+
// call intent api
|
253 |
+
$.when($.ajax({
|
254 |
+
method: 'POST',
|
255 |
+
dataType: 'json',
|
256 |
+
url: this.params.routes.sync_intent,
|
257 |
+
data: { order_id: order_id, client_secret: client_secret },
|
258 |
+
beforeSend: function(xhr) {
|
259 |
+
xhr.setRequestHeader('X-WP-Nonce', this.params.rest_nonce);
|
260 |
+
}.bind(this)
|
261 |
+
})).done(function(response) {
|
262 |
+
if (response.code) {
|
263 |
+
reject(response);
|
264 |
+
} else {
|
265 |
+
resolve(response);
|
266 |
+
}
|
267 |
+
}).fail(function(xhr, textStatus, errorThrown) {
|
268 |
+
this.submit_error(errorThrown);
|
269 |
+
}.bind(this));
|
270 |
+
}.bind(this))
|
271 |
+
}
|
272 |
+
|
273 |
/**
|
274 |
*
|
275 |
*/
|
assets/js/frontend/form-handler.js
CHANGED
@@ -74,13 +74,18 @@
|
|
74 |
* @return {[type]}
|
75 |
*/
|
76 |
Handler.prototype.saved_payment_methods = function() {
|
77 |
-
if ($().
|
78 |
-
if ($('select.wc-stripe-saved-methods').length && !$('select.wc-stripe-saved-methods').hasClass('
|
79 |
-
$('select.wc-stripe-saved-methods').
|
80 |
width: "100%",
|
81 |
templateResult: this.output_template,
|
82 |
templateSelection: this.output_template,
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
}
|
86 |
}
|
74 |
* @return {[type]}
|
75 |
*/
|
76 |
Handler.prototype.saved_payment_methods = function() {
|
77 |
+
if ($().selectWoo) {
|
78 |
+
if ($('select.wc-stripe-saved-methods').length && !$('select.wc-stripe-saved-methods').hasClass('enhanced')) {
|
79 |
+
$('select.wc-stripe-saved-methods').selectWoo({
|
80 |
width: "100%",
|
81 |
templateResult: this.output_template,
|
82 |
templateSelection: this.output_template,
|
83 |
+
language: {
|
84 |
+
noResults: function() {
|
85 |
+
return wc_stripe_form_handler_params.no_results;
|
86 |
+
}.bind(this)
|
87 |
+
}
|
88 |
+
}).addClass('enhanced').trigger('change');
|
89 |
}
|
90 |
}
|
91 |
}
|
assets/js/frontend/googlepay-checkout.js
CHANGED
@@ -41,7 +41,6 @@
|
|
41 |
GPay.prototype.create_button = function() {
|
42 |
wc_stripe.GooglePay.prototype.create_button.apply(this, arguments);
|
43 |
$("#place_order").parent().append(this.$button);
|
44 |
-
var position = $('#place_order').css('float');
|
45 |
this.trigger_payment_method_selected();
|
46 |
}
|
47 |
|
41 |
GPay.prototype.create_button = function() {
|
42 |
wc_stripe.GooglePay.prototype.create_button.apply(this, arguments);
|
43 |
$("#place_order").parent().append(this.$button);
|
|
|
44 |
this.trigger_payment_method_selected();
|
45 |
}
|
46 |
|
assets/js/frontend/googlepay-product.js
CHANGED
@@ -21,6 +21,7 @@
|
|
21 |
this.createPaymentsClient();
|
22 |
this.isReadyToPay().then(function() {
|
23 |
$(this.container).show();
|
|
|
24 |
}.bind(this))
|
25 |
}
|
26 |
|
21 |
this.createPaymentsClient();
|
22 |
this.isReadyToPay().then(function() {
|
23 |
$(this.container).show();
|
24 |
+
$(this.container).parent().parent().addClass('active');
|
25 |
}.bind(this))
|
26 |
}
|
27 |
|
assets/js/frontend/local-payment.js
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
(function($, wc_stripe) {
|
2 |
|
3 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
/**
|
6 |
* [LocalPayment description]
|
@@ -113,10 +119,49 @@
|
|
113 |
|
114 |
}
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
/*********** iDEAL ***********/
|
117 |
function IDEAL(params) {
|
118 |
this.elementType = 'idealBank';
|
|
|
119 |
LocalPayment.call(this, params);
|
|
|
120 |
}
|
121 |
|
122 |
/******* Sepa *******/
|
@@ -132,6 +177,23 @@
|
|
132 |
window.addEventListener('hashchange', this.hashChange.bind(this));
|
133 |
}
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
Klarna.prototype.category_change = function(e) {
|
136 |
$('[id^="klarna-instance-"]').hide();
|
137 |
var category = $('[name="klarna_category"]:checked').val();
|
@@ -224,12 +286,57 @@
|
|
224 |
}
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
IDEAL.prototype = $.extend({}, LocalPayment.prototype, IDEAL.prototype);
|
228 |
|
229 |
Sepa.prototype = $.extend({}, LocalPayment.prototype, Sepa.prototype);
|
230 |
|
231 |
Klarna.prototype = $.extend({}, LocalPayment.prototype, Klarna.prototype);
|
232 |
|
|
|
|
|
|
|
|
|
233 |
/**
|
234 |
* Local payment types that require JS integration
|
235 |
* @type {Object}
|
@@ -237,7 +344,9 @@
|
|
237 |
const types = {
|
238 |
'ideal': IDEAL,
|
239 |
'sepa_debit': Sepa,
|
240 |
-
'klarna': Klarna
|
|
|
|
|
241 |
}
|
242 |
|
243 |
for (var i in wc_stripe_local_payment_params.gateways) {
|
1 |
(function($, wc_stripe) {
|
2 |
|
3 |
+
var place_order_width = $('#place_order').css('width');
|
4 |
+
|
5 |
+
// this will ensure the place order's width does not change when the
|
6 |
+
// text for the local payment method is added
|
7 |
+
$(document.body).on('updated_checkout', function() {
|
8 |
+
$('#place_order').css('min-width', place_order_width)
|
9 |
+
})
|
10 |
|
11 |
/**
|
12 |
* [LocalPayment description]
|
119 |
|
120 |
}
|
121 |
|
122 |
+
LocalPayment.prototype.load_external_script = function(url) {
|
123 |
+
var script = document.createElement('script');
|
124 |
+
script.type = "text/javascript";
|
125 |
+
script.src = url;
|
126 |
+
script.onload = function() {
|
127 |
+
this.script_loaded = true;
|
128 |
+
}.bind(this);
|
129 |
+
document.body.appendChild(script);
|
130 |
+
}
|
131 |
+
|
132 |
+
LocalPayment.prototype.hashChange = function(e) {
|
133 |
+
if (this.is_gateway_selected()) {
|
134 |
+
var match = e.newURL.match(/response=(.*)/);
|
135 |
+
if (match) {
|
136 |
+
var obj = JSON.parse(window.atob(match[1]));
|
137 |
+
this.stripe[this.confirmation_method](obj.client_secret, this.get_confirmation_args(obj)).then(function(result) {
|
138 |
+
if (result.error) {
|
139 |
+
this.submit_error(result.error.message);
|
140 |
+
}
|
141 |
+
}.bind(this))
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
LocalPayment.prototype.get_confirmation_args = function(obj) {
|
147 |
+
var args = {
|
148 |
+
payment_method: {
|
149 |
+
billing_details: {
|
150 |
+
name: this.get_first_name('billing') + ' ' + this.get_last_name('billing')
|
151 |
+
}
|
152 |
+
},
|
153 |
+
return_url: obj.return_url
|
154 |
+
}
|
155 |
+
args['payment_method'][this.params.local_payment_type] = this.element;
|
156 |
+
return args;
|
157 |
+
}
|
158 |
+
|
159 |
/*********** iDEAL ***********/
|
160 |
function IDEAL(params) {
|
161 |
this.elementType = 'idealBank';
|
162 |
+
this.confirmation_method = 'confirmIdealPayment';
|
163 |
LocalPayment.call(this, params);
|
164 |
+
window.addEventListener('hashchange', this.hashChange.bind(this));
|
165 |
}
|
166 |
|
167 |
/******* Sepa *******/
|
177 |
window.addEventListener('hashchange', this.hashChange.bind(this));
|
178 |
}
|
179 |
|
180 |
+
function FPX(params) {
|
181 |
+
this.elementType = 'fpxBank';
|
182 |
+
this.confirmation_method = 'confirmFpxPayment';
|
183 |
+
LocalPayment.call(this, params);
|
184 |
+
window.addEventListener('hashchange', this.hashChange.bind(this));
|
185 |
+
}
|
186 |
+
|
187 |
+
function WeChat(params) {
|
188 |
+
LocalPayment.call(this, params);
|
189 |
+
window.addEventListener('hashchange', this.hashChange.bind(this));
|
190 |
+
}
|
191 |
+
|
192 |
+
IDEAL.prototype.createSource = function() {
|
193 |
+
this.payment_token_received = true;
|
194 |
+
this.get_form().submit();
|
195 |
+
}
|
196 |
+
|
197 |
Klarna.prototype.category_change = function(e) {
|
198 |
$('[id^="klarna-instance-"]').hide();
|
199 |
var category = $('[name="klarna_category"]:checked').val();
|
286 |
}
|
287 |
}
|
288 |
|
289 |
+
WeChat.prototype.updated_checkout = function() {
|
290 |
+
if (!this.script_loaded && $(this.container).length) {
|
291 |
+
this.load_external_script(this.params.qr_script);
|
292 |
+
}
|
293 |
+
LocalPayment.prototype.updated_checkout.apply(this, arguments);
|
294 |
+
}
|
295 |
+
|
296 |
+
WeChat.prototype.hashChange = function(e) {
|
297 |
+
if (this.is_gateway_selected()) {
|
298 |
+
var match = e.newURL.match(/qrcode=(.*)/);
|
299 |
+
if (match) {
|
300 |
+
this.qrcode = JSON.parse(window.atob(match[1]));
|
301 |
+
this.get_form().unblock().removeClass('processing').addClass('wechat');
|
302 |
+
const qrCode = new QRCode('wc_stripe_local_payment_stripe_wechat', {
|
303 |
+
text: this.qrcode.code,
|
304 |
+
width: 128,
|
305 |
+
height: 128,
|
306 |
+
colorDark: '#424770',
|
307 |
+
colorLight: '#f8fbfd',
|
308 |
+
correctLevel: QRCode.CorrectLevel.H,
|
309 |
+
});
|
310 |
+
$('#wc_stripe_local_payment_stripe_wechat').append('<p class="qrcode-message">' + this.params.qr_message + '</p>');
|
311 |
+
this.payment_token_received = true;
|
312 |
+
this.show_place_order();
|
313 |
+
}
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
WeChat.prototype.place_order = function() {
|
318 |
+
if (this.get_form().is('.wechat')) {
|
319 |
+
window.location = this.qrcode.redirect;
|
320 |
+
} else {
|
321 |
+
LocalPayment.prototype.place_order.apply(this, arguments);
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
FPX.prototype.createSource = function() {
|
326 |
+
this.payment_token_received = true;
|
327 |
+
this.get_form().submit();
|
328 |
+
}
|
329 |
+
|
330 |
IDEAL.prototype = $.extend({}, LocalPayment.prototype, IDEAL.prototype);
|
331 |
|
332 |
Sepa.prototype = $.extend({}, LocalPayment.prototype, Sepa.prototype);
|
333 |
|
334 |
Klarna.prototype = $.extend({}, LocalPayment.prototype, Klarna.prototype);
|
335 |
|
336 |
+
FPX.prototype = $.extend({}, LocalPayment.prototype, FPX.prototype);
|
337 |
+
|
338 |
+
WeChat.prototype = $.extend({}, LocalPayment.prototype, WeChat.prototype);
|
339 |
+
|
340 |
/**
|
341 |
* Local payment types that require JS integration
|
342 |
* @type {Object}
|
344 |
const types = {
|
345 |
'ideal': IDEAL,
|
346 |
'sepa_debit': Sepa,
|
347 |
+
'klarna': Klarna,
|
348 |
+
'fpx': FPX,
|
349 |
+
'wechat': WeChat
|
350 |
}
|
351 |
|
352 |
for (var i in wc_stripe_local_payment_params.gateways) {
|
assets/js/frontend/payment-request.js
CHANGED
@@ -20,6 +20,7 @@
|
|
20 |
PaymentRequest.prototype.canMakePayment = function() {
|
21 |
wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function(result) {
|
22 |
$(document.body).on('change', '[name="quantity"]', this.add_to_cart.bind(this));
|
|
|
23 |
if (!this.is_variable_product()) {
|
24 |
this.cart_calculation().then(function() {
|
25 |
this.paymentRequest.update(this.get_payment_request_update({
|
20 |
PaymentRequest.prototype.canMakePayment = function() {
|
21 |
wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function(result) {
|
22 |
$(document.body).on('change', '[name="quantity"]', this.add_to_cart.bind(this));
|
23 |
+
$(this.container).parent().parent().addClass('active');
|
24 |
if (!this.is_variable_product()) {
|
25 |
this.cart_calculation().then(function() {
|
26 |
this.paymentRequest.update(this.get_payment_request_update({
|
assets/js/frontend/qrcode.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c<a.length&&0==a[c];)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}function j(a,b){this.totalCount=a,this.dataCount=b}function k(){this.buffer=[],this.length=0}function m(){return"undefined"!=typeof CanvasRenderingContext2D}function n(){var a=!1,b=navigator.userAgent;return/android/i.test(b)&&(a=!0,aMat=b.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(a=parseFloat(aMat[1]))),a}function r(a,b){for(var c=1,e=s(a),f=0,g=l.length;g>=f;f++){var h=0;switch(b){case d.L:h=l[f][0];break;case d.M:h=l[f][1];break;case d.Q:h=l[f][2];break;case d.H:h=l[f][3]}if(h>=e)break;c++}if(c>l.length)throw new Error("Too long data");return c}function s(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){var c=new a(b);this.dataList.push(c),this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=new Array(this.moduleCount);for(var e=0;e<this.moduleCount;e++)this.modules[d][e]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,c),this.typeNumber>=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=f.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f<this.modules.length;f++)for(var g=f*e,h=0;h<this.modules[f].length;h++){var i=h*e,j=this.modules[f][h];j&&(d.beginFill(0,100),d.moveTo(i,g),d.lineTo(i+e,g),d.lineTo(i+e,g+e),d.lineTo(i,g+e),d.endFill())}return d},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(var b=8;b<this.moduleCount-8;b++)null==this.modules[6][b]&&(this.modules[6][b]=0==b%2)},setupPositionAdjustPattern:function(){for(var a=f.getPatternPosition(this.typeNumber),b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(null==this.modules[d][e])for(var g=-2;2>=g;g++)for(var h=-2;2>=h;h++)this.modules[d+g][e+h]=-2==g||2==g||-2==h||2==h||0==g&&0==h?!0:!1}},setupTypeNumber:function(a){for(var b=f.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=f.getBCHTypeInfo(c),e=0;15>e;e++){var g=!a&&1==(1&d>>e);6>e?this.modules[e][8]=g:8>e?this.modules[e+1][8]=g:this.modules[this.moduleCount-15+e][8]=g}for(var e=0;15>e;e++){var g=!a&&1==(1&d>>e);8>e?this.modules[8][this.moduleCount-e-1]=g:9>e?this.modules[8][15-e-1+1]=g:this.modules[8][15-e-1]=g}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,g=0,h=this.moduleCount-1;h>0;h-=2)for(6==h&&h--;;){for(var i=0;2>i;i++)if(null==this.modules[d][h-i]){var j=!1;g<a.length&&(j=1==(1&a[g]>>>e));var k=f.getMask(b,d,h-i);k&&(j=!j),this.modules[d][h-i]=j,e--,-1==e&&(g++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,d){for(var e=j.getRSBlocks(a,c),g=new k,h=0;h<d.length;h++){var i=d[h];g.put(i.mode,4),g.put(i.getLength(),f.getLengthInBits(i.mode,a)),i.write(g)}for(var l=0,h=0;h<e.length;h++)l+=e[h].dataCount;if(g.getLengthInBits()>8*l)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+8*l+")");for(g.getLengthInBits()+4<=8*l&&g.put(0,4);0!=g.getLengthInBits()%8;)g.putBit(!1);for(;;){if(g.getLengthInBits()>=8*l)break;if(g.put(b.PAD0,8),g.getLengthInBits()>=8*l)break;g.put(b.PAD1,8)}return b.createBytes(g,e)},b.createBytes=function(a,b){for(var c=0,d=0,e=0,g=new Array(b.length),h=new Array(b.length),j=0;j<b.length;j++){var k=b[j].dataCount,l=b[j].totalCount-k;d=Math.max(d,k),e=Math.max(e,l),g[j]=new Array(k);for(var m=0;m<g[j].length;m++)g[j][m]=255&a.buffer[m+c];c+=k;var n=f.getErrorCorrectPolynomial(l),o=new i(g[j],n.getLength()-1),p=o.mod(n);h[j]=new Array(n.getLength()-1);for(var m=0;m<h[j].length;m++){var q=m+p.getLength()-h[j].length;h[j][m]=q>=0?p.get(q):0}}for(var r=0,m=0;m<b.length;m++)r+=b[m].totalCount;for(var s=new Array(r),t=0,m=0;d>m;m++)for(var j=0;j<b.length;j++)m<g[j].length&&(s[t++]=g[j][m]);for(var m=0;e>m;m++)for(var j=0;j<b.length;j++)m<h[j].length&&(s[t++]=h[j][m]);return s};for(var c={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},d={L:1,M:0,Q:3,H:2},e={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},f={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var b=a<<10;f.getBCHDigit(b)-f.getBCHDigit(f.G15)>=0;)b^=f.G15<<f.getBCHDigit(b)-f.getBCHDigit(f.G15);return(a<<10|b)^f.G15_MASK},getBCHTypeNumber:function(a){for(var b=a<<12;f.getBCHDigit(b)-f.getBCHDigit(f.G18)>=0;)b^=f.G18<<f.getBCHDigit(b)-f.getBCHDigit(f.G18);return a<<12|b},getBCHDigit:function(a){for(var b=0;0!=a;)b++,a>>>=1;return b},getPatternPosition:function(a){return f.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case e.PATTERN000:return 0==(b+c)%2;case e.PATTERN001:return 0==b%2;case e.PATTERN010:return 0==c%3;case e.PATTERN011:return 0==(b+c)%3;case e.PATTERN100:return 0==(Math.floor(b/2)+Math.floor(c/3))%2;case e.PATTERN101:return 0==b*c%2+b*c%3;case e.PATTERN110:return 0==(b*c%2+b*c%3)%2;case e.PATTERN111:return 0==(b*c%3+(b+c)%2)%2;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new i([1],0),c=0;a>c;c++)b=b.multiply(new i([1,g.gexp(c)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case c.MODE_NUMBER:return 10;case c.MODE_ALPHA_NUM:return 9;case c.MODE_8BIT_BYTE:return 8;case c.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case c.MODE_NUMBER:return 12;case c.MODE_ALPHA_NUM:return 11;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case c.MODE_NUMBER:return 14;case c.MODE_ALPHA_NUM:return 13;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},g={glog:function(a){if(1>a)throw new Error("glog("+a+")");return g.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return g.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;8>h;h++)g.EXP_TABLE[h]=1<<h;for(var h=8;256>h;h++)g.EXP_TABLE[h]=g.EXP_TABLE[h-4]^g.EXP_TABLE[h-5]^g.EXP_TABLE[h-6]^g.EXP_TABLE[h-8];for(var h=0;255>h;h++)g.LOG_TABLE[g.EXP_TABLE[h]]=h;i.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),c=0;c<this.getLength();c++)for(var d=0;d<a.getLength();d++)b[c+d]^=g.gexp(g.glog(this.get(c))+g.glog(a.get(d)));return new i(b,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var b=g.glog(this.get(0))-g.glog(a.get(0)),c=new Array(this.getLength()),d=0;d<this.getLength();d++)c[d]=this.get(d);for(var d=0;d<a.getLength();d++)c[d]^=g.gexp(g.glog(a.get(d))+b);return new i(c,0).mod(a)}},j.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],j.getRSBlocks=function(a,b){var c=j.getRsBlockTable(a,b);if(void 0==c)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+b);for(var d=c.length/3,e=[],f=0;d>f;f++)for(var g=c[3*f+0],h=c[3*f+1],i=c[3*f+2],k=0;g>k;k++)e.push(new j(h,i));return e},j.getRsBlockTable=function(a,b){switch(b){case d.L:return j.RS_BLOCK_TABLE[4*(a-1)+0];case d.M:return j.RS_BLOCK_TABLE[4*(a-1)+1];case d.Q:return j.RS_BLOCK_TABLE[4*(a-1)+2];case d.H:return j.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},k.prototype={get:function(a){var b=Math.floor(a/8);return 1==(1&this.buffer[b]>>>7-a%8)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(1&a>>>b-c-1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var l=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],o=function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){function g(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d]);return c}var b=this._htOption,c=this._el,d=a.getModuleCount();Math.floor(b.width/d),Math.floor(b.height/d),this.clear();var h=g("svg",{viewBox:"0 0 "+String(d)+" "+String(d),width:"100%",height:"100%",fill:b.colorLight});h.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),c.appendChild(h),h.appendChild(g("rect",{fill:b.colorDark,width:"1",height:"1",id:"template"}));for(var i=0;d>i;i++)for(var j=0;d>j;j++)if(a.isDark(i,j)){var k=g("use",{x:String(i),y:String(j)});k.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),h.appendChild(k)}},a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},a}(),p="svg"===document.documentElement.tagName.toLowerCase(),q=p?o:m()?function(){function a(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function d(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement("img"),e=function(){c._bSupportDataURI=!1,c._fFail&&_fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};return d.onabort=e,d.onerror=e,d.onload=f,d.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}c._bSupportDataURI===!0&&c._fSuccess?c._fSuccess.call(c):c._bSupportDataURI===!1&&c._fFail&&c._fFail.call(c)}if(this._android&&this._android<=2.1){var b=1/window.devicePixelRatio,c=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,d,e,f,g,h,i,j){if("nodeName"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*b;else"undefined"==typeof j&&(arguments[1]*=b,arguments[2]*=b,arguments[3]*=b,arguments[4]*=b);c.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=n(),this._htOption=b,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=b.width,this._elCanvas.height=b.height,a.appendChild(this._elCanvas),this._el=a,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return e.prototype.draw=function(a){var b=this._elImage,c=this._oContext,d=this._htOption,e=a.getModuleCount(),f=d.width/e,g=d.height/e,h=Math.round(f),i=Math.round(g);b.style.display="none",this.clear();for(var j=0;e>j;j++)for(var k=0;e>k;k++){var l=a.isDark(j,k),m=k*f,n=j*g;c.strokeStyle=l?d.colorDark:d.colorLight,c.lineWidth=1,c.fillStyle=l?d.colorDark:d.colorLight,c.fillRect(m,n,f,g),c.strokeRect(Math.floor(m)+.5,Math.floor(n)+.5,h,i),c.strokeRect(Math.ceil(m)-.5,Math.ceil(n)-.5,h,i)}this._bIsPainted=!0},e.prototype.makeImage=function(){this._bIsPainted&&d.call(this,a)},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(a){return a?Math.floor(1e3*a)/1e3:a},e}():function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,d=a.getModuleCount(),e=Math.floor(b.width/d),f=Math.floor(b.height/d),g=['<table style="border:0;border-collapse:collapse;">'],h=0;d>h;h++){g.push("<tr>");for(var i=0;d>i;i++)g.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+e+"px;height:"+f+"px;background-color:"+(a.isDark(h,i)?b.colorDark:b.colorLight)+';"></td>');g.push("</tr>")}g.push("</table>"),c.innerHTML=g.join("");var j=c.childNodes[0],k=(b.width-j.offsetWidth)/2,l=(b.height-j.offsetHeight)/2;k>0&&l>0&&(j.style.margin=l+"px "+k+"px")},a.prototype.clear=function(){this._el.innerHTML=""},a}();QRCode=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:d.H},"string"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];"string"==typeof a&&(a=document.getElementById(a)),this._android=n(),this._el=a,this._oQRCode=null,this._oDrawing=new q(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(a){this._oQRCode=new b(r(a,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(a),this._oQRCode.make(),this._el.title=a,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=d}();
|
assets/js/frontend/wc-stripe.js
CHANGED
@@ -1,11 +1,17 @@
|
|
1 |
(function(window, $) {
|
2 |
window.wc_stripe = {};
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
/**
|
11 |
* @consructor
|
1 |
(function(window, $) {
|
2 |
window.wc_stripe = {};
|
3 |
|
4 |
+
try {
|
5 |
+
/**
|
6 |
+
* [Initiate Stripe]
|
7 |
+
* @type {[type]}
|
8 |
+
*/
|
9 |
+
var stripe = Stripe(wc_stripe_params_v3.api_key);
|
10 |
+
} catch (error) {
|
11 |
+
window.alert(error);
|
12 |
+
console.log(error);
|
13 |
+
return;
|
14 |
+
}
|
15 |
|
16 |
/**
|
17 |
* @consructor
|
assets/js/frontend/wc-stripe.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t,e){t.wc_stripe={};var i=Stripe(wc_stripe_params_v3.api_key);wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_intent_selector=this.params.payment_intent_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){e(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==t.indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return"1"===this.params.needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return e("#wc_stripe_currency").val()},wc_stripe.BaseGateway.prototype.get_country=function(){return e("#wc_stripe_country").val()},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return e("#billing_email").val()},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var i=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],a="",n=0;n<i.length;n++)a+=e(t+i[n]).val()+"_";return a},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return e("#wc_stripe_order_total").data("amount")},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return e("#wc_stripe_order_total_cents").data("amount")},wc_stripe.BaseGateway.prototype.set_total_price=function(t){e("#wc_stripe_order_total").data("amount",t)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){e("#wc_stripe_order_total_cents").data("amount",t)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var a=t[i];e('[name="shipping_method['+i+']"][value="'+a+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){this.paymentRequest=i.paymentRequest(this.get_payment_request_options()),this.needs_shipping()&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},a=this.get_display_items(),n=this.get_shipping_options();return a&&(i.displayItems=a),this.needs_shipping()&&n&&(i.shippingOptions=n),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return e("#wc_stripe_display_items").data("items")},wc_stripe.BaseGateway.prototype.set_display_items=function(t){e("#wc_stripe_display_items").data("items",t)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return e("#wc_stripe_shipping_options").data("items")},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){e("#wc_stripe_shipping_options").data("items",t)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){e(this.token_selector).val(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){var i=this.address_mappings();if(t.payerName&&i.payerName.set(t.payerName),t.payerEmail&&i.payerEmail.set(t.payerEmail),t.payerPhone&&i.payerPhone.set(t.payerPhone),t.shippingAddress){var a=t.shippingAddress;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#shipping")}if(t.paymentMethod.billing_details.address){a=t.paymentMethod.billing_details.address;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#billing")}this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return{payerName:{set:function(t,i){var a=t.split(" ");a.length>0&&e("#billing_first_name").val(a[0]),a.length>1&&e("#billing_last_name").val(a[1])},get:function(t){return e("#billing_first_name").val()+" "+e("#billing_last_name").val()}},payerEmail:{set:function(t){e("#billing_email").val(t)},get:function(){return e("#billing_email").val()}},payerPhone:{set:function(t){e("#billing_phone").val(t)},get:function(){return e("#billing_phone").val()}},recipient:{set:function(t,i){var a=t.split(" ");a.length>0&&e(i+"_first_name").val(a[0]),a.length>1&&e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()}},country:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},addressLine:{set:function(t,i){t.length>0&&e(i+"_address_1").val(t[0]),t.length>1&&e(i+"_address_2").val(t[1])},get:function(t){return[e(t+"_address_1").val(),e(t+"_address_2").val()]}},line1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},line2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},region:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},state:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},city:{set:function(t,i){e(i+"_city").val(t)},get:function(t){e(t+"_city").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}},postal_code:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}}}},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,a){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_form(this.get_form()),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),a={};for(var n in i){var s=i[n];a[s.name]=s.value}return a.payment_method=this.gateway_id,a},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^(\d):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("#billing")!==this.get_address_field_hash("#shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_methods:this.map_shipping_methods(t.shippingOption.id),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.container=this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("update_checkout",this.update_checkout.bind(this)),e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(".wc-stripe-banner-checkout").css("max-width",e(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var e=t.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(e&&e.length>1){var i=e[1],a=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(a),this.set_use_new_option(!0))}},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,e('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if("undefined"==typeof wc_stripe_checkout_fields)return!0;var t=Object.keys(wc_stripe_checkout_fields.billing),i=Object.keys(wc_stripe_checkout_fields.shipping);function a(t,i){for(var a=0;a<t.length;a++){if(i[t[a]].required){var n=e("#"+t[a]).val();if(void 0===n||0==n.length)return void(valid=!1)}}}return valid=!0,a(t,wc_stripe_checkout_fields.billing),this.needs_shipping()&&e("#ship-to-different-address-checkbox").is(":checked")&&a(i,wc_stripe_checkout_fields.shipping),valid=this.is_valid_checkout(),valid},wc_stripe.ProductGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.product",e(document.body).on("wc_stripe_updated_rest_nonce",this.set_rest_nonce.bind(this)),e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth(),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_product_data();i.price=e.display_price,i.needs_shipping=!e.is_virtual,i.variation=e,this.set_product_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.needs_shipping=function(){return this.get_product_data().needs_shipping},wc_stripe.ProductGateway.prototype.get_product_data=function(){return e("#wc_stripe_product_data").data("product")},wc_stripe.ProductGateway.prototype.set_product_data=function(t){e("#wc_stripe_product_data").data("product",t)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(a,n,s){this.unblock(),e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",s.getResponseHeader("X-WP-Nonce")),a.code?(this.submit_error(a.message),i(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),t(a.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(t,a,n){e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",n.getResponseHeader("X-WP-Nonce")),t.code?this.cart_calculation_error=!0:(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),i(t.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this))},wc_stripe.CartGateway.prototype.needs_shipping=function(){return 1===e("#wc_stripe_needs_shipping").data("value")},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(t)},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){e(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};const a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.address_mappings=function(t){return{name:{set:function(t,i){var a=t.split(" ");e(i+"_first_name").val(a[0]),e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+e(t+"_last_name").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){return e(t+"_postcode").val()}},countryCode:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},phoneNumber:{set:function(t,i){e("#billing_phone").val(t)},get:function(){return"#billing_phone".val()}},address1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},address2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},locality:{set:function(t,i){e(i+"_city").val(t)},get:function(t){return e(t+"_city").val()}},administrativeArea:{set:function(t,i){e(i+"_state").val(t)},get:function(t){return e(t+"_state").val()}}}},wc_stripe.GooglePay.prototype.serialize_form=function(t){return e.extend({},wc_stripe.BaseGateway.prototype.serialize_form.apply(this,arguments),{order_review:!this.dynamic_price_enabled()})},wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress,a=this.address_mappings();for(var n in i)a[n]&&a[n].set.call(this,i[n],"#billing");if(t.shippingAddress)for(var n in t.shippingAddress)a[n]&&a[n].set.call(this,t.shippingAddress[n],"#shipping");t.email&&e("#billing_email").val(t.email),this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(t){return new Promise(function(i,a){e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_methods:this.map_shipping_methods(t.shippingOptionData.id),shipping_method_id:t.shippingOptionData.id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)})).done(function(t){t.code?a(t.data.data):i(t.data)}.bind(this)).fail(function(){a()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.bind(this)).catch(function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_googlepay_display_items=function(){return e("#googlepay_display_items").data("items")},wc_stripe.GooglePay.prototype.set_googlepay_display_items=function(t){e("#googlepay_display_items").data("items",t)},wc_stripe.GooglePay.prototype.get_shipping_options=function(){return e("#googlepay_shipping_options").data("items")},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.dynamic_price_enabled=function(){return"1"===this.params.dynamic_price},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}}),t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},a,{emailRequired:!0,merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:this.needs_shipping()&&this.get_total_price_cents()>0,transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_googlepay_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:e("#billing_phone").length>0},this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"]),t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var i=e.extend({},a);i.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(i).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this)).catch(function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){e(document.body).on("click",".apple-pay-button",this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")}}(window,jQuery);
|
1 |
+
!function(t,e){t.wc_stripe={};try{var i=Stripe(wc_stripe_params_v3.api_key)}catch(e){return t.alert(e),void console.log(e)}wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_intent_selector=this.params.payment_intent_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){e(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==t.indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return"1"===this.params.needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return e("#wc_stripe_currency").val()},wc_stripe.BaseGateway.prototype.get_country=function(){return e("#wc_stripe_country").val()},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return e("#billing_email").val()},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var i=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],a="",n=0;n<i.length;n++)a+=e(t+i[n]).val()+"_";return a},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return e("#wc_stripe_order_total").data("amount")},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return e("#wc_stripe_order_total_cents").data("amount")},wc_stripe.BaseGateway.prototype.set_total_price=function(t){e("#wc_stripe_order_total").data("amount",t)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){e("#wc_stripe_order_total_cents").data("amount",t)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var a=t[i];e('[name="shipping_method['+i+']"][value="'+a+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){this.paymentRequest=i.paymentRequest(this.get_payment_request_options()),this.needs_shipping()&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},a=this.get_display_items(),n=this.get_shipping_options();return a&&(i.displayItems=a),this.needs_shipping()&&n&&(i.shippingOptions=n),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return e("#wc_stripe_display_items").data("items")},wc_stripe.BaseGateway.prototype.set_display_items=function(t){e("#wc_stripe_display_items").data("items",t)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return e("#wc_stripe_shipping_options").data("items")},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){e("#wc_stripe_shipping_options").data("items",t)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){e(this.token_selector).val(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){var i=this.address_mappings();if(t.payerName&&i.payerName.set(t.payerName),t.payerEmail&&i.payerEmail.set(t.payerEmail),t.payerPhone&&i.payerPhone.set(t.payerPhone),t.shippingAddress){var a=t.shippingAddress;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#shipping")}if(t.paymentMethod.billing_details.address){a=t.paymentMethod.billing_details.address;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#billing")}this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return{payerName:{set:function(t,i){var a=t.split(" ");a.length>0&&e("#billing_first_name").val(a[0]),a.length>1&&e("#billing_last_name").val(a[1])},get:function(t){return e("#billing_first_name").val()+" "+e("#billing_last_name").val()}},payerEmail:{set:function(t){e("#billing_email").val(t)},get:function(){return e("#billing_email").val()}},payerPhone:{set:function(t){e("#billing_phone").val(t)},get:function(){return e("#billing_phone").val()}},recipient:{set:function(t,i){var a=t.split(" ");a.length>0&&e(i+"_first_name").val(a[0]),a.length>1&&e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()}},country:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},addressLine:{set:function(t,i){t.length>0&&e(i+"_address_1").val(t[0]),t.length>1&&e(i+"_address_2").val(t[1])},get:function(t){return[e(t+"_address_1").val(),e(t+"_address_2").val()]}},line1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},line2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},region:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},state:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},city:{set:function(t,i){e(i+"_city").val(t)},get:function(t){e(t+"_city").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}},postal_code:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}}}},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,a){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_form(this.get_form()),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),a={};for(var n in i){var s=i[n];a[s.name]=s.value}return a.payment_method=this.gateway_id,a},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^(\d):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("#billing")!==this.get_address_field_hash("#shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_methods:this.map_shipping_methods(t.shippingOption.id),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.container=this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("update_checkout",this.update_checkout.bind(this)),e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(".wc-stripe-banner-checkout").css("max-width",e(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var e=t.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(e&&e.length>1){var i=e[1],a=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(a),this.set_use_new_option(!0))}},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,e('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if("undefined"==typeof wc_stripe_checkout_fields)return!0;var t=Object.keys(wc_stripe_checkout_fields.billing),i=Object.keys(wc_stripe_checkout_fields.shipping);function a(t,i){for(var a=0;a<t.length;a++){if(i[t[a]].required){var n=e("#"+t[a]).val();if(void 0===n||0==n.length)return void(valid=!1)}}}return valid=!0,a(t,wc_stripe_checkout_fields.billing),this.needs_shipping()&&e("#ship-to-different-address-checkbox").is(":checked")&&a(i,wc_stripe_checkout_fields.shipping),valid=this.is_valid_checkout(),valid},wc_stripe.ProductGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.product",e(document.body).on("wc_stripe_updated_rest_nonce",this.set_rest_nonce.bind(this)),e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth(),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_product_data();i.price=e.display_price,i.needs_shipping=!e.is_virtual,i.variation=e,this.set_product_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.needs_shipping=function(){return this.get_product_data().needs_shipping},wc_stripe.ProductGateway.prototype.get_product_data=function(){return e("#wc_stripe_product_data").data("product")},wc_stripe.ProductGateway.prototype.set_product_data=function(t){e("#wc_stripe_product_data").data("product",t)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(a,n,s){this.unblock(),e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",s.getResponseHeader("X-WP-Nonce")),a.code?(this.submit_error(a.message),i(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),t(a.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(t,a,n){e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",n.getResponseHeader("X-WP-Nonce")),t.code?this.cart_calculation_error=!0:(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),i(t.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this))},wc_stripe.CartGateway.prototype.needs_shipping=function(){return 1===e("#wc_stripe_needs_shipping").data("value")},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(t)},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){e(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};const a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.address_mappings=function(t){return{name:{set:function(t,i){var a=t.split(" ");e(i+"_first_name").val(a[0]),e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+e(t+"_last_name").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){return e(t+"_postcode").val()}},countryCode:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},phoneNumber:{set:function(t,i){e("#billing_phone").val(t)},get:function(){return"#billing_phone".val()}},address1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},address2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},locality:{set:function(t,i){e(i+"_city").val(t)},get:function(t){return e(t+"_city").val()}},administrativeArea:{set:function(t,i){e(i+"_state").val(t)},get:function(t){return e(t+"_state").val()}}}},wc_stripe.GooglePay.prototype.serialize_form=function(t){return e.extend({},wc_stripe.BaseGateway.prototype.serialize_form.apply(this,arguments),{order_review:!this.dynamic_price_enabled()})},wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress,a=this.address_mappings();for(var n in i)a[n]&&a[n].set.call(this,i[n],"#billing");if(t.shippingAddress)for(var n in t.shippingAddress)a[n]&&a[n].set.call(this,t.shippingAddress[n],"#shipping");t.email&&e("#billing_email").val(t.email),this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(t){return new Promise(function(i,a){e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_methods:this.map_shipping_methods(t.shippingOptionData.id),shipping_method_id:t.shippingOptionData.id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)})).done(function(t){t.code?a(t.data.data):i(t.data)}.bind(this)).fail(function(){a()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.bind(this)).catch(function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_googlepay_display_items=function(){return e("#googlepay_display_items").data("items")},wc_stripe.GooglePay.prototype.set_googlepay_display_items=function(t){e("#googlepay_display_items").data("items",t)},wc_stripe.GooglePay.prototype.get_shipping_options=function(){return e("#googlepay_shipping_options").data("items")},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.dynamic_price_enabled=function(){return"1"===this.params.dynamic_price},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}}),t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},a,{emailRequired:!0,merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:this.needs_shipping()&&this.get_total_price_cents()>0,transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_googlepay_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:e("#billing_phone").length>0},this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"]),t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var i=e.extend({},a);i.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(i).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this)).catch(function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){e(document.body).on("click",".apple-pay-button",this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")}}(window,jQuery);
|
i18n/languages/woo-stripe-payment.pot
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: woo-stripe-payment\n"
|
5 |
-
"POT-Creation-Date: 2020-
|
6 |
"PO-Revision-Date: 2019-08-16 14:27-0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
@@ -10,7 +10,7 @@ msgstr ""
|
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"X-Generator: Poedit 2.
|
14 |
"X-Poedit-Basepath: ../..\n"
|
15 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
"X-Poedit-KeywordsList: __;_e;_x\n"
|
@@ -18,226 +18,250 @@ msgstr ""
|
|
18 |
"X-Poedit-SearchPath-1: templates\n"
|
19 |
"X-Poedit-SearchPath-2: stripe-payments.php\n"
|
20 |
|
21 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
22 |
-
#: includes/
|
23 |
-
#: includes/
|
24 |
-
#: includes/gateways/
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:71
|
30 |
-
#, php-format
|
31 |
-
msgid "Error processing payment. Reason: %s. Code: %s"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
35 |
#, php-format
|
36 |
-
msgid ""
|
37 |
-
"Charge %s is pending. Payment Method: %s. Payment will be completed once "
|
38 |
-
"charge.succeeded webhook received from Stripe."
|
39 |
msgstr ""
|
40 |
|
41 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
47 |
-
#: includes/
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
53 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:200
|
54 |
#, php-format
|
55 |
-
msgid "
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
59 |
-
#: includes/
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
65 |
-
#: includes/
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
70 |
#, php-format
|
71 |
-
msgid ""
|
72 |
-
"Recurring payment for subscription failed. Reason: %s. Payment method: %s"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
76 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:262
|
77 |
#, php-format
|
78 |
-
msgid "
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-
|
82 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:220
|
83 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:264
|
84 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:330
|
85 |
#, php-format
|
86 |
-
msgid "
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe
|
90 |
-
#: includes/
|
91 |
#, php-format
|
92 |
-
msgid "Error
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe
|
96 |
#, php-format
|
97 |
msgid ""
|
98 |
-
"
|
99 |
-
|
100 |
-
|
101 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:218
|
102 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:328
|
103 |
-
#, php-format
|
104 |
-
msgid "Pre-order payment captured in Stripe. Payment method: %s"
|
105 |
-
msgstr ""
|
106 |
-
|
107 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:75
|
108 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:76
|
109 |
-
#, php-format
|
110 |
-
msgid "Error creating payment source. Reason: %s"
|
111 |
-
msgstr ""
|
112 |
-
|
113 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:165
|
114 |
-
#, php-format
|
115 |
-
msgid "Order %s"
|
116 |
-
msgstr ""
|
117 |
-
|
118 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:211
|
119 |
-
#, php-format
|
120 |
-
msgid "Gateway will appear when store currency is <strong>%s</strong>"
|
121 |
-
msgstr ""
|
122 |
-
|
123 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:214
|
124 |
-
#, php-format
|
125 |
-
msgid " & billing country is <strong>%s</strong>"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe
|
129 |
#, php-format
|
130 |
msgid "Order %s successful in Stripe. Charge: %s. Payment Method: %s"
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe
|
134 |
msgid "charge"
|
135 |
msgstr ""
|
136 |
|
137 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe
|
138 |
msgid "authorization"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe
|
142 |
-
msgid "A new payment method is required."
|
143 |
-
msgstr ""
|
144 |
-
|
145 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:251
|
146 |
-
#, php-format
|
147 |
-
msgid "Recurring payment for order failed. Reason: %s"
|
148 |
-
msgstr ""
|
149 |
-
|
150 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:268
|
151 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:334
|
152 |
-
#, php-format
|
153 |
-
msgid "Customer must manually complete payment for payment method %s"
|
154 |
-
msgstr ""
|
155 |
-
|
156 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:317
|
157 |
-
#, php-format
|
158 |
-
msgid "Pre-order payment for order failed. Reason: %s"
|
159 |
-
msgstr ""
|
160 |
-
|
161 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:299
|
162 |
msgid ""
|
163 |
"Please read and accept the terms and conditions to proceed with your order."
|
164 |
msgstr ""
|
165 |
|
166 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
167 |
-
#: includes/controllers/class-wc-stripe-controller-cart.php:
|
168 |
-
#: includes/controllers/class-wc-stripe-controller-cart.php:
|
169 |
-
#: includes/controllers/class-wc-stripe-controller-googlepay.php:
|
170 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
171 |
msgid "Total"
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
175 |
msgid "User must be logged in."
|
176 |
msgstr ""
|
177 |
|
178 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
179 |
#, php-format
|
180 |
msgid "Error saving your payment method. Reason: %s"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
184 |
#, php-format
|
185 |
msgid "Error saving payment method. Reason: %s"
|
186 |
msgstr ""
|
187 |
|
188 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
189 |
-
|
|
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
193 |
#, php-format
|
194 |
-
msgid "Order
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
|
|
|
|
|
|
|
|
198 |
msgid "n/a"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
202 |
#: includes/admin/meta-boxes/views/html-order-pay.php:42
|
203 |
msgid "New Card"
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
207 |
#: includes/admin/meta-boxes/views/html-order-pay.php:30
|
208 |
msgid "Saved Cards"
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
212 |
#, php-format
|
213 |
msgid "Attemp to save payment method failed. Reason: %s"
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
217 |
msgid ""
|
218 |
"We were not able to save your payment method. To prevent billing issues with "
|
219 |
"your subscription, please add a payment method to the subscription."
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
223 |
#, php-format
|
224 |
msgid "We were not able to save your payment method. Reason: %s"
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
228 |
msgid "Payment Method Token"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
#, php-format
|
233 |
msgid "Error saving payment method for subscription. Reason: %s"
|
234 |
msgstr ""
|
235 |
|
236 |
-
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:
|
|
|
237 |
#, php-format
|
238 |
msgid "Order %s from %s"
|
239 |
msgstr ""
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
#: includes/abstract/abstract-wc-stripe-rest-controller.php:56
|
242 |
msgid "You do not have permissions to access this resource."
|
243 |
msgstr ""
|
@@ -260,6 +284,16 @@ msgstr ""
|
|
260 |
msgid "Documentation"
|
261 |
msgstr ""
|
262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
#: includes/admin/class-wc-stripe-admin-settings.php:73
|
264 |
msgid "Local Gateways"
|
265 |
msgstr ""
|
@@ -292,19 +326,19 @@ msgid "Charge Data"
|
|
292 |
msgstr ""
|
293 |
|
294 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:24
|
295 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
296 |
msgid "Mode"
|
297 |
msgstr ""
|
298 |
|
299 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
|
300 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
301 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:
|
302 |
msgid "Live"
|
303 |
msgstr ""
|
304 |
|
305 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
|
306 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
307 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:
|
308 |
msgid "Test"
|
309 |
msgstr ""
|
310 |
|
@@ -326,25 +360,6 @@ msgstr ""
|
|
326 |
msgid "Payment Method"
|
327 |
msgstr ""
|
328 |
|
329 |
-
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:47
|
330 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:48
|
331 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:47
|
332 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:46
|
333 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:45
|
334 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:60
|
335 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:47
|
336 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:47
|
337 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:46
|
338 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:49
|
339 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:48
|
340 |
-
#: includes/gateways/settings/ach-settings.php:52
|
341 |
-
#: includes/gateways/settings/applepay-settings.php:16
|
342 |
-
#: includes/gateways/settings/cc-settings.php:16
|
343 |
-
#: includes/gateways/settings/googlepay-settings.php:30
|
344 |
-
#: includes/gateways/settings/payment-request-settings.php:17
|
345 |
-
msgid "Title"
|
346 |
-
msgstr ""
|
347 |
-
|
348 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:51
|
349 |
#: includes/admin/views/html-ach-fee.php:10
|
350 |
#: includes/gateways/settings/payment-request-settings.php:73
|
@@ -425,74 +440,56 @@ msgstr ""
|
|
425 |
msgid "Authorize"
|
426 |
msgstr ""
|
427 |
|
428 |
-
#: includes/admin/
|
429 |
-
#:
|
430 |
-
msgid "Save Card"
|
431 |
-
msgstr ""
|
432 |
-
|
433 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:6
|
434 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:26
|
435 |
msgid "API Settings"
|
436 |
msgstr ""
|
437 |
|
438 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
439 |
msgid ""
|
440 |
-
"The mode determines if you are processing test
|
441 |
"transactions on your site. Test mode allows you to simulate payments so you "
|
442 |
"can test your integration."
|
443 |
msgstr ""
|
444 |
|
445 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
446 |
-
msgid "
|
447 |
msgstr ""
|
448 |
|
449 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
450 |
-
|
451 |
-
msgid "Your publishable key is used to initialize Stripe assets."
|
452 |
-
msgstr ""
|
453 |
-
|
454 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:50
|
455 |
-
msgid "Test Secret Key"
|
456 |
msgstr ""
|
457 |
|
458 |
#: includes/admin/settings/class-wc-stripe-api-settings.php:53
|
459 |
-
|
460 |
-
msgid "Your secret key is used to authenticate requests to Stripe."
|
461 |
msgstr ""
|
462 |
|
463 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
464 |
-
msgid "
|
465 |
msgstr ""
|
466 |
|
467 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
468 |
-
msgid "
|
|
|
|
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
472 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
473 |
msgid "Connection Test"
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
477 |
msgid ""
|
478 |
-
"Click this button to perform a connection test. If successful,
|
479 |
-
"
|
480 |
-
msgstr ""
|
481 |
-
|
482 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:91
|
483 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:92
|
484 |
-
msgid "Generate Webhook"
|
485 |
-
msgstr ""
|
486 |
-
|
487 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:94
|
488 |
-
msgid "Click this button to configure webhooks automatically."
|
489 |
msgstr ""
|
490 |
|
491 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
492 |
msgid "Webhook url"
|
493 |
msgstr ""
|
494 |
|
495 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
496 |
#, php-format
|
497 |
msgid ""
|
498 |
"<strong>Important:</strong> the webhook url is called by Stripe when events "
|
@@ -501,12 +498,12 @@ msgid ""
|
|
501 |
"%sWebhook guide%s"
|
502 |
msgstr ""
|
503 |
|
504 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
505 |
msgid "Live Webhook Secret"
|
506 |
msgstr ""
|
507 |
|
508 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
509 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
510 |
#, php-format
|
511 |
msgid ""
|
512 |
"The webhook secret is used to authenticate webhooks sent from Stripe. It "
|
@@ -514,20 +511,47 @@ msgid ""
|
|
514 |
"guide%s"
|
515 |
msgstr ""
|
516 |
|
517 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
518 |
msgid "Test Webhook Secret"
|
519 |
msgstr ""
|
520 |
|
521 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
522 |
msgid "Debug Log"
|
523 |
msgstr ""
|
524 |
|
525 |
-
#: includes/admin/settings/class-wc-stripe-api-settings.php:
|
526 |
msgid ""
|
527 |
"When enabled, the plugin logs important errors and info that can help you "
|
528 |
"troubleshoot potential issues."
|
529 |
msgstr ""
|
530 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
#: includes/admin/views/html-ach-fee.php:18
|
532 |
msgid "Taxable"
|
533 |
msgstr ""
|
@@ -609,7 +633,7 @@ msgid ""
|
|
609 |
msgstr ""
|
610 |
|
611 |
#: includes/class-wc-stripe-customer-manager.php:30
|
612 |
-
#: includes/class-wc-stripe-customer-manager.php:
|
613 |
#, php-format
|
614 |
msgid "Error saving customer. Reason: %s"
|
615 |
msgstr ""
|
@@ -620,31 +644,45 @@ msgid ""
|
|
620 |
"the funds are received."
|
621 |
msgstr ""
|
622 |
|
623 |
-
#: includes/class-wc-stripe-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
624 |
#, php-format
|
625 |
msgid "Error capturing charge. Reason: %s"
|
626 |
msgstr ""
|
627 |
|
628 |
-
#: includes/class-wc-stripe-redirect-handler.php:
|
629 |
#, php-format
|
630 |
msgid "Error retrieving payment source. Reason: %s"
|
631 |
msgstr ""
|
632 |
|
633 |
-
#: includes/class-wc-stripe-redirect-handler.php:
|
634 |
msgid "Payment authorization failed. Please select another payment method."
|
635 |
msgstr ""
|
636 |
|
|
|
|
|
|
|
|
|
637 |
#: includes/class-wc-stripe-rest-api.php:42
|
638 |
#, php-format
|
639 |
msgid "%1$s is an invalid controller name."
|
640 |
msgstr ""
|
641 |
|
642 |
-
#: includes/class-wc-stripe-update.php:
|
643 |
#, php-format
|
644 |
msgid "Thank you for updating Stripe for WooCommerce to version %1$s."
|
645 |
msgstr ""
|
646 |
|
647 |
-
#: includes/controllers/class-wc-stripe-controller-cart.php:
|
648 |
msgid "Quantity must be greater than zero."
|
649 |
msgstr ""
|
650 |
|
@@ -680,38 +718,30 @@ msgid ""
|
|
680 |
"the webhook, login to your Stripe Dashboard."
|
681 |
msgstr ""
|
682 |
|
683 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:
|
684 |
#, php-format
|
685 |
msgid ""
|
686 |
"Webhook created in Stripe for %s environment. You can test your webhook by "
|
687 |
"logging in to the Stripe dashboard"
|
688 |
msgstr ""
|
689 |
|
690 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:
|
691 |
-
msgid "Secret key cannot be empty."
|
692 |
-
msgstr ""
|
693 |
-
|
694 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:165
|
695 |
-
msgid "Publishable key cannot be empty."
|
696 |
-
msgstr ""
|
697 |
-
|
698 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:171
|
699 |
#, php-format
|
700 |
msgid "Mode: %s. Invalid secret key. Please check your entry."
|
701 |
msgstr ""
|
702 |
|
703 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:
|
704 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:
|
705 |
#, php-format
|
706 |
msgid "Mode: %s. Invalid publishable key. Please check your entry."
|
707 |
msgstr ""
|
708 |
|
709 |
-
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:
|
710 |
#, php-format
|
711 |
msgid "Connection test to Stripe was successful. Mode: %s."
|
712 |
msgstr ""
|
713 |
|
714 |
-
#: includes/controllers/class-wc-stripe-controller-googlepay.php:
|
715 |
msgid "Your shipping address is not serviceable."
|
716 |
msgstr ""
|
717 |
|
@@ -724,517 +754,418 @@ msgstr ""
|
|
724 |
msgid "Order total must be greater than zero."
|
725 |
msgstr ""
|
726 |
|
727 |
-
#: includes/controllers/class-wc-stripe-controller-order-actions.php:
|
728 |
#, php-format
|
729 |
msgid ""
|
730 |
"This order has already been processed. Transaction ID: %s. Payment method: %s"
|
731 |
msgstr ""
|
732 |
|
733 |
-
#: includes/controllers/class-wc-stripe-controller-order-actions.php:
|
734 |
msgid "Order customer Id and payment method customer Id do not match."
|
735 |
msgstr ""
|
736 |
|
737 |
-
#: includes/controllers/class-wc-stripe-controller-payment-intent.php:
|
738 |
#, php-format
|
739 |
msgid "Error creating payment intent. Reason: %s"
|
740 |
msgstr ""
|
741 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
742 |
#: includes/controllers/class-wc-stripe-controller-webhook.php:44
|
743 |
#: includes/controllers/class-wc-stripe-controller-webhook.php:45
|
744 |
msgid "Invalid signature received. Verify that your webhook secret is correct."
|
745 |
msgstr ""
|
746 |
|
747 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:
|
|
|
748 |
msgid "ACH"
|
749 |
msgstr ""
|
750 |
|
751 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:
|
|
|
752 |
msgid "Stripe ACH"
|
753 |
msgstr ""
|
754 |
|
755 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:
|
|
|
756 |
msgid "ACH gateway that integrates with your Stripe account."
|
757 |
msgstr ""
|
758 |
|
759 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:
|
|
|
760 |
msgid "Bank Payment"
|
761 |
msgstr ""
|
762 |
|
763 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:
|
|
|
764 |
msgid "Saved Banks"
|
765 |
msgstr ""
|
766 |
|
767 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:
|
|
|
768 |
msgid "New Bank"
|
769 |
msgstr ""
|
770 |
|
771 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:
|
772 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:
|
773 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
774 |
msgid "ACH Fee"
|
775 |
msgstr ""
|
776 |
|
777 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
778 |
#: includes/gateways/settings/applepay-settings.php:17
|
779 |
msgid "Apple Pay"
|
780 |
msgstr ""
|
781 |
|
782 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:
|
783 |
msgid "Stripe Apple Pay"
|
784 |
msgstr ""
|
785 |
|
786 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:
|
787 |
msgid "Apple Pay gateway that integrates with your Stripe account."
|
788 |
msgstr ""
|
789 |
|
790 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:
|
791 |
msgid "Please update you product quantity before using Apple Pay."
|
792 |
msgstr ""
|
793 |
|
794 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:
|
795 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:
|
796 |
msgid "Please select a product option before updating quantity."
|
797 |
msgstr ""
|
798 |
|
799 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:
|
800 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:
|
801 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:
|
802 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:49
|
803 |
msgid "Bancontact"
|
804 |
msgstr ""
|
805 |
|
806 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:
|
807 |
msgid "Bancontact gateway that integrates with your Stripe account."
|
808 |
msgstr ""
|
809 |
|
810 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
811 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:36
|
812 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:35
|
813 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:34
|
814 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:49
|
815 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:36
|
816 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:36
|
817 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:35
|
818 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:38
|
819 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:37
|
820 |
-
#: includes/gateways/settings/ach-settings.php:7
|
821 |
-
#: includes/gateways/settings/applepay-settings.php:7
|
822 |
-
#: includes/gateways/settings/cc-settings.php:4
|
823 |
-
#: includes/gateways/settings/googlepay-settings.php:10
|
824 |
-
#: includes/gateways/settings/payment-request-settings.php:8
|
825 |
-
msgid "Enabled"
|
826 |
-
msgstr ""
|
827 |
-
|
828 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:41
|
829 |
-
msgid "If enabled, your site can accept Bancontact payments through Stripe."
|
830 |
-
msgstr ""
|
831 |
-
|
832 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:45
|
833 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:44
|
834 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:43
|
835 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:42
|
836 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:57
|
837 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:44
|
838 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:44
|
839 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:43
|
840 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:46
|
841 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:45
|
842 |
-
#: includes/gateways/settings/ach-settings.php:49
|
843 |
-
#: includes/gateways/settings/applepay-settings.php:13
|
844 |
-
#: includes/gateways/settings/cc-settings.php:13
|
845 |
-
#: includes/gateways/settings/googlepay-settings.php:16
|
846 |
-
#: includes/gateways/settings/payment-request-settings.php:14
|
847 |
-
msgid "General Settings"
|
848 |
-
msgstr ""
|
849 |
-
|
850 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:51
|
851 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:52
|
852 |
-
msgid "Title of the Sofort gateway"
|
853 |
-
msgstr ""
|
854 |
-
|
855 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:54
|
856 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:53
|
857 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:52
|
858 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:51
|
859 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:66
|
860 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:53
|
861 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:53
|
862 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:52
|
863 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:55
|
864 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:54
|
865 |
-
#: includes/gateways/settings/ach-settings.php:58
|
866 |
-
#: includes/gateways/settings/applepay-settings.php:22
|
867 |
-
#: includes/gateways/settings/cc-settings.php:22
|
868 |
-
#: includes/gateways/settings/googlepay-settings.php:36
|
869 |
-
#: includes/gateways/settings/payment-request-settings.php:23
|
870 |
-
msgid "Description"
|
871 |
-
msgstr ""
|
872 |
-
|
873 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:56
|
874 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:55
|
875 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:54
|
876 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:53
|
877 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:68
|
878 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:55
|
879 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:55
|
880 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:54
|
881 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:57
|
882 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:56
|
883 |
-
#: includes/gateways/settings/ach-settings.php:60
|
884 |
-
#: includes/gateways/settings/applepay-settings.php:24
|
885 |
-
#: includes/gateways/settings/cc-settings.php:24
|
886 |
-
#: includes/gateways/settings/googlepay-settings.php:38
|
887 |
-
#: includes/gateways/settings/payment-request-settings.php:25
|
888 |
-
msgid "Leave blank if you don't want a description to show for the gateway."
|
889 |
-
msgstr ""
|
890 |
-
|
891 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:12
|
892 |
#: includes/gateways/settings/cc-settings.php:17
|
893 |
msgid "Credit Cards"
|
894 |
msgstr ""
|
895 |
|
896 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:
|
897 |
msgid "Stripe Credit Cards"
|
898 |
msgstr ""
|
899 |
|
900 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:
|
901 |
msgid "Credit card gateway that integrates with your Stripe account."
|
902 |
msgstr ""
|
903 |
|
904 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:
|
905 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:
|
906 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:
|
907 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
908 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:23
|
909 |
msgid "EPS"
|
910 |
msgstr ""
|
911 |
|
912 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:
|
913 |
msgid "EPS gateway that integrates with your Stripe account."
|
914 |
msgstr ""
|
915 |
|
916 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
917 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
918 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
919 |
-
|
920 |
-
msgid "If enabled, your site can accept P24 payments through Stripe."
|
921 |
msgstr ""
|
922 |
|
923 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
924 |
-
|
925 |
-
msgid "Title of the p24 gateway"
|
926 |
msgstr ""
|
927 |
|
928 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:
|
929 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:
|
930 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:
|
931 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:47
|
932 |
msgid "Giropay"
|
933 |
msgstr ""
|
934 |
|
935 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:
|
936 |
msgid "Giropay gateway that integrates with your Stripe account."
|
937 |
msgstr ""
|
938 |
|
939 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
940 |
-
msgid "If enabled, your site can Giropay card payments through Stripe."
|
941 |
-
msgstr ""
|
942 |
-
|
943 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:49
|
944 |
-
msgid "Title of the Giropay gateway"
|
945 |
-
msgstr ""
|
946 |
-
|
947 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:16
|
948 |
#: includes/gateways/settings/googlepay-settings.php:31
|
949 |
msgid "Google Pay"
|
950 |
msgstr ""
|
951 |
|
952 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
953 |
msgid "Stripe Google Pay"
|
954 |
msgstr ""
|
955 |
|
956 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
957 |
msgid "Google Pay gateway that integrates with your Stripe account."
|
958 |
msgstr ""
|
959 |
|
960 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
961 |
msgid "Please update you product quantity before using Google Pay."
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
965 |
msgid "Subscription"
|
966 |
msgstr ""
|
967 |
|
968 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
969 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
970 |
-
#: includes/wc-
|
|
|
971 |
msgid "Shipping"
|
972 |
msgstr ""
|
973 |
|
974 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
975 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
976 |
-
#: includes/wc-
|
|
|
977 |
msgid "Discount"
|
978 |
msgstr ""
|
979 |
|
980 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
981 |
-
#: includes/wc-stripe-functions.php:
|
982 |
msgid "Fees"
|
983 |
msgstr ""
|
984 |
|
985 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
986 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
987 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
988 |
-
#: includes/wc-stripe-functions.php:
|
989 |
msgid "Tax"
|
990 |
msgstr ""
|
991 |
|
992 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
993 |
-
#: includes/wc-stripe-functions.php:
|
994 |
msgid "Waiting..."
|
995 |
msgstr ""
|
996 |
|
997 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:
|
998 |
-
#: includes/wc-stripe-functions.php:
|
999 |
msgid "loading shipping methods..."
|
1000 |
msgstr ""
|
1001 |
|
1002 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
1003 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
1004 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
1005 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:46
|
1006 |
msgid "iDEAL"
|
1007 |
msgstr ""
|
1008 |
|
1009 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:
|
1010 |
msgid "Ideal gateway that integrates with your Stripe account."
|
1011 |
msgstr ""
|
1012 |
|
1013 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
1014 |
-
#: includes/gateways/
|
1015 |
-
|
1016 |
-
msgstr ""
|
1017 |
-
|
1018 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:48
|
1019 |
-
msgid "Title of the iDEAL gateway"
|
1020 |
-
msgstr ""
|
1021 |
-
|
1022 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:19
|
1023 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:22
|
1024 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:25
|
1025 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:61
|
1026 |
msgid "Klarna"
|
1027 |
msgstr ""
|
1028 |
|
1029 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
1030 |
msgid "Klarna gateway that integrates with your Stripe account."
|
1031 |
msgstr ""
|
1032 |
|
1033 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
1034 |
-
msgid "
|
1035 |
-
msgstr ""
|
1036 |
-
|
1037 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:63
|
1038 |
-
msgid "Title of the Klarna gateway"
|
1039 |
msgstr ""
|
1040 |
|
1041 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
1042 |
msgid "Pay Now"
|
1043 |
msgstr ""
|
1044 |
|
1045 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
1046 |
msgid "Pay Later"
|
1047 |
msgstr ""
|
1048 |
|
1049 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:
|
1050 |
msgid "Pay Over Time"
|
1051 |
msgstr ""
|
1052 |
|
1053 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
1054 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
1055 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:48
|
1056 |
msgid "Multibanco"
|
1057 |
msgstr ""
|
1058 |
|
1059 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:
|
1060 |
msgid "Multibanco gateway that integrates with your Stripe account."
|
1061 |
msgstr ""
|
1062 |
|
1063 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
1064 |
-
|
1065 |
-
msgstr ""
|
1066 |
-
|
1067 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:50
|
1068 |
-
msgid "Title of the Multibanco gateway"
|
1069 |
-
msgstr ""
|
1070 |
-
|
1071 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:20
|
1072 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:23
|
1073 |
msgid "Przelewy24"
|
1074 |
msgstr ""
|
1075 |
|
1076 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
1077 |
msgid "P24 gateway that integrates with your Stripe account."
|
1078 |
msgstr ""
|
1079 |
|
1080 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:
|
1081 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:48
|
1082 |
msgid "P24"
|
1083 |
msgstr ""
|
1084 |
|
1085 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:
|
1086 |
msgid "PaymentRequest Gateway"
|
1087 |
msgstr ""
|
1088 |
|
1089 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:
|
1090 |
msgid "Stripe Payment Request"
|
1091 |
msgstr ""
|
1092 |
|
1093 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:
|
1094 |
msgid ""
|
1095 |
"Gateway that renders based on the user's browser. Chrome payment methods, "
|
1096 |
"Microsoft pay, etc."
|
1097 |
msgstr ""
|
1098 |
|
1099 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:
|
1100 |
msgid "Please update you product quantity before paying."
|
1101 |
msgstr ""
|
1102 |
|
1103 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:
|
1104 |
msgid "Adding to cart..."
|
1105 |
msgstr ""
|
1106 |
|
1107 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1108 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1109 |
msgid "SEPA"
|
1110 |
msgstr ""
|
1111 |
|
1112 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1113 |
msgid "Sepa"
|
1114 |
msgstr ""
|
1115 |
|
1116 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:
|
1117 |
msgid "Sepa gateway that integrates with your Stripe account."
|
1118 |
msgstr ""
|
1119 |
|
1120 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
1121 |
-
|
1122 |
-
msgstr ""
|
1123 |
-
|
1124 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:49
|
1125 |
-
msgid "Title of the Sepa gateway"
|
1126 |
-
msgstr ""
|
1127 |
-
|
1128 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:22
|
1129 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:25
|
1130 |
msgid "Sofort"
|
1131 |
msgstr ""
|
1132 |
|
1133 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:
|
1134 |
msgid "Sofort gateway that integrates with your Stripe account."
|
1135 |
msgstr ""
|
1136 |
|
1137 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:
|
1138 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:50
|
1139 |
msgid "SOFORT"
|
1140 |
msgstr ""
|
1141 |
|
1142 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:21
|
1147 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:24
|
1148 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:27
|
1149 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:49
|
1150 |
msgid "WeChat"
|
1151 |
msgstr ""
|
1152 |
|
1153 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
1154 |
msgid "WeChat gateway that integrates with your Stripe account."
|
1155 |
msgstr ""
|
1156 |
|
1157 |
-
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:
|
1158 |
-
msgid "
|
|
|
|
|
1159 |
msgstr ""
|
1160 |
|
|
|
1161 |
#: includes/gateways/settings/ach-settings.php:4
|
1162 |
msgid "For US customers only."
|
1163 |
msgstr ""
|
1164 |
|
|
|
1165 |
#: includes/gateways/settings/ach-settings.php:4
|
1166 |
#, php-format
|
1167 |
msgid "Read through our %sdocumentation%s to configure ACH payments"
|
1168 |
msgstr ""
|
1169 |
|
|
|
1170 |
#: includes/gateways/settings/ach-settings.php:10
|
1171 |
msgid "If enabled, your site can accept ACH payments through Stripe."
|
1172 |
msgstr ""
|
1173 |
|
|
|
1174 |
#: includes/gateways/settings/ach-settings.php:13
|
1175 |
-
msgid "Plaid
|
1176 |
msgstr ""
|
1177 |
|
|
|
1178 |
#: includes/gateways/settings/ach-settings.php:16
|
1179 |
-
msgid "
|
1180 |
-
msgstr ""
|
1181 |
-
|
1182 |
-
#: includes/gateways/settings/ach-settings.php:18
|
1183 |
-
msgid "ID that identifies your Plaid account."
|
1184 |
-
msgstr ""
|
1185 |
-
|
1186 |
-
#: includes/gateways/settings/ach-settings.php:22
|
1187 |
-
msgid "Public Key"
|
1188 |
-
msgstr ""
|
1189 |
-
|
1190 |
-
#: includes/gateways/settings/ach-settings.php:24
|
1191 |
-
msgid "Used to identify ACH payments initiated from your site."
|
1192 |
msgstr ""
|
1193 |
|
1194 |
-
#: includes/gateways/settings/ach-settings.php:
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
#: includes/gateways/settings/ach-settings.php:31
|
1199 |
-
msgid "Sandbox Secret"
|
1200 |
-
msgstr ""
|
1201 |
-
|
1202 |
-
#: includes/gateways/settings/ach-settings.php:33
|
1203 |
-
msgid ""
|
1204 |
-
"Key that acts as a password when connecting to Plaid's sandbox environment."
|
1205 |
msgstr ""
|
1206 |
|
1207 |
-
#: includes/gateways/settings/ach-settings.php:
|
1208 |
-
|
|
|
1209 |
msgstr ""
|
1210 |
|
1211 |
-
#: includes/gateways/settings/ach-settings.php:
|
1212 |
msgid ""
|
1213 |
-
"
|
1214 |
-
"
|
|
|
|
|
|
|
|
|
1215 |
msgstr ""
|
1216 |
|
1217 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1218 |
msgid "ACH Payment"
|
1219 |
msgstr ""
|
1220 |
|
1221 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1222 |
msgid "Title of the ACH gateway"
|
1223 |
msgstr ""
|
1224 |
|
1225 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1226 |
msgid "Client Name"
|
1227 |
msgstr ""
|
1228 |
|
1229 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1230 |
msgid "The name that appears on the ACH payment screen."
|
1231 |
msgstr ""
|
1232 |
|
1233 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1234 |
msgid "ACH Display"
|
1235 |
msgstr ""
|
1236 |
|
1237 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1238 |
#: includes/gateways/settings/applepay-settings.php:34
|
1239 |
#: includes/gateways/settings/cc-settings.php:34
|
1240 |
#: includes/gateways/settings/googlepay-settings.php:48
|
@@ -1244,24 +1175,86 @@ msgid ""
|
|
1244 |
"your customers on orders, subscriptions, etc."
|
1245 |
msgstr ""
|
1246 |
|
1247 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1248 |
msgid "None"
|
1249 |
msgstr ""
|
1250 |
|
1251 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1252 |
msgid "Amount"
|
1253 |
msgstr ""
|
1254 |
|
1255 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1256 |
msgid "Percentage"
|
1257 |
msgstr ""
|
1258 |
|
1259 |
-
#: includes/gateways/settings/ach-settings.php:
|
|
|
1260 |
msgid ""
|
1261 |
"You can assign a fee to the order for ACH payments. Amount is a static "
|
1262 |
"amount and percentage is a percentage of the cart amount."
|
1263 |
msgstr ""
|
1264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1265 |
#: includes/gateways/settings/applepay-settings.php:4
|
1266 |
msgid "Register Domain"
|
1267 |
msgstr ""
|
@@ -1408,6 +1401,10 @@ msgstr ""
|
|
1408 |
msgid "Product button type"
|
1409 |
msgstr ""
|
1410 |
|
|
|
|
|
|
|
|
|
1411 |
#: includes/gateways/settings/cc-settings.php:10
|
1412 |
#, php-format
|
1413 |
msgid "%sTest cards%s"
|
@@ -1442,6 +1439,7 @@ msgid "Visa"
|
|
1442 |
msgstr ""
|
1443 |
|
1444 |
#: includes/gateways/settings/cc-settings.php:70
|
|
|
1445 |
msgid "Amex"
|
1446 |
msgstr ""
|
1447 |
|
@@ -1603,7 +1601,9 @@ msgstr ""
|
|
1603 |
|
1604 |
#: includes/gateways/settings/googlepay-settings.php:96
|
1605 |
msgid ""
|
1606 |
-
"This is the icon style that appears next to the gateway on the checkout
|
|
|
|
|
1607 |
msgstr ""
|
1608 |
|
1609 |
#: includes/gateways/settings/googlepay-settings.php:99
|
@@ -1702,7 +1702,7 @@ msgstr ""
|
|
1702 |
|
1703 |
#: includes/tokens/class-wc-payment-token-stripe-ach.php:61
|
1704 |
#: includes/tokens/class-wc-payment-token-stripe-ach.php:66
|
1705 |
-
#: includes/tokens/class-wc-payment-token-stripe-cc.php:
|
1706 |
msgid "Type Ending In"
|
1707 |
msgstr ""
|
1708 |
|
@@ -1714,31 +1714,31 @@ msgstr ""
|
|
1714 |
msgid "{bank_name} **** {last4}"
|
1715 |
msgstr ""
|
1716 |
|
1717 |
-
#: includes/tokens/class-wc-payment-token-stripe-cc.php:
|
1718 |
msgid "{brand} ending in {last4}"
|
1719 |
msgstr ""
|
1720 |
|
1721 |
-
#: includes/tokens/class-wc-payment-token-stripe-cc.php:
|
1722 |
msgid "Type Masked Number"
|
1723 |
msgstr ""
|
1724 |
|
1725 |
-
#: includes/tokens/class-wc-payment-token-stripe-cc.php:
|
1726 |
msgid "Type Dash Masked Number"
|
1727 |
msgstr ""
|
1728 |
|
1729 |
-
#: includes/tokens/class-wc-payment-token-stripe-cc.php:
|
1730 |
msgid "Type Last 4"
|
1731 |
msgstr ""
|
1732 |
|
1733 |
-
#: includes/tokens/class-wc-payment-token-stripe-cc.php:
|
1734 |
msgid "Type Dash & Last 4"
|
1735 |
msgstr ""
|
1736 |
|
1737 |
-
#: includes/tokens/class-wc-payment-token-stripe-cc.php:
|
1738 |
msgid "Last Four"
|
1739 |
msgstr ""
|
1740 |
|
1741 |
-
#: includes/tokens/class-wc-payment-token-stripe-cc.php:
|
1742 |
msgid "Card Type"
|
1743 |
msgstr ""
|
1744 |
|
@@ -1746,27 +1746,63 @@ msgstr ""
|
|
1746 |
msgid "Gateway Title"
|
1747 |
msgstr ""
|
1748 |
|
1749 |
-
#: includes/wc-stripe-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1750 |
msgid "Please enter a valid postcode / ZIP."
|
1751 |
msgstr ""
|
1752 |
|
1753 |
-
#: includes/wc-stripe-functions.php:
|
1754 |
msgid "Bootstrap form"
|
1755 |
msgstr ""
|
1756 |
|
1757 |
-
#: includes/wc-stripe-functions.php:
|
1758 |
msgid "Simple form"
|
1759 |
msgstr ""
|
1760 |
|
1761 |
-
#: includes/wc-stripe-functions.php:
|
1762 |
msgid "Minimalist form"
|
1763 |
msgstr ""
|
1764 |
|
1765 |
-
#: includes/wc-stripe-functions.php:
|
1766 |
msgid "Inline Form"
|
1767 |
msgstr ""
|
1768 |
|
1769 |
-
#: includes/wc-stripe-functions.php:
|
1770 |
msgid "Rounded Form"
|
1771 |
msgstr ""
|
1772 |
|
@@ -1774,6 +1810,10 @@ msgstr ""
|
|
1774 |
msgid "Charge.succeeded webhook recieved. Payment has been completed."
|
1775 |
msgstr ""
|
1776 |
|
|
|
|
|
|
|
|
|
1777 |
#: stripe-payments.php:16
|
1778 |
#, php-format
|
1779 |
msgid "Your PHP version is %s but Stripe requires version 5.4+."
|
@@ -1783,22 +1823,22 @@ msgstr ""
|
|
1783 |
msgid "or"
|
1784 |
msgstr ""
|
1785 |
|
1786 |
-
#: templates/cc-forms/bootstrap.php:10 templates/cc-forms/inline.php:
|
1787 |
#: templates/cc-forms/minimalist.php:22 templates/cc-forms/simple.php:12
|
1788 |
msgid "Card Number"
|
1789 |
msgstr ""
|
1790 |
|
1791 |
-
#: templates/cc-forms/bootstrap.php:20 templates/cc-forms/inline.php:
|
1792 |
#: templates/cc-forms/minimalist.php:30 templates/cc-forms/simple.php:26
|
1793 |
msgid "CVV"
|
1794 |
msgstr ""
|
1795 |
|
1796 |
-
#: templates/cc-forms/bootstrap.php:25 templates/cc-forms/inline.php:
|
1797 |
#: templates/cc-forms/simple.php:34
|
1798 |
msgid "ZIP"
|
1799 |
msgstr ""
|
1800 |
|
1801 |
-
#: templates/cc-forms/inline.php:
|
1802 |
msgid "Exp Date"
|
1803 |
msgstr ""
|
1804 |
|
@@ -1833,3 +1873,7 @@ msgstr ""
|
|
1833 |
#: templates/checkout/checkout-banner.php:9
|
1834 |
msgid "Express Checkout"
|
1835 |
msgstr ""
|
|
|
|
|
|
|
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: woo-stripe-payment\n"
|
5 |
+
"POT-Creation-Date: 2020-03-31 11:53-0700\n"
|
6 |
"PO-Revision-Date: 2019-08-16 14:27-0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 2.3\n"
|
14 |
"X-Poedit-Basepath: ../..\n"
|
15 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
"X-Poedit-KeywordsList: __;_e;_x\n"
|
18 |
"X-Poedit-SearchPath-1: templates\n"
|
19 |
"X-Poedit-SearchPath-2: stripe-payments.php\n"
|
20 |
|
21 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:93
|
22 |
+
#: includes/gateways/settings/ach-settings-v2.php:7
|
23 |
+
#: includes/gateways/settings/ach-settings.php:7
|
24 |
+
#: includes/gateways/settings/applepay-settings.php:7
|
25 |
+
#: includes/gateways/settings/cc-settings.php:4
|
26 |
+
#: includes/gateways/settings/googlepay-settings.php:10
|
27 |
+
#: includes/gateways/settings/payment-request-settings.php:8
|
28 |
+
msgid "Enabled"
|
|
|
|
|
|
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:97
|
32 |
#, php-format
|
33 |
+
msgid "If enabled, your site can accept %s payments through Stripe."
|
|
|
|
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:101
|
37 |
+
#: includes/gateways/settings/ach-settings-v2.php:58
|
38 |
+
#: includes/gateways/settings/ach-settings.php:59
|
39 |
+
#: includes/gateways/settings/applepay-settings.php:13
|
40 |
+
#: includes/gateways/settings/cc-settings.php:13
|
41 |
+
#: includes/gateways/settings/googlepay-settings.php:16
|
42 |
+
#: includes/gateways/settings/payment-request-settings.php:14
|
43 |
+
msgid "General Settings"
|
44 |
msgstr ""
|
45 |
|
46 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:104
|
47 |
+
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:47
|
48 |
+
#: includes/gateways/settings/ach-settings-v2.php:61
|
49 |
+
#: includes/gateways/settings/ach-settings.php:62
|
50 |
+
#: includes/gateways/settings/applepay-settings.php:16
|
51 |
+
#: includes/gateways/settings/cc-settings.php:16
|
52 |
+
#: includes/gateways/settings/googlepay-settings.php:30
|
53 |
+
#: includes/gateways/settings/payment-request-settings.php:17
|
54 |
+
msgid "Title"
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:107
|
|
|
58 |
#, php-format
|
59 |
+
msgid "Title of the %s gateway"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:110
|
63 |
+
#: includes/gateways/settings/ach-settings-v2.php:67
|
64 |
+
#: includes/gateways/settings/ach-settings.php:68
|
65 |
+
#: includes/gateways/settings/applepay-settings.php:22
|
66 |
+
#: includes/gateways/settings/cc-settings.php:22
|
67 |
+
#: includes/gateways/settings/googlepay-settings.php:36
|
68 |
+
#: includes/gateways/settings/payment-request-settings.php:23
|
69 |
+
msgid "Description"
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:112
|
73 |
+
#: includes/gateways/settings/ach-settings-v2.php:69
|
74 |
+
#: includes/gateways/settings/ach-settings.php:70
|
75 |
+
#: includes/gateways/settings/applepay-settings.php:24
|
76 |
+
#: includes/gateways/settings/cc-settings.php:24
|
77 |
+
#: includes/gateways/settings/googlepay-settings.php:38
|
78 |
+
#: includes/gateways/settings/payment-request-settings.php:25
|
79 |
+
msgid "Leave blank if you don't want a description to show for the gateway."
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:157
|
83 |
#, php-format
|
84 |
+
msgid "Order %s"
|
|
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:203
|
|
|
88 |
#, php-format
|
89 |
+
msgid "Gateway will appear when store currency is <strong>%s</strong>"
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:206
|
|
|
|
|
|
|
93 |
#, php-format
|
94 |
+
msgid " & billing country is <strong>%s</strong>"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:334
|
98 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:112
|
99 |
#, php-format
|
100 |
+
msgid "Error processing payment. Reason: %s"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:341
|
104 |
#, php-format
|
105 |
msgid ""
|
106 |
+
"Charge %s is pending. Payment Method: %s. Payment will be completed once "
|
107 |
+
"charge.succeeded webhook received from Stripe."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:349
|
111 |
#, php-format
|
112 |
msgid "Order %s successful in Stripe. Charge: %s. Payment Method: %s"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:349
|
116 |
msgid "charge"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:349
|
120 |
msgid "authorization"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:375
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
msgid ""
|
125 |
"Please read and accept the terms and conditions to proceed with your order."
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:390
|
129 |
+
#: includes/controllers/class-wc-stripe-controller-cart.php:132
|
130 |
+
#: includes/controllers/class-wc-stripe-controller-cart.php:181
|
131 |
+
#: includes/controllers/class-wc-stripe-controller-googlepay.php:127
|
132 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:72
|
133 |
msgid "Total"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:448
|
137 |
msgid "User must be logged in."
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:460
|
141 |
#, php-format
|
142 |
msgid "Error saving your payment method. Reason: %s"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:474
|
146 |
#, php-format
|
147 |
msgid "Error saving payment method. Reason: %s"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:491
|
151 |
+
#, php-format
|
152 |
+
msgid "Order refunded in Stripe. Amount: %s"
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:520
|
156 |
#, php-format
|
157 |
+
msgid "Order amount captured in Stripe. Amount: %s"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:524
|
161 |
+
#, php-format
|
162 |
+
msgid "Error capturing charge in Stripe. Reason: %s"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:540
|
166 |
+
#, php-format
|
167 |
+
msgid "Error voiding charge. Reason: %s"
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:542
|
171 |
+
msgid "Charge voided in Stripe."
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:701
|
175 |
msgid "n/a"
|
176 |
msgstr ""
|
177 |
|
178 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:724
|
179 |
#: includes/admin/meta-boxes/views/html-order-pay.php:42
|
180 |
msgid "New Card"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:728
|
184 |
#: includes/admin/meta-boxes/views/html-order-pay.php:30
|
185 |
msgid "Saved Cards"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:885
|
189 |
#, php-format
|
190 |
msgid "Attemp to save payment method failed. Reason: %s"
|
191 |
msgstr ""
|
192 |
|
193 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:905
|
194 |
msgid ""
|
195 |
"We were not able to save your payment method. To prevent billing issues with "
|
196 |
"your subscription, please add a payment method to the subscription."
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:907
|
200 |
#, php-format
|
201 |
msgid "We were not able to save your payment method. Reason: %s"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:939
|
205 |
msgid "Payment Method Token"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:958
|
209 |
+
#, php-format
|
210 |
+
msgid "Recurring payment for order failed. Reason: %s"
|
211 |
+
msgstr ""
|
212 |
+
|
213 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:967
|
214 |
+
#, php-format
|
215 |
+
msgid "Recurring payment captured in Stripe. Payment method: %s"
|
216 |
+
msgstr ""
|
217 |
+
|
218 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:969
|
219 |
+
#, php-format
|
220 |
+
msgid "Recurring payment authorized in Stripe. Payment method: %s"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:972
|
224 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1216
|
225 |
+
#, php-format
|
226 |
+
msgid "Customer must manually complete payment for payment method %s"
|
227 |
+
msgstr ""
|
228 |
+
|
229 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:988
|
230 |
#, php-format
|
231 |
msgid "Error saving payment method for subscription. Reason: %s"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1043
|
235 |
+
#: includes/abstract/abstract-wc-stripe-payment.php:166
|
236 |
#, php-format
|
237 |
msgid "Order %s from %s"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1203
|
241 |
+
#, php-format
|
242 |
+
msgid "Pre-order payment for order failed. Reason: %s"
|
243 |
+
msgstr ""
|
244 |
+
|
245 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1211
|
246 |
+
#, php-format
|
247 |
+
msgid "Pre-order payment captured in Stripe. Payment method: %s"
|
248 |
+
msgstr ""
|
249 |
+
|
250 |
+
#: includes/abstract/abstract-wc-payment-gateway-stripe.php:1213
|
251 |
+
#, php-format
|
252 |
+
msgid "Pre-order payment authorized in Stripe. Payment method: %s"
|
253 |
+
msgstr ""
|
254 |
+
|
255 |
+
#: includes/abstract/abstract-wc-payment-token-stripe.php:168
|
256 |
+
#: includes/abstract/abstract-wc-payment-token-stripe.php:174
|
257 |
+
#, php-format
|
258 |
+
msgid "Error deleting Stripe card. Token Id: %s"
|
259 |
+
msgstr ""
|
260 |
+
|
261 |
+
#: includes/abstract/abstract-wc-stripe-payment.php:95
|
262 |
+
msgid "Transaction Id cannot be empty."
|
263 |
+
msgstr ""
|
264 |
+
|
265 |
#: includes/abstract/abstract-wc-stripe-rest-controller.php:56
|
266 |
msgid "You do not have permissions to access this resource."
|
267 |
msgstr ""
|
284 |
msgid "Documentation"
|
285 |
msgstr ""
|
286 |
|
287 |
+
#: includes/admin/class-wc-stripe-admin-notices.php:40
|
288 |
+
#, php-format
|
289 |
+
msgid ""
|
290 |
+
"At Stripe's request we have updated how the Stripe for WooCommerce\n"
|
291 |
+
"\t\t\t\t\t\t\t\t\tplugin integrates with Stripe. This new integration offers "
|
292 |
+
"even more security and \n"
|
293 |
+
"\t\t\t\t\t\t\t\t\tStripe is requesting that all merchants switch. %sUpdate "
|
294 |
+
"Integration%s"
|
295 |
+
msgstr ""
|
296 |
+
|
297 |
#: includes/admin/class-wc-stripe-admin-settings.php:73
|
298 |
msgid "Local Gateways"
|
299 |
msgstr ""
|
326 |
msgstr ""
|
327 |
|
328 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:24
|
329 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:35
|
330 |
msgid "Mode"
|
331 |
msgstr ""
|
332 |
|
333 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
|
334 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:39
|
335 |
+
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:144
|
336 |
msgid "Live"
|
337 |
msgstr ""
|
338 |
|
339 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
|
340 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:38
|
341 |
+
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:144
|
342 |
msgid "Test"
|
343 |
msgstr ""
|
344 |
|
360 |
msgid "Payment Method"
|
361 |
msgstr ""
|
362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
#: includes/admin/meta-boxes/views/html-charge-data-subview.php:51
|
364 |
#: includes/admin/views/html-ach-fee.php:10
|
365 |
#: includes/gateways/settings/payment-request-settings.php:73
|
440 |
msgid "Authorize"
|
441 |
msgstr ""
|
442 |
|
443 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:12
|
444 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:32
|
|
|
|
|
|
|
|
|
|
|
445 |
msgid "API Settings"
|
446 |
msgstr ""
|
447 |
|
448 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:42
|
449 |
msgid ""
|
450 |
+
"The mode determines if you are processing test transactions or live "
|
451 |
"transactions on your site. Test mode allows you to simulate payments so you "
|
452 |
"can test your integration."
|
453 |
msgstr ""
|
454 |
|
455 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:46
|
456 |
+
msgid "Account ID"
|
457 |
msgstr ""
|
458 |
|
459 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:49
|
460 |
+
msgid "This is your Stripe Connect ID and serves as a unique identifier."
|
|
|
|
|
|
|
|
|
|
|
461 |
msgstr ""
|
462 |
|
463 |
#: includes/admin/settings/class-wc-stripe-api-settings.php:53
|
464 |
+
msgid "Connect Stripe Account"
|
|
|
465 |
msgstr ""
|
466 |
|
467 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:54
|
468 |
+
msgid "Click to Connect"
|
469 |
msgstr ""
|
470 |
|
471 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:56
|
472 |
+
msgid ""
|
473 |
+
"We make it easy to connect Stripe to your site. Click the Connect button to "
|
474 |
+
"go through our connect flow."
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:60
|
478 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:61
|
479 |
msgid "Connection Test"
|
480 |
msgstr ""
|
481 |
|
482 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:63
|
483 |
msgid ""
|
484 |
+
"Click this button to perform a connection test. If successful, your site is "
|
485 |
+
"connected to Stripe."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:67
|
489 |
msgid "Webhook url"
|
490 |
msgstr ""
|
491 |
|
492 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:70
|
493 |
#, php-format
|
494 |
msgid ""
|
495 |
"<strong>Important:</strong> the webhook url is called by Stripe when events "
|
498 |
"%sWebhook guide%s"
|
499 |
msgstr ""
|
500 |
|
501 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:74
|
502 |
msgid "Live Webhook Secret"
|
503 |
msgstr ""
|
504 |
|
505 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:75
|
506 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:85
|
507 |
#, php-format
|
508 |
msgid ""
|
509 |
"The webhook secret is used to authenticate webhooks sent from Stripe. It "
|
511 |
"guide%s"
|
512 |
msgstr ""
|
513 |
|
514 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:84
|
515 |
msgid "Test Webhook Secret"
|
516 |
msgstr ""
|
517 |
|
518 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:93
|
519 |
msgid "Debug Log"
|
520 |
msgstr ""
|
521 |
|
522 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:97
|
523 |
msgid ""
|
524 |
"When enabled, the plugin logs important errors and info that can help you "
|
525 |
"troubleshoot potential issues."
|
526 |
msgstr ""
|
527 |
|
528 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:102
|
529 |
+
#, php-format
|
530 |
+
msgid ""
|
531 |
+
"%s Your Stripe account has been connected. You can now accept Live and Test "
|
532 |
+
"payments. You can Re-Connect if you want to recycle your API keys for "
|
533 |
+
"security."
|
534 |
+
msgstr ""
|
535 |
+
|
536 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:118
|
537 |
+
msgid "Click To Re-Connect"
|
538 |
+
msgstr ""
|
539 |
+
|
540 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:135
|
541 |
+
msgid "Please try again."
|
542 |
+
msgstr ""
|
543 |
+
|
544 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:138
|
545 |
+
#, php-format
|
546 |
+
msgid "We were not able to connect your Stripe account. Reason: %s"
|
547 |
+
msgstr ""
|
548 |
+
|
549 |
+
#: includes/admin/settings/class-wc-stripe-api-settings.php:158
|
550 |
+
msgid ""
|
551 |
+
"Your Stripe account has been connected to your WooCommerce store. You may "
|
552 |
+
"now accept payments in Live and Test mode."
|
553 |
+
msgstr ""
|
554 |
+
|
555 |
#: includes/admin/views/html-ach-fee.php:18
|
556 |
msgid "Taxable"
|
557 |
msgstr ""
|
633 |
msgstr ""
|
634 |
|
635 |
#: includes/class-wc-stripe-customer-manager.php:30
|
636 |
+
#: includes/class-wc-stripe-customer-manager.php:39
|
637 |
#, php-format
|
638 |
msgid "Error saving customer. Reason: %s"
|
639 |
msgstr ""
|
644 |
"the funds are received."
|
645 |
msgstr ""
|
646 |
|
647 |
+
#: includes/class-wc-stripe-frontend-scripts.php:57
|
648 |
+
msgid "No matches found"
|
649 |
+
msgstr ""
|
650 |
+
|
651 |
+
#: includes/class-wc-stripe-gateway-ach.php:48
|
652 |
+
msgid ""
|
653 |
+
"Please update your ACH environment to Production to match your Stripe API "
|
654 |
+
"Mode."
|
655 |
+
msgstr ""
|
656 |
+
|
657 |
+
#: includes/class-wc-stripe-gateway.php:223
|
658 |
#, php-format
|
659 |
msgid "Error capturing charge. Reason: %s"
|
660 |
msgstr ""
|
661 |
|
662 |
+
#: includes/class-wc-stripe-redirect-handler.php:52
|
663 |
#, php-format
|
664 |
msgid "Error retrieving payment source. Reason: %s"
|
665 |
msgstr ""
|
666 |
|
667 |
+
#: includes/class-wc-stripe-redirect-handler.php:56
|
668 |
msgid "Payment authorization failed. Please select another payment method."
|
669 |
msgstr ""
|
670 |
|
671 |
+
#: includes/class-wc-stripe-redirect-handler.php:57
|
672 |
+
msgid "Payment authorization failed."
|
673 |
+
msgstr ""
|
674 |
+
|
675 |
#: includes/class-wc-stripe-rest-api.php:42
|
676 |
#, php-format
|
677 |
msgid "%1$s is an invalid controller name."
|
678 |
msgstr ""
|
679 |
|
680 |
+
#: includes/class-wc-stripe-update.php:35
|
681 |
#, php-format
|
682 |
msgid "Thank you for updating Stripe for WooCommerce to version %1$s."
|
683 |
msgstr ""
|
684 |
|
685 |
+
#: includes/controllers/class-wc-stripe-controller-cart.php:95
|
686 |
msgid "Quantity must be greater than zero."
|
687 |
msgstr ""
|
688 |
|
718 |
"the webhook, login to your Stripe Dashboard."
|
719 |
msgstr ""
|
720 |
|
721 |
+
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:144
|
722 |
#, php-format
|
723 |
msgid ""
|
724 |
"Webhook created in Stripe for %s environment. You can test your webhook by "
|
725 |
"logging in to the Stripe dashboard"
|
726 |
msgstr ""
|
727 |
|
728 |
+
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:164
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
#, php-format
|
730 |
msgid "Mode: %s. Invalid secret key. Please check your entry."
|
731 |
msgstr ""
|
732 |
|
733 |
+
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:177
|
734 |
+
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:180
|
735 |
#, php-format
|
736 |
msgid "Mode: %s. Invalid publishable key. Please check your entry."
|
737 |
msgstr ""
|
738 |
|
739 |
+
#: includes/controllers/class-wc-stripe-controller-gateway-settings.php:188
|
740 |
#, php-format
|
741 |
msgid "Connection test to Stripe was successful. Mode: %s."
|
742 |
msgstr ""
|
743 |
|
744 |
+
#: includes/controllers/class-wc-stripe-controller-googlepay.php:90
|
745 |
msgid "Your shipping address is not serviceable."
|
746 |
msgstr ""
|
747 |
|
754 |
msgid "Order total must be greater than zero."
|
755 |
msgstr ""
|
756 |
|
757 |
+
#: includes/controllers/class-wc-stripe-controller-order-actions.php:179
|
758 |
#, php-format
|
759 |
msgid ""
|
760 |
"This order has already been processed. Transaction ID: %s. Payment method: %s"
|
761 |
msgstr ""
|
762 |
|
763 |
+
#: includes/controllers/class-wc-stripe-controller-order-actions.php:188
|
764 |
msgid "Order customer Id and payment method customer Id do not match."
|
765 |
msgstr ""
|
766 |
|
767 |
+
#: includes/controllers/class-wc-stripe-controller-payment-intent.php:53
|
768 |
#, php-format
|
769 |
msgid "Error creating payment intent. Reason: %s"
|
770 |
msgstr ""
|
771 |
|
772 |
+
#: includes/controllers/class-wc-stripe-controller-payment-intent.php:67
|
773 |
+
msgid "Invalid order id provided"
|
774 |
+
msgstr ""
|
775 |
+
|
776 |
+
#: includes/controllers/class-wc-stripe-controller-payment-intent.php:77
|
777 |
+
msgid "You are not authorized to update this order."
|
778 |
+
msgstr ""
|
779 |
+
|
780 |
#: includes/controllers/class-wc-stripe-controller-webhook.php:44
|
781 |
#: includes/controllers/class-wc-stripe-controller-webhook.php:45
|
782 |
msgid "Invalid signature received. Verify that your webhook secret is correct."
|
783 |
msgstr ""
|
784 |
|
785 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:24
|
786 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:24
|
787 |
msgid "ACH"
|
788 |
msgstr ""
|
789 |
|
790 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:27
|
791 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:27
|
792 |
msgid "Stripe ACH"
|
793 |
msgstr ""
|
794 |
|
795 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:28
|
796 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:28
|
797 |
msgid "ACH gateway that integrates with your Stripe account."
|
798 |
msgstr ""
|
799 |
|
800 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:30
|
801 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:30
|
802 |
msgid "Bank Payment"
|
803 |
msgstr ""
|
804 |
|
805 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:124
|
806 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:200
|
807 |
msgid "Saved Banks"
|
808 |
msgstr ""
|
809 |
|
810 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:128
|
811 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:204
|
812 |
msgid "New Bank"
|
813 |
msgstr ""
|
814 |
|
815 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:169
|
816 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:260
|
817 |
+
msgid ""
|
818 |
+
"You must set the API mode to live in order to enable the Plaid development "
|
819 |
+
"environment."
|
820 |
+
msgstr ""
|
821 |
+
|
822 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:210
|
823 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php:213
|
824 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:301
|
825 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ach.php:304
|
826 |
+
#: includes/gateways/settings/ach-settings-v2.php:88
|
827 |
+
#: includes/gateways/settings/ach-settings.php:89
|
828 |
msgid "ACH Fee"
|
829 |
msgstr ""
|
830 |
|
831 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-alipay.php:23
|
832 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-alipay.php:26
|
833 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-alipay.php:29
|
834 |
+
msgid "Alipay"
|
835 |
+
msgstr ""
|
836 |
+
|
837 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-alipay.php:27
|
838 |
+
msgid "Alipay gateway that integrates with your Stripe account."
|
839 |
+
msgstr ""
|
840 |
+
|
841 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:19
|
842 |
#: includes/gateways/settings/applepay-settings.php:17
|
843 |
msgid "Apple Pay"
|
844 |
msgstr ""
|
845 |
|
846 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:22
|
847 |
msgid "Stripe Apple Pay"
|
848 |
msgstr ""
|
849 |
|
850 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:23
|
851 |
msgid "Apple Pay gateway that integrates with your Stripe account."
|
852 |
msgstr ""
|
853 |
|
854 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:62
|
855 |
msgid "Please update you product quantity before using Apple Pay."
|
856 |
msgstr ""
|
857 |
|
858 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:63
|
859 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:69
|
860 |
msgid "Please select a product option before updating quantity."
|
861 |
msgstr ""
|
862 |
|
863 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:23
|
864 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:26
|
865 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:29
|
|
|
866 |
msgid "Bancontact"
|
867 |
msgstr ""
|
868 |
|
869 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:27
|
870 |
msgid "Bancontact gateway that integrates with your Stripe account."
|
871 |
msgstr ""
|
872 |
|
873 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:16
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
874 |
#: includes/gateways/settings/cc-settings.php:17
|
875 |
msgid "Credit Cards"
|
876 |
msgstr ""
|
877 |
|
878 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:19
|
879 |
msgid "Stripe Credit Cards"
|
880 |
msgstr ""
|
881 |
|
882 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-cc.php:20
|
883 |
msgid "Credit card gateway that integrates with your Stripe account."
|
884 |
msgstr ""
|
885 |
|
886 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:22
|
887 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:25
|
888 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:28
|
889 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:25
|
|
|
890 |
msgid "EPS"
|
891 |
msgstr ""
|
892 |
|
893 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-eps.php:26
|
894 |
msgid "EPS gateway that integrates with your Stripe account."
|
895 |
msgstr ""
|
896 |
|
897 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-fpx.php:24
|
898 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-fpx.php:25
|
899 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-fpx.php:28
|
900 |
+
msgid "FPX"
|
|
|
901 |
msgstr ""
|
902 |
|
903 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-fpx.php:26
|
904 |
+
msgid "FPX gateway that integrates with your Stripe account."
|
|
|
905 |
msgstr ""
|
906 |
|
907 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:21
|
908 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:24
|
909 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:27
|
|
|
910 |
msgid "Giropay"
|
911 |
msgstr ""
|
912 |
|
913 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-giropay.php:25
|
914 |
msgid "Giropay gateway that integrates with your Stripe account."
|
915 |
msgstr ""
|
916 |
|
917 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:18
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
918 |
#: includes/gateways/settings/googlepay-settings.php:31
|
919 |
msgid "Google Pay"
|
920 |
msgstr ""
|
921 |
|
922 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:21
|
923 |
msgid "Stripe Google Pay"
|
924 |
msgstr ""
|
925 |
|
926 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:22
|
927 |
msgid "Google Pay gateway that integrates with your Stripe account."
|
928 |
msgstr ""
|
929 |
|
930 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:77
|
931 |
msgid "Please update you product quantity before using Google Pay."
|
932 |
msgstr ""
|
933 |
|
934 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:90
|
935 |
msgid "Subscription"
|
936 |
msgstr ""
|
937 |
|
938 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:120
|
939 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:168
|
940 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:150
|
941 |
+
#: includes/wc-stripe-functions.php:355 includes/wc-stripe-functions.php:402
|
942 |
msgid "Shipping"
|
943 |
msgstr ""
|
944 |
|
945 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:128
|
946 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:189
|
947 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:160
|
948 |
+
#: includes/wc-stripe-functions.php:371 includes/wc-stripe-functions.php:410
|
949 |
msgid "Discount"
|
950 |
msgstr ""
|
951 |
|
952 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:139
|
953 |
+
#: includes/wc-stripe-functions.php:421
|
954 |
msgid "Fees"
|
955 |
msgstr ""
|
956 |
|
957 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:147
|
958 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:197
|
959 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:181
|
960 |
+
#: includes/wc-stripe-functions.php:379 includes/wc-stripe-functions.php:429
|
961 |
msgid "Tax"
|
962 |
msgstr ""
|
963 |
|
964 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:228
|
965 |
+
#: includes/wc-stripe-functions.php:481
|
966 |
msgid "Waiting..."
|
967 |
msgstr ""
|
968 |
|
969 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:229
|
970 |
+
#: includes/wc-stripe-functions.php:482
|
971 |
msgid "loading shipping methods..."
|
972 |
msgstr ""
|
973 |
|
974 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:26
|
975 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:27
|
976 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:30
|
|
|
977 |
msgid "iDEAL"
|
978 |
msgstr ""
|
979 |
|
980 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-ideal.php:28
|
981 |
msgid "Ideal gateway that integrates with your Stripe account."
|
982 |
msgstr ""
|
983 |
|
984 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:21
|
985 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:24
|
986 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:27
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
msgid "Klarna"
|
988 |
msgstr ""
|
989 |
|
990 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:25
|
991 |
msgid "Klarna gateway that integrates with your Stripe account."
|
992 |
msgstr ""
|
993 |
|
994 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:173
|
995 |
+
msgid "Fee"
|
|
|
|
|
|
|
|
|
996 |
msgstr ""
|
997 |
|
998 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:209
|
999 |
msgid "Pay Now"
|
1000 |
msgstr ""
|
1001 |
|
1002 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:210
|
1003 |
msgid "Pay Later"
|
1004 |
msgstr ""
|
1005 |
|
1006 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:211
|
1007 |
msgid "Pay Over Time"
|
1008 |
msgstr ""
|
1009 |
|
1010 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:22
|
1011 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:28
|
|
|
1012 |
msgid "Multibanco"
|
1013 |
msgstr ""
|
1014 |
|
1015 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-multibanco.php:26
|
1016 |
msgid "Multibanco gateway that integrates with your Stripe account."
|
1017 |
msgstr ""
|
1018 |
|
1019 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:22
|
1020 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:25
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1021 |
msgid "Przelewy24"
|
1022 |
msgstr ""
|
1023 |
|
1024 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:26
|
1025 |
msgid "P24 gateway that integrates with your Stripe account."
|
1026 |
msgstr ""
|
1027 |
|
1028 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-p24.php:28
|
|
|
1029 |
msgid "P24"
|
1030 |
msgstr ""
|
1031 |
|
1032 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:20
|
1033 |
msgid "PaymentRequest Gateway"
|
1034 |
msgstr ""
|
1035 |
|
1036 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:23
|
1037 |
msgid "Stripe Payment Request"
|
1038 |
msgstr ""
|
1039 |
|
1040 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:24
|
1041 |
msgid ""
|
1042 |
"Gateway that renders based on the user's browser. Chrome payment methods, "
|
1043 |
"Microsoft pay, etc."
|
1044 |
msgstr ""
|
1045 |
|
1046 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:67
|
1047 |
msgid "Please update you product quantity before paying."
|
1048 |
msgstr ""
|
1049 |
|
1050 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:68
|
1051 |
msgid "Adding to cart..."
|
1052 |
msgstr ""
|
1053 |
|
1054 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:21
|
1055 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:27
|
1056 |
msgid "SEPA"
|
1057 |
msgstr ""
|
1058 |
|
1059 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:24
|
1060 |
msgid "Sepa"
|
1061 |
msgstr ""
|
1062 |
|
1063 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:25
|
1064 |
msgid "Sepa gateway that integrates with your Stripe account."
|
1065 |
msgstr ""
|
1066 |
|
1067 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:24
|
1068 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:27
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1069 |
msgid "Sofort"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:28
|
1073 |
msgid "Sofort gateway that integrates with your Stripe account."
|
1074 |
msgstr ""
|
1075 |
|
1076 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-sofort.php:30
|
|
|
1077 |
msgid "SOFORT"
|
1078 |
msgstr ""
|
1079 |
|
1080 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:23
|
1081 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:26
|
1082 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:29
|
|
|
|
|
|
|
|
|
|
|
1083 |
msgid "WeChat"
|
1084 |
msgstr ""
|
1085 |
|
1086 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:27
|
1087 |
msgid "WeChat gateway that integrates with your Stripe account."
|
1088 |
msgstr ""
|
1089 |
|
1090 |
+
#: includes/gateways/class-wc-payment-gateway-stripe-wechat.php:62
|
1091 |
+
msgid ""
|
1092 |
+
"Scan the QR code using your WeChat app. Once scanned click the Place Order "
|
1093 |
+
"button."
|
1094 |
msgstr ""
|
1095 |
|
1096 |
+
#: includes/gateways/settings/ach-settings-v2.php:4
|
1097 |
#: includes/gateways/settings/ach-settings.php:4
|
1098 |
msgid "For US customers only."
|
1099 |
msgstr ""
|
1100 |
|
1101 |
+
#: includes/gateways/settings/ach-settings-v2.php:4
|
1102 |
#: includes/gateways/settings/ach-settings.php:4
|
1103 |
#, php-format
|
1104 |
msgid "Read through our %sdocumentation%s to configure ACH payments"
|
1105 |
msgstr ""
|
1106 |
|
1107 |
+
#: includes/gateways/settings/ach-settings-v2.php:10
|
1108 |
#: includes/gateways/settings/ach-settings.php:10
|
1109 |
msgid "If enabled, your site can accept ACH payments through Stripe."
|
1110 |
msgstr ""
|
1111 |
|
1112 |
+
#: includes/gateways/settings/ach-settings-v2.php:13
|
1113 |
#: includes/gateways/settings/ach-settings.php:13
|
1114 |
+
msgid "Plaid Environment"
|
1115 |
msgstr ""
|
1116 |
|
1117 |
+
#: includes/gateways/settings/ach-settings-v2.php:15
|
1118 |
#: includes/gateways/settings/ach-settings.php:16
|
1119 |
+
msgid "Sandbox"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1120 |
msgstr ""
|
1121 |
|
1122 |
+
#: includes/gateways/settings/ach-settings-v2.php:16
|
1123 |
+
#: includes/gateways/settings/ach-settings.php:17
|
1124 |
+
msgid "Development"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1125 |
msgstr ""
|
1126 |
|
1127 |
+
#: includes/gateways/settings/ach-settings-v2.php:17
|
1128 |
+
#: includes/gateways/settings/ach-settings.php:18
|
1129 |
+
msgid "Production"
|
1130 |
msgstr ""
|
1131 |
|
1132 |
+
#: includes/gateways/settings/ach-settings-v2.php:19
|
1133 |
msgid ""
|
1134 |
+
"This setting determines the Plaid environment you are connecting with. When "
|
1135 |
+
"you are ready to accept live transactions, switch this option to Production."
|
1136 |
+
"<br><strong>Production</strong> - accept live ACH payments "
|
1137 |
+
"<br><strong>Development</strong> - use real bank login details with test "
|
1138 |
+
"transactions <br><strong>Sandbox</strong> - test integration using test "
|
1139 |
+
"credentials"
|
1140 |
msgstr ""
|
1141 |
|
1142 |
+
#: includes/gateways/settings/ach-settings-v2.php:62
|
1143 |
+
#: includes/gateways/settings/ach-settings.php:63
|
1144 |
msgid "ACH Payment"
|
1145 |
msgstr ""
|
1146 |
|
1147 |
+
#: includes/gateways/settings/ach-settings-v2.php:64
|
1148 |
+
#: includes/gateways/settings/ach-settings.php:65
|
1149 |
msgid "Title of the ACH gateway"
|
1150 |
msgstr ""
|
1151 |
|
1152 |
+
#: includes/gateways/settings/ach-settings-v2.php:73
|
1153 |
+
#: includes/gateways/settings/ach-settings.php:74
|
1154 |
msgid "Client Name"
|
1155 |
msgstr ""
|
1156 |
|
1157 |
+
#: includes/gateways/settings/ach-settings-v2.php:75
|
1158 |
+
#: includes/gateways/settings/ach-settings.php:76
|
1159 |
msgid "The name that appears on the ACH payment screen."
|
1160 |
msgstr ""
|
1161 |
|
1162 |
+
#: includes/gateways/settings/ach-settings-v2.php:79
|
1163 |
+
#: includes/gateways/settings/ach-settings.php:80
|
1164 |
msgid "ACH Display"
|
1165 |
msgstr ""
|
1166 |
|
1167 |
+
#: includes/gateways/settings/ach-settings-v2.php:85
|
1168 |
+
#: includes/gateways/settings/ach-settings.php:86
|
1169 |
#: includes/gateways/settings/applepay-settings.php:34
|
1170 |
#: includes/gateways/settings/cc-settings.php:34
|
1171 |
#: includes/gateways/settings/googlepay-settings.php:48
|
1175 |
"your customers on orders, subscriptions, etc."
|
1176 |
msgstr ""
|
1177 |
|
1178 |
+
#: includes/gateways/settings/ach-settings-v2.php:95
|
1179 |
+
#: includes/gateways/settings/ach-settings.php:96
|
1180 |
msgid "None"
|
1181 |
msgstr ""
|
1182 |
|
1183 |
+
#: includes/gateways/settings/ach-settings-v2.php:96
|
1184 |
+
#: includes/gateways/settings/ach-settings.php:97
|
1185 |
msgid "Amount"
|
1186 |
msgstr ""
|
1187 |
|
1188 |
+
#: includes/gateways/settings/ach-settings-v2.php:97
|
1189 |
+
#: includes/gateways/settings/ach-settings.php:98
|
1190 |
msgid "Percentage"
|
1191 |
msgstr ""
|
1192 |
|
1193 |
+
#: includes/gateways/settings/ach-settings-v2.php:99
|
1194 |
+
#: includes/gateways/settings/ach-settings.php:100
|
1195 |
msgid ""
|
1196 |
"You can assign a fee to the order for ACH payments. Amount is a static "
|
1197 |
"amount and percentage is a percentage of the cart amount."
|
1198 |
msgstr ""
|
1199 |
|
1200 |
+
#: includes/gateways/settings/ach-settings.php:20
|
1201 |
+
msgid ""
|
1202 |
+
"The active Plaid environment. You must set API mode to live to use Plaid's "
|
1203 |
+
"development environment."
|
1204 |
+
msgstr ""
|
1205 |
+
|
1206 |
+
#: includes/gateways/settings/ach-settings.php:23
|
1207 |
+
msgid "Plaid Keys"
|
1208 |
+
msgstr ""
|
1209 |
+
|
1210 |
+
#: includes/gateways/settings/ach-settings.php:26
|
1211 |
+
msgid "Client ID"
|
1212 |
+
msgstr ""
|
1213 |
+
|
1214 |
+
#: includes/gateways/settings/ach-settings.php:28
|
1215 |
+
msgid "ID that identifies your Plaid account."
|
1216 |
+
msgstr ""
|
1217 |
+
|
1218 |
+
#: includes/gateways/settings/ach-settings.php:32
|
1219 |
+
msgid "Public Key"
|
1220 |
+
msgstr ""
|
1221 |
+
|
1222 |
+
#: includes/gateways/settings/ach-settings.php:34
|
1223 |
+
msgid "Used to identify ACH payments initiated from your site."
|
1224 |
+
msgstr ""
|
1225 |
+
|
1226 |
+
#: includes/gateways/settings/ach-settings.php:38
|
1227 |
+
msgid "Plaid Secrets"
|
1228 |
+
msgstr ""
|
1229 |
+
|
1230 |
+
#: includes/gateways/settings/ach-settings.php:41
|
1231 |
+
msgid "Sandbox Secret"
|
1232 |
+
msgstr ""
|
1233 |
+
|
1234 |
+
#: includes/gateways/settings/ach-settings.php:43
|
1235 |
+
msgid ""
|
1236 |
+
"Key that acts as a password when connecting to Plaid's sandbox environment."
|
1237 |
+
msgstr ""
|
1238 |
+
|
1239 |
+
#: includes/gateways/settings/ach-settings.php:47
|
1240 |
+
msgid "Development Secret"
|
1241 |
+
msgstr ""
|
1242 |
+
|
1243 |
+
#: includes/gateways/settings/ach-settings.php:49
|
1244 |
+
msgid ""
|
1245 |
+
"Development allows you to test real bank credentials with test transactions."
|
1246 |
+
msgstr ""
|
1247 |
+
|
1248 |
+
#: includes/gateways/settings/ach-settings.php:53
|
1249 |
+
msgid "Production Secret"
|
1250 |
+
msgstr ""
|
1251 |
+
|
1252 |
+
#: includes/gateways/settings/ach-settings.php:55
|
1253 |
+
msgid ""
|
1254 |
+
"Key that acts as a password when connecting to Plaid's production "
|
1255 |
+
"environment."
|
1256 |
+
msgstr ""
|
1257 |
+
|
1258 |
#: includes/gateways/settings/applepay-settings.php:4
|
1259 |
msgid "Register Domain"
|
1260 |
msgstr ""
|
1401 |
msgid "Product button type"
|
1402 |
msgstr ""
|
1403 |
|
1404 |
+
#: includes/gateways/settings/cc-settings.php:7
|
1405 |
+
msgid "If enabled, your site can accept credit card payments through Stripe."
|
1406 |
+
msgstr ""
|
1407 |
+
|
1408 |
#: includes/gateways/settings/cc-settings.php:10
|
1409 |
#, php-format
|
1410 |
msgid "%sTest cards%s"
|
1439 |
msgstr ""
|
1440 |
|
1441 |
#: includes/gateways/settings/cc-settings.php:70
|
1442 |
+
#: includes/wc-stripe-functions.php:1037
|
1443 |
msgid "Amex"
|
1444 |
msgstr ""
|
1445 |
|
1601 |
|
1602 |
#: includes/gateways/settings/googlepay-settings.php:96
|
1603 |
msgid ""
|
1604 |
+
"This is the icon style that appears next to the gateway on the checkout "
|
1605 |
+
"page. Google's API team typically requires the With Outline option on the "
|
1606 |
+
"checkout page for branding purposes."
|
1607 |
msgstr ""
|
1608 |
|
1609 |
#: includes/gateways/settings/googlepay-settings.php:99
|
1702 |
|
1703 |
#: includes/tokens/class-wc-payment-token-stripe-ach.php:61
|
1704 |
#: includes/tokens/class-wc-payment-token-stripe-ach.php:66
|
1705 |
+
#: includes/tokens/class-wc-payment-token-stripe-cc.php:82
|
1706 |
msgid "Type Ending In"
|
1707 |
msgstr ""
|
1708 |
|
1714 |
msgid "{bank_name} **** {last4}"
|
1715 |
msgstr ""
|
1716 |
|
1717 |
+
#: includes/tokens/class-wc-payment-token-stripe-cc.php:84
|
1718 |
msgid "{brand} ending in {last4}"
|
1719 |
msgstr ""
|
1720 |
|
1721 |
+
#: includes/tokens/class-wc-payment-token-stripe-cc.php:87
|
1722 |
msgid "Type Masked Number"
|
1723 |
msgstr ""
|
1724 |
|
1725 |
+
#: includes/tokens/class-wc-payment-token-stripe-cc.php:92
|
1726 |
msgid "Type Dash Masked Number"
|
1727 |
msgstr ""
|
1728 |
|
1729 |
+
#: includes/tokens/class-wc-payment-token-stripe-cc.php:97
|
1730 |
msgid "Type Last 4"
|
1731 |
msgstr ""
|
1732 |
|
1733 |
+
#: includes/tokens/class-wc-payment-token-stripe-cc.php:102
|
1734 |
msgid "Type Dash & Last 4"
|
1735 |
msgstr ""
|
1736 |
|
1737 |
+
#: includes/tokens/class-wc-payment-token-stripe-cc.php:107
|
1738 |
msgid "Last Four"
|
1739 |
msgstr ""
|
1740 |
|
1741 |
+
#: includes/tokens/class-wc-payment-token-stripe-cc.php:112
|
1742 |
msgid "Card Type"
|
1743 |
msgstr ""
|
1744 |
|
1746 |
msgid "Gateway Title"
|
1747 |
msgstr ""
|
1748 |
|
1749 |
+
#: includes/traits/wc-stripe-payment-traits.php:83
|
1750 |
+
#: includes/traits/wc-stripe-payment-traits.php:84
|
1751 |
+
#, php-format
|
1752 |
+
msgid "Error creating payment source. Reason: %s"
|
1753 |
+
msgstr ""
|
1754 |
+
|
1755 |
+
#: includes/updates/update-3.1.0.php:29 includes/updates/update-3.1.0.php:52
|
1756 |
+
msgid "Stripe For WooCommerce Update"
|
1757 |
+
msgstr ""
|
1758 |
+
|
1759 |
+
#: includes/updates/update-3.1.0.php:31
|
1760 |
+
msgid "Greetings from Payment Plugins,"
|
1761 |
+
msgstr ""
|
1762 |
+
|
1763 |
+
#: includes/updates/update-3.1.0.php:32
|
1764 |
+
msgid ""
|
1765 |
+
"At Stripe's request, we have updated Stripe for WooCommerce to use the new "
|
1766 |
+
"Stripe Connect integration. This new integration offers even more security "
|
1767 |
+
"and Stripe is requesting that all merchants switch."
|
1768 |
+
msgstr ""
|
1769 |
+
|
1770 |
+
#: includes/updates/update-3.1.0.php:33
|
1771 |
+
#, php-format
|
1772 |
+
msgid ""
|
1773 |
+
"Click %shere%s to be redirected to your Stripe API settings page where you "
|
1774 |
+
"should click the <strong>Click to Connect</strong> button."
|
1775 |
+
msgstr ""
|
1776 |
+
|
1777 |
+
#: includes/updates/update-3.1.0.php:42
|
1778 |
+
msgid "Kind Regards,"
|
1779 |
+
msgstr ""
|
1780 |
+
|
1781 |
+
#: includes/updates/update-3.1.0.php:43
|
1782 |
+
msgid "Payment Plugins"
|
1783 |
+
msgstr ""
|
1784 |
+
|
1785 |
+
#: includes/wc-stripe-functions.php:262
|
1786 |
msgid "Please enter a valid postcode / ZIP."
|
1787 |
msgstr ""
|
1788 |
|
1789 |
+
#: includes/wc-stripe-functions.php:701
|
1790 |
msgid "Bootstrap form"
|
1791 |
msgstr ""
|
1792 |
|
1793 |
+
#: includes/wc-stripe-functions.php:735
|
1794 |
msgid "Simple form"
|
1795 |
msgstr ""
|
1796 |
|
1797 |
+
#: includes/wc-stripe-functions.php:768
|
1798 |
msgid "Minimalist form"
|
1799 |
msgstr ""
|
1800 |
|
1801 |
+
#: includes/wc-stripe-functions.php:802
|
1802 |
msgid "Inline Form"
|
1803 |
msgstr ""
|
1804 |
|
1805 |
+
#: includes/wc-stripe-functions.php:838
|
1806 |
msgid "Rounded Form"
|
1807 |
msgstr ""
|
1808 |
|
1810 |
msgid "Charge.succeeded webhook recieved. Payment has been completed."
|
1811 |
msgstr ""
|
1812 |
|
1813 |
+
#: includes/wc-stripe-webhook-functions.php:113
|
1814 |
+
msgid "payment_intent.succeeded webhook recieved. Payment has been completed."
|
1815 |
+
msgstr ""
|
1816 |
+
|
1817 |
#: stripe-payments.php:16
|
1818 |
#, php-format
|
1819 |
msgid "Your PHP version is %s but Stripe requires version 5.4+."
|
1823 |
msgid "or"
|
1824 |
msgstr ""
|
1825 |
|
1826 |
+
#: templates/cc-forms/bootstrap.php:10 templates/cc-forms/inline.php:9
|
1827 |
#: templates/cc-forms/minimalist.php:22 templates/cc-forms/simple.php:12
|
1828 |
msgid "Card Number"
|
1829 |
msgstr ""
|
1830 |
|
1831 |
+
#: templates/cc-forms/bootstrap.php:20 templates/cc-forms/inline.php:17
|
1832 |
#: templates/cc-forms/minimalist.php:30 templates/cc-forms/simple.php:26
|
1833 |
msgid "CVV"
|
1834 |
msgstr ""
|
1835 |
|
1836 |
+
#: templates/cc-forms/bootstrap.php:25 templates/cc-forms/inline.php:22
|
1837 |
#: templates/cc-forms/simple.php:34
|
1838 |
msgid "ZIP"
|
1839 |
msgstr ""
|
1840 |
|
1841 |
+
#: templates/cc-forms/inline.php:13
|
1842 |
msgid "Exp Date"
|
1843 |
msgstr ""
|
1844 |
|
1873 |
#: templates/checkout/checkout-banner.php:9
|
1874 |
msgid "Express Checkout"
|
1875 |
msgstr ""
|
1876 |
+
|
1877 |
+
#: templates/checkout/credit-card.php:17
|
1878 |
+
msgid "Save Card"
|
1879 |
+
msgstr ""
|
includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -9,7 +9,7 @@ if (! class_exists ( 'WC_Payment_Gateway_Stripe_Charge' )) {
|
|
9 |
* @author Payment Plugins
|
10 |
*
|
11 |
*/
|
12 |
-
abstract class WC_Payment_Gateway_Stripe_Local_Payment extends
|
13 |
|
14 |
protected $tab_title = '';
|
15 |
|
@@ -55,41 +55,6 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
55 |
) );
|
56 |
}
|
57 |
|
58 |
-
public function process_payment($order_id) {
|
59 |
-
$order = wc_get_order ( $order_id );
|
60 |
-
if (! $this->processing_payment) {
|
61 |
-
$source_id = $this->get_new_source_token ();
|
62 |
-
if (! empty ( $source_id )) {
|
63 |
-
// source was created client side.
|
64 |
-
$source = $this->gateway->fetch_payment_source ( $source_id );
|
65 |
-
|
66 |
-
// save the order ID to the session. Stripe doesn't allow the source object's
|
67 |
-
// redirect url to be updated so we can't pass order_id in url params.
|
68 |
-
WC ()->session->set ( 'wc_stripe_order_id', $order_id );
|
69 |
-
} else {
|
70 |
-
// create the source
|
71 |
-
$source = $this->gateway->create_source ( $this->get_source_args ( $order ) );
|
72 |
-
}
|
73 |
-
|
74 |
-
if (is_wp_error ( $source )) {
|
75 |
-
wc_add_notice ( sprintf ( __ ( 'Error creating payment source. Reason: %s', 'woo-stripe-payment' ), $source->get_error_message () ), 'error' );
|
76 |
-
$order->update_status ( 'failed', sprintf ( __ ( 'Error creating payment source. Reason: %s', 'woo-stripe-payment' ), $source->get_error_message () ) );
|
77 |
-
return $this->order_error ();
|
78 |
-
}
|
79 |
-
|
80 |
-
$order->update_meta_data ( '_stripe_source_id', $source->id );
|
81 |
-
$order->update_meta_data ( '_wc_stripe_mode', wc_stripe_mode () );
|
82 |
-
|
83 |
-
$order->save ();
|
84 |
-
|
85 |
-
return [ 'result' => 'success',
|
86 |
-
'redirect' => $this->get_source_redirect_url ( $source, $order )
|
87 |
-
];
|
88 |
-
} else {
|
89 |
-
return parent::process_payment ( $order_id );
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
/**
|
94 |
*
|
95 |
* @param \Stripe\Source $source
|
@@ -120,7 +85,34 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
120 |
* @return array
|
121 |
*/
|
122 |
public function get_local_payment_settings() {
|
123 |
-
return [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
|
126 |
public function get_localized_params() {
|
@@ -164,7 +156,7 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
164 |
'currency' => $order->get_currency (),
|
165 |
'statement_descriptor' => sprintf ( __ ( 'Order %s', 'woo-stripe-payment' ), $order->get_order_number () ),
|
166 |
'owner' => [
|
167 |
-
'name' => $this->get_name_from_order ( $order, 'billing' ),
|
168 |
'email' => $order->get_billing_email ()
|
169 |
],
|
170 |
'redirect' => [
|
@@ -195,7 +187,7 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
|
|
195 |
}
|
196 |
}
|
197 |
|
198 |
-
public function get_payment_token($method_id, $method_details) {
|
199 |
/**
|
200 |
*
|
201 |
* @var WC_Payment_Token_Stripe_Local $token
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
9 |
* @author Payment Plugins
|
10 |
*
|
11 |
*/
|
12 |
+
abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gateway_Stripe {
|
13 |
|
14 |
protected $tab_title = '';
|
15 |
|
55 |
) );
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
/**
|
59 |
*
|
60 |
* @param \Stripe\Source $source
|
85 |
* @return array
|
86 |
*/
|
87 |
public function get_local_payment_settings() {
|
88 |
+
return [
|
89 |
+
'desc' => array( 'type' => 'description',
|
90 |
+
'description' => $this->get_payment_description ()
|
91 |
+
),
|
92 |
+
'enabled' => array(
|
93 |
+
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
94 |
+
'type' => 'checkbox',
|
95 |
+
'default' => 'no', 'value' => 'yes',
|
96 |
+
'desc_tip' => true,
|
97 |
+
'description' => sprintf ( __ ( 'If enabled, your site can accept %s payments through Stripe.', 'woo-stripe-payment' ), $this->get_method_title () )
|
98 |
+
),
|
99 |
+
'general_settings' => array(
|
100 |
+
'type' => 'title',
|
101 |
+
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
102 |
+
),
|
103 |
+
'title_text' => array( 'type' => 'text',
|
104 |
+
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
105 |
+
'default' => $this->get_method_title (),
|
106 |
+
'desc_tip' => true,
|
107 |
+
'description' => sprintf ( __ ( 'Title of the %s gateway' ), $this->get_method_title () )
|
108 |
+
),
|
109 |
+
'description' => array(
|
110 |
+
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
111 |
+
'type' => 'text', 'default' => '',
|
112 |
+
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
113 |
+
'desc_tip' => true
|
114 |
+
)
|
115 |
+
];
|
116 |
}
|
117 |
|
118 |
public function get_localized_params() {
|
156 |
'currency' => $order->get_currency (),
|
157 |
'statement_descriptor' => sprintf ( __ ( 'Order %s', 'woo-stripe-payment' ), $order->get_order_number () ),
|
158 |
'owner' => [
|
159 |
+
'name' => $this->payment_object->get_name_from_order ( $order, 'billing' ),
|
160 |
'email' => $order->get_billing_email ()
|
161 |
],
|
162 |
'redirect' => [
|
187 |
}
|
188 |
}
|
189 |
|
190 |
+
public function get_payment_token($method_id, $method_details = []) {
|
191 |
/**
|
192 |
*
|
193 |
* @var WC_Payment_Token_Stripe_Local $token
|
includes/abstract/abstract-wc-payment-gateway-stripe.php
CHANGED
@@ -2,6 +2,12 @@
|
|
2 |
if (! class_exists ( 'WC_Payment_Gateway' )) {
|
3 |
return;
|
4 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
/**
|
6 |
*
|
7 |
* @since 3.0.0
|
@@ -10,25 +16,55 @@ if (! class_exists ( 'WC_Payment_Gateway' )) {
|
|
10 |
*
|
11 |
*/
|
12 |
abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
|
|
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
|
|
|
|
|
|
|
|
|
16 |
public $token_key;
|
17 |
|
|
|
|
|
|
|
|
|
18 |
public $saved_method_key;
|
19 |
|
|
|
|
|
|
|
|
|
20 |
public $payment_type_key;
|
21 |
|
|
|
|
|
|
|
|
|
22 |
public $payment_intent_key;
|
23 |
|
|
|
|
|
|
|
|
|
24 |
public $save_source_key;
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
public $template_name;
|
29 |
|
30 |
-
|
31 |
-
|
|
|
|
|
32 |
protected $checkout_error = false;
|
33 |
|
34 |
/**
|
@@ -56,6 +92,10 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
56 |
*/
|
57 |
protected $payment_method_token = null;
|
58 |
|
|
|
|
|
|
|
|
|
59 |
protected $new_source_token = null;
|
60 |
|
61 |
/**
|
@@ -65,6 +105,10 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
65 |
*/
|
66 |
public $synchronous = true;
|
67 |
|
|
|
|
|
|
|
|
|
68 |
protected $post_payment_processes = [];
|
69 |
|
70 |
/**
|
@@ -86,7 +130,9 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
86 |
$this->description = $this->get_option ( 'description' );
|
87 |
$this->hooks ();
|
88 |
$this->init_supports ();
|
89 |
-
$this->gateway =
|
|
|
|
|
90 |
}
|
91 |
|
92 |
public function hooks() {
|
@@ -142,11 +188,6 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
142 |
);
|
143 |
}
|
144 |
|
145 |
-
public function admin_nav_tab($tabs) {
|
146 |
-
$tabs[ $this->id ] = $this->tab_title;
|
147 |
-
return $tabs;
|
148 |
-
}
|
149 |
-
|
150 |
public function init_form_fields() {
|
151 |
$this->form_fields = include wc_stripe ()->plugin_path () . 'includes/gateways/settings/' . str_replace ( [
|
152 |
'stripe_', '_'
|
@@ -155,36 +196,6 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
155 |
$this->form_fields = apply_filters ( 'wc_stripe_form_fields_' . $this->id, $this->form_fields );
|
156 |
}
|
157 |
|
158 |
-
public function admin_options() {
|
159 |
-
if ($this->admin_output) {
|
160 |
-
return;
|
161 |
-
}
|
162 |
-
$this->output_settings_nav ();
|
163 |
-
printf ( '<input type="hidden" id="wc_stripe_prefix" name="wc_stripe_prefix" value="%1$s"/>', $this->get_prefix () );
|
164 |
-
echo '<div class="wc-stripe-settings-container ' . $this->id . '">';
|
165 |
-
parent::admin_options ();
|
166 |
-
echo '</div>';
|
167 |
-
$this->admin_output = true;
|
168 |
-
}
|
169 |
-
|
170 |
-
public function output_settings_nav() {
|
171 |
-
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-settings-nav.php';
|
172 |
-
}
|
173 |
-
|
174 |
-
public function get_prefix() {
|
175 |
-
return $this->plugin_id . $this->id . '_';
|
176 |
-
}
|
177 |
-
|
178 |
-
public function generate_multiselect_html($key, $data) {
|
179 |
-
$value = ( array ) $this->get_option ( $key, array() );
|
180 |
-
$data[ 'options' ] = array_merge ( array_flip ( $value ), $data[ 'options' ] );
|
181 |
-
return parent::generate_multiselect_html ( $key, $data );
|
182 |
-
}
|
183 |
-
|
184 |
-
public function is_active($key) {
|
185 |
-
return $this->get_option ( $key ) === 'yes';
|
186 |
-
}
|
187 |
-
|
188 |
public function get_method_formats() {
|
189 |
$class_name = 'WC_Payment_Token_' . $this->token_type;
|
190 |
if (class_exists ( $class_name )) {
|
@@ -285,6 +296,71 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
285 |
*/
|
286 |
public function enqueue_product_scripts($scripts) {}
|
287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
/**
|
289 |
*
|
290 |
* @return array
|
@@ -300,6 +376,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
300 |
),
|
301 |
'routes' => array(
|
302 |
'setup_intent' => wc_stripe ()->rest_api->payment_intent->rest_url ( 'setup-intent' ),
|
|
|
303 |
'add_to_cart' => wc_stripe ()->rest_api->cart->rest_url ( 'add-to-cart' ),
|
304 |
'cart_calculation' => wc_stripe ()->rest_api->cart->rest_url ( 'cart-calculation' ),
|
305 |
'shipping_method' => wc_stripe ()->rest_api->cart->rest_url ( 'shipping-method' ),
|
@@ -315,18 +392,6 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
315 |
);
|
316 |
}
|
317 |
|
318 |
-
/**
|
319 |
-
* Returns the payment method the customer wants to use.
|
320 |
-
* This can be a saved payment method
|
321 |
-
* or a new payment method.
|
322 |
-
*/
|
323 |
-
protected function get_payment_method_from_request() {
|
324 |
-
if ($this->use_saved_source ()) {
|
325 |
-
return $this->get_saved_source_id ();
|
326 |
-
}
|
327 |
-
return $this->get_new_source_token ();
|
328 |
-
}
|
329 |
-
|
330 |
/**
|
331 |
* Save the Stripe data to the order.
|
332 |
*
|
@@ -341,9 +406,9 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
341 |
$token = $this->get_payment_token ( $this->get_payment_method_from_charge ( $charge ), $charge->payment_method_details );
|
342 |
$order->set_transaction_id ( $charge->id );
|
343 |
$order->set_payment_method_title ( $token->get_payment_method_title () );
|
344 |
-
$order->update_meta_data (
|
345 |
-
$order->update_meta_data (
|
346 |
-
$order->update_meta_data (
|
347 |
$order->save ();
|
348 |
|
349 |
// if WCS is active and there are subscriptions in the order, save meta data
|
@@ -351,10 +416,10 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
351 |
foreach ( wcs_get_subscriptions_for_order ( $order ) as $subscription ) {
|
352 |
$subscription->set_transaction_id ( $charge->id );
|
353 |
$subscription->set_payment_method_title ( $token->get_payment_method_title () );
|
354 |
-
$subscription->update_meta_data (
|
355 |
-
$subscription->update_meta_data (
|
356 |
-
$subscription->update_meta_data (
|
357 |
-
$subscription->update_meta_data (
|
358 |
$subscription->save ();
|
359 |
}
|
360 |
}
|
@@ -366,7 +431,9 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
366 |
* @since 3.0.6
|
367 |
* @param \Stripe\Charge $charge
|
368 |
*/
|
369 |
-
public
|
|
|
|
|
370 |
|
371 |
/**
|
372 |
*
|
@@ -375,13 +442,16 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
375 |
* @see WC_Payment_Gateway::add_payment_method()
|
376 |
*/
|
377 |
public function add_payment_method() {
|
378 |
-
$
|
379 |
try {
|
380 |
if (! is_user_logged_in ()) {
|
381 |
throw new Exception ( __ ( 'User must be logged in.', 'woo-stripe-payment' ) );
|
382 |
}
|
|
|
|
|
|
|
383 |
if (empty ( $customer_id )) {
|
384 |
-
$customer_id = $this->create_customer (
|
385 |
}
|
386 |
|
387 |
$result = $this->create_payment_method ( $this->get_new_source_token (), $customer_id );
|
@@ -391,9 +461,9 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
391 |
return array( 'result' => 'error'
|
392 |
);
|
393 |
}
|
394 |
-
$result->set_user_id (
|
395 |
$result->save ();
|
396 |
-
WC_Payment_Tokens::set_users_default (
|
397 |
|
398 |
do_action ( 'wc_stripe_add_payment_method_success', $result );
|
399 |
|
@@ -407,28 +477,22 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
407 |
}
|
408 |
}
|
409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
public function process_refund($order_id, $amount = null, $reason = '') {
|
411 |
$order = wc_get_order ( $order_id );
|
412 |
-
$
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$result = $this->gateway->refund ( array(
|
419 |
-
'charge' => $charge,
|
420 |
-
'amount' => $amount_in_cents
|
421 |
-
), wc_stripe_order_mode ( $order ) );
|
422 |
-
if (! is_wp_error ( $result )) {
|
423 |
-
$order->add_order_note ( sprintf ( __ ( 'Order refunded in Stripe. Amount: %s', 'woo-stripe-payment' ), wc_price ( $amount, array(
|
424 |
-
'currency' => $order->get_currency ()
|
425 |
-
) ) ) );
|
426 |
-
return true;
|
427 |
-
}
|
428 |
-
return $result;
|
429 |
-
} catch ( Exception $e ) {
|
430 |
-
return new WP_Error ( 'refund-error', $e->getMessage () );
|
431 |
}
|
|
|
432 |
}
|
433 |
|
434 |
/**
|
@@ -437,14 +501,47 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
437 |
* @param float $amount
|
438 |
* @param WC_Order $order
|
439 |
*/
|
440 |
-
public function capture_charge($amount, $order) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
|
442 |
/**
|
443 |
* Void the Stripe charge.
|
444 |
*
|
445 |
* @param WC_Order $order
|
446 |
*/
|
447 |
-
public function void_charge($order) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
|
449 |
/**
|
450 |
* Return the \Stripe\Charge object
|
@@ -462,7 +559,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
462 |
* @param string $method_id
|
463 |
* @param \Stripe\Card|array $method_details
|
464 |
*/
|
465 |
-
public function get_payment_token($method_id, $method_details) {
|
466 |
$class_name = 'WC_Payment_Token_' . $this->token_type;
|
467 |
if (class_exists ( $class_name )) {
|
468 |
/**
|
@@ -470,11 +567,13 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
470 |
* @var WC_Payment_Token_Stripe $token
|
471 |
*/
|
472 |
$token = new $class_name ( '', $method_details );
|
473 |
-
$token->details_to_props ( $method_details );
|
474 |
$token->set_token ( $method_id );
|
475 |
$token->set_gateway_id ( $this->id );
|
476 |
$token->set_format ( $this->get_option ( 'method_format' ) );
|
477 |
$token->set_environment ( wc_stripe_mode () );
|
|
|
|
|
|
|
478 |
return $token;
|
479 |
}
|
480 |
}
|
@@ -484,32 +583,12 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
484 |
*
|
485 |
* @return array
|
486 |
*/
|
487 |
-
public function
|
488 |
wc_stripe_set_checkout_error ();
|
489 |
return array( 'result' => 'failure'
|
490 |
);
|
491 |
}
|
492 |
|
493 |
-
/**
|
494 |
-
*
|
495 |
-
* @param WC_Order $order
|
496 |
-
*/
|
497 |
-
protected function get_order_identifier($order) {
|
498 |
-
return sprintf ( '%s%s%s', $this->get_option ( 'order_prefix' ), $order->get_order_number (), $this->get_option ( 'order_suffix' ) );
|
499 |
-
}
|
500 |
-
|
501 |
-
/**
|
502 |
-
*
|
503 |
-
* @param WC_Order $order
|
504 |
-
*/
|
505 |
-
protected function get_name_from_order($order, $type) {
|
506 |
-
if ($type === 'billing') {
|
507 |
-
return sprintf ( '%s %s', $order->get_billing_first_name (), $order->get_billing_last_name () );
|
508 |
-
} else {
|
509 |
-
return sprintf ( '%s %s', $order->get_shipping_first_name (), $order->get_shipping_last_name () );
|
510 |
-
}
|
511 |
-
}
|
512 |
-
|
513 |
/**
|
514 |
* Return the payment source the customer has chosen to use.
|
515 |
* This can be a saved source
|
@@ -526,6 +605,15 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
526 |
}
|
527 |
}
|
528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
public function get_payment_intent_id() {
|
530 |
return ! empty ( $_POST[ $this->payment_intent_key ] ) ? $_POST[ $this->payment_intent_key ] : '';
|
531 |
}
|
@@ -583,7 +671,20 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
583 |
* WC Stripe customer ID
|
584 |
* @return WC_Payment_Token_Stripe|WP_Error
|
585 |
*/
|
586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
|
588 |
/**
|
589 |
*
|
@@ -609,7 +710,9 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
609 |
* @param string $token_id
|
610 |
* @param WC_Payment_Token_Stripe $token
|
611 |
*/
|
612 |
-
public function delete_payment_method($token_id, $token) {
|
|
|
|
|
613 |
|
614 |
public function saved_payment_methods($tokens = array()) {
|
615 |
wc_stripe_get_template ( 'payment-methods.php', array(
|
@@ -766,69 +869,10 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
766 |
return apply_filters ( 'wc_stripe_update_shipping_address_response', $data );
|
767 |
}
|
768 |
|
769 |
-
public function generate_button_demo_html($key, $data) {
|
770 |
-
$field_key = $this->get_field_key ( $key );
|
771 |
-
$data = wp_parse_args ( $data, array(
|
772 |
-
'title' => '', 'class' => '', 'style' => '',
|
773 |
-
'description' => '', 'desc_tip' => false,
|
774 |
-
'id' => 'wc-stripe-button-demo'
|
775 |
-
) );
|
776 |
-
ob_start ();
|
777 |
-
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-button-demo.php';
|
778 |
-
return ob_get_clean ();
|
779 |
-
}
|
780 |
-
|
781 |
-
public function generate_stripe_button_html($key, $data) {
|
782 |
-
$field_key = $this->get_field_key ( $key );
|
783 |
-
$data = wp_parse_args ( $data, array(
|
784 |
-
'title' => '', 'class' => '', 'style' => '',
|
785 |
-
'description' => '', 'desc_tip' => false,
|
786 |
-
'id' => 'wc-stripe-button_' . $key
|
787 |
-
) );
|
788 |
-
ob_start ();
|
789 |
-
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-button.php';
|
790 |
-
return ob_get_clean ();
|
791 |
-
}
|
792 |
-
|
793 |
-
public function generate_description_html($key, $data) {
|
794 |
-
$field_key = $this->get_field_key ( $key );
|
795 |
-
$data = wp_parse_args ( $data, array(
|
796 |
-
'class' => '', 'style' => '',
|
797 |
-
'description' => ''
|
798 |
-
) );
|
799 |
-
ob_start ();
|
800 |
-
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-description.php';
|
801 |
-
return ob_get_clean ();
|
802 |
-
}
|
803 |
-
|
804 |
-
/**
|
805 |
-
* Returns an array of metadata for the transaction.
|
806 |
-
*
|
807 |
-
* @param WC_Order $order
|
808 |
-
*/
|
809 |
-
protected function get_order_meta_data($order) {
|
810 |
-
$meta_data = [ 'gateway_id' => $this->id,
|
811 |
-
'order_id' => $order->get_order_number (),
|
812 |
-
'user_id' => $order->get_user_id (),
|
813 |
-
'customer_id' => wc_stripe_get_customer_id ( $order->get_user_id () ),
|
814 |
-
'ip_address' => $order->get_customer_ip_address (),
|
815 |
-
'user_agent' => isset ( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : 'unavailable',
|
816 |
-
'partner' => 'PaymentPlugins'
|
817 |
-
];
|
818 |
-
foreach ( $order->get_items ( 'line_item' ) as $item ) {
|
819 |
-
/**
|
820 |
-
*
|
821 |
-
* @var WC_Order_Item_Product $item
|
822 |
-
*/
|
823 |
-
$meta_data[ 'product_' . $item->get_product_id () ] = sprintf ( '%s x %s', $item->get_name (), $item->get_quantity () );
|
824 |
-
}
|
825 |
-
return apply_filters ( 'wc_stripe_order_meta_data', $meta_data, $order );
|
826 |
-
}
|
827 |
-
|
828 |
/**
|
829 |
* Save the customer's payment method.
|
830 |
* If the payment method has already been saved to the customer
|
831 |
-
*
|
832 |
*
|
833 |
* @param string $id
|
834 |
* @param WC_Order $order
|
@@ -856,7 +900,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
856 |
* @param WC_Order $order
|
857 |
* @param WP_Error $error
|
858 |
*/
|
859 |
-
|
860 |
if (wcs_stripe_active () && wcs_order_contains_subscription ( $order )) {
|
861 |
$message = __ ( 'We were not able to save your payment method. To prevent billing issues with your subscription, please add a payment method to the subscription.', 'woo-stripe-payment' );
|
862 |
} else {
|
@@ -890,8 +934,8 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
890 |
public function subscription_payment_meta($payment_meta, $subscription) {
|
891 |
$payment_meta[ $this->id ] = array(
|
892 |
'post_meta' => array(
|
893 |
-
|
894 |
-
'value' => $
|
895 |
'label' => __ ( 'Payment Method Token', 'woo-stripe-payment' )
|
896 |
)
|
897 |
)
|
@@ -904,7 +948,30 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
904 |
* @param float $amount
|
905 |
* @param WC_Order $order
|
906 |
*/
|
907 |
-
public function scheduled_subscription_payment($amount, $order) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
|
909 |
/**
|
910 |
*
|
@@ -939,7 +1006,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
939 |
$token = $this->get_token ( $this->payment_method_token, $subscription->get_user_id () );
|
940 |
|
941 |
// update the meta data needed by the gateway to process a subscription payment.
|
942 |
-
$subscription->update_meta_data (
|
943 |
$subscription->set_payment_method_title ( $token->get_payment_method_title () );
|
944 |
$subscription->save ();
|
945 |
}
|
@@ -967,6 +1034,8 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
967 |
}
|
968 |
|
969 |
/**
|
|
|
|
|
970 |
*
|
971 |
* @param WC_Order $order
|
972 |
*/
|
@@ -974,17 +1043,6 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
974 |
return sprintf ( __ ( 'Order %s from %s', 'woo-stripe-payment' ), $order->get_order_number (), get_bloginfo ( 'name' ) );
|
975 |
}
|
976 |
|
977 |
-
public function get_custom_attribute_html($attribs) {
|
978 |
-
if (! empty ( $attribs[ 'custom_attributes' ] ) && is_array ( $attribs[ 'custom_attributes' ] )) {
|
979 |
-
foreach ( $attribs[ 'custom_attributes' ] as $k => $v ) {
|
980 |
-
if (is_array ( $v )) {
|
981 |
-
$attribs[ 'custom_attributes' ][ $k ] = htmlspecialchars ( wp_json_encode ( $v ) );
|
982 |
-
}
|
983 |
-
}
|
984 |
-
}
|
985 |
-
return parent::get_custom_attribute_html ( $attribs );
|
986 |
-
}
|
987 |
-
|
988 |
/**
|
989 |
*
|
990 |
* @param WC_Order $order
|
@@ -994,7 +1052,8 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
994 |
if ($this->should_save_payment_method ( $order )) {
|
995 |
$result = $this->save_payment_method ( $this->get_new_source_token (), $order );
|
996 |
if (is_wp_error ( $result )) {
|
997 |
-
|
|
|
998 |
}
|
999 |
} else {
|
1000 |
$this->payment_method_token = $this->get_saved_source_id ();
|
@@ -1005,7 +1064,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
1005 |
$order->payment_complete ();
|
1006 |
} else {
|
1007 |
$order_status = $this->get_option ( 'order_status' );
|
1008 |
-
$order->update_status ( apply_filters ( 'wc_stripe_authorized_order_status', 'default' === $order_status ? '
|
1009 |
}
|
1010 |
WC ()->cart->empty_cart ();
|
1011 |
return array( 'result' => 'success',
|
@@ -1018,13 +1077,15 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
1018 |
if (! $this->use_saved_source ()) {
|
1019 |
$result = $this->save_payment_method ( $this->get_new_source_token (), $order );
|
1020 |
if (is_wp_error ( $result )) {
|
1021 |
-
|
|
|
1022 |
}
|
1023 |
} else {
|
1024 |
$this->payment_method_token = $this->get_saved_source_id ();
|
1025 |
}
|
1026 |
WC_Pre_Orders_Order::mark_order_as_pre_ordered ( $order );
|
1027 |
$this->save_zero_total_meta ( $order );
|
|
|
1028 |
return array( 'result' => 'success',
|
1029 |
'redirect' => $order->get_checkout_order_received_url ()
|
1030 |
);
|
@@ -1037,8 +1098,9 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
1037 |
protected function save_zero_total_meta($order) {
|
1038 |
$token = $this->get_token ( $this->payment_method_token, $order->get_user_id () );
|
1039 |
$order->set_payment_method_title ( $token->get_payment_method_title () );
|
1040 |
-
$order->update_meta_data (
|
1041 |
-
$order->update_meta_data (
|
|
|
1042 |
$order->save ();
|
1043 |
|
1044 |
if (wcs_stripe_active () && wcs_order_contains_subscription ( $order )) {
|
@@ -1048,9 +1110,9 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
1048 |
* @var WC_Subscription $subscription
|
1049 |
*/
|
1050 |
$subscription->set_payment_method_title ( $token->get_payment_method_title () );
|
1051 |
-
$subscription->update_meta_data (
|
1052 |
-
$subscription->update_meta_data (
|
1053 |
-
$subscription->update_meta_data (
|
1054 |
$subscription->save ();
|
1055 |
}
|
1056 |
}
|
@@ -1126,4 +1188,77 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
|
1126 |
}
|
1127 |
return $value;
|
1128 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1129 |
}
|
2 |
if (! class_exists ( 'WC_Payment_Gateway' )) {
|
3 |
return;
|
4 |
}
|
5 |
+
|
6 |
+
require_once ( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-payment-intent.php' );
|
7 |
+
require_once ( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-payment-charge.php' );
|
8 |
+
|
9 |
+
require_once ( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/traits/wc-stripe-payment-traits.php' );
|
10 |
+
|
11 |
/**
|
12 |
*
|
13 |
* @since 3.0.0
|
16 |
*
|
17 |
*/
|
18 |
abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
|
19 |
+
|
20 |
+
use WC_Stripe_Settings_Trait;
|
21 |
|
22 |
+
/**
|
23 |
+
*
|
24 |
+
* @var WC_Stripe_Payment
|
25 |
+
*/
|
26 |
+
public $payment_object;
|
27 |
|
28 |
+
/**
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
public $token_key;
|
33 |
|
34 |
+
/**
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
public $saved_method_key;
|
39 |
|
40 |
+
/**
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
public $payment_type_key;
|
45 |
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @var string
|
49 |
+
*/
|
50 |
public $payment_intent_key;
|
51 |
|
52 |
+
/**
|
53 |
+
*
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
public $save_source_key;
|
57 |
|
58 |
+
/**
|
59 |
+
*
|
60 |
+
* @var string
|
61 |
+
*/
|
62 |
public $template_name;
|
63 |
|
64 |
+
/**
|
65 |
+
*
|
66 |
+
* @var bool
|
67 |
+
*/
|
68 |
protected $checkout_error = false;
|
69 |
|
70 |
/**
|
92 |
*/
|
93 |
protected $payment_method_token = null;
|
94 |
|
95 |
+
/**
|
96 |
+
*
|
97 |
+
* @var string
|
98 |
+
*/
|
99 |
protected $new_source_token = null;
|
100 |
|
101 |
/**
|
105 |
*/
|
106 |
public $synchronous = true;
|
107 |
|
108 |
+
/**
|
109 |
+
*
|
110 |
+
* @var array
|
111 |
+
*/
|
112 |
protected $post_payment_processes = [];
|
113 |
|
114 |
/**
|
130 |
$this->description = $this->get_option ( 'description' );
|
131 |
$this->hooks ();
|
132 |
$this->init_supports ();
|
133 |
+
$this->gateway = WC_Stripe_Gateway::load ();
|
134 |
+
|
135 |
+
$this->payment_object = $this->get_payment_object ();
|
136 |
}
|
137 |
|
138 |
public function hooks() {
|
188 |
);
|
189 |
}
|
190 |
|
|
|
|
|
|
|
|
|
|
|
191 |
public function init_form_fields() {
|
192 |
$this->form_fields = include wc_stripe ()->plugin_path () . 'includes/gateways/settings/' . str_replace ( [
|
193 |
'stripe_', '_'
|
196 |
$this->form_fields = apply_filters ( 'wc_stripe_form_fields_' . $this->id, $this->form_fields );
|
197 |
}
|
198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
public function get_method_formats() {
|
200 |
$class_name = 'WC_Payment_Token_' . $this->token_type;
|
201 |
if (class_exists ( $class_name )) {
|
296 |
*/
|
297 |
public function enqueue_product_scripts($scripts) {}
|
298 |
|
299 |
+
/**
|
300 |
+
*
|
301 |
+
* {@inheritDoc}
|
302 |
+
*
|
303 |
+
* @see WC_Payment_Gateway::process_payment()
|
304 |
+
*/
|
305 |
+
public function process_payment($order_id) {
|
306 |
+
$order = wc_get_order ( $order_id );
|
307 |
+
|
308 |
+
if ($this->is_change_payment_method_request ()) {
|
309 |
+
return [ 'result' => 'success',
|
310 |
+
'redirect' => $order->get_view_order_url ()
|
311 |
+
];
|
312 |
+
}
|
313 |
+
|
314 |
+
do_action ( 'wc_stripe_before_process_payment', $order, $this->id );
|
315 |
+
|
316 |
+
if (wc_notice_count ( 'error' ) > 0) {
|
317 |
+
return $this->get_order_error ();
|
318 |
+
}
|
319 |
+
$this->processing_payment = true;
|
320 |
+
|
321 |
+
if ($this->order_contains_pre_order ( $order ) && $this->pre_order_requires_tokenization ( $order )) {
|
322 |
+
return $this->process_pre_order ( $order );
|
323 |
+
}
|
324 |
+
|
325 |
+
// if order total is zero, then save meta but don't process payment.
|
326 |
+
if ($order->get_total () == 0) {
|
327 |
+
return $this->process_zero_total_order ( $order );
|
328 |
+
}
|
329 |
+
|
330 |
+
$result = $this->payment_object->process_payment ( $order, $this );
|
331 |
+
|
332 |
+
if (is_wp_error ( $result )) {
|
333 |
+
wc_add_notice ( $result->get_error_message (), 'error' );
|
334 |
+
$order->update_status ( 'failed', sprintf ( __ ( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $result->get_error_message () ) );
|
335 |
+
return $this->get_order_error ();
|
336 |
+
}
|
337 |
+
|
338 |
+
if ($result->complete_payment) {
|
339 |
+
$this->save_order_meta ( $order, $result->charge );
|
340 |
+
if ('pending' === $result->charge->status) {
|
341 |
+
$order->update_status ( apply_filters ( 'wc_stripe_pending_charge_status', 'on-hold', $order, $this ), sprintf ( __ ( 'Charge %s is pending. Payment Method: %s. Payment will be completed once charge.succeeded webhook received from Stripe.', 'woo-stripe-payment' ), $order->get_transaction_id (), $order->get_payment_method_title () ) );
|
342 |
+
} else {
|
343 |
+
if ($result->charge->captured) {
|
344 |
+
$order->payment_complete ( $result->charge->id );
|
345 |
+
} else {
|
346 |
+
$order_status = $this->get_option ( 'order_status' );
|
347 |
+
$order->update_status ( apply_filters ( 'wc_stripe_authorized_order_status', 'default' === $order_status ? 'on-hold' : $order_status, $order, $this ) );
|
348 |
+
}
|
349 |
+
$order->add_order_note ( sprintf ( __ ( 'Order %s successful in Stripe. Charge: %s. Payment Method: %s', 'woo-stripe-payment' ), $result->charge->captured ? __ ( 'charge', 'woo-stripe-payment' ) : __ ( 'authorization', 'woo-stripe-payment' ), $order->get_transaction_id (), $order->get_payment_method_title () ) );
|
350 |
+
}
|
351 |
+
|
352 |
+
$this->trigger_post_payment_processes ( $order, $this );
|
353 |
+
|
354 |
+
return array( 'result' => 'success',
|
355 |
+
'redirect' => $order->get_checkout_order_received_url ()
|
356 |
+
);
|
357 |
+
} else {
|
358 |
+
return [ 'result' => 'success',
|
359 |
+
'redirect' => $result->redirect
|
360 |
+
];
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
/**
|
365 |
*
|
366 |
* @return array
|
376 |
),
|
377 |
'routes' => array(
|
378 |
'setup_intent' => wc_stripe ()->rest_api->payment_intent->rest_url ( 'setup-intent' ),
|
379 |
+
'sync_intent' => wc_stripe ()->rest_api->payment_intent->rest_url ( 'sync-payment-intent' ),
|
380 |
'add_to_cart' => wc_stripe ()->rest_api->cart->rest_url ( 'add-to-cart' ),
|
381 |
'cart_calculation' => wc_stripe ()->rest_api->cart->rest_url ( 'cart-calculation' ),
|
382 |
'shipping_method' => wc_stripe ()->rest_api->cart->rest_url ( 'shipping-method' ),
|
392 |
);
|
393 |
}
|
394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
/**
|
396 |
* Save the Stripe data to the order.
|
397 |
*
|
406 |
$token = $this->get_payment_token ( $this->get_payment_method_from_charge ( $charge ), $charge->payment_method_details );
|
407 |
$order->set_transaction_id ( $charge->id );
|
408 |
$order->set_payment_method_title ( $token->get_payment_method_title () );
|
409 |
+
$order->update_meta_data ( WC_Stripe_Constants::MODE, wc_stripe_mode () );
|
410 |
+
$order->update_meta_data ( WC_Stripe_Constants::CHARGE_STATUS, $charge->status );
|
411 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $token->get_token () );
|
412 |
$order->save ();
|
413 |
|
414 |
// if WCS is active and there are subscriptions in the order, save meta data
|
416 |
foreach ( wcs_get_subscriptions_for_order ( $order ) as $subscription ) {
|
417 |
$subscription->set_transaction_id ( $charge->id );
|
418 |
$subscription->set_payment_method_title ( $token->get_payment_method_title () );
|
419 |
+
$subscription->update_meta_data ( WC_Stripe_Constants::MODE, wc_stripe_mode () );
|
420 |
+
$subscription->update_meta_data ( WC_Stripe_Constants::CHARGE_STATUS, $charge->status );
|
421 |
+
$subscription->update_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $token->get_token () );
|
422 |
+
$subscription->update_meta_data ( WC_Stripe_Constants::CUSTOMER_ID, wc_stripe_get_customer_id ( $order->get_user_id () ) );
|
423 |
$subscription->save ();
|
424 |
}
|
425 |
}
|
431 |
* @since 3.0.6
|
432 |
* @param \Stripe\Charge $charge
|
433 |
*/
|
434 |
+
public function get_payment_method_from_charge($charge) {
|
435 |
+
return $this->payment_object->get_payment_method_from_charge ( $charge );
|
436 |
+
}
|
437 |
|
438 |
/**
|
439 |
*
|
442 |
* @see WC_Payment_Gateway::add_payment_method()
|
443 |
*/
|
444 |
public function add_payment_method() {
|
445 |
+
$user_id = get_current_user_id ();
|
446 |
try {
|
447 |
if (! is_user_logged_in ()) {
|
448 |
throw new Exception ( __ ( 'User must be logged in.', 'woo-stripe-payment' ) );
|
449 |
}
|
450 |
+
|
451 |
+
$customer_id = wc_stripe_get_customer_id ( $user_id );
|
452 |
+
|
453 |
if (empty ( $customer_id )) {
|
454 |
+
$customer_id = $this->create_customer ( $user_id );
|
455 |
}
|
456 |
|
457 |
$result = $this->create_payment_method ( $this->get_new_source_token (), $customer_id );
|
461 |
return array( 'result' => 'error'
|
462 |
);
|
463 |
}
|
464 |
+
$result->set_user_id ( $user_id );
|
465 |
$result->save ();
|
466 |
+
WC_Payment_Tokens::set_users_default ( $user_id, $result->get_id () );
|
467 |
|
468 |
do_action ( 'wc_stripe_add_payment_method_success', $result );
|
469 |
|
477 |
}
|
478 |
}
|
479 |
|
480 |
+
/**
|
481 |
+
*
|
482 |
+
* {@inheritDoc}
|
483 |
+
*
|
484 |
+
* @see WC_Payment_Gateway::process_refund()
|
485 |
+
*/
|
486 |
public function process_refund($order_id, $amount = null, $reason = '') {
|
487 |
$order = wc_get_order ( $order_id );
|
488 |
+
$result = $this->payment_object->process_refund ( $order, $amount, $reason );
|
489 |
+
|
490 |
+
if (! is_wp_error ( $result )) {
|
491 |
+
$order->add_order_note ( sprintf ( __ ( 'Order refunded in Stripe. Amount: %s', 'woo-stripe-payment' ), wc_price ( $amount, array(
|
492 |
+
'currency' => $order->get_currency ()
|
493 |
+
) ) ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
}
|
495 |
+
return $result;
|
496 |
}
|
497 |
|
498 |
/**
|
501 |
* @param float $amount
|
502 |
* @param WC_Order $order
|
503 |
*/
|
504 |
+
public function capture_charge($amount, $order) {
|
505 |
+
$result = $this->retrieve_charge ( $order->get_transaction_id (), wc_stripe_order_mode ( $order ) );
|
506 |
+
|
507 |
+
if (is_wp_error ( $result )) {
|
508 |
+
return;
|
509 |
+
} else {
|
510 |
+
if (! $result->captured) {
|
511 |
+
$result = $this->payment_object->capture_charge ( $amount, $order );
|
512 |
+
|
513 |
+
if (! is_wp_error ( $result )) {
|
514 |
+
remove_action ( 'woocommerce_order_status_completed', 'wc_stripe_order_status_completed' );
|
515 |
+
$order->payment_complete ();
|
516 |
+
if ($amount != $order->get_total ()) {
|
517 |
+
$order->set_total ( $amount );
|
518 |
+
$order->save ();
|
519 |
+
}
|
520 |
+
$order->add_order_note ( sprintf ( __ ( 'Order amount captured in Stripe. Amount: %s', 'woo-stripe-payment' ), wc_price ( $amount, array(
|
521 |
+
'currency' => $order->get_currency ()
|
522 |
+
) ) ) );
|
523 |
+
} else {
|
524 |
+
$order->add_order_note ( sprintf ( __ ( 'Error capturing charge in Stripe. Reason: %s', 'woo-stripe-payment' ), $result->get_error_message () ) );
|
525 |
+
}
|
526 |
+
}
|
527 |
+
}
|
528 |
+
return $result;
|
529 |
+
}
|
530 |
|
531 |
/**
|
532 |
* Void the Stripe charge.
|
533 |
*
|
534 |
* @param WC_Order $order
|
535 |
*/
|
536 |
+
public function void_charge($order) {
|
537 |
+
$result = $this->payment_object->void_charge ( $order );
|
538 |
+
|
539 |
+
if (is_wp_error ( $result )) {
|
540 |
+
$order->add_order_note ( sprintf ( __ ( 'Error voiding charge. Reason: %s', 'woo-stripe-payment' ), $result->get_error_message () ) );
|
541 |
+
} else {
|
542 |
+
$order->add_order_note ( __ ( 'Charge voided in Stripe.', 'woo-stripe-payment' ) );
|
543 |
+
}
|
544 |
+
}
|
545 |
|
546 |
/**
|
547 |
* Return the \Stripe\Charge object
|
559 |
* @param string $method_id
|
560 |
* @param \Stripe\Card|array $method_details
|
561 |
*/
|
562 |
+
public function get_payment_token($method_id, $method_details = null) {
|
563 |
$class_name = 'WC_Payment_Token_' . $this->token_type;
|
564 |
if (class_exists ( $class_name )) {
|
565 |
/**
|
567 |
* @var WC_Payment_Token_Stripe $token
|
568 |
*/
|
569 |
$token = new $class_name ( '', $method_details );
|
|
|
570 |
$token->set_token ( $method_id );
|
571 |
$token->set_gateway_id ( $this->id );
|
572 |
$token->set_format ( $this->get_option ( 'method_format' ) );
|
573 |
$token->set_environment ( wc_stripe_mode () );
|
574 |
+
if ($method_details) {
|
575 |
+
$token->details_to_props ( $method_details );
|
576 |
+
}
|
577 |
return $token;
|
578 |
}
|
579 |
}
|
583 |
*
|
584 |
* @return array
|
585 |
*/
|
586 |
+
public function get_order_error() {
|
587 |
wc_stripe_set_checkout_error ();
|
588 |
return array( 'result' => 'failure'
|
589 |
);
|
590 |
}
|
591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
/**
|
593 |
* Return the payment source the customer has chosen to use.
|
594 |
* This can be a saved source
|
605 |
}
|
606 |
}
|
607 |
|
608 |
+
/**
|
609 |
+
* Returns the payment method the customer wants to use.
|
610 |
+
* This can be a saved payment method
|
611 |
+
* or a new payment method.
|
612 |
+
*/
|
613 |
+
public function get_payment_method_from_request() {
|
614 |
+
return $this->get_payment_source ();
|
615 |
+
}
|
616 |
+
|
617 |
public function get_payment_intent_id() {
|
618 |
return ! empty ( $_POST[ $this->payment_intent_key ] ) ? $_POST[ $this->payment_intent_key ] : '';
|
619 |
}
|
671 |
* WC Stripe customer ID
|
672 |
* @return WC_Payment_Token_Stripe|WP_Error
|
673 |
*/
|
674 |
+
public function create_payment_method($id, $customer_id) {
|
675 |
+
$token = $this->get_payment_token ( $id );
|
676 |
+
$token->set_customer_id ( $customer_id );
|
677 |
+
|
678 |
+
$result = $token->save_payment_method ();
|
679 |
+
|
680 |
+
if (is_wp_error ( $result )) {
|
681 |
+
return $result;
|
682 |
+
} else {
|
683 |
+
$token->set_token ( $result->id );
|
684 |
+
$token->details_to_props ( $result );
|
685 |
+
return $token;
|
686 |
+
}
|
687 |
+
}
|
688 |
|
689 |
/**
|
690 |
*
|
710 |
* @param string $token_id
|
711 |
* @param WC_Payment_Token_Stripe $token
|
712 |
*/
|
713 |
+
public function delete_payment_method($token_id, $token) {
|
714 |
+
$token->delete_from_stripe ();
|
715 |
+
}
|
716 |
|
717 |
public function saved_payment_methods($tokens = array()) {
|
718 |
wc_stripe_get_template ( 'payment-methods.php', array(
|
869 |
return apply_filters ( 'wc_stripe_update_shipping_address_response', $data );
|
870 |
}
|
871 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
/**
|
873 |
* Save the customer's payment method.
|
874 |
* If the payment method has already been saved to the customer
|
875 |
+
* then simply return true.
|
876 |
*
|
877 |
* @param string $id
|
878 |
* @param WC_Order $order
|
900 |
* @param WC_Order $order
|
901 |
* @param WP_Error $error
|
902 |
*/
|
903 |
+
public function set_payment_save_error($order, $error) {
|
904 |
if (wcs_stripe_active () && wcs_order_contains_subscription ( $order )) {
|
905 |
$message = __ ( 'We were not able to save your payment method. To prevent billing issues with your subscription, please add a payment method to the subscription.', 'woo-stripe-payment' );
|
906 |
} else {
|
934 |
public function subscription_payment_meta($payment_meta, $subscription) {
|
935 |
$payment_meta[ $this->id ] = array(
|
936 |
'post_meta' => array(
|
937 |
+
WC_Stripe_Constants::PAYMENT_METHOD_TOKEN => array(
|
938 |
+
'value' => $this->get_order_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $subscription ),
|
939 |
'label' => __ ( 'Payment Method Token', 'woo-stripe-payment' )
|
940 |
)
|
941 |
)
|
948 |
* @param float $amount
|
949 |
* @param WC_Order $order
|
950 |
*/
|
951 |
+
public function scheduled_subscription_payment($amount, $order) {
|
952 |
+
$this->processing_payment = true;
|
953 |
+
|
954 |
+
$result = $this->payment_object->scheduled_subscription_payment ( $amount, $order );
|
955 |
+
|
956 |
+
if (is_wp_error ( $result )) {
|
957 |
+
$order->update_status ( 'failed' );
|
958 |
+
$order->add_order_note ( sprintf ( __ ( 'Recurring payment for order failed. Reason: %s', 'woo-stripe-payment' ), $result->get_error_message () ) );
|
959 |
+
return;
|
960 |
+
}
|
961 |
+
|
962 |
+
$this->save_order_meta ( $order, $result->charge );
|
963 |
+
|
964 |
+
if ($result->complete_payment) {
|
965 |
+
if ($result->charge->captured) {
|
966 |
+
$order->payment_complete ( $result->charge->id );
|
967 |
+
$order->add_order_note ( sprintf ( __ ( 'Recurring payment captured in Stripe. Payment method: %s', 'woo-stripe-payment' ), $order->get_payment_method_title () ) );
|
968 |
+
} else {
|
969 |
+
$order->update_status ( apply_filters ( 'wc_stripe_authorized_renewal_order_status', 'on-hold', $order, $this ), sprintf ( __ ( 'Recurring payment authorized in Stripe. Payment method: %s', 'woo-stripe-payment' ), $order->get_payment_method_title () ) );
|
970 |
+
}
|
971 |
+
} else {
|
972 |
+
$order->update_status ( 'pending', sprintf ( __ ( 'Customer must manually complete payment for payment method %s', 'woo-stripe-payment' ), $order->get_payment_method_title () ) );
|
973 |
+
}
|
974 |
+
}
|
975 |
|
976 |
/**
|
977 |
*
|
1006 |
$token = $this->get_token ( $this->payment_method_token, $subscription->get_user_id () );
|
1007 |
|
1008 |
// update the meta data needed by the gateway to process a subscription payment.
|
1009 |
+
$subscription->update_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $this->payment_method_token );
|
1010 |
$subscription->set_payment_method_title ( $token->get_payment_method_title () );
|
1011 |
$subscription->save ();
|
1012 |
}
|
1034 |
}
|
1035 |
|
1036 |
/**
|
1037 |
+
*
|
1038 |
+
* @deprecated
|
1039 |
*
|
1040 |
* @param WC_Order $order
|
1041 |
*/
|
1043 |
return sprintf ( __ ( 'Order %s from %s', 'woo-stripe-payment' ), $order->get_order_number (), get_bloginfo ( 'name' ) );
|
1044 |
}
|
1045 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1046 |
/**
|
1047 |
*
|
1048 |
* @param WC_Order $order
|
1052 |
if ($this->should_save_payment_method ( $order )) {
|
1053 |
$result = $this->save_payment_method ( $this->get_new_source_token (), $order );
|
1054 |
if (is_wp_error ( $result )) {
|
1055 |
+
wc_add_notice ( $result->get_error_message (), 'error' );
|
1056 |
+
return $this->get_order_error ();
|
1057 |
}
|
1058 |
} else {
|
1059 |
$this->payment_method_token = $this->get_saved_source_id ();
|
1064 |
$order->payment_complete ();
|
1065 |
} else {
|
1066 |
$order_status = $this->get_option ( 'order_status' );
|
1067 |
+
$order->update_status ( apply_filters ( 'wc_stripe_authorized_order_status', 'default' === $order_status ? 'on-hold' : $order_status, $order, $this ) );
|
1068 |
}
|
1069 |
WC ()->cart->empty_cart ();
|
1070 |
return array( 'result' => 'success',
|
1077 |
if (! $this->use_saved_source ()) {
|
1078 |
$result = $this->save_payment_method ( $this->get_new_source_token (), $order );
|
1079 |
if (is_wp_error ( $result )) {
|
1080 |
+
wc_add_notice ( $result->get_error_message (), 'error' );
|
1081 |
+
return $this->get_order_error ();
|
1082 |
}
|
1083 |
} else {
|
1084 |
$this->payment_method_token = $this->get_saved_source_id ();
|
1085 |
}
|
1086 |
WC_Pre_Orders_Order::mark_order_as_pre_ordered ( $order );
|
1087 |
$this->save_zero_total_meta ( $order );
|
1088 |
+
|
1089 |
return array( 'result' => 'success',
|
1090 |
'redirect' => $order->get_checkout_order_received_url ()
|
1091 |
);
|
1098 |
protected function save_zero_total_meta($order) {
|
1099 |
$token = $this->get_token ( $this->payment_method_token, $order->get_user_id () );
|
1100 |
$order->set_payment_method_title ( $token->get_payment_method_title () );
|
1101 |
+
$order->update_meta_data ( WC_Stripe_Constants::MODE, wc_stripe_mode () );
|
1102 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $token->get_token () );
|
1103 |
+
$order->update_meta_data ( WC_Stripe_Constants::CUSTOMER_ID, wc_stripe_get_customer_id ( $order->get_user_id () ) );
|
1104 |
$order->save ();
|
1105 |
|
1106 |
if (wcs_stripe_active () && wcs_order_contains_subscription ( $order )) {
|
1110 |
* @var WC_Subscription $subscription
|
1111 |
*/
|
1112 |
$subscription->set_payment_method_title ( $token->get_payment_method_title () );
|
1113 |
+
$subscription->update_meta_data ( WC_Stripe_Constants::MODE, wc_stripe_mode () );
|
1114 |
+
$subscription->update_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $token->get_token () );
|
1115 |
+
$subscription->update_meta_data ( WC_Stripe_Constants::CUSTOMER_ID, wc_stripe_get_customer_id ( $order->get_user_id () ) );
|
1116 |
$subscription->save ();
|
1117 |
}
|
1118 |
}
|
1188 |
}
|
1189 |
return $value;
|
1190 |
}
|
1191 |
+
|
1192 |
+
/**
|
1193 |
+
*
|
1194 |
+
* @param WC_Order $order
|
1195 |
+
*/
|
1196 |
+
public function process_pre_order_payment($order) {
|
1197 |
+
$this->processing_payment = true;
|
1198 |
+
|
1199 |
+
$result = $this->payment_object->process_pre_order_payment ( $order );
|
1200 |
+
|
1201 |
+
if (is_wp_error ( $result )) {
|
1202 |
+
$order->update_status ( 'failed' );
|
1203 |
+
$order->add_order_note ( sprintf ( __ ( 'Pre-order payment for order failed. Reason: %s', 'woo-stripe-payment' ), $result->get_error_message () ) );
|
1204 |
+
} else {
|
1205 |
+
if ($result->complete_payment) {
|
1206 |
+
|
1207 |
+
$this->save_order_meta ( $order, $result->charge );
|
1208 |
+
|
1209 |
+
if ($result->charge->captured) {
|
1210 |
+
$order->payment_complete ( $result->charge->id );
|
1211 |
+
$order->add_order_note ( sprintf ( __ ( 'Pre-order payment captured in Stripe. Payment method: %s', 'woo-stripe-payment' ), $order->get_payment_method_title () ) );
|
1212 |
+
} else {
|
1213 |
+
$order->update_status ( apply_filters ( 'wc_stripe_authorized_preorder_order_status', 'on-hold', $order, $this ), sprintf ( __ ( 'Pre-order payment authorized in Stripe. Payment method: %s', 'woo-stripe-payment' ), $order->get_payment_method_title () ) );
|
1214 |
+
}
|
1215 |
+
} else {
|
1216 |
+
$order->update_status ( 'pending', sprintf ( __ ( 'Customer must manually complete payment for payment method %s', 'woo-stripe-payment' ), $order->get_payment_method_title () ) );
|
1217 |
+
}
|
1218 |
+
}
|
1219 |
+
}
|
1220 |
+
|
1221 |
+
/**
|
1222 |
+
* Given a meta key, see if there is a value for that key in another plugin.
|
1223 |
+
* This acts as a lazy conversion
|
1224 |
+
* method for merchants that have switched to our plugin from other plugins.
|
1225 |
+
*
|
1226 |
+
* @since 3.1.0
|
1227 |
+
* @param string $meta_key
|
1228 |
+
* @param WC_Order $order
|
1229 |
+
* @param string $context
|
1230 |
+
*/
|
1231 |
+
public function get_order_meta_data($meta_key, $order, $context = 'view') {
|
1232 |
+
$value = $order->get_meta ( $meta_key, true, $context );
|
1233 |
+
// value is empty so check metadata from other plugins
|
1234 |
+
if (empty ( $value )) {
|
1235 |
+
$keys = [];
|
1236 |
+
switch ($meta_key) {
|
1237 |
+
case WC_Stripe_Constants::PAYMENT_METHOD_TOKEN :
|
1238 |
+
$keys = [ '_stripe_source_id'
|
1239 |
+
];
|
1240 |
+
break;
|
1241 |
+
case WC_Stripe_Constants::CUSTOMER_ID :
|
1242 |
+
$keys = [ '_stripe_customer_id'
|
1243 |
+
];
|
1244 |
+
break;
|
1245 |
+
case WC_Stripe_Constants::PAYMENT_INTENT_ID :
|
1246 |
+
$keys = [ '_stripe_intent_id'
|
1247 |
+
];
|
1248 |
+
}
|
1249 |
+
if ($keys) {
|
1250 |
+
$meta_data = $order->get_meta_data ();
|
1251 |
+
if ($meta_data) {
|
1252 |
+
$keys = array_intersect ( wp_list_pluck ( $meta_data, 'key' ), $keys );
|
1253 |
+
$array_keys = array_keys ( $keys );
|
1254 |
+
if (! empty ( $array_keys )) {
|
1255 |
+
$value = $meta_data[ current ( $array_keys ) ]->value;
|
1256 |
+
update_post_meta ( $order->get_id (), $meta_key, $value );
|
1257 |
+
}
|
1258 |
+
}
|
1259 |
+
}
|
1260 |
+
}
|
1261 |
+
|
1262 |
+
return $value;
|
1263 |
+
}
|
1264 |
}
|
includes/abstract/abstract-wc-payment-token-stripe.php
CHANGED
@@ -15,9 +15,16 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
15 |
|
16 |
protected $object_type = 'payment_token';
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
protected $extra_data = array( 'format' => '',
|
19 |
-
'
|
20 |
-
'
|
21 |
);
|
22 |
|
23 |
protected $stripe_data = array();
|
@@ -45,16 +52,12 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
45 |
$this->format = $value;
|
46 |
}
|
47 |
|
48 |
-
public function set_method_type($value) {
|
49 |
-
$this->set_prop ( 'method_type', $value );
|
50 |
-
}
|
51 |
-
|
52 |
public function set_environment($value) {
|
53 |
$this->set_prop ( 'environment', $value );
|
54 |
}
|
55 |
|
56 |
-
public function
|
57 |
-
|
58 |
}
|
59 |
|
60 |
public function get_format() {
|
@@ -65,6 +68,10 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
65 |
return $this->get_prop ( 'environment' );
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* Return a human readable representation of the payment method.
|
70 |
*/
|
@@ -78,7 +85,11 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
78 |
public function get_props_data() {
|
79 |
$data = array();
|
80 |
foreach ( $this->extra_data as $k => $v ) {
|
81 |
-
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
return $data;
|
84 |
}
|
@@ -114,7 +125,6 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
114 |
return apply_filters ( 'wc_stripe_get_' . $this->object_type . '_json', array(
|
115 |
'id' => $this->get_id (),
|
116 |
'type' => $this->get_type (),
|
117 |
-
'method_type' => $this->get_method_type (),
|
118 |
'token' => $this->get_token (),
|
119 |
'title' => $this->get_payment_method_title (),
|
120 |
'gateway' => $this->get_gateway_id ()
|
@@ -127,7 +137,7 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
127 |
public abstract function get_formats();
|
128 |
|
129 |
public function get_brand($context = 'view') {
|
130 |
-
return $this->get_prop ( 'brand', $context );
|
131 |
}
|
132 |
|
133 |
public function set_brand($value) {
|
@@ -141,4 +151,57 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
|
|
141 |
public function has_expiration() {
|
142 |
return $this->has_expiration;
|
143 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
}
|
15 |
|
16 |
protected $object_type = 'payment_token';
|
17 |
|
18 |
+
/**
|
19 |
+
*
|
20 |
+
* @since 3.1.0
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
protected $stripe_payment_type;
|
24 |
+
|
25 |
protected $extra_data = array( 'format' => '',
|
26 |
+
'environment' => 'production', 'brand' => '',
|
27 |
+
'customer_id' => ''
|
28 |
);
|
29 |
|
30 |
protected $stripe_data = array();
|
52 |
$this->format = $value;
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
55 |
public function set_environment($value) {
|
56 |
$this->set_prop ( 'environment', $value );
|
57 |
}
|
58 |
|
59 |
+
public function set_customer_id($value) {
|
60 |
+
$this->set_prop ( 'customer_id', $value );
|
61 |
}
|
62 |
|
63 |
public function get_format() {
|
68 |
return $this->get_prop ( 'environment' );
|
69 |
}
|
70 |
|
71 |
+
public function get_customer_id() {
|
72 |
+
return $this->get_prop ( 'customer_id' );
|
73 |
+
}
|
74 |
+
|
75 |
/**
|
76 |
* Return a human readable representation of the payment method.
|
77 |
*/
|
85 |
public function get_props_data() {
|
86 |
$data = array();
|
87 |
foreach ( $this->extra_data as $k => $v ) {
|
88 |
+
if (method_exists ( $this, "get_{$k}" )) {
|
89 |
+
$data[ '{' . $k . '}' ] = $this->{"get_$k"} ();
|
90 |
+
} else {
|
91 |
+
$data[ '{' . $k . '}' ] = $this->get_prop ( $k );
|
92 |
+
}
|
93 |
}
|
94 |
return $data;
|
95 |
}
|
125 |
return apply_filters ( 'wc_stripe_get_' . $this->object_type . '_json', array(
|
126 |
'id' => $this->get_id (),
|
127 |
'type' => $this->get_type (),
|
|
|
128 |
'token' => $this->get_token (),
|
129 |
'title' => $this->get_payment_method_title (),
|
130 |
'gateway' => $this->get_gateway_id ()
|
137 |
public abstract function get_formats();
|
138 |
|
139 |
public function get_brand($context = 'view') {
|
140 |
+
return wc_get_credit_card_type_label ( $this->get_prop ( 'brand', $context ) );
|
141 |
}
|
142 |
|
143 |
public function set_brand($value) {
|
151 |
public function has_expiration() {
|
152 |
return $this->has_expiration;
|
153 |
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
*
|
157 |
+
* @since 3.1.0
|
158 |
+
*/
|
159 |
+
public function delete_from_stripe() {
|
160 |
+
$customer_id = wc_stripe_get_customer_id ( $this->get_user_id (), $this->get_environment () );
|
161 |
+
$gateway = WC_Stripe_Gateway::load ();
|
162 |
+
|
163 |
+
if ('payment_method' == $this->stripe_payment_type) {
|
164 |
+
try {
|
165 |
+
$payment_method = $gateway->fetch_payment_method ( $this->get_token () );
|
166 |
+
$gateway->delete_payment_method ( $payment_method );
|
167 |
+
} catch ( \Stripe\Error\Base $e ) {
|
168 |
+
wc_stripe_log_error ( sprintf ( __ ( 'Error deleting Stripe card. Token Id: %s', 'woo-stripe-payment' ), $this->get_token () ) );
|
169 |
+
}
|
170 |
+
} elseif ('source' == $this->stripe_payment_type) {
|
171 |
+
try {
|
172 |
+
$gateway->delete_card ( $this->get_token (), $customer_id, $this->get_environment () );
|
173 |
+
} catch ( \Stripe\Error\Base $e ) {
|
174 |
+
wc_stripe_log_error ( sprintf ( __ ( 'Error deleting Stripe card. Token Id: %s', 'woo-stripe-payment' ), $this->get_token () ) );
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
*
|
181 |
+
* @since 3.1.0
|
182 |
+
*/
|
183 |
+
public function save_payment_method() {
|
184 |
+
$gateway = WC_Stripe_Gateway::load ();
|
185 |
+
|
186 |
+
if ('payment_method' == $this->stripe_payment_type) {
|
187 |
+
|
188 |
+
$payment_method = $gateway->fetch_payment_method ( $this->get_token () );
|
189 |
+
|
190 |
+
if (is_wp_error ( $payment_method )) {
|
191 |
+
return $payment_method;
|
192 |
+
}
|
193 |
+
|
194 |
+
return $gateway->attach_payment_method ( $payment_method, [
|
195 |
+
'customer' => $this->get_customer_id ()
|
196 |
+
] );
|
197 |
+
} elseif ('source' == $this->stripe_payment_type) {
|
198 |
+
return $gateway->create_customer_source ( $this->get_customer_id (), $this->get_token () );
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
public static function token_exists($token_id, $user_id) {
|
203 |
+
global $wpdb;
|
204 |
+
$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 ) );
|
205 |
+
return $count > 0;
|
206 |
+
}
|
207 |
}
|
includes/abstract/abstract-wc-stripe-payment.php
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @author PaymentPlugins
|
5 |
+
* @since 3.1.0
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
abstract class WC_Stripe_Payment {
|
9 |
+
|
10 |
+
/**
|
11 |
+
*
|
12 |
+
* @var WC_Payment_Gateway_Stripe
|
13 |
+
*/
|
14 |
+
protected $payment_method;
|
15 |
+
|
16 |
+
/**
|
17 |
+
*
|
18 |
+
* @var WC_Stripe_Gateway
|
19 |
+
*/
|
20 |
+
protected $gateway;
|
21 |
+
|
22 |
+
/**
|
23 |
+
*
|
24 |
+
* @param WC_Payment_Gateway_Stripe $payment_method
|
25 |
+
* @param WC_Stripe_Gateway $gateway
|
26 |
+
*/
|
27 |
+
public function __construct($payment_method, $gateway) {
|
28 |
+
$this->payment_method = $payment_method;
|
29 |
+
$this->gateway = $gateway;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function get_gateway() {
|
33 |
+
return $this->gateway;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Process the payment for the order.
|
38 |
+
*
|
39 |
+
* @param WC_Order $order
|
40 |
+
* @param WC_Payment_Gateway_Stripe $payment_method
|
41 |
+
*/
|
42 |
+
public abstract function process_payment($order);
|
43 |
+
|
44 |
+
/**
|
45 |
+
*
|
46 |
+
* @param float $amount
|
47 |
+
* @param WC_Order $order
|
48 |
+
*/
|
49 |
+
public abstract function capture_charge($amount, $order);
|
50 |
+
|
51 |
+
/**
|
52 |
+
*
|
53 |
+
* @param WC_Order $order
|
54 |
+
*/
|
55 |
+
public abstract function void_charge($order);
|
56 |
+
|
57 |
+
/**
|
58 |
+
*
|
59 |
+
* @param \Stripe\Charge $charge
|
60 |
+
*/
|
61 |
+
public abstract function get_payment_method_from_charge($charge);
|
62 |
+
|
63 |
+
/**
|
64 |
+
*
|
65 |
+
* @param array $args
|
66 |
+
* @param WC_Order $order
|
67 |
+
*/
|
68 |
+
public abstract function add_order_payment_method(&$args, $order);
|
69 |
+
|
70 |
+
/**
|
71 |
+
*
|
72 |
+
* @param float $amount
|
73 |
+
* @param WC_Order $order
|
74 |
+
*/
|
75 |
+
public abstract function scheduled_subscription_payment($amount, $order);
|
76 |
+
|
77 |
+
/**
|
78 |
+
*
|
79 |
+
* @param WC_Order $order
|
80 |
+
*/
|
81 |
+
public abstract function process_pre_order_payment($order);
|
82 |
+
|
83 |
+
/**
|
84 |
+
*
|
85 |
+
* @param WC_Order $order
|
86 |
+
* @param float $amount
|
87 |
+
* @param string $reason
|
88 |
+
* @throws Exception
|
89 |
+
*/
|
90 |
+
public function process_refund($order, $amount = null, $reason = '') {
|
91 |
+
$amount_in_cents = wc_stripe_add_number_precision ( $amount );
|
92 |
+
$charge = $order->get_transaction_id ();
|
93 |
+
try {
|
94 |
+
if (empty ( $charge )) {
|
95 |
+
throw new Exception ( __ ( 'Transaction Id cannot be empty.', 'woo-stripe-payment' ) );
|
96 |
+
}
|
97 |
+
$result = $this->gateway->refund ( array(
|
98 |
+
'charge' => $charge,
|
99 |
+
'amount' => $amount_in_cents
|
100 |
+
), wc_stripe_order_mode ( $order ) );
|
101 |
+
if (! is_wp_error ( $result )) {
|
102 |
+
return true;
|
103 |
+
}
|
104 |
+
return $result;
|
105 |
+
} catch ( Exception $e ) {
|
106 |
+
return new WP_Error ( 'refund-error', $e->getMessage () );
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Return a failed order response.
|
112 |
+
*
|
113 |
+
* @return array
|
114 |
+
*/
|
115 |
+
public function order_error() {
|
116 |
+
wc_stripe_set_checkout_error ();
|
117 |
+
return [ 'result' => 'failure'
|
118 |
+
];
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
*
|
123 |
+
* @param array $args
|
124 |
+
* @param WC_Order $order
|
125 |
+
*/
|
126 |
+
public function add_general_order_args(&$args, $order) {
|
127 |
+
$this->add_order_amount ( $args, $order );
|
128 |
+
$this->add_order_currency ( $args, $order );
|
129 |
+
$this->add_order_description ( $args, $order );
|
130 |
+
$this->add_order_shipping_address ( $args, $order );
|
131 |
+
$this->add_order_metadata ( $args, $order );
|
132 |
+
$this->add_order_payment_method ( $args, $order );
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
*
|
137 |
+
* @param array $args
|
138 |
+
* @param WC_Order $order
|
139 |
+
*/
|
140 |
+
public function add_order_metadata(&$args, $order) {
|
141 |
+
$meta_data = [
|
142 |
+
'gateway_id' => $this->payment_method->id,
|
143 |
+
'order_id' => $order->get_order_number (),
|
144 |
+
'user_id' => $order->get_user_id (),
|
145 |
+
'customer_id' => wc_stripe_get_customer_id ( $order->get_user_id () ),
|
146 |
+
'ip_address' => $order->get_customer_ip_address (),
|
147 |
+
'user_agent' => isset ( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : 'unavailable',
|
148 |
+
'partner' => 'PaymentPlugins'
|
149 |
+
];
|
150 |
+
foreach ( $order->get_items ( 'line_item' ) as $item ) {
|
151 |
+
/**
|
152 |
+
*
|
153 |
+
* @var WC_Order_Item_Product $item
|
154 |
+
*/
|
155 |
+
$meta_data[ 'product_' . $item->get_product_id () ] = sprintf ( '%s x %s', $item->get_name (), $item->get_quantity () );
|
156 |
+
}
|
157 |
+
$args[ 'metadata' ] = apply_filters ( 'wc_stripe_order_meta_data', $meta_data, $order );
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
*
|
162 |
+
* @param array $args
|
163 |
+
* @param WC_Order $order
|
164 |
+
*/
|
165 |
+
public function add_order_description(&$args, $order) {
|
166 |
+
$args[ 'description' ] = sprintf ( __ ( 'Order %s from %s', 'woo-stripe-payment' ), $order->get_order_number (), get_bloginfo ( 'name' ) );
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
*
|
171 |
+
* @param array $args
|
172 |
+
* @param WC_Order $order
|
173 |
+
* @param float $amount
|
174 |
+
*/
|
175 |
+
public function add_order_amount(&$args, $order, $amount = null) {
|
176 |
+
$args[ 'amount' ] = wc_stripe_add_number_precision ( $amount ? $amount : $order->get_total () );
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
*
|
181 |
+
* @param array $args
|
182 |
+
* @param WC_Order $order
|
183 |
+
*/
|
184 |
+
public function add_order_currency(&$args, $order) {
|
185 |
+
$args[ 'currency' ] = $order->get_currency ();
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
*
|
190 |
+
* @param array $args
|
191 |
+
* @param WC_Order $order
|
192 |
+
*/
|
193 |
+
public function add_order_shipping_address(&$args, $order) {
|
194 |
+
if (wc_stripe_order_has_shipping_address ( $order )) {
|
195 |
+
$args[ 'shipping' ] = [
|
196 |
+
'address' => [
|
197 |
+
'city' => $order->get_shipping_city (),
|
198 |
+
'country' => $order->get_shipping_country (),
|
199 |
+
'line1' => $order->get_shipping_address_1 (),
|
200 |
+
'line2' => $order->get_shipping_address_2 (),
|
201 |
+
'postal_code' => $order->get_shipping_postcode (),
|
202 |
+
'state' => $order->get_shipping_state ()
|
203 |
+
],
|
204 |
+
'name' => $this->get_name_from_order ( $order, 'shipping' )
|
205 |
+
];
|
206 |
+
} else {
|
207 |
+
$args[ 'shipping' ] = [];
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
*
|
213 |
+
* @param WC_Order $order
|
214 |
+
*/
|
215 |
+
public function get_name_from_order($order, $type) {
|
216 |
+
if ($type === 'billing') {
|
217 |
+
return sprintf ( '%s %s', $order->get_billing_first_name (), $order->get_billing_last_name () );
|
218 |
+
} else {
|
219 |
+
return sprintf ( '%s %s', $order->get_shipping_first_name (), $order->get_shipping_last_name () );
|
220 |
+
}
|
221 |
+
}
|
222 |
+
}
|
includes/abstract/abstract-wc-stripe-rest-controller.php
CHANGED
@@ -82,7 +82,8 @@ abstract class WC_Stripe_Rest_Controller {
|
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
-
*
|
|
|
86 |
* @param WP_Error $error
|
87 |
*/
|
88 |
protected function add_validation_error($error) {
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
+
* Allows a status code of 200 to be returned even if there is a validation error.
|
86 |
+
*
|
87 |
* @param WP_Error $error
|
88 |
*/
|
89 |
protected function add_validation_error($error) {
|
includes/abstract/abstract-wc-stripe-settings.php
CHANGED
@@ -6,10 +6,8 @@
|
|
6 |
*
|
7 |
*/
|
8 |
abstract class WC_Stripe_Settings_API extends WC_Settings_API {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
private $admin_output = false;
|
13 |
|
14 |
public function __construct() {
|
15 |
$this->init_form_fields ();
|
@@ -23,88 +21,7 @@ abstract class WC_Stripe_Settings_API extends WC_Settings_API {
|
|
23 |
) );
|
24 |
}
|
25 |
|
26 |
-
public function admin_nav_tab($tabs) {
|
27 |
-
$tabs[ $this->id ] = $this->tab_title;
|
28 |
-
return $tabs;
|
29 |
-
}
|
30 |
-
|
31 |
-
public function admin_options() {
|
32 |
-
if ($this->admin_output) {
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
$this->display_errors ();
|
36 |
-
$this->output_settings_nav ();
|
37 |
-
printf ( '<input type="hidden" id="wc_stripe_prefix" name="wc_stripe_prefix" value="%1$s"/>', $this->get_prefix () );
|
38 |
-
echo '<div class="wc-stripe-settings-container ' . $this->id . '">';
|
39 |
-
parent::admin_options ();
|
40 |
-
echo '</div>';
|
41 |
-
$this->admin_output = true;
|
42 |
-
}
|
43 |
-
|
44 |
-
public function output_settings_nav() {
|
45 |
-
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-settings-nav.php';
|
46 |
-
}
|
47 |
-
|
48 |
-
public function get_prefix() {
|
49 |
-
return $this->plugin_id . $this->id . '_';
|
50 |
-
}
|
51 |
-
|
52 |
public function localize_settings() {
|
53 |
return $this->settings;
|
54 |
}
|
55 |
-
|
56 |
-
public function get_custom_attribute_html($attribs) {
|
57 |
-
if (! empty ( $attribs[ 'custom_attributes' ] ) && is_array ( $attribs[ 'custom_attributes' ] )) {
|
58 |
-
foreach ( $attribs[ 'custom_attributes' ] as $k => $v ) {
|
59 |
-
if (is_array ( $v )) {
|
60 |
-
$attribs[ 'custom_attributes' ][ $k ] = htmlspecialchars ( wp_json_encode ( $v ) );
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
return parent::get_custom_attribute_html ( $attribs );
|
65 |
-
}
|
66 |
-
|
67 |
-
public function is_active($key) {
|
68 |
-
return $this->get_option ( $key ) === 'yes';
|
69 |
-
}
|
70 |
-
|
71 |
-
public function generate_description_html($key, $data) {
|
72 |
-
$field_key = $this->get_field_key ( $key );
|
73 |
-
$data = wp_parse_args ( $data, array(
|
74 |
-
'class' => '', 'style' => '',
|
75 |
-
'description' => ''
|
76 |
-
) );
|
77 |
-
ob_start ();
|
78 |
-
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-description.php';
|
79 |
-
return ob_get_clean ();
|
80 |
-
}
|
81 |
-
|
82 |
-
public function generate_paragraph_html($key, $data) {
|
83 |
-
$field_key = $this->get_field_key ( $key );
|
84 |
-
$defaults = array( 'title' => '', 'label' => '',
|
85 |
-
'class' => '', 'css' => '', 'type' => 'text',
|
86 |
-
'desc_tip' => false, 'description' => '',
|
87 |
-
'custom_attributes' => array()
|
88 |
-
);
|
89 |
-
$data = wp_parse_args ( $data, $defaults );
|
90 |
-
if (! $data[ 'label' ]) {
|
91 |
-
$data[ 'label' ] = $data[ 'title' ];
|
92 |
-
}
|
93 |
-
ob_start ();
|
94 |
-
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-paragraph.php';
|
95 |
-
return ob_get_clean ();
|
96 |
-
}
|
97 |
-
|
98 |
-
public function generate_stripe_button_html($key, $data) {
|
99 |
-
$field_key = $this->get_field_key ( $key );
|
100 |
-
$data = wp_parse_args ( $data, array(
|
101 |
-
'title' => '', 'class' => '', 'style' => '',
|
102 |
-
'description' => '', 'desc_tip' => false,
|
103 |
-
'id' => 'wc-stripe-button_' . $key,
|
104 |
-
'disabled' => false, 'css' => ''
|
105 |
-
) );
|
106 |
-
ob_start ();
|
107 |
-
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-button.php';
|
108 |
-
return ob_get_clean ();
|
109 |
-
}
|
110 |
}
|
6 |
*
|
7 |
*/
|
8 |
abstract class WC_Stripe_Settings_API extends WC_Settings_API {
|
9 |
+
|
10 |
+
use WC_Stripe_Settings_Trait;
|
|
|
|
|
11 |
|
12 |
public function __construct() {
|
13 |
$this->init_form_fields ();
|
21 |
) );
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
public function localize_settings() {
|
25 |
return $this->settings;
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
includes/admin/class-wc-stripe-admin-notices.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PaymentPlugins;
|
4 |
+
|
5 |
+
defined ( 'ABSPATH' ) || exit ();
|
6 |
+
|
7 |
+
/**
|
8 |
+
*
|
9 |
+
* @since 3.1.0
|
10 |
+
* @author PaymentPlugins
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class WC_Stripe_Admin_Notices {
|
14 |
+
|
15 |
+
public static function init() {
|
16 |
+
add_action ( 'admin_notices', [ __CLASS__,
|
17 |
+
'notices'
|
18 |
+
] );
|
19 |
+
}
|
20 |
+
|
21 |
+
public static function notices() {
|
22 |
+
$messages = [];
|
23 |
+
foreach ( static::get_notices () as $key => $notice ) {
|
24 |
+
if ($notice[ 'callback' ] ()) {
|
25 |
+
$screen = get_current_screen ();
|
26 |
+
$screen_id = $screen ? $screen->id : '';
|
27 |
+
ob_start ();
|
28 |
+
echo '<div class="notice notice-info woocommerce-message"><p>' . $notice[ 'message' ] () . '</p></div>';
|
29 |
+
$message = ob_get_clean ();
|
30 |
+
if (strstr ( $screen_id, 'wc-settings' )) {
|
31 |
+
$messages[] = $message;
|
32 |
+
} else {
|
33 |
+
echo $message;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
// in WC 4.0 admin notices don't show on the WC Settings pages so adding this workaround.
|
38 |
+
if ($messages) {
|
39 |
+
wp_localize_script ( 'wc-stripe-admin-settings', 'wc_stripe_admin_notices', $messages );
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
public static function get_notices() {
|
44 |
+
return [
|
45 |
+
'connect_notice' => [
|
46 |
+
'callback' => function () {
|
47 |
+
return ( ! isset ( $_GET[ '_stripe_connect_nonce' ] ) && ( ! wc_stripe ()->api_settings->get_option ( 'account_id' ) && get_option ( 'wc_stripe_connect_notice', 'no' ) == 'yes' ) );
|
48 |
+
},
|
49 |
+
'message' => function () {
|
50 |
+
wp_enqueue_style ( 'wc-stripe-styles', wc_stripe ()->assets_url ( 'css/admin/admin.css' ), [], wc_stripe ()->version () );
|
51 |
+
return sprintf ( __ ( 'At Stripe\'s request we have updated how the Stripe for WooCommerce
|
52 |
+
plugin integrates with Stripe. This new integration offers even more security and
|
53 |
+
Stripe is requesting that all merchants switch. %sUpdate Integration%s', 'woo-stripe-payment' ), '<a href="' . wc_stripe ()->api_settings->get_connect_url () . '" class="stripe-connect light-blue do-stripe-connect"><span>', '</span></a>' );
|
54 |
+
}
|
55 |
+
]
|
56 |
+
];
|
57 |
+
}
|
58 |
+
}
|
59 |
+
\PaymentPlugins\WC_Stripe_Admin_Notices::init ();
|
includes/admin/class-wc-stripe-admin-user-edit.php
CHANGED
@@ -30,6 +30,7 @@ class WC_Stripe_Admin_User_Edit {
|
|
30 |
// enquue scripts
|
31 |
wp_enqueue_style ( 'wc-stripe-admin-style' );
|
32 |
|
|
|
33 |
// get payment methods for all environments.
|
34 |
$tokens = WC_Payment_Tokens::get_customer_tokens ( $user->ID );
|
35 |
$payment_methods = array( 'live' => array(),
|
@@ -83,7 +84,7 @@ class WC_Stripe_Admin_User_Edit {
|
|
83 |
'live' => $old_live_id !== wc_stripe_get_customer_id ( $user_id, 'live' ),
|
84 |
'test' => $old_test_id !== wc_stripe_get_customer_id ( $user_id, 'test' )
|
85 |
);
|
86 |
-
$gateway =
|
87 |
|
88 |
// this will prevent the payment method from being deleted in Stripe. We only want to remove the tokens
|
89 |
// from the WC tables.
|
@@ -102,29 +103,7 @@ class WC_Stripe_Admin_User_Edit {
|
|
102 |
}
|
103 |
}
|
104 |
// import payment methods from Stripe.
|
105 |
-
|
106 |
-
if (! is_wp_error ( $payment_methods )) {
|
107 |
-
$gateway_id = '';
|
108 |
-
foreach ( $payment_methods->data as $payment_method ) {
|
109 |
-
if (strpos ( $payment_method->id, 'pm_' ) !== false) {
|
110 |
-
$gateway_id = 'stripe_cc';
|
111 |
-
}
|
112 |
-
if (strpos ( $payment_method->id, 'card_' ) !== false) {
|
113 |
-
$gateway_id = 'stripe_googlepay';
|
114 |
-
}
|
115 |
-
if ($gateway_id) {
|
116 |
-
/**
|
117 |
-
*
|
118 |
-
* @var WC_Payment_Gateway_Stripe $gateway
|
119 |
-
*/
|
120 |
-
$gateway = WC ()->payment_gateways ()->payment_gateways ()[ $gateway_id ];
|
121 |
-
$token = $gateway->get_payment_token ( $payment_method->id, $payment_method );
|
122 |
-
$token->set_environment ( $mode );
|
123 |
-
$token->set_user_id ( $user_id );
|
124 |
-
$token->save ();
|
125 |
-
}
|
126 |
-
}
|
127 |
-
}
|
128 |
}
|
129 |
}
|
130 |
}
|
30 |
// enquue scripts
|
31 |
wp_enqueue_style ( 'wc-stripe-admin-style' );
|
32 |
|
33 |
+
remove_filter ( 'woocommerce_get_customer_payment_tokens', 'wc_stripe_get_customer_payment_tokens' );
|
34 |
// get payment methods for all environments.
|
35 |
$tokens = WC_Payment_Tokens::get_customer_tokens ( $user->ID );
|
36 |
$payment_methods = array( 'live' => array(),
|
84 |
'live' => $old_live_id !== wc_stripe_get_customer_id ( $user_id, 'live' ),
|
85 |
'test' => $old_test_id !== wc_stripe_get_customer_id ( $user_id, 'test' )
|
86 |
);
|
87 |
+
$gateway = WC_Stripe_Gateway::load ();
|
88 |
|
89 |
// this will prevent the payment method from being deleted in Stripe. We only want to remove the tokens
|
90 |
// from the WC tables.
|
103 |
}
|
104 |
}
|
105 |
// import payment methods from Stripe.
|
106 |
+
WC_Stripe_Customer_Manager::sync_payment_methods ( wc_stripe_get_customer_id ( $user_id, $mode ), $user_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
}
|
109 |
}
|
includes/admin/meta-boxes/views/html-order-charge-data.php
CHANGED
@@ -30,11 +30,8 @@
|
|
30 |
<style>
|
31 |
#order_data .order_data_column .transaction-data a.disabled:before {
|
32 |
content: '';
|
33 |
-
}
|
34 |
-
|
35 |
-
#order_data .order_data_column .transaction-data a.disabled {
|
36 |
background: url(<?php echo plugins_url('assets/images/wpspin.gif', WC_PLUGIN_FILE)?>)
|
37 |
no-repeat center top;
|
38 |
-
padding:
|
39 |
}
|
40 |
</style>
|
30 |
<style>
|
31 |
#order_data .order_data_column .transaction-data a.disabled:before {
|
32 |
content: '';
|
|
|
|
|
|
|
33 |
background: url(<?php echo plugins_url('assets/images/wpspin.gif', WC_PLUGIN_FILE)?>)
|
34 |
no-repeat center top;
|
35 |
+
padding: 0px 10px;
|
36 |
}
|
37 |
</style>
|
includes/admin/settings/class-wc-stripe-api-settings.php
CHANGED
@@ -1,4 +1,10 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
class WC_Stripe_API_Settings extends WC_Stripe_Settings_API {
|
3 |
|
4 |
public function __construct() {
|
@@ -33,65 +39,28 @@ class WC_Stripe_API_Settings extends WC_Stripe_Settings_API {
|
|
33 |
'live' => __ ( 'Live', 'woo-stripe-payment' )
|
34 |
), 'default' => 'test',
|
35 |
'desc_tip' => true,
|
36 |
-
'description' => __ ( 'The mode determines if you are processing test
|
37 |
),
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'description' => __ ( 'Your publishable key is used to initialize Stripe assets.', 'woo-stripe-payment' ),
|
43 |
-
'custom_attributes' => array(
|
44 |
-
'data-show-if' => array(
|
45 |
-
'mode' => 'test'
|
46 |
-
)
|
47 |
-
)
|
48 |
-
),
|
49 |
-
'secret_key_test' => array(
|
50 |
-
'title' => __ ( 'Test Secret Key', 'woo-stripe-payment' ),
|
51 |
-
'type' => 'password',
|
52 |
'default' => '', 'desc_tip' => true,
|
53 |
-
'description' => __ ( '
|
54 |
-
'custom_attributes' => array(
|
55 |
-
'data-show-if' => array(
|
56 |
-
'mode' => 'test'
|
57 |
-
)
|
58 |
-
)
|
59 |
),
|
60 |
-
'
|
61 |
-
'
|
62 |
-
'
|
63 |
-
'
|
64 |
-
'
|
65 |
-
'
|
66 |
-
'data-show-if' => array(
|
67 |
-
'mode' => 'live'
|
68 |
-
)
|
69 |
-
)
|
70 |
-
),
|
71 |
-
'secret_key_live' => array(
|
72 |
-
'title' => __ ( 'Live Secret Key', 'woo-stripe-payment' ),
|
73 |
-
'type' => 'password',
|
74 |
-
'default' => '', 'desc_tip' => true,
|
75 |
-
'description' => __ ( 'Your secret key is used to authenticate requests to Stripe.', 'woo-stripe-payment' ),
|
76 |
-
'custom_attributes' => array(
|
77 |
-
'data-show-if' => array(
|
78 |
-
'mode' => 'live'
|
79 |
-
)
|
80 |
-
)
|
81 |
),
|
82 |
'connection_test' => array(
|
83 |
'type' => 'stripe_button',
|
84 |
'title' => __ ( 'Connection Test', 'woo-stripe-payment' ),
|
85 |
'label' => __ ( 'Connection Test', 'woo-stripe-payment' ),
|
86 |
'class' => 'wc-stripe-connection-test button-secondary',
|
87 |
-
'description' => __ ( 'Click this button to perform a connection test. If successful,
|
88 |
-
),
|
89 |
-
'webhook_button' => array(
|
90 |
-
'type' => 'stripe_button',
|
91 |
-
'title' => __ ( 'Generate Webhook', 'woo-stripe-payment' ),
|
92 |
-
'label' => __ ( 'Generate Webhook', 'woo-stripe-payment' ),
|
93 |
-
'class' => 'wc-stripe-create-webhook button-secondary',
|
94 |
-
'description' => __ ( 'Click this button to configure webhooks automatically.', 'woo-stripe-payment' )
|
95 |
),
|
96 |
'webhook_url' => array(
|
97 |
'type' => 'paragraph',
|
@@ -128,21 +97,76 @@ class WC_Stripe_API_Settings extends WC_Stripe_Settings_API {
|
|
128 |
'description' => __ ( 'When enabled, the plugin logs important errors and info that can help you troubleshoot potential issues.', 'woo-stripe-payment' )
|
129 |
)
|
130 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
-
|
133 |
-
/*
|
134 |
-
* public function validate_publishable_key_test_field($key, $value) {
|
135 |
-
* if (! strstr ( $value, 'test' )) {
|
136 |
-
* throw new Exception ( __ ( 'You have entered an invalid publishable key for Test mode', 'woo-stripe-payment' ) );
|
137 |
-
* }
|
138 |
-
* return $value;
|
139 |
-
* }
|
140 |
-
*
|
141 |
-
* public function validate_publishable_key_live_field($key, $value) {
|
142 |
-
* if (! strstr ( $value, 'live' )) {
|
143 |
-
* throw new Exception ( __ ( 'You have entered an invalid publishable key for Live mode', 'woo-stripe-payment' ) );
|
144 |
-
* }
|
145 |
-
* return $value;
|
146 |
-
* }
|
147 |
-
*/
|
148 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @author Payment Plugins
|
5 |
+
* @since 3.0.0
|
6 |
+
*
|
7 |
+
*/
|
8 |
class WC_Stripe_API_Settings extends WC_Stripe_Settings_API {
|
9 |
|
10 |
public function __construct() {
|
39 |
'live' => __ ( 'Live', 'woo-stripe-payment' )
|
40 |
), 'default' => 'test',
|
41 |
'desc_tip' => true,
|
42 |
+
'description' => __ ( 'The mode determines if you are processing test transactions or live transactions on your site. Test mode allows you to simulate payments so you can test your integration.', 'woo-stripe-payment' )
|
43 |
),
|
44 |
+
'account_id' => array(
|
45 |
+
'type' => 'paragraph',
|
46 |
+
'title' => __ ( 'Account ID', 'woo-stripe-payment' ),
|
47 |
+
'text' => '', 'class' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
'default' => '', 'desc_tip' => true,
|
49 |
+
'description' => __ ( 'This is your Stripe Connect ID and serves as a unique identifier.', 'woo-stripe-payment' )
|
|
|
|
|
|
|
|
|
|
|
50 |
),
|
51 |
+
'stripe_connect' => array(
|
52 |
+
'type' => 'stripe_connect',
|
53 |
+
'title' => __ ( 'Connect Stripe Account', 'woo-stripe-payment' ),
|
54 |
+
'label' => __ ( 'Click to Connect', 'woo-stripe-payment' ),
|
55 |
+
'class' => 'do-stripe-connect',
|
56 |
+
'description' => __ ( 'We make it easy to connect Stripe to your site. Click the Connect button to go through our connect flow.', 'woo-stripe-payment' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
),
|
58 |
'connection_test' => array(
|
59 |
'type' => 'stripe_button',
|
60 |
'title' => __ ( 'Connection Test', 'woo-stripe-payment' ),
|
61 |
'label' => __ ( 'Connection Test', 'woo-stripe-payment' ),
|
62 |
'class' => 'wc-stripe-connection-test button-secondary',
|
63 |
+
'description' => __ ( 'Click this button to perform a connection test. If successful, your site is connected to Stripe.', 'woo-stripe-payment' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
),
|
65 |
'webhook_url' => array(
|
66 |
'type' => 'paragraph',
|
97 |
'description' => __ ( 'When enabled, the plugin logs important errors and info that can help you troubleshoot potential issues.', 'woo-stripe-payment' )
|
98 |
)
|
99 |
);
|
100 |
+
if ($this->get_option ( 'account_id' )) {
|
101 |
+
$this->form_fields[ 'account_id' ][ 'text' ] = $this->get_option ( 'account_id' );
|
102 |
+
$this->form_fields[ 'stripe_connect' ][ 'description' ] = sprintf ( __ ( '%s Your Stripe account has been connected. You can now accept Live and Test payments. You can Re-Connect if you want to recycle your API keys for security.', 'woo-stripe-payment' ), '<span class="dashicons dashicons-yes stipe-connect-active"></span>' );
|
103 |
+
$this->form_fields[ 'stripe_connect' ][ 'active' ] = true;
|
104 |
+
} else {
|
105 |
+
unset ( $this->form_fields[ 'account_id' ], $this->form_fields[ 'connection_test' ], $this->form_fields[ 'mode' ], $this->form_fields[ 'webhook_url' ] );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
public function generate_stripe_connect_html($key, $data) {
|
110 |
+
$field_key = $this->get_field_key ( $key );
|
111 |
+
$data = wp_parse_args ( $data, array(
|
112 |
+
'class' => '', 'style' => '',
|
113 |
+
'description' => '', 'desc_tip' => false,
|
114 |
+
'css' => '', 'active' => false
|
115 |
+
) );
|
116 |
+
$data[ 'connect_url' ] = $this->get_connect_url ();
|
117 |
+
if ($data[ 'active' ]) {
|
118 |
+
$data[ 'label' ] = __ ( 'Click To Re-Connect', 'woo-stripe-payment' );
|
119 |
+
}
|
120 |
+
ob_start ();
|
121 |
+
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-stripe-connect.php';
|
122 |
+
return ob_get_clean ();
|
123 |
+
}
|
124 |
+
|
125 |
+
public function admin_options() {
|
126 |
+
// Check if user is being returned from Stripe Connect
|
127 |
+
if (isset ( $_GET[ '_stripe_connect_nonce' ] ) && wp_verify_nonce ( $_GET[ '_stripe_connect_nonce' ], 'stripe-connect' )) {
|
128 |
+
if (isset ( $_GET[ 'error' ] )) {
|
129 |
+
$error = json_decode ( base64_decode ( wc_clean ( $_GET[ 'error' ] ) ) );
|
130 |
+
if (property_exists ( $error, 'message' )) {
|
131 |
+
$message = $error->message;
|
132 |
+
} elseif (property_exists ( $error, 'raw' )) {
|
133 |
+
$message = $error->raw->message;
|
134 |
+
} else {
|
135 |
+
$message = __ ( 'Please try again.', 'woo-stripe-payment' );
|
136 |
+
}
|
137 |
+
wc_stripe_log_error ( sprintf ( 'Error connecting to Stripe account. Reason: %s', $message ) );
|
138 |
+
$this->add_error ( sprintf ( __ ( 'We were not able to connect your Stripe account. Reason: %s', 'woo-stripe-payment' ), $message ) );
|
139 |
+
} elseif (isset ( $_GET[ 'response' ] )) {
|
140 |
+
$response = json_decode ( base64_decode ( $_GET[ 'response' ] ) );
|
141 |
+
|
142 |
+
// save the token to the api settings
|
143 |
+
$this->settings[ 'account_id' ] = $response->live->stripe_user_id;
|
144 |
+
$this->settings[ 'refresh_token' ] = $response->live->refresh_token;
|
145 |
+
|
146 |
+
$this->settings[ 'secret_key_live' ] = $response->live->access_token;
|
147 |
+
$this->settings[ 'publishable_key_live' ] = $response->live->stripe_publishable_key;
|
148 |
+
|
149 |
+
$this->settings[ 'secret_key_test' ] = $response->test->access_token;
|
150 |
+
$this->settings[ 'publishable_key_test' ] = $response->test->stripe_publishable_key;
|
151 |
+
|
152 |
+
update_option ( $this->get_option_key (), $this->settings );
|
153 |
+
|
154 |
+
delete_option ( 'wc_stripe_connect_notice' );
|
155 |
+
|
156 |
+
$this->init_form_fields ();
|
157 |
+
|
158 |
+
echo '<div class="updated inline notice-success is-dismissible "><p>' . __ ( 'Your Stripe account has been connected to your WooCommerce store. You may now accept payments in Live and Test mode.', 'woo-stripe-payment' ) . '</p></div>';
|
159 |
+
}
|
160 |
+
}
|
161 |
+
parent::admin_options ();
|
162 |
+
}
|
163 |
+
|
164 |
+
public function get_connect_url() {
|
165 |
+
return sprintf ( 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id=%s&stripe_landing=login&scope=read_write&state=%s', wc_stripe ()->client_id, base64_encode ( wp_json_encode ( [
|
166 |
+
'redirect' => sprintf ( admin_url ( 'admin.php?page=wc-settings&tab=checkout§ion=stripe_api&_stripe_connect_nonce=%s' ), wp_create_nonce ( 'stripe-connect' ) ),
|
167 |
+
'location' => get_option ( 'woocommerce_default_country', 'US' ),
|
168 |
+
'website' => get_site_url (),
|
169 |
+
'email' => get_bloginfo ( 'admin_email' )
|
170 |
+
] ) ) );
|
171 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
includes/admin/views/html-stripe-connect.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<tr valign="top">
|
2 |
+
<th scope="row" class="titledesc">
|
3 |
+
<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label>
|
4 |
+
</th>
|
5 |
+
<td class="forminp<?php if($data['active']){?> active<?php }?>">
|
6 |
+
<fieldset>
|
7 |
+
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
8 |
+
<label for="<?php echo esc_attr( $field_key ); ?>">
|
9 |
+
<a href="<?php echo $data['connect_url']?>" type="submit" class="stripe-connect light-blue <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo $field_key?>" <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?>><span><?php echo wp_kses_post( $data['label'] ); ?></span></a>
|
10 |
+
</label>
|
11 |
+
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
|
12 |
+
</fieldset>
|
13 |
+
</td>
|
14 |
+
</tr>
|
includes/class-stripe.php
CHANGED
@@ -21,7 +21,7 @@ class WC_Stripe_Manager {
|
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
-
public $version = '3.0
|
25 |
|
26 |
/**
|
27 |
*
|
@@ -35,6 +35,19 @@ class WC_Stripe_Manager {
|
|
35 |
*/
|
36 |
public $rest_api;
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/**
|
39 |
*
|
40 |
* @var WC_Stripe_Frontend_Scripts
|
@@ -114,6 +127,7 @@ class WC_Stripe_Manager {
|
|
114 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-settings.php';
|
115 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/meta-boxes/class-wc-stripe-admin-order-metaboxes.php';
|
116 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-user-edit.php';
|
|
|
117 |
}
|
118 |
}
|
119 |
|
@@ -128,10 +142,15 @@ class WC_Stripe_Manager {
|
|
128 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/wc-stripe-webhook-functions.php';
|
129 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/wc-stripe-hooks.php';
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
// load gateways
|
132 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe.php';
|
133 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe-charge.php';
|
134 |
-
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php';
|
135 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php';
|
136 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-cc.php';
|
137 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-applepay.php';
|
@@ -148,6 +167,8 @@ class WC_Stripe_Manager {
|
|
148 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-sofort.php';
|
149 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-wechat.php';
|
150 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-bancontact.php';
|
|
|
|
|
151 |
|
152 |
// tokens
|
153 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-token-stripe.php';
|
@@ -162,7 +183,9 @@ class WC_Stripe_Manager {
|
|
162 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-field-manager.php';
|
163 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-rest-api.php';
|
164 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway.php';
|
|
|
165 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-customer-manager.php';
|
|
|
166 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-frontend-notices.php';
|
167 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-redirect-handler.php';
|
168 |
|
@@ -185,7 +208,9 @@ class WC_Stripe_Manager {
|
|
185 |
'WC_Payment_Gateway_Stripe_Multibanco',
|
186 |
'WC_Payment_Gateway_Stripe_Sepa',
|
187 |
'WC_Payment_Gateway_Stripe_Sofort',
|
188 |
-
'WC_Payment_Gateway_Stripe_WeChat'
|
|
|
|
|
189 |
) );
|
190 |
|
191 |
$api_class = apply_filters ( 'wc_stripe_rest_api_class', 'WC_Stripe_Rest_API' );
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
+
public $version = '3.1.0';
|
25 |
|
26 |
/**
|
27 |
*
|
35 |
*/
|
36 |
public $rest_api;
|
37 |
|
38 |
+
/**
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
public $client_id = 'ca_Gp4vLOJiqHJLZGxakHW7JdbBlcgWK8Up';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Test client id;
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
// public $client_id = 'ca_Gp4vL3V6FpTguYoZIehD5COPeI80rLpV';
|
50 |
+
|
51 |
/**
|
52 |
*
|
53 |
* @var WC_Stripe_Frontend_Scripts
|
127 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-settings.php';
|
128 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/meta-boxes/class-wc-stripe-admin-order-metaboxes.php';
|
129 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-user-edit.php';
|
130 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/admin/class-wc-stripe-admin-notices.php';
|
131 |
}
|
132 |
}
|
133 |
|
142 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/wc-stripe-webhook-functions.php';
|
143 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/wc-stripe-hooks.php';
|
144 |
|
145 |
+
// constants
|
146 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-constants.php';
|
147 |
+
|
148 |
+
// traits
|
149 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/traits/wc-stripe-settings-trait.php';
|
150 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/traits/wc-stripe-controller-cart-trait.php';
|
151 |
+
|
152 |
// load gateways
|
153 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe.php';
|
|
|
|
|
154 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php';
|
155 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-cc.php';
|
156 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-applepay.php';
|
167 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-sofort.php';
|
168 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-wechat.php';
|
169 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-bancontact.php';
|
170 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-fpx.php';
|
171 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/gateways/class-wc-payment-gateway-stripe-alipay.php';
|
172 |
|
173 |
// tokens
|
174 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-payment-token-stripe.php';
|
183 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-field-manager.php';
|
184 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-rest-api.php';
|
185 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway.php';
|
186 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway-ach.php';
|
187 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-customer-manager.php';
|
188 |
+
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-gateway-conversions.php';
|
189 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-frontend-notices.php';
|
190 |
include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/class-wc-stripe-redirect-handler.php';
|
191 |
|
208 |
'WC_Payment_Gateway_Stripe_Multibanco',
|
209 |
'WC_Payment_Gateway_Stripe_Sepa',
|
210 |
'WC_Payment_Gateway_Stripe_Sofort',
|
211 |
+
'WC_Payment_Gateway_Stripe_WeChat',
|
212 |
+
'WC_Payment_Gateway_Stripe_FPX',
|
213 |
+
'WC_Payment_Gateway_Stripe_Alipay'
|
214 |
) );
|
215 |
|
216 |
$api_class = apply_filters ( 'wc_stripe_rest_api_class', 'WC_Stripe_Rest_API' );
|
includes/class-wc-stripe-constants.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @since 3.1.0
|
4 |
+
* @author Payment Plugins
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class WC_Stripe_Constants {
|
8 |
+
|
9 |
+
const CUSTOMER_ID = '_wc_stripe_customer';
|
10 |
+
|
11 |
+
const PAYMENT_METHOD_TOKEN = '_payment_method_token';
|
12 |
+
|
13 |
+
const PAYMENT_INTENT_ID = '_payment_intent_id';
|
14 |
+
|
15 |
+
const PAYMENT_INTENT = '_payment_intent';
|
16 |
+
|
17 |
+
const MODE = '_wc_stripe_mode';
|
18 |
+
|
19 |
+
const CHARGE_STATUS = '_wc_stripe_charge_status';
|
20 |
+
}
|
includes/class-wc-stripe-customer-manager.php
CHANGED
@@ -32,7 +32,6 @@ class WC_Stripe_Customer_Manager {
|
|
32 |
}
|
33 |
} else {
|
34 |
// create the customer
|
35 |
-
$gateway = new WC_Stripe_Gateway ();
|
36 |
$customer_id = $this->create_customer ( $customer );
|
37 |
if (! is_wp_error ( $customer_id )) {
|
38 |
wc_stripe_save_customer ( $customer_id, $customer->get_id () );
|
@@ -47,8 +46,7 @@ class WC_Stripe_Customer_Manager {
|
|
47 |
* @param WC_Customer $customer
|
48 |
*/
|
49 |
private function create_customer($customer) {
|
50 |
-
|
51 |
-
return $gateway->create_customer ( apply_filters ( 'wc_stripe_customer_args', array(
|
52 |
'email' => $customer->get_email (),
|
53 |
'name' => sprintf ( '%s %s', $customer->get_first_name (), $customer->get_last_name () ),
|
54 |
'phone' => $customer->get_billing_phone (),
|
@@ -65,10 +63,9 @@ class WC_Stripe_Customer_Manager {
|
|
65 |
* @param WC_Customer $customer
|
66 |
*/
|
67 |
private function update_customer($customer) {
|
68 |
-
|
69 |
-
|
70 |
-
'
|
71 |
-
'name' => sprintf ( '%s %s', $customer->get_first_name (), $customer->get_last_name () ),
|
72 |
'phone' => $customer->get_billing_phone ()
|
73 |
) );
|
74 |
}
|
@@ -96,9 +93,65 @@ class WC_Stripe_Customer_Manager {
|
|
96 |
*/
|
97 |
private function user_has_id($customer) {
|
98 |
$id = wc_stripe_get_customer_id ( $customer->get_id () );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
return ! empty ( $id );
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Returns true if the customer should be updated in Stripe.
|
104 |
*
|
32 |
}
|
33 |
} else {
|
34 |
// create the customer
|
|
|
35 |
$customer_id = $this->create_customer ( $customer );
|
36 |
if (! is_wp_error ( $customer_id )) {
|
37 |
wc_stripe_save_customer ( $customer_id, $customer->get_id () );
|
46 |
* @param WC_Customer $customer
|
47 |
*/
|
48 |
private function create_customer($customer) {
|
49 |
+
return WC_Stripe_Gateway::load ()->create_customer ( apply_filters ( 'wc_stripe_customer_args', array(
|
|
|
50 |
'email' => $customer->get_email (),
|
51 |
'name' => sprintf ( '%s %s', $customer->get_first_name (), $customer->get_last_name () ),
|
52 |
'phone' => $customer->get_billing_phone (),
|
63 |
* @param WC_Customer $customer
|
64 |
*/
|
65 |
private function update_customer($customer) {
|
66 |
+
return WC_Stripe_Gateway::load ()->update_customer ( wc_stripe_get_customer_id ( $customer->get_id () ), array(
|
67 |
+
'email' => $customer->get_billing_email (),
|
68 |
+
'name' => sprintf ( '%s %s', $customer->get_billing_first_name (), $customer->get_billing_last_name () ),
|
|
|
69 |
'phone' => $customer->get_billing_phone ()
|
70 |
) );
|
71 |
}
|
93 |
*/
|
94 |
private function user_has_id($customer) {
|
95 |
$id = wc_stripe_get_customer_id ( $customer->get_id () );
|
96 |
+
|
97 |
+
// this customer may have an ID from another plugin. Check that too.
|
98 |
+
if (empty ( $id )) {
|
99 |
+
$id = get_user_option ( '_stripe_customer_id', $customer->get_id () );
|
100 |
+
if (! empty ( $id )) {
|
101 |
+
// validate that this customer exists in the Stripe gateway
|
102 |
+
$response = WC_Stripe_Gateway::load ()->fetch_customer ( $id );
|
103 |
+
if (! is_wp_error ( $response )) {
|
104 |
+
// id exists so save customer ID to this plugin's format.
|
105 |
+
wc_stripe_save_customer ( $id, $customer->get_id () );
|
106 |
+
|
107 |
+
// load this customer's payment methods
|
108 |
+
$this->sync_payment_methods ( $id, $customer->get_id () );
|
109 |
+
} else {
|
110 |
+
$id = '';
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
return ! empty ( $id );
|
115 |
}
|
116 |
|
117 |
+
/**
|
118 |
+
* Syncs the WC database payment methods with the payment methods stored in Stripe.
|
119 |
+
*
|
120 |
+
* @since 3.1.0
|
121 |
+
* @param string $customer_id
|
122 |
+
* @param int $user_id
|
123 |
+
*/
|
124 |
+
public static function sync_payment_methods($customer_id, $user_id) {
|
125 |
+
$payment_methods = WC_Stripe_Gateway::load ()->fetch_payment_methods ( $customer_id );
|
126 |
+
|
127 |
+
if (! is_wp_error ( $payment_methods )) {
|
128 |
+
foreach ( $payment_methods->data as $payment_method ) {
|
129 |
+
if (! WC_Payment_Token_Stripe::token_exists ( $payment_method->id, $user_id )) {
|
130 |
+
$payment_gateways = WC ()->payment_gateways ()->payment_gateways ();
|
131 |
+
$gateway_id = null;
|
132 |
+
|
133 |
+
if (strstr ( $payment_method->id, 'pm_' ) || strstr ( $payment_method->id, 'src_' )) {
|
134 |
+
$gateway_id = 'stripe_cc';
|
135 |
+
} elseif (strstr ( $payment_method->id, 'card_' )) {
|
136 |
+
$gateway_id = 'stripe_googlepay';
|
137 |
+
}
|
138 |
+
/**
|
139 |
+
*
|
140 |
+
* @var WC_Payment_Gateway_Stripe_CC $payment_gateway
|
141 |
+
*/
|
142 |
+
$payment_gateway = $payment_gateways[ $gateway_id ];
|
143 |
+
$token = $payment_gateway->get_payment_token ( $payment_method->id, $payment_method );
|
144 |
+
$token->set_environment ( $payment_method->livemode ? 'live' : 'test' );
|
145 |
+
$token->set_user_id ( $user_id );
|
146 |
+
$token->set_customer_id ( $customer_id );
|
147 |
+
$token->save ();
|
148 |
+
}
|
149 |
+
}
|
150 |
+
} else {
|
151 |
+
wc_stripe_log_info ( sprintf ( 'Payment methods for customer %s could not be synced. Reason: %s', $customer_id, $payment_methods->get_error_message () ) );
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
/**
|
156 |
* Returns true if the customer should be updated in Stripe.
|
157 |
*
|
includes/class-wc-stripe-field-manager.php
CHANGED
@@ -28,9 +28,11 @@ class WC_Stripe_Field_Manager {
|
|
28 |
add_action ( 'before_woocommerce_pay', array(
|
29 |
__CLASS__, 'change_payment_request'
|
30 |
) );
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
34 |
add_action ( 'woocommerce_pay_order_after_submit', array(
|
35 |
__CLASS__, 'pay_order_fields'
|
36 |
) );
|
@@ -40,7 +42,7 @@ class WC_Stripe_Field_Manager {
|
|
40 |
self::$_cart_priority = apply_filters ( 'wc_stripe_cart_buttons_order', 30 );
|
41 |
add_action ( 'woocommerce_proceed_to_checkout', [
|
42 |
__CLASS__, 'output_cart_fields'
|
43 |
-
],
|
44 |
}
|
45 |
|
46 |
public static function output_banner_checkout_fields() {
|
@@ -65,7 +67,7 @@ class WC_Stripe_Field_Manager {
|
|
65 |
|
66 |
wp_localize_script ( 'wc-checkout', 'wc_stripe_checkout_fields', [
|
67 |
'billing' => WC ()->checkout ()->get_checkout_fields ( 'billing' ),
|
68 |
-
'shipping' => WC ()->checkout ()->get_checkout_fields ( '
|
69 |
] );
|
70 |
|
71 |
do_action ( 'wc_stripe_output_checkout_fields' );
|
@@ -83,31 +85,35 @@ class WC_Stripe_Field_Manager {
|
|
83 |
$gateways[ $gateway->id ] = $gateway;
|
84 |
}
|
85 |
}
|
86 |
-
self::output_required_fields ();
|
87 |
-
printf ( '<input type="hidden" id="product_id", value="%s"/>', $product->get_id () );
|
88 |
-
printf ( '<input type="hidden" id="wc_stripe_product_data" data-product="%s"/>', htmlspecialchars ( wp_json_encode ( [
|
89 |
-
'product_id' => $product->get_id (),
|
90 |
-
'price' => $product->get_price (),
|
91 |
-
'needs_shipping' => $product->needs_shipping ()
|
92 |
-
] ) ) );
|
93 |
-
printf ( '<input type="hidden" id="wc_stripe_display_items" data-items="%s"/>', htmlspecialchars ( wp_json_encode ( [
|
94 |
-
[
|
95 |
-
'amount' => wc_stripe_add_number_precision ( $product->get_price () ),
|
96 |
-
'label' => esc_attr ( $product->get_name () ),
|
97 |
-
'pending' => true
|
98 |
-
]
|
99 |
-
] ) ) );
|
100 |
-
printf ( '<input type="hidden" id="wc_stripe_shipping_options" data-items="%s"/>', htmlspecialchars ( wp_json_encode ( [] ) ) );
|
101 |
-
printf ( '<input type="hidden" id="wc_stripe_order_total_cents" data-amount="%s"/>', wc_stripe_add_number_precision ( $product->get_price () ) );
|
102 |
-
|
103 |
-
self::output_fields ( 'billing' );
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
|
113 |
public static function output_cart_fields() {
|
@@ -186,6 +192,12 @@ class WC_Stripe_Field_Manager {
|
|
186 |
printf ( '<input type="hidden" id="wc_stripe_needs_shipping" data-value="%s" />', $needs_shipping );
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
public static function quantity_input_value($args) {
|
190 |
if (is_product ()) {
|
191 |
foreach ( WC ()->payment_gateways ()->get_available_payment_gateways () as $id => $gateway ) {
|
28 |
add_action ( 'before_woocommerce_pay', array(
|
29 |
__CLASS__, 'change_payment_request'
|
30 |
) );
|
31 |
+
/*
|
32 |
+
* add_action ( 'woocommerce_quantity_input_args', array(
|
33 |
+
* __CLASS__, 'quantity_input_value'
|
34 |
+
* ) );
|
35 |
+
*/
|
36 |
add_action ( 'woocommerce_pay_order_after_submit', array(
|
37 |
__CLASS__, 'pay_order_fields'
|
38 |
) );
|
42 |
self::$_cart_priority = apply_filters ( 'wc_stripe_cart_buttons_order', 30 );
|
43 |
add_action ( 'woocommerce_proceed_to_checkout', [
|
44 |
__CLASS__, 'output_cart_fields'
|
45 |
+
], self::$_cart_priority );
|
46 |
}
|
47 |
|
48 |
public static function output_banner_checkout_fields() {
|
67 |
|
68 |
wp_localize_script ( 'wc-checkout', 'wc_stripe_checkout_fields', [
|
69 |
'billing' => WC ()->checkout ()->get_checkout_fields ( 'billing' ),
|
70 |
+
'shipping' => WC ()->checkout ()->get_checkout_fields ( 'shipping' )
|
71 |
] );
|
72 |
|
73 |
do_action ( 'wc_stripe_output_checkout_fields' );
|
85 |
$gateways[ $gateway->id ] = $gateway;
|
86 |
}
|
87 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
+
if (count ( $gateways ) > 0) {
|
90 |
+
|
91 |
+
self::output_required_fields ();
|
92 |
+
printf ( '<input type="hidden" id="product_id", value="%s"/>', $product->get_id () );
|
93 |
+
printf ( '<input type="hidden" id="wc_stripe_product_data" data-product="%s"/>', htmlspecialchars ( wp_json_encode ( [
|
94 |
+
'product_id' => $product->get_id (),
|
95 |
+
'price' => $product->get_price (),
|
96 |
+
'needs_shipping' => $product->needs_shipping ()
|
97 |
+
] ) ) );
|
98 |
+
printf ( '<input type="hidden" id="wc_stripe_display_items" data-items="%s"/>', htmlspecialchars ( wp_json_encode ( [
|
99 |
+
[
|
100 |
+
'amount' => wc_stripe_add_number_precision ( $product->get_price () ),
|
101 |
+
'label' => esc_attr ( $product->get_name () ),
|
102 |
+
'pending' => true
|
103 |
+
]
|
104 |
+
] ) ) );
|
105 |
+
printf ( '<input type="hidden" id="wc_stripe_shipping_options" data-items="%s"/>', htmlspecialchars ( wp_json_encode ( [] ) ) );
|
106 |
+
printf ( '<input type="hidden" id="wc_stripe_order_total_cents" data-amount="%s"/>', wc_stripe_add_number_precision ( $product->get_price () ) );
|
107 |
+
|
108 |
+
self::output_fields ( 'billing' );
|
109 |
+
|
110 |
+
// don't always need shipping fields but doesn't hurt to output them anyway.
|
111 |
+
self::output_fields ( 'shipping' );
|
112 |
+
|
113 |
+
wc_stripe_get_template ( 'product/payment-methods.php', [
|
114 |
+
'gateways' => $gateways
|
115 |
+
] );
|
116 |
+
}
|
117 |
}
|
118 |
|
119 |
public static function output_cart_fields() {
|
192 |
printf ( '<input type="hidden" id="wc_stripe_needs_shipping" data-value="%s" />', $needs_shipping );
|
193 |
}
|
194 |
|
195 |
+
/**
|
196 |
+
*
|
197 |
+
* @deprecated
|
198 |
+
*
|
199 |
+
* @param array $args
|
200 |
+
*/
|
201 |
public static function quantity_input_value($args) {
|
202 |
if (is_product ()) {
|
203 |
foreach ( WC ()->payment_gateways ()->get_available_payment_gateways () as $id => $gateway ) {
|
includes/class-wc-stripe-frontend-scripts.php
CHANGED
@@ -40,35 +40,43 @@ class WC_Stripe_Frontend_Scripts {
|
|
40 |
}
|
41 |
|
42 |
// register scripts that aren't part of gateways
|
43 |
-
$this->register_script ( 'wc-stripe', $this->assets_url ( 'js/frontend/wc-stripe' . $this->get_min () . '.js' ),
|
44 |
'jquery', $this->get_handle ( 'external' )
|
45 |
-
|
46 |
|
47 |
-
$this->register_script ( 'form-handler', $this->assets_url ( 'js/frontend/form-handler.js' ),
|
48 |
-
'
|
49 |
-
|
50 |
|
51 |
wp_localize_script ( $this->get_handle ( 'wc-stripe' ), 'wc_stripe_params_v3', [
|
52 |
'api_key' => wc_stripe_get_publishable_key (),
|
53 |
'page' => $this->get_page_id ()
|
54 |
] );
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
public function enqueue_checkout_scripts() {
|
58 |
-
$
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
-
public function register_script($handle, $src, $deps =
|
66 |
$version = empty ( $version ) ? wc_stripe ()->version () : $version;
|
67 |
$this->registered_scripts[] = $this->get_handle ( $handle );
|
68 |
wp_register_script ( $this->get_handle ( $handle ), $src, $deps, $version, $footer );
|
69 |
}
|
70 |
|
71 |
-
public function enqueue_script($handle, $src = '', $deps =
|
72 |
$handle = $this->get_handle ( $handle );
|
73 |
$version = empty ( $version ) ? wc_stripe ()->version () : $version;
|
74 |
if (! in_array ( $handle, $this->registered_scripts )) {
|
40 |
}
|
41 |
|
42 |
// register scripts that aren't part of gateways
|
43 |
+
$this->register_script ( 'wc-stripe', $this->assets_url ( 'js/frontend/wc-stripe' . $this->get_min () . '.js' ), [
|
44 |
'jquery', $this->get_handle ( 'external' )
|
45 |
+
] );
|
46 |
|
47 |
+
$this->register_script ( 'form-handler', $this->assets_url ( 'js/frontend/form-handler.js' ), [
|
48 |
+
'selectWoo'
|
49 |
+
] );
|
50 |
|
51 |
wp_localize_script ( $this->get_handle ( 'wc-stripe' ), 'wc_stripe_params_v3', [
|
52 |
'api_key' => wc_stripe_get_publishable_key (),
|
53 |
'page' => $this->get_page_id ()
|
54 |
] );
|
55 |
+
|
56 |
+
wp_localize_script ( $this->get_handle ( 'form-handler' ), 'wc_stripe_form_handler_params', [
|
57 |
+
'no_results' => __ ( 'No matches found', 'woo-stripe-payment' )
|
58 |
+
] );
|
59 |
}
|
60 |
|
61 |
public function enqueue_checkout_scripts() {
|
62 |
+
$data = wc_stripe_get_local_payment_params ();
|
63 |
+
// only enqueue local payment script if there are local payment gateways that have been enabled.
|
64 |
+
if (! empty ( $data[ 'gateways' ] )) {
|
65 |
+
$this->enqueue_script ( 'local-payment', $this->assets_url ( 'js/frontend/local-payment.js' ), [
|
66 |
+
$this->get_handle ( 'external' ),
|
67 |
+
$this->get_handle ( 'wc-stripe' )
|
68 |
+
] );
|
69 |
+
$this->localize_script ( 'local-payment', $data );
|
70 |
+
}
|
71 |
}
|
72 |
|
73 |
+
public function register_script($handle, $src, $deps = [], $version = '', $footer = true) {
|
74 |
$version = empty ( $version ) ? wc_stripe ()->version () : $version;
|
75 |
$this->registered_scripts[] = $this->get_handle ( $handle );
|
76 |
wp_register_script ( $this->get_handle ( $handle ), $src, $deps, $version, $footer );
|
77 |
}
|
78 |
|
79 |
+
public function enqueue_script($handle, $src = '', $deps = [], $version = '', $footer = true) {
|
80 |
$handle = $this->get_handle ( $handle );
|
81 |
$version = empty ( $version ) ? wc_stripe ()->version () : $version;
|
82 |
if (! in_array ( $handle, $this->registered_scripts )) {
|
includes/class-wc-stripe-gateway-ach.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @since 3.1.0
|
4 |
+
* @author Payment Plugins
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class WC_Stripe_Gateway_ACH extends WC_Stripe_Gateway {
|
8 |
+
|
9 |
+
private $public_token = '';
|
10 |
+
|
11 |
+
private $account_id = '';
|
12 |
+
|
13 |
+
private $environment = '';
|
14 |
+
|
15 |
+
public function set_public_token($public_token) {
|
16 |
+
$this->public_token = $public_token;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function set_account_id($account_id) {
|
20 |
+
$this->account_id = $account_id;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function set_plaid_environment($environment) {
|
24 |
+
$this->environment = $environment;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
*
|
29 |
+
* {@inheritDoc}
|
30 |
+
*
|
31 |
+
* @see WC_Stripe_Gateway::charge()
|
32 |
+
*/
|
33 |
+
public function charge($args, $mode = '') {
|
34 |
+
$mode = empty ( $mode ) ? wc_stripe_mode () : $mode;
|
35 |
+
$args = [ 'charge' => $args, 'mode' => $mode,
|
36 |
+
'account_id' => wc_stripe ()->api_settings->get_option ( 'account_id' ),
|
37 |
+
'plaid' => [
|
38 |
+
'public_token' => $this->public_token,
|
39 |
+
'account_id' => $this->account_id,
|
40 |
+
'environment' => $this->environment
|
41 |
+
]
|
42 |
+
];
|
43 |
+
try {
|
44 |
+
// validate env and mode to prevent conflicts
|
45 |
+
if ($mode == 'live' && in_array ( $this->environment, [
|
46 |
+
'sandbox', 'development'
|
47 |
+
] )) {
|
48 |
+
throw new Exception ( __ ( 'Please update your ACH environment to Production to match your Stripe API Mode.', 'woo-stripe-payment' ) );
|
49 |
+
}
|
50 |
+
$response = $this->do_request ( 'POST', '', $args, $mode );
|
51 |
+
return $response;
|
52 |
+
} catch ( Exception $e ) {
|
53 |
+
return new WP_Error ( 'charge-error', $e->getMessage () );
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
private function do_request($method, $uri, $args, $mode) {
|
58 |
+
$response = wp_safe_remote_post ( $this->base_url ( $uri, $mode ), [
|
59 |
+
'headers' => [
|
60 |
+
'Content-Type' => 'application/json'
|
61 |
+
], /**
|
62 |
+
* 20 second timeout
|
63 |
+
*/
|
64 |
+
'timeout' => 20,
|
65 |
+
'body' => wp_json_encode ( $args )
|
66 |
+
] );
|
67 |
+
if (is_wp_error ( $response )) {
|
68 |
+
throw new Exception ( $response->get_error_message () );
|
69 |
+
} else {
|
70 |
+
$body = json_decode ( $response[ 'body' ], true );
|
71 |
+
if ($response[ 'response' ][ 'code' ] > 299) {
|
72 |
+
throw new Exception ( $body[ 'message' ] );
|
73 |
+
} else {
|
74 |
+
$obj = \Stripe\Util\Util::convertToStripeObject ( $body, null );
|
75 |
+
$obj->setLastResponse ( $response );
|
76 |
+
return $obj;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
*
|
83 |
+
* @param string $uri
|
84 |
+
*/
|
85 |
+
private function base_url($uri, $mode) {
|
86 |
+
$url = '';
|
87 |
+
switch ($mode) {
|
88 |
+
case 'live' :
|
89 |
+
case 'test' :
|
90 |
+
$url = 'https://api.plaid.paymentplugins.com/v1/stripe/';
|
91 |
+
// $url = 'http://localhost:8080/v1/stripe/';
|
92 |
+
break;
|
93 |
+
}
|
94 |
+
return $url . $uri;
|
95 |
+
}
|
96 |
+
}
|
includes/class-wc-stripe-gateway-conversions.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @since 3.1.0
|
4 |
+
* @author Payment Plugins
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class WC_Stripe_Gateway_Conversion {
|
8 |
+
|
9 |
+
public static function init() {
|
10 |
+
add_filter ( 'woocommerce_order_get_payment_method', array(
|
11 |
+
__CLASS__, 'convert_payment_method'
|
12 |
+
), 10, 2 );
|
13 |
+
add_filter ( 'woocommerce_subscription_get_payment_method', array(
|
14 |
+
__CLASS__, 'convert_payment_method'
|
15 |
+
), 10, 2 );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
*
|
20 |
+
* @param string $payment_method
|
21 |
+
* @param WC_Order $order
|
22 |
+
*/
|
23 |
+
public static function convert_payment_method($payment_method, $order) {
|
24 |
+
$old_payment_method = $payment_method;
|
25 |
+
|
26 |
+
switch ($payment_method) {
|
27 |
+
case 'stripe' :
|
28 |
+
$payment_method = 'stripe_cc';
|
29 |
+
break;
|
30 |
+
}
|
31 |
+
if ($payment_method != $old_payment_method && ! empty ( $payment_method )) {
|
32 |
+
update_post_meta ( $order->get_id (), '_payment_method', $payment_method );
|
33 |
+
}
|
34 |
+
return $payment_method;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
WC_Stripe_Gateway_Conversion::init ();
|
includes/class-wc-stripe-gateway.php
CHANGED
@@ -41,6 +41,26 @@ class WC_Stripe_Gateway {
|
|
41 |
\Stripe\Stripe::setApiVersion ( '2019-12-03' );
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
/**
|
45 |
* Create a customer within Stripe.
|
46 |
*
|
@@ -217,7 +237,8 @@ class WC_Stripe_Gateway {
|
|
217 |
try {
|
218 |
return \Stripe\Charge::retrieve ( $charge_id, $this->get_api_options ( $mode ) );
|
219 |
} catch ( \Stripe\Error\Base $e ) {
|
220 |
-
|
|
|
221 |
}
|
222 |
}
|
223 |
|
@@ -279,8 +300,7 @@ class WC_Stripe_Gateway {
|
|
279 |
|
280 |
/**
|
281 |
*
|
282 |
-
* @param string $id
|
283 |
-
* card id
|
284 |
* @param string $customer
|
285 |
* @param string $mode
|
286 |
*/
|
@@ -378,7 +398,7 @@ class WC_Stripe_Gateway {
|
|
378 |
return \Stripe\Customer::retrieve ( $customer_id, $this->get_api_options ( $mode ) );
|
379 |
} catch ( \Stripe\Error\Base $e ) {
|
380 |
$err = $e->getJsonBody ()[ 'error' ];
|
381 |
-
return new WP_Error ( '
|
382 |
}
|
383 |
}
|
384 |
|
@@ -393,11 +413,11 @@ class WC_Stripe_Gateway {
|
|
393 |
}
|
394 |
}
|
395 |
|
396 |
-
public function fetch_payment_methods($customer_id, $mode = '') {
|
397 |
try {
|
398 |
return \Stripe\PaymentMethod::all ( [
|
399 |
'customer' => $customer_id,
|
400 |
-
'type' =>
|
401 |
], $this->get_api_options ( $mode ) );
|
402 |
} catch ( \Stripe\Error\Base $e ) {
|
403 |
$err = $e->getJsonBody ()[ 'error' ];
|
@@ -439,13 +459,32 @@ class WC_Stripe_Gateway {
|
|
439 |
}
|
440 |
}
|
441 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
private function get_api_options($mode = '') {
|
443 |
if (empty ( $mode ) && $this->mode != null) {
|
444 |
$mode = $this->mode;
|
445 |
}
|
446 |
-
|
447 |
'api_key' => $this->secret_key ? $this->secret_key : wc_stripe_get_secret_key ( $mode )
|
448 |
-
]
|
|
|
449 |
}
|
450 |
}
|
451 |
WC_Stripe_Gateway::init ();
|
41 |
\Stripe\Stripe::setApiVersion ( '2019-12-03' );
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
*
|
46 |
+
* @since 3.1.0
|
47 |
+
* @param string $mode
|
48 |
+
* @param string $secret_key
|
49 |
+
*/
|
50 |
+
public static function load($mode = null, $secret_key = null) {
|
51 |
+
$class = apply_filters ( 'wc_stripe_gateway_class', 'WC_Stripe_Gateway' );
|
52 |
+
return new $class ( $mode, $secret_key );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
*
|
57 |
+
* @since 3.1.0
|
58 |
+
* @param unknown $mode
|
59 |
+
*/
|
60 |
+
public function set_mode($mode) {
|
61 |
+
$this->mode = $mode;
|
62 |
+
}
|
63 |
+
|
64 |
/**
|
65 |
* Create a customer within Stripe.
|
66 |
*
|
237 |
try {
|
238 |
return \Stripe\Charge::retrieve ( $charge_id, $this->get_api_options ( $mode ) );
|
239 |
} catch ( \Stripe\Error\Base $e ) {
|
240 |
+
$err = $e->getJsonBody ()[ 'error' ];
|
241 |
+
return new WP_Error ( 'payment-intent-error', $err[ 'message' ] );
|
242 |
}
|
243 |
}
|
244 |
|
300 |
|
301 |
/**
|
302 |
*
|
303 |
+
* @param string $id
|
|
|
304 |
* @param string $customer
|
305 |
* @param string $mode
|
306 |
*/
|
398 |
return \Stripe\Customer::retrieve ( $customer_id, $this->get_api_options ( $mode ) );
|
399 |
} catch ( \Stripe\Error\Base $e ) {
|
400 |
$err = $e->getJsonBody ()[ 'error' ];
|
401 |
+
return new WP_Error ( 'customer-error', $err[ 'message' ] );
|
402 |
}
|
403 |
}
|
404 |
|
413 |
}
|
414 |
}
|
415 |
|
416 |
+
public function fetch_payment_methods($customer_id, $mode = '', $type = 'card') {
|
417 |
try {
|
418 |
return \Stripe\PaymentMethod::all ( [
|
419 |
'customer' => $customer_id,
|
420 |
+
'type' => $type
|
421 |
], $this->get_api_options ( $mode ) );
|
422 |
} catch ( \Stripe\Error\Base $e ) {
|
423 |
$err = $e->getJsonBody ()[ 'error' ];
|
459 |
}
|
460 |
}
|
461 |
|
462 |
+
public function update_webhook($id, $params, $mode = '') {
|
463 |
+
try {
|
464 |
+
return \Stripe\WebhookEndpoint::update ( $id, $params, $this->get_api_options ( $mode ) );
|
465 |
+
} catch ( \Stripe\Error\Base $e ) {
|
466 |
+
$err = $e->getJsonBody ()[ 'error' ];
|
467 |
+
return new WP_Error ( 'webhook-error', $err[ 'message' ] );
|
468 |
+
}
|
469 |
+
}
|
470 |
+
|
471 |
+
public function fetch_webhook($id, $mode = '') {
|
472 |
+
try {
|
473 |
+
return \Stripe\WebhookEndpoint::retrieve ( $id, $this->get_api_options ( $mode ) );
|
474 |
+
} catch ( \Stripe\Error\Base $e ) {
|
475 |
+
$err = $e->getJsonBody ()[ 'error' ];
|
476 |
+
return new WP_Error ( 'webhook-error', $err[ 'message' ] );
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
private function get_api_options($mode = '') {
|
481 |
if (empty ( $mode ) && $this->mode != null) {
|
482 |
$mode = $this->mode;
|
483 |
}
|
484 |
+
$args = [
|
485 |
'api_key' => $this->secret_key ? $this->secret_key : wc_stripe_get_secret_key ( $mode )
|
486 |
+
];
|
487 |
+
return apply_filters ( 'wc_stripe_api_options', $args );
|
488 |
}
|
489 |
}
|
490 |
WC_Stripe_Gateway::init ();
|
includes/class-wc-stripe-payment-charge.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once ( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-stripe-payment.php' );
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @author Payment Plugins
|
7 |
+
* @since 3.1.0
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
class WC_Stripe_Payment_Charge extends WC_Stripe_Payment {
|
11 |
+
|
12 |
+
/**
|
13 |
+
*
|
14 |
+
* {@inheritDoc}
|
15 |
+
*
|
16 |
+
* @see WC_Stripe_Payment::process_payment()
|
17 |
+
*/
|
18 |
+
public function process_payment($order) {
|
19 |
+
/**
|
20 |
+
* Set a lock on the order so webhooks don't cause issues with payment processing.
|
21 |
+
*/
|
22 |
+
$this->payment_method->set_order_lock ( $order );
|
23 |
+
|
24 |
+
if ($this->payment_method->should_save_payment_method ( $order )) {
|
25 |
+
$result = $this->payment_method->save_payment_method ( $this->payment_method->get_new_source_token (), $order );
|
26 |
+
if (is_wp_error ( $result )) {
|
27 |
+
return $result;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
$args = $this->get_order_charge_args ( $args, $order );
|
32 |
+
|
33 |
+
$charge = $this->gateway->charge ( $args, wc_stripe_order_mode ( $order ) );
|
34 |
+
|
35 |
+
wc_stripe_log_info ( 'Stripe charge: ' . print_r ( $charge, true ) );
|
36 |
+
|
37 |
+
if (is_wp_error ( $charge )) {
|
38 |
+
return $charge;
|
39 |
+
}
|
40 |
+
|
41 |
+
return ( object ) [ 'complete_payment' => true,
|
42 |
+
'charge' => $charge
|
43 |
+
];
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* {@inheritDoc}
|
49 |
+
*
|
50 |
+
* @see WC_Stripe_Payment::capture_charge()
|
51 |
+
*/
|
52 |
+
public function capture_charge($amount, $order) {
|
53 |
+
return $this->gateway->capture ( $order->get_transaction_id (), array(
|
54 |
+
'amount' => wc_stripe_add_number_precision ( $amount )
|
55 |
+
), wc_stripe_order_mode ( $order ) );
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
*
|
60 |
+
* {@inheritDoc}
|
61 |
+
*
|
62 |
+
* @see WC_Stripe_Payment::void_charge()
|
63 |
+
*/
|
64 |
+
public function void_charge($order) {
|
65 |
+
return $this->gateway->refund ( array(
|
66 |
+
'charge' => $order->get_transaction_id ()
|
67 |
+
), wc_stripe_order_mode ( $order ) );
|
68 |
+
}
|
69 |
+
|
70 |
+
public function scheduled_subscription_payment($amount, $order) {
|
71 |
+
$this->get_order_charge_args ( $args, $order );
|
72 |
+
|
73 |
+
$args[ 'source' ] = $order->get_meta ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN );
|
74 |
+
|
75 |
+
if (( $customer_id = $order->get_meta ( WC_Stripe_Constants::CUSTOMER_ID ) )) {
|
76 |
+
$args[ 'customer' ] = $customer_id;
|
77 |
+
}
|
78 |
+
|
79 |
+
$charge = $this->gateway->charge ( $args, wc_stripe_order_mode ( $order ) );
|
80 |
+
|
81 |
+
if (is_wp_error ( $charge )) {
|
82 |
+
return $charge;
|
83 |
+
} else {
|
84 |
+
return ( object ) [
|
85 |
+
'complete_payment' => true,
|
86 |
+
'charge' => $charge
|
87 |
+
];
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
*
|
93 |
+
* {@inheritDoc}
|
94 |
+
*
|
95 |
+
* @see WC_Stripe_Payment::process_pre_order_payment()
|
96 |
+
*/
|
97 |
+
public function process_pre_order_payment($order) {
|
98 |
+
$this->get_order_charge_args ( $args, $order );
|
99 |
+
|
100 |
+
$args[ 'source' ] = $order->get_meta ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN );
|
101 |
+
|
102 |
+
if (( $customer_id = wc_stripe_get_customer_id ( $order->get_customer_id (), wc_stripe_order_mode ( $order ) ) )) {
|
103 |
+
$args[ 'customer' ] = $customer_id;
|
104 |
+
}
|
105 |
+
|
106 |
+
$charge = $this->gateway->charge ( $args, wc_stripe_order_mode ( $order ) );
|
107 |
+
|
108 |
+
if (is_wp_error ( $charge )) {
|
109 |
+
return $charge;
|
110 |
+
} else {
|
111 |
+
return ( object ) [
|
112 |
+
'complete_payment' => true,
|
113 |
+
'charge' => $charge
|
114 |
+
];
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
*
|
120 |
+
* @param array $args
|
121 |
+
* @param WC_Order $order
|
122 |
+
*/
|
123 |
+
public function get_order_charge_args(&$args, $order) {
|
124 |
+
$this->add_general_order_args ( $args, $order );
|
125 |
+
$this->add_order_payment_method ( $args, $order );
|
126 |
+
|
127 |
+
$args[ 'receipt_email' ] = $order->get_billing_email ();
|
128 |
+
$args[ 'capture' ] = $this->payment_method->get_option ( 'charge_type' ) === 'capture';
|
129 |
+
|
130 |
+
$customer_id = wc_stripe_get_customer_id ( $order->get_user_id () );
|
131 |
+
|
132 |
+
// only add customer ID if user is paying with a saved payment method
|
133 |
+
if ($customer_id && $this->payment_method->use_saved_source ()) {
|
134 |
+
$args[ 'customer' ] = $customer_id;
|
135 |
+
}
|
136 |
+
|
137 |
+
return apply_filters ( 'wc_stripe_charge_order_args', $args, $order, $this->payment_method->id );
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
*
|
142 |
+
* {@inheritDoc}
|
143 |
+
*
|
144 |
+
* @see WC_Stripe_Payment::get_payment_method_from_charge()
|
145 |
+
*/
|
146 |
+
public function get_payment_method_from_charge($charge) {
|
147 |
+
return $charge->source->id;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
*
|
152 |
+
* {@inheritDoc}
|
153 |
+
*
|
154 |
+
* @see WC_Stripe_Payment::add_order_payment_method()
|
155 |
+
*/
|
156 |
+
public function add_order_payment_method(&$args, $order) {
|
157 |
+
$args[ 'source' ] = $this->payment_method->get_payment_method_from_request ();
|
158 |
+
}
|
159 |
+
}
|
includes/class-wc-stripe-payment-intent.php
ADDED
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once ( WC_STRIPE_PLUGIN_FILE_PATH . 'includes/abstract/abstract-wc-stripe-payment.php' );
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* @author Payment Plugins
|
7 |
+
* @since 3.1.0
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
class WC_Stripe_Payment_Intent extends WC_Stripe_Payment {
|
11 |
+
|
12 |
+
/**
|
13 |
+
*
|
14 |
+
* {@inheritDoc}
|
15 |
+
*
|
16 |
+
* @see WC_Stripe_Payment::process_payment()
|
17 |
+
*/
|
18 |
+
public function process_payment($order) {
|
19 |
+
// first check to see if a payment intent already exists
|
20 |
+
if (( $intent = $order->get_meta ( WC_Stripe_Constants::PAYMENT_INTENT ) ) && $intent[ 'confirmation_method' ] == $this->payment_method->get_confirmation_method ( $order )) {
|
21 |
+
$intent_id = $intent[ 'id' ];
|
22 |
+
if ($this->can_update_payment_intent ( $order )) {
|
23 |
+
$intent = $this->gateway->update_payment_intent ( $intent_id, $this->get_payment_intent_args ( $order, false ) );
|
24 |
+
} else {
|
25 |
+
$intent = $this->gateway->fetch_payment_intent ( $intent_id );
|
26 |
+
}
|
27 |
+
} else {
|
28 |
+
$intent = $this->gateway->create_payment_intent ( $this->get_payment_intent_args ( $order ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
if (is_wp_error ( $intent )) {
|
32 |
+
return $intent;
|
33 |
+
}
|
34 |
+
|
35 |
+
// always update the order with the payment intent.
|
36 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_INTENT_ID, $intent->id );
|
37 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $intent->payment_method );
|
38 |
+
// serialize the the intent and save to the order. The intent will be used to analyze if anything
|
39 |
+
// has changed.
|
40 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_INTENT, $intent->jsonSerialize () );
|
41 |
+
$order->save ();
|
42 |
+
|
43 |
+
if ($intent->status === 'requires_confirmation') {
|
44 |
+
$intent = $this->gateway->confirm_payment_intent ( $intent );
|
45 |
+
if (is_wp_error ( $intent )) {
|
46 |
+
return $intent;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
// the intent was processed.
|
51 |
+
if ($intent->status === 'succeeded' || $intent->status === 'requires_capture') {
|
52 |
+
|
53 |
+
if ($this->payment_method->should_save_payment_method ( $order )) {
|
54 |
+
$result = $this->payment_method->save_payment_method ( $this->payment_method->get_new_source_token (), $order );
|
55 |
+
if (is_wp_error ( $result )) {
|
56 |
+
$this->payment_method->set_payment_save_error ( $order, $result );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
// payment has been processed.
|
61 |
+
$charges = $intent->charges;
|
62 |
+
if (count ( $charges->data ) > 0) {
|
63 |
+
$charge = $charges->data[ 0 ];
|
64 |
+
return ( object ) [
|
65 |
+
'complete_payment' => true,
|
66 |
+
'charge' => $charge
|
67 |
+
];
|
68 |
+
}
|
69 |
+
}
|
70 |
+
if ($intent->status === 'requires_source_action' || $intent->status === 'requires_action') {
|
71 |
+
// 3DS actions are required. Need to have customer complete action.
|
72 |
+
return ( object ) [
|
73 |
+
'complete_payment' => false,
|
74 |
+
'redirect' => $this->payment_method->get_payment_intent_checkout_url ( $intent, $order )
|
75 |
+
];
|
76 |
+
}
|
77 |
+
if ($intent->status === 'requires_source' || $intent->status === 'requires_payment_method') {
|
78 |
+
// return new WP_Error ( 'payment-intent-error', __ ( 'A new payment method is required.', 'woo-stripe-payment' ) );
|
79 |
+
return ( object ) [
|
80 |
+
'complete_payment' => false,
|
81 |
+
'redirect' => $this->payment_method->get_payment_intent_checkout_url ( $intent, $order )
|
82 |
+
];
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
public function scheduled_subscription_payment($amount, $order) {
|
87 |
+
$args = $this->get_payment_intent_args ( $order );
|
88 |
+
|
89 |
+
$args[ 'confirm' ] = true;
|
90 |
+
$args[ 'off_session' ] = true;
|
91 |
+
$args[ 'payment_method' ] = $this->payment_method->get_order_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $order );
|
92 |
+
|
93 |
+
if (( $customer = $this->payment_method->get_order_meta_data ( WC_Stripe_Constants::CUSTOMER_ID, $order ) )) {
|
94 |
+
$args[ 'customer' ] = $customer;
|
95 |
+
}
|
96 |
+
|
97 |
+
$intent = $this->gateway->create_payment_intent ( $args, wc_stripe_order_mode ( $order ) );
|
98 |
+
|
99 |
+
if (is_wp_error ( $intent )) {
|
100 |
+
return $intent;
|
101 |
+
} else {
|
102 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_INTENT_ID, $intent->id );
|
103 |
+
|
104 |
+
$charge = $intent->charges->data[ 0 ];
|
105 |
+
|
106 |
+
if ($intent->status === 'succeeded' || $intent->status === 'requires_capture') {
|
107 |
+
|
108 |
+
return ( object ) [
|
109 |
+
'complete_payment' => true,
|
110 |
+
'charge' => $charge
|
111 |
+
];
|
112 |
+
} else {
|
113 |
+
return ( object ) [
|
114 |
+
'complete_payment' => false,
|
115 |
+
'charge' => $charge
|
116 |
+
];
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
*
|
123 |
+
* {@inheritDoc}
|
124 |
+
*
|
125 |
+
* @see WC_Stripe_Payment::process_pre_order_payment()
|
126 |
+
*/
|
127 |
+
public function process_pre_order_payment($order) {
|
128 |
+
$args = $this->get_payment_intent_args ( $order );
|
129 |
+
|
130 |
+
$args[ 'confirm' ] = true;
|
131 |
+
$args[ 'off_session' ] = true;
|
132 |
+
$args[ 'payment_method' ] = $this->payment_method->get_order_meta_data ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, $order );
|
133 |
+
|
134 |
+
if (( $customer = wc_stripe_get_customer_id ( $order->get_customer_id (), wc_stripe_order_mode ( $order ) ) )) {
|
135 |
+
$args[ 'customer' ] = $customer;
|
136 |
+
}
|
137 |
+
|
138 |
+
$intent = $this->gateway->create_payment_intent ( $args, wc_stripe_order_mode ( $order ) );
|
139 |
+
|
140 |
+
if (is_wp_error ( $intent )) {
|
141 |
+
return $intent;
|
142 |
+
} else {
|
143 |
+
$order->update_meta_data ( '_payment_intent_id', $intent->id );
|
144 |
+
|
145 |
+
$charge = $intent->charges->data[ 0 ];
|
146 |
+
|
147 |
+
if ($intent->status === 'succeeded' || $intent->status === 'requires_capture') {
|
148 |
+
return ( object ) [
|
149 |
+
'complete_payment' => true,
|
150 |
+
'charge' => $charge
|
151 |
+
];
|
152 |
+
} else {
|
153 |
+
return ( object ) [
|
154 |
+
'complete_payment' => false,
|
155 |
+
'charge' => $charge
|
156 |
+
];
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Compares the order's saved intent to the order's updates attributes.
|
163 |
+
* If there is a delta, then the payment intent can be updated.
|
164 |
+
*
|
165 |
+
* @param WC_Order $order
|
166 |
+
*/
|
167 |
+
public function can_update_payment_intent($order) {
|
168 |
+
$intent = $order->get_meta ( WC_Stripe_Constants::PAYMENT_INTENT );
|
169 |
+
if ($intent) {
|
170 |
+
$order_hash = implode ( '_', [
|
171 |
+
wc_stripe_add_number_precision ( $order->get_total () ),
|
172 |
+
wc_stripe_get_customer_id ( $order->get_user_id () ),
|
173 |
+
$this->payment_method->get_payment_method_from_request (),
|
174 |
+
$this->payment_method->get_payment_method_type ()
|
175 |
+
] );
|
176 |
+
$intent_hash = implode ( '_', [
|
177 |
+
$intent[ 'amount' ],
|
178 |
+
$intent[ 'customer' ],
|
179 |
+
$intent[ 'payment_method' ],
|
180 |
+
isset ( $intent[ 'payment_method_types' ] ) ? $intent[ 'payment_method_types' ][ 0 ] : ''
|
181 |
+
] );
|
182 |
+
return $order_hash !== $intent_hash;
|
183 |
+
}
|
184 |
+
return false;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
*
|
189 |
+
* @param WC_Order $order
|
190 |
+
*/
|
191 |
+
public function get_payment_intent_args($order, $new = true) {
|
192 |
+
$this->add_general_order_args ( $args, $order );
|
193 |
+
|
194 |
+
if ($new) {
|
195 |
+
$args[ 'confirmation_method' ] = $this->payment_method->get_confirmation_method ( $order );
|
196 |
+
$args[ 'capture_method' ] = $this->payment_method->get_option ( 'charge_type' ) === 'capture' ? 'automatic' : 'manual';
|
197 |
+
$args[ 'confirm' ] = false;
|
198 |
+
}
|
199 |
+
if (( $customer_id = wc_stripe_get_customer_id ( $order->get_customer_id () ) )) {
|
200 |
+
$args[ 'customer' ] = $customer_id;
|
201 |
+
}
|
202 |
+
if ($this->payment_method->should_save_payment_method ( $order )) {
|
203 |
+
$args[ 'setup_future_usage' ] = 'off_session';
|
204 |
+
}
|
205 |
+
|
206 |
+
$args[ 'payment_method_types' ][] = $this->payment_method->get_payment_method_type ();
|
207 |
+
|
208 |
+
return apply_filters ( 'wc_stripe_payment_intent_args', $args, $order, $this );
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
*
|
213 |
+
* {@inheritDoc}
|
214 |
+
*
|
215 |
+
* @see WC_Stripe_Payment::capture_charge()
|
216 |
+
*/
|
217 |
+
public function capture_charge($amount, $order) {
|
218 |
+
$payment_intent = $this->payment_method->get_order_meta_data ( WC_Stripe_Constants::PAYMENT_INTENT_ID, $order );
|
219 |
+
if (empty ( $payment_intent )) {
|
220 |
+
$charge = $this->gateway->get_charge ( $order->get_transaction_id (), wc_stripe_order_mode ( $order ) );
|
221 |
+
$payment_intent = $charge->payment_intent;
|
222 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_INTENT_ID, $payment_intent );
|
223 |
+
$order->save ();
|
224 |
+
}
|
225 |
+
return $this->gateway->capture_payment_intent ( $payment_intent, array(
|
226 |
+
'amount_to_capture' => wc_stripe_add_number_precision ( $amount )
|
227 |
+
), wc_stripe_order_mode ( $order ) );
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
*
|
232 |
+
* {@inheritDoc}
|
233 |
+
*
|
234 |
+
* @see WC_Stripe_Payment::void_charge()
|
235 |
+
*/
|
236 |
+
public function void_charge($order) {
|
237 |
+
// fetch the intent and check its status
|
238 |
+
$payment_intent = $this->gateway->fetch_payment_intent ( $order->get_meta ( '_payment_intent_id', true ), wc_stripe_order_mode ( $order ) );
|
239 |
+
if (is_wp_error ( $payment_intent )) {
|
240 |
+
return $payment_intent;
|
241 |
+
}
|
242 |
+
$statuses = array( 'requires_payment_method',
|
243 |
+
'requires_capture', 'requires_confirmation',
|
244 |
+
'requires_action'
|
245 |
+
);
|
246 |
+
if ('canceled' !== $payment_intent->status) {
|
247 |
+
if (in_array ( $payment_intent->status, $statuses )) {
|
248 |
+
return $this->gateway->cancel_payment_intent ( $payment_intent, wc_stripe_order_mode ( $order ) );
|
249 |
+
} elseif ('succeeded' === $payment_intent->status) {
|
250 |
+
return $this->process_refund ( $order, $order->get_total () );
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
*
|
257 |
+
* {@inheritDoc}
|
258 |
+
*
|
259 |
+
* @see WC_Stripe_Payment::get_payment_method_from_charge()
|
260 |
+
*/
|
261 |
+
public function get_payment_method_from_charge($charge) {
|
262 |
+
return $charge->payment_method;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
*
|
267 |
+
* {@inheritDoc}
|
268 |
+
*
|
269 |
+
* @see WC_Stripe_Payment::add_order_payment_method()
|
270 |
+
*/
|
271 |
+
public function add_order_payment_method(&$args, $order) {
|
272 |
+
// if ($order->get_meta ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN, true ) !== $this->payment_method->get_payment_method_from_request ()) {
|
273 |
+
$args[ 'payment_method' ] = $this->payment_method->get_payment_method_from_request ();
|
274 |
+
if (empty ( $args[ 'payment_method' ] )) {
|
275 |
+
unset ( $args[ 'payment_method' ] );
|
276 |
+
}
|
277 |
+
// }
|
278 |
+
}
|
279 |
+
}
|
includes/class-wc-stripe-redirect-handler.php
CHANGED
@@ -41,23 +41,31 @@ class WC_Stripe_Redirect_Handler {
|
|
41 |
$payment_method = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
|
42 |
|
43 |
// first do some validations on the source
|
44 |
-
$stripe_gateway =
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
return;
|
50 |
} else {
|
51 |
-
if ('failed' === $
|
52 |
wc_add_notice ( __ ( 'Payment authorization failed. Please select another payment method.', 'woo-stripe-payment' ), 'error' );
|
|
|
|
|
|
|
|
|
53 |
return;
|
54 |
-
} elseif ('chargeable' === $
|
55 |
if ($payment_method->has_order_lock ( $order )) {
|
56 |
wp_safe_redirect ( $order->get_checkout_order_received_url () );
|
57 |
exit ();
|
58 |
}
|
59 |
// source can be charged synchronously
|
60 |
-
$payment_method->set_new_source_token ( $
|
61 |
$payment_method->processing_payment = true;
|
62 |
$payment_method->set_order_lock ( $order );
|
63 |
wc_stripe_log_info ( 'processing from redirect handler.' );
|
@@ -66,6 +74,17 @@ class WC_Stripe_Redirect_Handler {
|
|
66 |
wp_safe_redirect ( $result[ 'redirect' ] );
|
67 |
die ();
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
}
|
71 |
wp_safe_redirect ( $order->get_checkout_order_received_url () );
|
41 |
$payment_method = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
|
42 |
|
43 |
// first do some validations on the source
|
44 |
+
$stripe_gateway = WC_Stripe_Gateway::load ();
|
45 |
|
46 |
+
if (isset ( $_GET[ 'source' ] )) {
|
47 |
+
$result = $stripe_gateway->fetch_payment_source ( wc_clean ( $_GET[ 'source' ] ) );
|
48 |
+
} else {
|
49 |
+
$result = $stripe_gateway->fetch_payment_intent ( wc_clean ( $_GET[ 'payment_intent' ] ) );
|
50 |
+
}
|
51 |
+
if (is_wp_error ( $result )) {
|
52 |
+
wc_add_notice ( sprintf ( __ ( 'Error retrieving payment source. Reason: %s', 'woo-stripe-payment' ), $result->get_error_message () ), 'error' );
|
53 |
return;
|
54 |
} else {
|
55 |
+
if ('failed' === $result->status || 'requires_payment_method' == $result->status) {
|
56 |
wc_add_notice ( __ ( 'Payment authorization failed. Please select another payment method.', 'woo-stripe-payment' ), 'error' );
|
57 |
+
$order->update_status ( 'failed', __ ( 'Payment authorization failed.', 'woo-stripe-payment' ) );
|
58 |
+
if ($result instanceof \Stripe\PaymentIntent) {
|
59 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_INTENT, $result->jsonSerialize () );
|
60 |
+
}
|
61 |
return;
|
62 |
+
} elseif ('chargeable' === $result->status) {
|
63 |
if ($payment_method->has_order_lock ( $order )) {
|
64 |
wp_safe_redirect ( $order->get_checkout_order_received_url () );
|
65 |
exit ();
|
66 |
}
|
67 |
// source can be charged synchronously
|
68 |
+
$payment_method->set_new_source_token ( $result->id );
|
69 |
$payment_method->processing_payment = true;
|
70 |
$payment_method->set_order_lock ( $order );
|
71 |
wc_stripe_log_info ( 'processing from redirect handler.' );
|
74 |
wp_safe_redirect ( $result[ 'redirect' ] );
|
75 |
die ();
|
76 |
}
|
77 |
+
} elseif ('succeeded' == $result->status) {
|
78 |
+
if ($payment_method->has_order_lock ( $order )) {
|
79 |
+
wp_safe_redirect ( $order->get_checkout_order_received_url () );
|
80 |
+
exit ();
|
81 |
+
}
|
82 |
+
$payment_method->set_order_lock ( $order );
|
83 |
+
$result = $payment_method->process_payment ( $order_id );
|
84 |
+
if ($result[ 'result' ] === 'success') {
|
85 |
+
wp_safe_redirect ( $result[ 'redirect' ] );
|
86 |
+
die ();
|
87 |
+
}
|
88 |
}
|
89 |
}
|
90 |
wp_safe_redirect ( $order->get_checkout_order_received_url () );
|
includes/class-wc-stripe-update.php
CHANGED
@@ -2,7 +2,8 @@
|
|
2 |
class WC_Stripe_Update {
|
3 |
|
4 |
private static $updates = [
|
5 |
-
'3.0.7' => 'update-3.0.7.php'
|
|
|
6 |
];
|
7 |
|
8 |
public static function init() {
|
2 |
class WC_Stripe_Update {
|
3 |
|
4 |
private static $updates = [
|
5 |
+
'3.0.7' => 'update-3.0.7.php',
|
6 |
+
'3.1.0' => 'update-3.1.0.php'
|
7 |
];
|
8 |
|
9 |
public static function init() {
|
includes/controllers/class-wc-stripe-controller-cart.php
CHANGED
@@ -6,6 +6,8 @@
|
|
6 |
*
|
7 |
*/
|
8 |
class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
|
|
|
|
|
9 |
|
10 |
protected $namespace = 'cart/';
|
11 |
|
@@ -112,6 +114,8 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
|
|
112 |
|
113 |
wc_stripe_update_shipping_methods ( $shipping_methods );
|
114 |
|
|
|
|
|
115 |
// if this request is coming from product page, stash cart and use product cart
|
116 |
if ('product' == $request->get_param ( 'page_id' )) {
|
117 |
wc_stripe_stash_cart ( WC ()->cart );
|
@@ -156,6 +160,8 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
|
|
156 |
try {
|
157 |
wc_stripe_update_customer_location ( $address );
|
158 |
|
|
|
|
|
159 |
if ('product' == $request->get_param ( 'page_id' )) {
|
160 |
wc_stripe_stash_cart ( WC ()->cart );
|
161 |
} else {
|
6 |
*
|
7 |
*/
|
8 |
class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
|
9 |
+
|
10 |
+
use WC_Stripe_Controller_Cart_Trait;
|
11 |
|
12 |
protected $namespace = 'cart/';
|
13 |
|
114 |
|
115 |
wc_stripe_update_shipping_methods ( $shipping_methods );
|
116 |
|
117 |
+
$this->add_ready_to_calc_shipping ();
|
118 |
+
|
119 |
// if this request is coming from product page, stash cart and use product cart
|
120 |
if ('product' == $request->get_param ( 'page_id' )) {
|
121 |
wc_stripe_stash_cart ( WC ()->cart );
|
160 |
try {
|
161 |
wc_stripe_update_customer_location ( $address );
|
162 |
|
163 |
+
$this->add_ready_to_calc_shipping ();
|
164 |
+
|
165 |
if ('product' == $request->get_param ( 'page_id' )) {
|
166 |
wc_stripe_stash_cart ( WC ()->cart );
|
167 |
} else {
|
includes/controllers/class-wc-stripe-controller-gateway-settings.php
CHANGED
@@ -43,7 +43,7 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
|
|
43 |
* @param WP_REST_Request $request
|
44 |
*/
|
45 |
public function register_apple_domain($request) {
|
46 |
-
$gateway =
|
47 |
// try to add domain association file.
|
48 |
if (isset ( $_SERVER[ 'DOCUMENT_ROOT' ] )) {
|
49 |
$path = $_SERVER[ 'DOCUMENT_ROOT' ] . DIRECTORY_SEPARATOR . '.well-known';
|
@@ -129,7 +129,8 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
|
|
129 |
// create the webhooks and save it to the api settings.
|
130 |
$webhook = $gateway->create_webhook ( $url, apply_filters ( 'wc_stripe_webhook_events', [
|
131 |
'charge.failed', 'charge.succeeded',
|
132 |
-
'source.chargeable'
|
|
|
133 |
] ) );
|
134 |
if (is_wp_error ( $webhook )) {
|
135 |
return new WP_Error ( $webhook->get_error_code (), $webhook->get_error_message (), [
|
@@ -153,17 +154,9 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
|
|
153 |
*/
|
154 |
public function connection_test($request) {
|
155 |
$mode = $request->get_param ( 'mode' );
|
156 |
-
$
|
157 |
-
$pub_key = $request->get_param ( 'publishable_key' );
|
158 |
-
$gateway = new WC_Stripe_Gateway ( $mode, $secret_key );
|
159 |
|
160 |
try {
|
161 |
-
if (empty ( $secret_key )) {
|
162 |
-
throw new Exception ( __ ( 'Secret key cannot be empty.', 'woo-stripe-payment' ) );
|
163 |
-
}
|
164 |
-
if (empty ( $pub_key )) {
|
165 |
-
throw new Exception ( __ ( 'Publishable key cannot be empty.', 'woo-stripe-payment' ) );
|
166 |
-
}
|
167 |
// test the secret key
|
168 |
$response = $gateway->fetch_customers ();
|
169 |
|
@@ -171,15 +164,13 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
|
|
171 |
throw new Exception ( sprintf ( __ ( 'Mode: %s. Invalid secret key. Please check your entry.', 'woo-stripe-payment' ), $mode ) );
|
172 |
}
|
173 |
|
174 |
-
// secret key is good so save it.
|
175 |
-
wc_stripe ()->api_settings->update_option ( "secret_key_{$mode}", $secret_key );
|
176 |
-
|
177 |
// test the publishable key
|
178 |
$response = wp_remote_post ( 'https://api.stripe.com/v1/payment_methods', [
|
179 |
'headers' => [
|
180 |
'Content-Type' => 'application/x-www-form-urlencoded'
|
181 |
],
|
182 |
-
'body' => [
|
|
|
183 |
]
|
184 |
] );
|
185 |
if (is_wp_error ( $response )) {
|
@@ -188,7 +179,6 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
|
|
188 |
if ($response[ 'response' ][ 'code' ] == 401) {
|
189 |
throw new Exception ( sprintf ( __ ( 'Mode: %s. Invalid publishable key. Please check your entry.', 'woo-stripe-payment' ), $mode ) );
|
190 |
}
|
191 |
-
wc_stripe ()->api_settings->update_option ( "publishable_key_{$mode}", $pub_key );
|
192 |
} catch ( Exception $e ) {
|
193 |
return new WP_Error ( 'connection-failure', $e->getMessage (), [
|
194 |
'status' => 200
|
43 |
* @param WP_REST_Request $request
|
44 |
*/
|
45 |
public function register_apple_domain($request) {
|
46 |
+
$gateway = WC_Stripe_Gateway::load ();
|
47 |
// try to add domain association file.
|
48 |
if (isset ( $_SERVER[ 'DOCUMENT_ROOT' ] )) {
|
49 |
$path = $_SERVER[ 'DOCUMENT_ROOT' ] . DIRECTORY_SEPARATOR . '.well-known';
|
129 |
// create the webhooks and save it to the api settings.
|
130 |
$webhook = $gateway->create_webhook ( $url, apply_filters ( 'wc_stripe_webhook_events', [
|
131 |
'charge.failed', 'charge.succeeded',
|
132 |
+
'source.chargeable',
|
133 |
+
'payment_intent.succeeded'
|
134 |
] ) );
|
135 |
if (is_wp_error ( $webhook )) {
|
136 |
return new WP_Error ( $webhook->get_error_code (), $webhook->get_error_message (), [
|
154 |
*/
|
155 |
public function connection_test($request) {
|
156 |
$mode = $request->get_param ( 'mode' );
|
157 |
+
$gateway = new WC_Stripe_Gateway ( $mode );
|
|
|
|
|
158 |
|
159 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
// test the secret key
|
161 |
$response = $gateway->fetch_customers ();
|
162 |
|
164 |
throw new Exception ( sprintf ( __ ( 'Mode: %s. Invalid secret key. Please check your entry.', 'woo-stripe-payment' ), $mode ) );
|
165 |
}
|
166 |
|
|
|
|
|
|
|
167 |
// test the publishable key
|
168 |
$response = wp_remote_post ( 'https://api.stripe.com/v1/payment_methods', [
|
169 |
'headers' => [
|
170 |
'Content-Type' => 'application/x-www-form-urlencoded'
|
171 |
],
|
172 |
+
'body' => [
|
173 |
+
'key' => wc_stripe_get_publishable_key ( $mode )
|
174 |
]
|
175 |
] );
|
176 |
if (is_wp_error ( $response )) {
|
179 |
if ($response[ 'response' ][ 'code' ] == 401) {
|
180 |
throw new Exception ( sprintf ( __ ( 'Mode: %s. Invalid publishable key. Please check your entry.', 'woo-stripe-payment' ), $mode ) );
|
181 |
}
|
|
|
182 |
} catch ( Exception $e ) {
|
183 |
return new WP_Error ( 'connection-failure', $e->getMessage (), [
|
184 |
'status' => 200
|
includes/controllers/class-wc-stripe-controller-googlepay.php
CHANGED
@@ -8,6 +8,8 @@ if (! class_exists ( 'WC_Stripe_Rest_Controller' )) {
|
|
8 |
* @package Stripe/Controllers
|
9 |
*/
|
10 |
class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
|
|
|
|
|
11 |
|
12 |
protected $namespace = 'googlepay/';
|
13 |
|
@@ -69,6 +71,8 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
|
|
69 |
|
70 |
$this->gateway = WC ()->payment_gateways ()->payment_gateways ()[ 'stripe_googlepay' ];
|
71 |
|
|
|
|
|
72 |
try {
|
73 |
if ('product' == $request->get_param ( 'page_id' )) {
|
74 |
wc_stripe_stash_cart ( WC ()->cart );
|
8 |
* @package Stripe/Controllers
|
9 |
*/
|
10 |
class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
|
11 |
+
|
12 |
+
use WC_Stripe_Controller_Cart_Trait;
|
13 |
|
14 |
protected $namespace = 'googlepay/';
|
15 |
|
71 |
|
72 |
$this->gateway = WC ()->payment_gateways ()->payment_gateways ()[ 'stripe_googlepay' ];
|
73 |
|
74 |
+
$this->add_ready_to_calc_shipping ();
|
75 |
+
|
76 |
try {
|
77 |
if ('product' == $request->get_param ( 'page_id' )) {
|
78 |
wc_stripe_stash_cart ( WC ()->cart );
|
includes/controllers/class-wc-stripe-controller-order-actions.php
CHANGED
@@ -267,7 +267,10 @@ class WC_Stripe_Controller_Order_Actions extends WC_Stripe_Rest_Controller {
|
|
267 |
// fetch the charge so data is up to date.
|
268 |
$charge = $gateway->retrieve_charge ( $order->get_transaction_id (), wc_stripe_order_mode ( $order ) );
|
269 |
|
270 |
-
|
|
|
|
|
|
|
271 |
$order->save ();
|
272 |
ob_start ();
|
273 |
include wc_stripe ()->plugin_path () . 'includes/admin/meta-boxes/views/html-charge-data-subview.php';
|
267 |
// fetch the charge so data is up to date.
|
268 |
$charge = $gateway->retrieve_charge ( $order->get_transaction_id (), wc_stripe_order_mode ( $order ) );
|
269 |
|
270 |
+
if (is_wp_error ( $charge )) {
|
271 |
+
throw new Exception ( $charge->get_error_message () );
|
272 |
+
}
|
273 |
+
$order->update_meta_data ( WC_Stripe_Constants::CHARGE_STATUS, $charge->status );
|
274 |
$order->save ();
|
275 |
ob_start ();
|
276 |
include wc_stripe ()->plugin_path () . 'includes/admin/meta-boxes/views/html-charge-data-subview.php';
|
includes/controllers/class-wc-stripe-controller-payment-intent.php
CHANGED
@@ -16,6 +16,20 @@ class WC_Stripe_Controller_Payment_Intent extends WC_Stripe_Rest_Controller {
|
|
16 |
'create_setup_intent'
|
17 |
)
|
18 |
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
/**
|
@@ -23,8 +37,7 @@ class WC_Stripe_Controller_Payment_Intent extends WC_Stripe_Rest_Controller {
|
|
23 |
* @param WP_REST_Request $request
|
24 |
*/
|
25 |
public function create_setup_intent($request) {
|
26 |
-
$
|
27 |
-
$intent = $gateway->create_setup_intent ( array(
|
28 |
'usage' => 'off_session'
|
29 |
) );
|
30 |
try {
|
@@ -42,4 +55,35 @@ class WC_Stripe_Controller_Payment_Intent extends WC_Stripe_Rest_Controller {
|
|
42 |
) );
|
43 |
}
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
16 |
'create_setup_intent'
|
17 |
)
|
18 |
) );
|
19 |
+
register_rest_route ( $this->rest_uri (), 'sync-payment-intent', [
|
20 |
+
'methods' => WP_REST_Server::CREATABLE,
|
21 |
+
'callback' => array( $this,
|
22 |
+
'sync_payment_intent'
|
23 |
+
),
|
24 |
+
'args' => [
|
25 |
+
'order_id' => [
|
26 |
+
'required' => true
|
27 |
+
],
|
28 |
+
'client_secret' => [
|
29 |
+
'required' => true
|
30 |
+
]
|
31 |
+
]
|
32 |
+
] );
|
33 |
}
|
34 |
|
35 |
/**
|
37 |
* @param WP_REST_Request $request
|
38 |
*/
|
39 |
public function create_setup_intent($request) {
|
40 |
+
$intent = WC_Stripe_Gateway::load ()->create_setup_intent ( array(
|
|
|
41 |
'usage' => 'off_session'
|
42 |
) );
|
43 |
try {
|
55 |
) );
|
56 |
}
|
57 |
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
*
|
61 |
+
* @param WP_REST_Request $request
|
62 |
+
*/
|
63 |
+
public function sync_payment_intent($request) {
|
64 |
+
try {
|
65 |
+
$order = wc_get_order ( absint ( $request->get_param ( 'order_id' ) ) );
|
66 |
+
if (! $order) {
|
67 |
+
throw new Exception ( __ ( 'Invalid order id provided', 'woo-stripe-payment' ) );
|
68 |
+
}
|
69 |
+
/**
|
70 |
+
*
|
71 |
+
* @var WC_Payment_Gateway_Stripe $payment_method
|
72 |
+
*/
|
73 |
+
$payment_method = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
|
74 |
+
$intent = $payment_method->payment_object->get_gateway ()->fetch_payment_intent ( $order->get_meta ( '_payment_intent_id' ) );
|
75 |
+
|
76 |
+
if ($intent->client_secret != $request->get_param ( 'client_secret' )) {
|
77 |
+
throw new Exception ( __ ( 'You are not authorized to update this order.', 'woo-stripe-payment' ) );
|
78 |
+
}
|
79 |
+
|
80 |
+
$order->update_meta_data ( WC_Stripe_Constants::PAYMENT_INTENT, $intent->jsonSerialize () );
|
81 |
+
$order->save ();
|
82 |
+
return rest_ensure_response ( [] );
|
83 |
+
} catch ( Exception $e ) {
|
84 |
+
return new WP_Error ( 'payment-intent-error', $e->getMessage (), [
|
85 |
+
'status' => 200
|
86 |
+
] );
|
87 |
+
}
|
88 |
+
}
|
89 |
}
|
includes/controllers/class-wc-stripe-controller-payment-method.php
CHANGED
@@ -28,8 +28,7 @@ class WC_Stripe_Controller_Payment_Method extends WC_Stripe_Rest_Controller {
|
|
28 |
* @return WP_Error|WP_REST_Response|mixed
|
29 |
*/
|
30 |
public function payment_method_from_token($request) {
|
31 |
-
$
|
32 |
-
$result = $gateway->create_payment_method ( [
|
33 |
'type' => 'card',
|
34 |
'card' => [
|
35 |
'token' => $request->get_param ( 'token' )
|
28 |
* @return WP_Error|WP_REST_Response|mixed
|
29 |
*/
|
30 |
public function payment_method_from_token($request) {
|
31 |
+
$result = WC_Stripe_Gateway::load ()->create_payment_method ( [
|
|
|
32 |
'type' => 'card',
|
33 |
'card' => [
|
34 |
'token' => $request->get_param ( 'token' )
|
includes/controllers/class-wc-stripe-controller-webhook.php
CHANGED
@@ -26,8 +26,8 @@ class WC_Stripe_Controller_Webhook extends WC_Stripe_Rest_Controller {
|
|
26 |
public function webhook($request) {
|
27 |
$payload = $request->get_body ();
|
28 |
$json_payload = json_decode ( $payload, true );
|
29 |
-
$
|
30 |
-
$this->secret = wc_stripe ()->api_settings->get_option ( 'webhook_secret_' . $
|
31 |
$header = isset ( $_SERVER[ 'HTTP_STRIPE_SIGNATURE' ] ) ? $_SERVER[ 'HTTP_STRIPE_SIGNATURE' ] : '';
|
32 |
try {
|
33 |
$event = \Stripe\Webhook::constructEvent ( $payload, $header, $this->secret );
|
26 |
public function webhook($request) {
|
27 |
$payload = $request->get_body ();
|
28 |
$json_payload = json_decode ( $payload, true );
|
29 |
+
$mode = $json_payload[ 'livemode' ] == true ? 'live' : 'test';
|
30 |
+
$this->secret = wc_stripe ()->api_settings->get_option ( 'webhook_secret_' . $mode );
|
31 |
$header = isset ( $_SERVER[ 'HTTP_STRIPE_SIGNATURE' ] ) ? $_SERVER[ 'HTTP_STRIPE_SIGNATURE' ] : '';
|
32 |
try {
|
33 |
$event = \Stripe\Webhook::constructEvent ( $payload, $header, $this->secret );
|
includes/gateways/class-wc-payment-gateway-stripe-ach-v2.php
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Gateway that processes ACH payments.
|
4 |
+
* Only available for U.S. based merchants at this time.
|
5 |
+
*
|
6 |
+
* @since 3.0.5
|
7 |
+
* @author Payment Plugins
|
8 |
+
* @package Stripe/Gateways
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class WC_Payment_Gateway_Stripe_ACH_V2 extends WC_Payment_Gateway_Stripe {
|
12 |
+
|
13 |
+
use WC_Stripe_Payment_Charge_Trait;
|
14 |
+
|
15 |
+
/**
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public $metadata_key = '';
|
20 |
+
|
21 |
+
public function __construct() {
|
22 |
+
$this->synchronous = false;
|
23 |
+
$this->id = 'stripe_ach';
|
24 |
+
$this->tab_title = __ ( 'ACH', 'woo-stripe-payment' );
|
25 |
+
$this->template_name = 'ach.php';
|
26 |
+
$this->token_type = 'Stripe_ACH';
|
27 |
+
$this->method_title = __ ( 'Stripe ACH', 'woo-stripe-payment' );
|
28 |
+
$this->method_description = __ ( 'ACH gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
29 |
+
$this->icon = wc_stripe ()->assets_url ( 'img/ach.svg' );
|
30 |
+
$this->order_button_text = __ ( 'Bank Payment', 'woo-stripe-payment' );
|
31 |
+
$this->metadata_key = $this->id . '_metadata';
|
32 |
+
parent::__construct ();
|
33 |
+
$this->settings[ 'charge_type' ] = 'capture';
|
34 |
+
}
|
35 |
+
|
36 |
+
public function get_payment_object() {
|
37 |
+
return new WC_Stripe_Payment_Charge ( $this, new WC_Stripe_Gateway_ACH () );
|
38 |
+
}
|
39 |
+
|
40 |
+
public static function init() {
|
41 |
+
add_action ( 'woocommerce_checkout_update_order_review', [
|
42 |
+
__CLASS__, 'update_order_review'
|
43 |
+
] );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* {@inheritDoc}
|
49 |
+
*
|
50 |
+
* @see WC_Payment_Gateway::is_available()
|
51 |
+
*/
|
52 |
+
public function is_available() {
|
53 |
+
$is_available = parent::is_available ();
|
54 |
+
return $is_available && get_woocommerce_currency () == 'USD';
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
*
|
59 |
+
* {@inheritDoc}
|
60 |
+
*
|
61 |
+
* @see WC_Payment_Gateway_Stripe::init_supports()
|
62 |
+
*/
|
63 |
+
public function init_supports() {
|
64 |
+
/*
|
65 |
+
* $this->supports = [ 'tokenization', 'products',
|
66 |
+
* 'refunds'
|
67 |
+
* ];
|
68 |
+
*/
|
69 |
+
parent::init_supports ();
|
70 |
+
unset ( $this->supports[ 'add_payment_method' ] );
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
*
|
75 |
+
* {@inheritDoc}
|
76 |
+
*
|
77 |
+
* @see WC_Payment_Gateway_Stripe::enqueue_checkout_scripts()
|
78 |
+
*/
|
79 |
+
public function enqueue_checkout_scripts($scripts) {
|
80 |
+
$scripts->enqueue_script ( 'ach', $scripts->assets_url ( 'js/frontend/ach-payments.js' ), array(
|
81 |
+
$scripts->get_handle ( 'external' ),
|
82 |
+
$scripts->get_handle ( 'plaid' )
|
83 |
+
) );
|
84 |
+
$scripts->localize_script ( 'ach', $this->get_localized_params () );
|
85 |
+
}
|
86 |
+
|
87 |
+
public function get_localized_params() {
|
88 |
+
return array_merge_recursive ( parent::get_localized_params (), array(
|
89 |
+
'env' => $this->get_plaid_environment (),
|
90 |
+
'client_name' => $this->get_option ( 'client_name' ),
|
91 |
+
'public_key' => '3a5433ed5ff7229aef78bb4d87a63a',
|
92 |
+
'metadata_key' => '[name="' . $this->metadata_key . '"]',
|
93 |
+
'fees_enabled' => $this->fees_enabled ()
|
94 |
+
) );
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
*
|
99 |
+
* {@inheritDoc}
|
100 |
+
*
|
101 |
+
* @see WC_Payment_Gateway_Stripe_Charge::process_payment()
|
102 |
+
*/
|
103 |
+
public function process_payment($order_id) {
|
104 |
+
$this->payment_object->get_gateway ()->set_plaid_environment ( $this->get_option ( 'environment' ) );
|
105 |
+
$this->payment_object->get_gateway ()->set_public_token ( $this->get_public_token () );
|
106 |
+
$this->payment_object->get_gateway ()->set_account_id ( $this->get_metadata ()[ 'account_id' ] );
|
107 |
+
|
108 |
+
return parent::process_payment ( $order_id );
|
109 |
+
}
|
110 |
+
|
111 |
+
public function get_plaid_environment() {
|
112 |
+
return $this->get_option ( 'environment' );
|
113 |
+
}
|
114 |
+
|
115 |
+
private function get_metadata() {
|
116 |
+
return isset ( $_POST[ $this->metadata_key ] ) ? json_decode ( stripslashes ( $_POST[ $this->metadata_key ] ), true ) : null;
|
117 |
+
}
|
118 |
+
|
119 |
+
private function get_public_token() {
|
120 |
+
return $this->get_new_source_token ();
|
121 |
+
}
|
122 |
+
|
123 |
+
public function get_saved_methods_label() {
|
124 |
+
return __ ( 'Saved Banks', 'woo-stripe-payment' );
|
125 |
+
}
|
126 |
+
|
127 |
+
public function get_new_method_label() {
|
128 |
+
return __ ( 'New Bank', 'woo-stripe-payment' );
|
129 |
+
}
|
130 |
+
|
131 |
+
public function generate_ach_fee_html($key, $data) {
|
132 |
+
$field_key = $this->get_field_key ( $key );
|
133 |
+
$defaults = array( 'title' => '',
|
134 |
+
'disabled' => false, 'class' => '',
|
135 |
+
'css' => 'max-width: 150px; min-width: 150px;',
|
136 |
+
'placeholder' => '', 'type' => 'text',
|
137 |
+
'desc_tip' => false, 'description' => '',
|
138 |
+
'custom_attributes' => array(),
|
139 |
+
'options' => array()
|
140 |
+
);
|
141 |
+
$data = wp_parse_args ( $data, $defaults );
|
142 |
+
ob_start ();
|
143 |
+
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-ach-fee.php';
|
144 |
+
return ob_get_clean ();
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
*
|
149 |
+
* @param string $key
|
150 |
+
* @param array $value
|
151 |
+
*/
|
152 |
+
public function validate_ach_fee_field($key, $value) {
|
153 |
+
$value = empty ( $value ) ? [ 'type' => 'none',
|
154 |
+
'taxable' => 'no', 'value' => '0'
|
155 |
+
] : $value;
|
156 |
+
if (! isset ( $value[ 'taxable' ] )) {
|
157 |
+
$value[ 'taxable' ] = 'no';
|
158 |
+
}
|
159 |
+
return $value;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
*
|
164 |
+
* @param string $key
|
165 |
+
* @param string $value
|
166 |
+
*/
|
167 |
+
public function validate_environment_field($key, $value) {
|
168 |
+
if ('test' == wc_stripe_mode () && 'development' == $value) {
|
169 |
+
WC_Admin_Settings::add_error ( __ ( 'You must set the API mode to live in order to enable the Plaid development environment.', 'woo-stripe-payment' ) );
|
170 |
+
}
|
171 |
+
return $value;
|
172 |
+
}
|
173 |
+
|
174 |
+
public function fees_enabled() {
|
175 |
+
$fee = $this->get_option ( 'fee', [
|
176 |
+
'type' => 'none', 'value' => '0'
|
177 |
+
] );
|
178 |
+
return ! empty ( $fee ) && $fee[ 'type' ] != 'none';
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
*
|
183 |
+
* @param WC_Cart $cart
|
184 |
+
*/
|
185 |
+
public function after_calculate_totals($cart) {
|
186 |
+
remove_action ( 'woocommerce_after_calculate_totals', [
|
187 |
+
$this, 'after_calculate_totals'
|
188 |
+
] );
|
189 |
+
|
190 |
+
add_action ( 'woocommerce_cart_calculate_fees', array(
|
191 |
+
$this, 'calculate_fees'
|
192 |
+
) );
|
193 |
+
|
194 |
+
WC ()->session->set ( 'wc_stripe_cart_total', $cart->total );
|
195 |
+
$cart->calculate_totals ();
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
*
|
200 |
+
* @param WC_Cart $cart
|
201 |
+
*/
|
202 |
+
public function calculate_fees($cart) {
|
203 |
+
remove_action ( 'woocommerce_cart_calculate_fees', array(
|
204 |
+
$this, 'calculate_fees'
|
205 |
+
) );
|
206 |
+
$fee = $this->get_option ( 'fee' );
|
207 |
+
$taxable = $fee[ 'taxable' ] == 'yes';
|
208 |
+
switch ($fee[ 'type' ]) {
|
209 |
+
case 'amount' :
|
210 |
+
$cart->add_fee ( __ ( 'ACH Fee' ), $fee[ 'value' ], $taxable );
|
211 |
+
break;
|
212 |
+
case 'percent' :
|
213 |
+
$cart->add_fee ( __ ( 'ACH Fee' ), $fee[ 'value' ] * WC ()->session->get ( 'wc_stripe_cart_total', 0 ), $taxable );
|
214 |
+
break;
|
215 |
+
}
|
216 |
+
unset ( WC ()->session->wc_stripe_cart_total );
|
217 |
+
}
|
218 |
+
|
219 |
+
public static function update_order_review() {
|
220 |
+
if (! empty ( $_POST[ 'payment_method' ] ) && $_POST[ 'payment_method' ] == 'stripe_ach') {
|
221 |
+
$payment_method = new WC_Payment_Gateway_Stripe_ACH ();
|
222 |
+
if ($payment_method->fees_enabled ()) {
|
223 |
+
add_action ( 'woocommerce_after_calculate_totals', [
|
224 |
+
$payment_method,
|
225 |
+
'after_calculate_totals'
|
226 |
+
] );
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}
|
231 |
+
WC_Payment_Gateway_Stripe_ACH::init ();
|
includes/gateways/class-wc-payment-gateway-stripe-ach.php
CHANGED
@@ -1,12 +1,16 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Gateway that processes ACH payments.
|
|
|
|
|
4 |
* @since 3.0.5
|
5 |
* @author Payment Plugins
|
6 |
* @package Stripe/Gateways
|
7 |
-
*
|
8 |
*/
|
9 |
-
class WC_Payment_Gateway_Stripe_ACH extends
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
*
|
@@ -71,6 +75,7 @@ class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe_Charge {
|
|
71 |
public function enqueue_checkout_scripts($scripts) {
|
72 |
$scripts->enqueue_script ( 'ach', $scripts->assets_url ( 'js/frontend/ach-payments.js' ), array(
|
73 |
$scripts->get_handle ( 'external' ),
|
|
|
74 |
$scripts->get_handle ( 'plaid' )
|
75 |
) );
|
76 |
$scripts->localize_script ( 'ach', $this->get_localized_params () );
|
@@ -107,7 +112,13 @@ class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe_Charge {
|
|
107 |
wc_add_notice ( sprintf ( __ ( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $e->getMessage () ), 'error' );
|
108 |
}
|
109 |
}
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
|
113 |
private function do_api_request($uri, $body, $method = 'POST') {
|
@@ -174,7 +185,7 @@ class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe_Charge {
|
|
174 |
}
|
175 |
|
176 |
public function get_plaid_environment() {
|
177 |
-
return
|
178 |
}
|
179 |
|
180 |
private function get_metadata() {
|
@@ -193,6 +204,26 @@ class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe_Charge {
|
|
193 |
return __ ( 'New Bank', 'woo-stripe-payment' );
|
194 |
}
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
public function generate_ach_fee_html($key, $data) {
|
197 |
$field_key = $this->get_field_key ( $key );
|
198 |
$defaults = array( 'title' => '',
|
@@ -219,6 +250,18 @@ class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe_Charge {
|
|
219 |
return $value;
|
220 |
}
|
221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
public function fees_enabled() {
|
223 |
$fee = $this->get_option ( 'fee', [
|
224 |
'type' => 'none', 'value' => '0'
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Gateway that processes ACH payments.
|
4 |
+
* Only available for U.S. based merchants at this time.
|
5 |
+
*
|
6 |
* @since 3.0.5
|
7 |
* @author Payment Plugins
|
8 |
* @package Stripe/Gateways
|
9 |
+
*
|
10 |
*/
|
11 |
+
class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe {
|
12 |
+
|
13 |
+
use WC_Stripe_Payment_Charge_Trait;
|
14 |
|
15 |
/**
|
16 |
*
|
75 |
public function enqueue_checkout_scripts($scripts) {
|
76 |
$scripts->enqueue_script ( 'ach', $scripts->assets_url ( 'js/frontend/ach-payments.js' ), array(
|
77 |
$scripts->get_handle ( 'external' ),
|
78 |
+
$scripts->get_handle ( 'wc-stripe' ),
|
79 |
$scripts->get_handle ( 'plaid' )
|
80 |
) );
|
81 |
$scripts->localize_script ( 'ach', $this->get_localized_params () );
|
112 |
wc_add_notice ( sprintf ( __ ( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $e->getMessage () ), 'error' );
|
113 |
}
|
114 |
}
|
115 |
+
$result = parent::process_payment ( $order_id );
|
116 |
+
if ($result[ 'result' ] == 'success') {
|
117 |
+
if (wc_stripe ()->api_settings->get_option ( 'account_id' ) && ! $this->get_option ( 'record_ach', false )) {
|
118 |
+
$this->ach_analytics ();
|
119 |
+
}
|
120 |
+
}
|
121 |
+
return $result;
|
122 |
}
|
123 |
|
124 |
private function do_api_request($uri, $body, $method = 'POST') {
|
185 |
}
|
186 |
|
187 |
public function get_plaid_environment() {
|
188 |
+
return $this->get_option ( 'environment' );
|
189 |
}
|
190 |
|
191 |
private function get_metadata() {
|
204 |
return __ ( 'New Bank', 'woo-stripe-payment' );
|
205 |
}
|
206 |
|
207 |
+
private function ach_analytics() {
|
208 |
+
$response = wp_safe_remote_post ( 'https://api.plaid.paymentplugins.com/v1/stripe/analytics', [
|
209 |
+
'headers' => [
|
210 |
+
'Content-Type' => 'application/json'
|
211 |
+
],
|
212 |
+
'body' => wp_json_encode ( [
|
213 |
+
'client_id' => $this->get_option ( 'client_id' ),
|
214 |
+
'account_id' => wc_stripe ()->api_settings->get_option ( 'account_id' )
|
215 |
+
] ), 'data_format' => 'body'
|
216 |
+
] );
|
217 |
+
if (is_wp_error ( $response )) {
|
218 |
+
return;
|
219 |
+
} else {
|
220 |
+
$body = json_decode ( $response[ 'body' ] );
|
221 |
+
if ($response[ 'response' ][ 'code' ] == 200) {
|
222 |
+
$this->update_option ( 'record_ach', true );
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
public function generate_ach_fee_html($key, $data) {
|
228 |
$field_key = $this->get_field_key ( $key );
|
229 |
$defaults = array( 'title' => '',
|
250 |
return $value;
|
251 |
}
|
252 |
|
253 |
+
/**
|
254 |
+
*
|
255 |
+
* @param string $key
|
256 |
+
* @param string $value
|
257 |
+
*/
|
258 |
+
public function validate_environment_field($key, $value) {
|
259 |
+
if ('test' == wc_stripe_mode () && 'development' == $value) {
|
260 |
+
WC_Admin_Settings::add_error ( __ ( 'You must set the API mode to live in order to enable the Plaid development environment.', 'woo-stripe-payment' ) );
|
261 |
+
}
|
262 |
+
return $value;
|
263 |
+
}
|
264 |
+
|
265 |
public function fees_enabled() {
|
266 |
$fee = $this->get_option ( 'fee', [
|
267 |
'type' => 'none', 'value' => '0'
|
includes/gateways/class-wc-payment-gateway-stripe-alipay.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
+
return;
|
4 |
+
}
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @package Stripe/Gateways
|
8 |
+
* @author PaymentPlugins
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class WC_Payment_Gateway_Stripe_Alipay extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
+
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
+
|
15 |
+
public function __construct() {
|
16 |
+
$this->local_payment_type = 'alipay';
|
17 |
+
$this->currencies = [ 'AUD', 'CAD', 'EUR',
|
18 |
+
'GBP', 'HKD', 'JPY', 'SGD', 'USD'
|
19 |
+
];
|
20 |
+
// $this->countries = [ 'CN'
|
21 |
+
// ];
|
22 |
+
$this->id = 'stripe_alipay';
|
23 |
+
$this->tab_title = __ ( 'Alipay', 'woo-stripe-payment' );
|
24 |
+
$this->template_name = 'local-payment.php';
|
25 |
+
$this->token_type = 'Stripe_Local';
|
26 |
+
$this->method_title = __ ( 'Alipay', 'woo-stripe-payment' );
|
27 |
+
$this->method_description = __ ( 'Alipay gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
28 |
+
$this->icon = wc_stripe ()->assets_url ( 'img/alipay.svg' );
|
29 |
+
$this->order_button_text = __ ( 'Alipay', 'woo-stripe-payment' );
|
30 |
+
parent::__construct ();
|
31 |
+
}
|
32 |
+
}
|
includes/gateways/class-wc-payment-gateway-stripe-applepay.php
CHANGED
@@ -8,7 +8,11 @@ if (! class_exists ( 'WC_Payment_Gateway_Stripe' )) {
|
|
8 |
* @author PaymentPlugins
|
9 |
*
|
10 |
*/
|
11 |
-
class WC_Payment_Gateway_Stripe_ApplePay extends
|
|
|
|
|
|
|
|
|
12 |
|
13 |
public function __construct() {
|
14 |
$this->id = 'stripe_applepay';
|
8 |
* @author PaymentPlugins
|
9 |
*
|
10 |
*/
|
11 |
+
class WC_Payment_Gateway_Stripe_ApplePay extends WC_Payment_Gateway_Stripe {
|
12 |
+
|
13 |
+
use WC_Stripe_Payment_Intent_Trait;
|
14 |
+
|
15 |
+
protected $payment_method_type = 'card';
|
16 |
|
17 |
public function __construct() {
|
18 |
$this->id = 'stripe_applepay';
|
includes/gateways/class-wc-payment-gateway-stripe-bancontact.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -10,6 +10,8 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Bancontact extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
|
|
|
|
13 |
public function __construct() {
|
14 |
$this->synchronous = false;
|
15 |
$this->local_payment_type = 'bancontact';
|
@@ -27,35 +29,4 @@ class WC_Payment_Gateway_Stripe_Bancontact extends WC_Payment_Gateway_Stripe_Loc
|
|
27 |
$this->order_button_text = __ ( 'Bancontact', 'woo-stripe-payment' );
|
28 |
parent::__construct ();
|
29 |
}
|
30 |
-
|
31 |
-
public function get_local_payment_settings() {
|
32 |
-
return [
|
33 |
-
'desc' => array( 'type' => 'description',
|
34 |
-
'description' => $this->get_payment_description ()
|
35 |
-
),
|
36 |
-
'enabled' => array(
|
37 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
38 |
-
'type' => 'checkbox',
|
39 |
-
'default' => 'no', 'value' => 'yes',
|
40 |
-
'desc_tip' => true,
|
41 |
-
'description' => __ ( 'If enabled, your site can accept Bancontact payments through Stripe.', 'woo-stripe-payment' )
|
42 |
-
),
|
43 |
-
'general_settings' => array(
|
44 |
-
'type' => 'title',
|
45 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
46 |
-
),
|
47 |
-
'title_text' => array( 'type' => 'text',
|
48 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
49 |
-
'default' => __ ( 'Bancontact', 'woo-stripe-payment' ),
|
50 |
-
'desc_tip' => true,
|
51 |
-
'description' => __ ( 'Title of the Sofort gateway' )
|
52 |
-
),
|
53 |
-
'description' => array(
|
54 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
55 |
-
'type' => 'text', 'default' => '',
|
56 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
57 |
-
'desc_tip' => true
|
58 |
-
)
|
59 |
-
];
|
60 |
-
}
|
61 |
}
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Bancontact extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
+
|
15 |
public function __construct() {
|
16 |
$this->synchronous = false;
|
17 |
$this->local_payment_type = 'bancontact';
|
29 |
$this->order_button_text = __ ( 'Bancontact', 'woo-stripe-payment' );
|
30 |
parent::__construct ();
|
31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-cc.php
CHANGED
@@ -5,8 +5,12 @@
|
|
5 |
* @author User
|
6 |
*
|
7 |
*/
|
8 |
-
class WC_Payment_Gateway_Stripe_CC extends
|
9 |
|
|
|
|
|
|
|
|
|
10 |
public function __construct() {
|
11 |
$this->id = 'stripe_cc';
|
12 |
$this->tab_title = __ ( 'Credit Cards', 'woo-stripe-payment' );
|
@@ -17,10 +21,6 @@ class WC_Payment_Gateway_Stripe_CC extends WC_Payment_Gateway_Stripe_Payment_Int
|
|
17 |
parent::__construct ();
|
18 |
}
|
19 |
|
20 |
-
public function hooks() {
|
21 |
-
parent::hooks ();
|
22 |
-
}
|
23 |
-
|
24 |
public function get_icon() {
|
25 |
return wc_stripe_get_template ( 'card-icons.php', array(
|
26 |
'cards' => $this->get_option ( 'cards' ),
|
5 |
* @author User
|
6 |
*
|
7 |
*/
|
8 |
+
class WC_Payment_Gateway_Stripe_CC extends WC_Payment_Gateway_Stripe {
|
9 |
|
10 |
+
use WC_Stripe_Payment_Intent_Trait;
|
11 |
+
|
12 |
+
protected $payment_method_type = 'card';
|
13 |
+
|
14 |
public function __construct() {
|
15 |
$this->id = 'stripe_cc';
|
16 |
$this->tab_title = __ ( 'Credit Cards', 'woo-stripe-payment' );
|
21 |
parent::__construct ();
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
24 |
public function get_icon() {
|
25 |
return wc_stripe_get_template ( 'card-icons.php', array(
|
26 |
'cards' => $this->get_option ( 'cards' ),
|
includes/gateways/class-wc-payment-gateway-stripe-eps.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -10,6 +10,8 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_EPS extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
|
|
|
|
13 |
public function __construct() {
|
14 |
$this->local_payment_type = 'eps';
|
15 |
$this->currencies = [ 'EUR'
|
@@ -26,35 +28,4 @@ class WC_Payment_Gateway_Stripe_EPS extends WC_Payment_Gateway_Stripe_Local_Paym
|
|
26 |
$this->order_button_text = __ ( 'EPS', 'woo-stripe-payment' );
|
27 |
parent::__construct ();
|
28 |
}
|
29 |
-
|
30 |
-
public function get_local_payment_settings() {
|
31 |
-
return [
|
32 |
-
'desc' => array( 'type' => 'description',
|
33 |
-
'description' => $this->get_payment_description ()
|
34 |
-
),
|
35 |
-
'enabled' => array(
|
36 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
37 |
-
'type' => 'checkbox',
|
38 |
-
'default' => 'no', 'value' => 'yes',
|
39 |
-
'desc_tip' => true,
|
40 |
-
'description' => __ ( 'If enabled, your site can accept P24 payments through Stripe.', 'woo-stripe-payment' )
|
41 |
-
),
|
42 |
-
'general_settings' => array(
|
43 |
-
'type' => 'title',
|
44 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
45 |
-
),
|
46 |
-
'title_text' => array( 'type' => 'text',
|
47 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
48 |
-
'default' => __ ( 'EPS', 'woo-stripe-payment' ),
|
49 |
-
'desc_tip' => true,
|
50 |
-
'description' => __ ( 'Title of the p24 gateway' )
|
51 |
-
),
|
52 |
-
'description' => array(
|
53 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
54 |
-
'type' => 'text', 'default' => '',
|
55 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
56 |
-
'desc_tip' => true
|
57 |
-
)
|
58 |
-
];
|
59 |
-
}
|
60 |
}
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_EPS extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
+
|
15 |
public function __construct() {
|
16 |
$this->local_payment_type = 'eps';
|
17 |
$this->currencies = [ 'EUR'
|
28 |
$this->order_button_text = __ ( 'EPS', 'woo-stripe-payment' );
|
29 |
parent::__construct ();
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-fpx.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
+
return;
|
4 |
+
}
|
5 |
+
/**
|
6 |
+
*
|
7 |
+
* @package Stripe/Gateways
|
8 |
+
* @author PaymentPlugins
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class WC_Payment_Gateway_Stripe_FPX extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
+
|
13 |
+
use WC_Stripe_Local_Payment_Intent_Trait;
|
14 |
+
|
15 |
+
protected $payment_method_type = 'fpx';
|
16 |
+
|
17 |
+
public function __construct() {
|
18 |
+
$this->local_payment_type = 'fpx';
|
19 |
+
$this->currencies = [ 'MYR'
|
20 |
+
];
|
21 |
+
$this->countries = [ 'MY'
|
22 |
+
];
|
23 |
+
$this->id = 'stripe_fpx';
|
24 |
+
$this->tab_title = __ ( 'FPX', 'woo-stripe-payment' );
|
25 |
+
$this->method_title = __ ( 'FPX', 'woo-stripe-payment' );
|
26 |
+
$this->method_description = __ ( 'FPX gateway that integrates with your Stripe account.', 'woo-stripe-payment' );
|
27 |
+
$this->icon = wc_stripe ()->assets_url ( 'img/fpx.svg' );
|
28 |
+
$this->order_button_text = __ ( 'FPX', 'woo-stripe-payment' );
|
29 |
+
parent::__construct ();
|
30 |
+
}
|
31 |
+
|
32 |
+
public function get_element_params() {
|
33 |
+
$params = parent::get_element_params ();
|
34 |
+
$params[ 'accountHolderType' ] = 'individual';
|
35 |
+
return $params;
|
36 |
+
}
|
37 |
+
}
|
includes/gateways/class-wc-payment-gateway-stripe-giropay.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -9,6 +9,8 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
9 |
*/
|
10 |
class WC_Payment_Gateway_Stripe_Giropay extends WC_Payment_Gateway_Stripe_Local_Payment {
|
11 |
|
|
|
|
|
12 |
public function __construct() {
|
13 |
$this->local_payment_type = 'giropay';
|
14 |
$this->currencies = [ 'EUR'
|
@@ -25,35 +27,4 @@ class WC_Payment_Gateway_Stripe_Giropay extends WC_Payment_Gateway_Stripe_Local_
|
|
25 |
$this->order_button_text = __ ( 'Giropay', 'woo-stripe-payment' );
|
26 |
parent::__construct ();
|
27 |
}
|
28 |
-
|
29 |
-
public function get_local_payment_settings() {
|
30 |
-
return [
|
31 |
-
'desc' => array( 'type' => 'description',
|
32 |
-
'description' => $this->get_payment_description()
|
33 |
-
),
|
34 |
-
'enabled' => array(
|
35 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
36 |
-
'type' => 'checkbox',
|
37 |
-
'default' => 'no', 'value' => 'yes',
|
38 |
-
'desc_tip' => true,
|
39 |
-
'description' => __ ( 'If enabled, your site can Giropay card payments through Stripe.', 'woo-stripe-payment' )
|
40 |
-
),
|
41 |
-
'general_settings' => array(
|
42 |
-
'type' => 'title',
|
43 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
44 |
-
),
|
45 |
-
'title_text' => array( 'type' => 'text',
|
46 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
47 |
-
'default' => __ ( 'Giropay', 'woo-stripe-payment' ),
|
48 |
-
'desc_tip' => true,
|
49 |
-
'description' => __ ( 'Title of the Giropay gateway' )
|
50 |
-
),
|
51 |
-
'description' => array(
|
52 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
53 |
-
'type' => 'text', 'default' => '',
|
54 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
55 |
-
'desc_tip' => true
|
56 |
-
)
|
57 |
-
];
|
58 |
-
}
|
59 |
}
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
9 |
*/
|
10 |
class WC_Payment_Gateway_Stripe_Giropay extends WC_Payment_Gateway_Stripe_Local_Payment {
|
11 |
|
12 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
13 |
+
|
14 |
public function __construct() {
|
15 |
$this->local_payment_type = 'giropay';
|
16 |
$this->currencies = [ 'EUR'
|
27 |
$this->order_button_text = __ ( 'Giropay', 'woo-stripe-payment' );
|
28 |
parent::__construct ();
|
29 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-googlepay.php
CHANGED
@@ -9,7 +9,9 @@ if (! class_exists ( 'WC_Payment_Gateway_Stripe' )) {
|
|
9 |
* @package Stripe/Gateways
|
10 |
*
|
11 |
*/
|
12 |
-
class WC_Payment_Gateway_Stripe_GooglePay extends
|
|
|
|
|
13 |
|
14 |
public function __construct() {
|
15 |
$this->id = 'stripe_googlepay';
|
@@ -165,7 +167,7 @@ class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe_Char
|
|
165 |
$items[] = [
|
166 |
'label' => __ ( 'Shipping', 'woo-stripe-payment' ),
|
167 |
'type' => 'LINE_ITEM',
|
168 |
-
'price' => strval ( WC ()->cart->shipping_total )
|
169 |
];
|
170 |
}
|
171 |
|
9 |
* @package Stripe/Gateways
|
10 |
*
|
11 |
*/
|
12 |
+
class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe {
|
13 |
+
|
14 |
+
use WC_Stripe_Payment_Charge_Trait;
|
15 |
|
16 |
public function __construct() {
|
17 |
$this->id = 'stripe_googlepay';
|
167 |
$items[] = [
|
168 |
'label' => __ ( 'Shipping', 'woo-stripe-payment' ),
|
169 |
'type' => 'LINE_ITEM',
|
170 |
+
'price' => strval ( round ( WC ()->cart->shipping_total, wc_get_price_decimals () ) )
|
171 |
];
|
172 |
}
|
173 |
|
includes/gateways/class-wc-payment-gateway-stripe-ideal.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -10,6 +10,12 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Ideal extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
public function __construct() {
|
14 |
$this->local_payment_type = 'ideal';
|
15 |
$this->currencies = [ 'EUR'
|
@@ -24,35 +30,4 @@ class WC_Payment_Gateway_Stripe_Ideal extends WC_Payment_Gateway_Stripe_Local_Pa
|
|
24 |
$this->order_button_text = __ ( 'iDEAL', 'woo-stripe-payment' );
|
25 |
parent::__construct ();
|
26 |
}
|
27 |
-
|
28 |
-
public function get_local_payment_settings() {
|
29 |
-
return [
|
30 |
-
'desc' => array( 'type' => 'description',
|
31 |
-
'description' => $this->get_payment_description ()
|
32 |
-
),
|
33 |
-
'enabled' => array(
|
34 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
35 |
-
'type' => 'checkbox',
|
36 |
-
'default' => 'no', 'value' => 'yes',
|
37 |
-
'desc_tip' => true,
|
38 |
-
'description' => __ ( 'If enabled, your site can accept credit card payments through Stripe.', 'woo-stripe-payment' )
|
39 |
-
),
|
40 |
-
'general_settings' => array(
|
41 |
-
'type' => 'title',
|
42 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
43 |
-
),
|
44 |
-
'title_text' => array( 'type' => 'text',
|
45 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
46 |
-
'default' => __ ( 'iDEAL', 'woo-stripe-payment' ),
|
47 |
-
'desc_tip' => true,
|
48 |
-
'description' => __ ( 'Title of the iDEAL gateway' )
|
49 |
-
),
|
50 |
-
'description' => array(
|
51 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
52 |
-
'type' => 'text', 'default' => '',
|
53 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
54 |
-
'desc_tip' => true
|
55 |
-
)
|
56 |
-
];
|
57 |
-
}
|
58 |
}
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Ideal extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
13 |
+
protected $payment_method_type = 'ideal';
|
14 |
+
|
15 |
+
// use WC_Stripe_Local_Payment_Charge_Trait;
|
16 |
+
|
17 |
+
use WC_Stripe_Local_Payment_Intent_Trait;
|
18 |
+
|
19 |
public function __construct() {
|
20 |
$this->local_payment_type = 'ideal';
|
21 |
$this->currencies = [ 'EUR'
|
30 |
$this->order_button_text = __ ( 'iDEAL', 'woo-stripe-payment' );
|
31 |
parent::__construct ();
|
32 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-klarna.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -9,6 +9,8 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
9 |
*
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_Payment {
|
|
|
|
|
12 |
|
13 |
public function __construct() {
|
14 |
$this->local_payment_type = 'klarna';
|
@@ -34,43 +36,15 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
|
|
34 |
) );
|
35 |
}
|
36 |
|
|
|
|
|
|
|
37 |
public function enqueue_klarna() {
|
38 |
if ($this->is_available ()) {
|
39 |
wc_stripe ()->scripts ()->enqueue_script ( 'klarna', 'https://x.klarnacdn.net/kp/lib/v1/api.js', [], wc_stripe ()->version (), true );
|
40 |
}
|
41 |
}
|
42 |
|
43 |
-
public function get_local_payment_settings() {
|
44 |
-
return [
|
45 |
-
'desc' => array( 'type' => 'description',
|
46 |
-
'description' => $this->get_payment_description ()
|
47 |
-
),
|
48 |
-
'enabled' => array(
|
49 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
50 |
-
'type' => 'checkbox',
|
51 |
-
'default' => 'no', 'value' => 'yes',
|
52 |
-
'desc_tip' => true,
|
53 |
-
'description' => __ ( 'If enabled, your site can accept Klarna payments through Stripe.', 'woo-stripe-payment' )
|
54 |
-
),
|
55 |
-
'general_settings' => array(
|
56 |
-
'type' => 'title',
|
57 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
58 |
-
),
|
59 |
-
'title_text' => array( 'type' => 'text',
|
60 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
61 |
-
'default' => __ ( 'Klarna', 'woo-stripe-payment' ),
|
62 |
-
'desc_tip' => true,
|
63 |
-
'description' => __ ( 'Title of the Klarna gateway' )
|
64 |
-
),
|
65 |
-
'description' => array(
|
66 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
67 |
-
'type' => 'text', 'default' => '',
|
68 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
69 |
-
'desc_tip' => true
|
70 |
-
)
|
71 |
-
];
|
72 |
-
}
|
73 |
-
|
74 |
public function get_required_parameters() {
|
75 |
return [ 'USD' => [ 'US'
|
76 |
], 'EUR' => [ 'AT', 'FI', 'DE', 'NL'
|
@@ -152,42 +126,63 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
|
|
152 |
'state' => $order->get_shipping_state ()
|
153 |
];
|
154 |
}
|
155 |
-
|
156 |
-
|
157 |
-
];
|
158 |
-
foreach ( $order->get_items ( $types ) as $item ) {
|
159 |
/**
|
160 |
*
|
161 |
-
* @var
|
162 |
*/
|
163 |
-
$
|
164 |
-
'
|
|
|
|
|
165 |
'quantity' => $item->get_quantity (),
|
166 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
];
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
$source_item[ 'type' ] = 'shipping';
|
175 |
-
$source_item[ 'amount' ] = wc_stripe_add_number_precision ( $item->get_total () );
|
176 |
-
} elseif ($item instanceof WC_Order_Item_Coupon) {
|
177 |
-
// $source_item[ 'type' ] = 'discount';
|
178 |
-
$source_item[ 'amount' ] = - 1 * wc_stripe_add_number_precision ( $item->get_discount () );
|
179 |
-
} else {
|
180 |
-
continue;
|
181 |
}
|
182 |
-
$args[ 'source_order' ][ 'items' ][] =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
184 |
-
$args[ 'source_order' ][ 'items' ][] = [
|
185 |
-
'type' => 'tax',
|
186 |
-
'amount' => wc_stripe_add_number_precision ( $order->get_total_tax () ),
|
187 |
-
'description' => __ ( 'Tax', 'woo-stripe-payment' ),
|
188 |
-
'quantity' => 1,
|
189 |
-
'currency' => $order->get_currency ()
|
190 |
-
];
|
191 |
return $args;
|
192 |
}
|
193 |
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
9 |
*
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
+
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
|
15 |
public function __construct() {
|
16 |
$this->local_payment_type = 'klarna';
|
36 |
) );
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* Enqueue Klarna based on whether it's available or not.
|
41 |
+
*/
|
42 |
public function enqueue_klarna() {
|
43 |
if ($this->is_available ()) {
|
44 |
wc_stripe ()->scripts ()->enqueue_script ( 'klarna', 'https://x.klarnacdn.net/kp/lib/v1/api.js', [], wc_stripe ()->version (), true );
|
45 |
}
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
public function get_required_parameters() {
|
49 |
return [ 'USD' => [ 'US'
|
50 |
], 'EUR' => [ 'AT', 'FI', 'DE', 'NL'
|
126 |
'state' => $order->get_shipping_state ()
|
127 |
];
|
128 |
}
|
129 |
+
|
130 |
+
foreach ( $order->get_items ( 'line_item' ) as $item ) {
|
|
|
|
|
131 |
/**
|
132 |
*
|
133 |
+
* @var WC_Order_Item_Product $item
|
134 |
*/
|
135 |
+
$args[ 'source_order' ][ 'items' ][] = [
|
136 |
+
'type' => 'sku',
|
137 |
+
'amount' => wc_stripe_add_number_precision ( $item->get_subtotal () ),
|
138 |
+
'currency' => $order->get_currency (),
|
139 |
'quantity' => $item->get_quantity (),
|
140 |
+
'description' => $item->get_name ()
|
141 |
+
];
|
142 |
+
}
|
143 |
+
// shipping
|
144 |
+
if ($order->get_shipping_total ()) {
|
145 |
+
$args[ 'source_order' ][ 'items' ][] = [
|
146 |
+
'type' => 'shipping',
|
147 |
+
'amount' => wc_stripe_add_number_precision ( $order->get_shipping_total () ),
|
148 |
+
'currency' => $order->get_currency (),
|
149 |
+
'quantity' => 1,
|
150 |
+
'description' => __ ( 'Shipping', 'woo-stripe-payment' )
|
151 |
+
];
|
152 |
+
}
|
153 |
+
// discount
|
154 |
+
if ($order->get_discount_total ()) {
|
155 |
+
$args[ 'source_order' ][ 'items' ][] = [
|
156 |
+
'type' => 'discount',
|
157 |
+
'amount' => - 1 * wc_stripe_add_number_precision ( $order->get_discount_total () ),
|
158 |
+
'currency' => $order->get_currency (),
|
159 |
+
'quantity' => 1,
|
160 |
+
'description' => __ ( 'Discount', 'woo-stripe-payment' )
|
161 |
];
|
162 |
+
}
|
163 |
+
// fees
|
164 |
+
if ($order->get_fees ()) {
|
165 |
+
$fee_total = 0;
|
166 |
+
foreach ( $order->get_fees () as $fee ) {
|
167 |
+
$fee_total += wc_stripe_add_number_precision ( $fee->get_total () );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
+
$args[ 'source_order' ][ 'items' ][] = [
|
170 |
+
'type' => 'sku', 'amount' => $fee_total,
|
171 |
+
'currency' => $order->get_currency (),
|
172 |
+
'quantity' => 1,
|
173 |
+
'description' => __ ( 'Fee', 'woo-stripe-payment' )
|
174 |
+
];
|
175 |
+
}
|
176 |
+
// tax
|
177 |
+
if ($order->get_total_tax ()) {
|
178 |
+
$args[ 'source_order' ][ 'items' ][] = [
|
179 |
+
'type' => 'tax',
|
180 |
+
'amount' => wc_stripe_add_number_precision ( $order->get_total_tax () ),
|
181 |
+
'description' => __ ( 'Tax', 'woo-stripe-payment' ),
|
182 |
+
'quantity' => 1,
|
183 |
+
'currency' => $order->get_currency ()
|
184 |
+
];
|
185 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
return $args;
|
187 |
}
|
188 |
|
includes/gateways/class-wc-payment-gateway-stripe-multibanco.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -10,6 +10,8 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Multibanco extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
|
|
|
|
13 |
public function __construct() {
|
14 |
$this->local_payment_type = 'multibanco';
|
15 |
$this->currencies = [ 'EUR'
|
@@ -26,35 +28,4 @@ class WC_Payment_Gateway_Stripe_Multibanco extends WC_Payment_Gateway_Stripe_Loc
|
|
26 |
$this->order_button_text = __ ( 'Multibanco', 'woo-stripe-payment' );
|
27 |
parent::__construct ();
|
28 |
}
|
29 |
-
|
30 |
-
public function get_local_payment_settings() {
|
31 |
-
return [
|
32 |
-
'desc' => array( 'type' => 'description',
|
33 |
-
'description' => $this->get_payment_description ()
|
34 |
-
),
|
35 |
-
'enabled' => array(
|
36 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
37 |
-
'type' => 'checkbox',
|
38 |
-
'default' => 'no', 'value' => 'yes',
|
39 |
-
'desc_tip' => true,
|
40 |
-
'description' => __ ( 'If enabled, your site can accept Multibanco payments through Stripe.', 'woo-stripe-payment' )
|
41 |
-
),
|
42 |
-
'general_settings' => array(
|
43 |
-
'type' => 'title',
|
44 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
45 |
-
),
|
46 |
-
'title_text' => array( 'type' => 'text',
|
47 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
48 |
-
'default' => __ ( 'Multibanco', 'woo-stripe-payment' ),
|
49 |
-
'desc_tip' => true,
|
50 |
-
'description' => __ ( 'Title of the Multibanco gateway' )
|
51 |
-
),
|
52 |
-
'description' => array(
|
53 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
54 |
-
'type' => 'text', 'default' => '',
|
55 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
56 |
-
'desc_tip' => true
|
57 |
-
)
|
58 |
-
];
|
59 |
-
}
|
60 |
}
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Multibanco extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
+
|
15 |
public function __construct() {
|
16 |
$this->local_payment_type = 'multibanco';
|
17 |
$this->currencies = [ 'EUR'
|
28 |
$this->order_button_text = __ ( 'Multibanco', 'woo-stripe-payment' );
|
29 |
parent::__construct ();
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-p24.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -10,6 +10,8 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_P24 extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
|
|
|
|
13 |
public function __construct() {
|
14 |
$this->local_payment_type = 'p24';
|
15 |
$this->currencies = [ 'EUR', 'PLN'
|
@@ -26,35 +28,4 @@ class WC_Payment_Gateway_Stripe_P24 extends WC_Payment_Gateway_Stripe_Local_Paym
|
|
26 |
$this->order_button_text = __ ( 'P24', 'woo-stripe-payment' );
|
27 |
parent::__construct ();
|
28 |
}
|
29 |
-
|
30 |
-
public function get_local_payment_settings() {
|
31 |
-
return [
|
32 |
-
'desc' => array( 'type' => 'description',
|
33 |
-
'description' => $this->get_payment_description ()
|
34 |
-
),
|
35 |
-
'enabled' => array(
|
36 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
37 |
-
'type' => 'checkbox',
|
38 |
-
'default' => 'no', 'value' => 'yes',
|
39 |
-
'desc_tip' => true,
|
40 |
-
'description' => __ ( 'If enabled, your site can accept P24 payments through Stripe.', 'woo-stripe-payment' )
|
41 |
-
),
|
42 |
-
'general_settings' => array(
|
43 |
-
'type' => 'title',
|
44 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
45 |
-
),
|
46 |
-
'title_text' => array( 'type' => 'text',
|
47 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
48 |
-
'default' => __ ( 'P24', 'woo-stripe-payment' ),
|
49 |
-
'desc_tip' => true,
|
50 |
-
'description' => __ ( 'Title of the p24 gateway' )
|
51 |
-
),
|
52 |
-
'description' => array(
|
53 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
54 |
-
'type' => 'text', 'default' => '',
|
55 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
56 |
-
'desc_tip' => true
|
57 |
-
)
|
58 |
-
];
|
59 |
-
}
|
60 |
}
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_P24 extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
+
|
15 |
public function __construct() {
|
16 |
$this->local_payment_type = 'p24';
|
17 |
$this->currencies = [ 'EUR', 'PLN'
|
28 |
$this->order_button_text = __ ( 'P24', 'woo-stripe-payment' );
|
29 |
parent::__construct ();
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
includes/gateways/class-wc-payment-gateway-stripe-payment-request.php
CHANGED
@@ -9,7 +9,11 @@ if (! class_exists ( 'WC_Payment_Gateway_Stripe' )) {
|
|
9 |
* @package Stripe/Gateways
|
10 |
*
|
11 |
*/
|
12 |
-
class WC_Payment_Gateway_Stripe_Payment_Request extends
|
|
|
|
|
|
|
|
|
13 |
|
14 |
public function __construct() {
|
15 |
$this->id = 'stripe_payment_request';
|
9 |
* @package Stripe/Gateways
|
10 |
*
|
11 |
*/
|
12 |
+
class WC_Payment_Gateway_Stripe_Payment_Request extends WC_Payment_Gateway_Stripe {
|
13 |
+
|
14 |
+
use WC_Stripe_Payment_Intent_Trait;
|
15 |
+
|
16 |
+
protected $payment_method_type = 'card';
|
17 |
|
18 |
public function __construct() {
|
19 |
$this->id = 'stripe_payment_request';
|
includes/gateways/class-wc-payment-gateway-stripe-sepa.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -10,6 +10,8 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Sepa extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
|
|
|
|
13 |
public function __construct() {
|
14 |
$this->synchronous = false;
|
15 |
$this->local_payment_type = 'sepa_debit';
|
@@ -26,37 +28,6 @@ class WC_Payment_Gateway_Stripe_Sepa extends WC_Payment_Gateway_Stripe_Local_Pay
|
|
26 |
parent::__construct ();
|
27 |
}
|
28 |
|
29 |
-
public function get_local_payment_settings() {
|
30 |
-
return [
|
31 |
-
'desc' => array( 'type' => 'description',
|
32 |
-
'description' => $this->get_payment_description()
|
33 |
-
),
|
34 |
-
'enabled' => array(
|
35 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
36 |
-
'type' => 'checkbox',
|
37 |
-
'default' => 'no', 'value' => 'yes',
|
38 |
-
'desc_tip' => true,
|
39 |
-
'description' => __ ( 'If enabled, your site can accept P24 payments through Stripe.', 'woo-stripe-payment' )
|
40 |
-
),
|
41 |
-
'general_settings' => array(
|
42 |
-
'type' => 'title',
|
43 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
44 |
-
),
|
45 |
-
'title_text' => array( 'type' => 'text',
|
46 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
47 |
-
'default' => __ ( 'SEPA Direct Debit', 'woo-stripe-payment' ),
|
48 |
-
'desc_tip' => true,
|
49 |
-
'description' => __ ( 'Title of the Sepa gateway' )
|
50 |
-
),
|
51 |
-
'description' => array(
|
52 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
53 |
-
'type' => 'text', 'default' => '',
|
54 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
55 |
-
'desc_tip' => true
|
56 |
-
)
|
57 |
-
];
|
58 |
-
}
|
59 |
-
|
60 |
public function get_element_params() {
|
61 |
return array_merge ( parent::get_element_params (), [
|
62 |
'supportedCountries' => [ 'SEPA'
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Sepa extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
+
|
15 |
public function __construct() {
|
16 |
$this->synchronous = false;
|
17 |
$this->local_payment_type = 'sepa_debit';
|
28 |
parent::__construct ();
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
public function get_element_params() {
|
32 |
return array_merge ( parent::get_element_params (), [
|
33 |
'supportedCountries' => [ 'SEPA'
|
includes/gateways/class-wc-payment-gateway-stripe-sofort.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -10,6 +10,8 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Sofort extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
|
|
|
|
13 |
public function __construct() {
|
14 |
$this->synchronous = false;
|
15 |
$this->local_payment_type = 'sofort';
|
@@ -29,37 +31,6 @@ class WC_Payment_Gateway_Stripe_Sofort extends WC_Payment_Gateway_Stripe_Local_P
|
|
29 |
parent::__construct ();
|
30 |
}
|
31 |
|
32 |
-
public function get_local_payment_settings() {
|
33 |
-
return [
|
34 |
-
'desc' => array( 'type' => 'description',
|
35 |
-
'description' => $this->get_payment_description()
|
36 |
-
),
|
37 |
-
'enabled' => array(
|
38 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
39 |
-
'type' => 'checkbox',
|
40 |
-
'default' => 'no', 'value' => 'yes',
|
41 |
-
'desc_tip' => true,
|
42 |
-
'description' => __ ( 'If enabled, your site can accept Sofort payments through Stripe.', 'woo-stripe-payment' )
|
43 |
-
),
|
44 |
-
'general_settings' => array(
|
45 |
-
'type' => 'title',
|
46 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
47 |
-
),
|
48 |
-
'title_text' => array( 'type' => 'text',
|
49 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
50 |
-
'default' => __ ( 'SOFORT', 'woo-stripe-payment' ),
|
51 |
-
'desc_tip' => true,
|
52 |
-
'description' => __ ( 'Title of the Sofort gateway' )
|
53 |
-
),
|
54 |
-
'description' => array(
|
55 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
56 |
-
'type' => 'text', 'default' => '',
|
57 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
58 |
-
'desc_tip' => true
|
59 |
-
)
|
60 |
-
];
|
61 |
-
}
|
62 |
-
|
63 |
public function get_source_args($order) {
|
64 |
return array_merge ( parent::get_source_args ( $order ), [
|
65 |
'sofort' => [
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_Sofort extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
+
|
15 |
public function __construct() {
|
16 |
$this->synchronous = false;
|
17 |
$this->local_payment_type = 'sofort';
|
31 |
parent::__construct ();
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
public function get_source_args($order) {
|
35 |
return array_merge ( parent::get_source_args ( $order ), [
|
36 |
'sofort' => [
|
includes/gateways/class-wc-payment-gateway-stripe-wechat.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (! class_exists ( '
|
3 |
return;
|
4 |
}
|
5 |
/**
|
@@ -9,14 +9,16 @@ if (! class_exists ( 'WC_Payment_Gateway_Local_Payment' )) {
|
|
9 |
*
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_WeChat extends WC_Payment_Gateway_Stripe_Local_Payment {
|
|
|
|
|
12 |
|
13 |
public function __construct() {
|
14 |
$this->local_payment_type = 'wechat';
|
15 |
$this->currencies = [ 'AUD', 'CAD', 'EUR',
|
16 |
'GBP', 'HKD', 'JPY', 'SGD', 'USD'
|
17 |
];
|
18 |
-
$this->countries = [ 'CN'
|
19 |
-
];
|
20 |
$this->id = 'stripe_wechat';
|
21 |
$this->tab_title = __ ( 'WeChat', 'woo-stripe-payment' );
|
22 |
$this->template_name = 'local-payment.php';
|
@@ -28,38 +30,36 @@ class WC_Payment_Gateway_Stripe_WeChat extends WC_Payment_Gateway_Stripe_Local_P
|
|
28 |
parent::__construct ();
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
38 |
-
'type' => 'checkbox',
|
39 |
-
'default' => 'no', 'value' => 'yes',
|
40 |
-
'desc_tip' => true,
|
41 |
-
'description' => __ ( 'If enabled, your site can accept P24 payments through Stripe.', 'woo-stripe-payment' )
|
42 |
-
),
|
43 |
-
'general_settings' => array(
|
44 |
-
'type' => 'title',
|
45 |
-
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
46 |
-
),
|
47 |
-
'title_text' => array( 'type' => 'text',
|
48 |
-
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
49 |
-
'default' => __ ( 'WeChat', 'woo-stripe-payment' ),
|
50 |
-
'desc_tip' => true,
|
51 |
-
'description' => __ ( 'Title of the WeChat gateway', 'woo-stripe-payment' )
|
52 |
-
),
|
53 |
-
'description' => array(
|
54 |
-
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
55 |
-
'type' => 'text', 'default' => '',
|
56 |
-
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
57 |
-
'desc_tip' => true
|
58 |
-
)
|
59 |
-
];
|
60 |
-
}
|
61 |
-
|
62 |
protected function get_source_redirect_url($source, $order) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
return $source->wechat->qr_code_url;
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
1 |
<?php
|
2 |
+
if (! class_exists ( 'WC_Payment_Gateway_Stripe_Local_Payment' )) {
|
3 |
return;
|
4 |
}
|
5 |
/**
|
9 |
*
|
10 |
*/
|
11 |
class WC_Payment_Gateway_Stripe_WeChat extends WC_Payment_Gateway_Stripe_Local_Payment {
|
12 |
+
|
13 |
+
use WC_Stripe_Local_Payment_Charge_Trait;
|
14 |
|
15 |
public function __construct() {
|
16 |
$this->local_payment_type = 'wechat';
|
17 |
$this->currencies = [ 'AUD', 'CAD', 'EUR',
|
18 |
'GBP', 'HKD', 'JPY', 'SGD', 'USD'
|
19 |
];
|
20 |
+
// $this->countries = [ 'CN'
|
21 |
+
// ];
|
22 |
$this->id = 'stripe_wechat';
|
23 |
$this->tab_title = __ ( 'WeChat', 'woo-stripe-payment' );
|
24 |
$this->template_name = 'local-payment.php';
|
30 |
parent::__construct ();
|
31 |
}
|
32 |
|
33 |
+
/**
|
34 |
+
*
|
35 |
+
* {@inheritDoc}
|
36 |
+
*
|
37 |
+
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_source_redirect_url()
|
38 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
protected function get_source_redirect_url($source, $order) {
|
40 |
+
if (wc_stripe_mode () == 'live') {
|
41 |
+
return sprintf ( '#qrcode=%s', base64_encode ( wp_json_encode ( [
|
42 |
+
'code' => $source->wechat->qr_code_url,
|
43 |
+
'redirect' => $order->get_checkout_order_received_url ()
|
44 |
+
] ) ) );
|
45 |
+
}
|
46 |
+
// test code
|
47 |
+
// 'code' => 'weixin:\/\/wxpay\/bizpayurl?pr=tMih4Jo'
|
48 |
+
|
49 |
+
// in test mode just return the redirect url
|
50 |
return $source->wechat->qr_code_url;
|
51 |
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
*
|
55 |
+
* {@inheritDoc}
|
56 |
+
*
|
57 |
+
* @see WC_Payment_Gateway_Stripe_Local_Payment::get_localized_params()
|
58 |
+
*/
|
59 |
+
public function get_localized_params() {
|
60 |
+
$data = parent::get_localized_params ();
|
61 |
+
$data[ 'qr_script' ] = sprintf ( wc_stripe ()->scripts ()->assets_url ( 'js/frontend/qrcode.js?ver=%s' ), wc_stripe ()->version );
|
62 |
+
$data[ 'qr_message' ] = __ ( 'Scan the QR code using your WeChat app. Once scanned click the Place Order button.', 'woo-stripe-payment' );
|
63 |
+
return $data;
|
64 |
+
}
|
65 |
}
|
includes/gateways/settings/ach-settings-v2.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
return array(
|
3 |
+
'desc' => array( 'type' => 'description',
|
4 |
+
'description' => sprintf ( '<div>%s</div>', __ ( 'For US customers only.', 'woo-stripe-payment' ) ) . sprintf ( '<p>%s</p>', sprintf ( __ ( 'Read through our %sdocumentation%s to configure ACH payments', 'woo-stripe-payment' ), '<a target="_blank" href="https://docs.paymentplugins.com/wc-stripe/config/#/stripe_ach">', '</a>' ) )
|
5 |
+
),
|
6 |
+
'enabled' => array(
|
7 |
+
'title' => __ ( 'Enabled', 'woo-stripe-payment' ),
|
8 |
+
'type' => 'checkbox', 'default' => 'no',
|
9 |
+
'value' => 'yes', 'desc_tip' => true,
|
10 |
+
'description' => __ ( 'If enabled, your site can accept ACH payments through Stripe.', 'woo-stripe-payment' )
|
11 |
+
),
|
12 |
+
'environment' => array( 'type' => 'select',
|
13 |
+
'title' => __ ( 'Plaid Environment', 'woo-stripe-payment' ),
|
14 |
+
'options' => array(
|
15 |
+
'sandbox' => __ ( 'Sandbox', 'woo-stripe-payment' ),
|
16 |
+
'development' => __ ( 'Development', 'woo-stripe-payment' ),
|
17 |
+
'production' => __ ( 'Production', 'woo-stripe-payment' )
|
18 |
+
),
|
19 |
+
'description' => __ ( 'This setting determines the Plaid environment you are connecting with. When you are ready to accept live transactions, switch this option to Production.<br><strong>Production</strong> - accept live ACH payments <br><strong>Development</strong> - use real bank login details with test transactions <br><strong>Sandbox</strong> - test integration using test credentials', 'woo-stripe-payment' )
|
20 |
+
),
|
21 |
+
/* 'plaid_keys' => array( 'type' => 'title',
|
22 |
+
'title' => __ ( 'Plaid Keys', 'wo-stripe-paymento' )
|
23 |
+
),
|
24 |
+
'client_id' => array( 'type' => 'text',
|
25 |
+
'title' => __ ( 'Client ID' ),
|
26 |
+
'default' => '',
|
27 |
+
'description' => __ ( 'ID that identifies your Plaid account.', 'woo-stripe-payment' ),
|
28 |
+
'desc_tip' => true
|
29 |
+
),
|
30 |
+
'public_key' => array( 'type' => 'text',
|
31 |
+
'title' => __ ( 'Public Key' ),
|
32 |
+
'default' => '',
|
33 |
+
'description' => __ ( 'Used to identify ACH payments initiated from your site.', 'woo-stripe-payment' ),
|
34 |
+
'desc_tip' => true
|
35 |
+
),
|
36 |
+
'plaid_secrets' => array( 'type' => 'title',
|
37 |
+
'title' => __ ( 'Plaid Secrets', 'wo-stripe-paymento' )
|
38 |
+
),
|
39 |
+
'sandbox_secret' => array(
|
40 |
+
'title' => __ ( 'Sandbox Secret', 'woo-stripe-payment' ),
|
41 |
+
'type' => 'password', 'default' => '',
|
42 |
+
'description' => __ ( 'Key that acts as a password when connecting to Plaid\'s sandbox environment.', 'woo-stripe-payment' ),
|
43 |
+
'desc_tip' => true
|
44 |
+
),
|
45 |
+
'development_secret' => array(
|
46 |
+
'title' => __ ( 'Development Secret', 'woo-stripe-payment' ),
|
47 |
+
'type' => 'password', 'default' => '',
|
48 |
+
'description' => __ ( '', 'woo-stripe-payment' ),
|
49 |
+
'desc_tip' => true
|
50 |
+
),
|
51 |
+
'production_secret' => array(
|
52 |
+
'title' => __ ( 'Production Secret', 'woo-stripe-payment' ),
|
53 |
+
'type' => 'password', 'default' => '',
|
54 |
+
'description' => __ ( 'Key that acts as a password when connecting to Plaid\'s production environment.', 'woo-stripe-payment' ),
|
55 |
+
'desc_tip' => true
|
56 |
+
), */
|
57 |
+
'general_settings' => array( 'type' => 'title',
|
58 |
+
'title' => __ ( 'General Settings', 'woo-stripe-payment' )
|
59 |
+
),
|
60 |
+
'title_text' => array( 'type' => 'text',
|
61 |
+
'title' => __ ( 'Title', 'woo-stripe-payment' ),
|
62 |
+
'default' => __ ( 'ACH Payment', 'woo-stripe-payment' ),
|
63 |
+
'desc_tip' => true,
|
64 |
+
'description' => __ ( 'Title of the ACH gateway' )
|
65 |
+
),
|
66 |
+
'description' => array(
|
67 |
+
'title' => __ ( 'Description', 'woo-stripe-payment' ),
|
68 |
+
'type' => 'text', 'default' => '',
|
69 |
+
'description' => __ ( 'Leave blank if you don\'t want a description to show for the gateway.', 'woo-stripe-payment' ),
|
70 |
+
'desc_tip' => true
|
71 |
+
),
|
72 |
+
'client_name' => array( 'type' => 'text',
|
73 |
+
'title' => __ ( 'Client Name', 'woo-stripe-payment' ),
|
74 |
+
'default' => get_bloginfo ( 'name' ),
|
75 |
+
'description' => __ ( 'The name that appears on the ACH payment screen.', 'woo-stripe-payment' ),
|
76 |
+
'desc_tip' => true
|
77 |
+
),
|
78 |
+
'method_format' => array(
|
79 |
+
'title' => __ ( 'ACH Display', 'woo-stripe-payment' ),
|
80 |
+
'type' => 'select',
|
81 |
+
'class' => 'wc-enhanced-select',
|
82 |
+
'options' => wp_list_pluck ( $this->get_method_formats (), 'example' ),
|
83 |
+
'value' => '', 'default' => 'type_ending_in',
|
84 |
+
'desc_tip' => true,
|
85 |
+
'description' => __ ( 'This option allows you to customize how the credit card will display for your customers on orders, subscriptions, etc.' )
|
86 |
+
),
|
87 |
+
'fee' => array(
|
88 |
+
'title' => __ ( 'ACH Fee', 'woo-stripe-payment' ),
|
89 |
+
'type' => 'ach_fee', 'class' => '',
|
90 |
+
'value' => '',
|
91 |
+
'default' => [ 'type' => 'none',
|
92 |
+
'taxable' => 'no', 'value' => '0'
|
93 |
+
],
|
94 |
+
'options' => [
|
95 |
+
'none' => __ ( 'None', 'woo-stripe-payment' ),
|
96 |
+
'amount' => __ ( 'Amount', 'woo-stripe-payment' ),
|
97 |
+
'percent' => __ ( 'Percentage', 'woo-stripe-payment' )
|
98 |
+
], 'desc_tip' => true,
|
99 |
+
'description' => __ ( 'You can assign a fee to the order for ACH payments. Amount is a static amount and percentage is a percentage of the cart amount.', 'woo-stripe-payment' )
|
100 |
+
)
|
101 |
+
);
|
includes/gateways/settings/ach-settings.php
CHANGED
@@ -9,6 +9,16 @@ return array(
|
|
9 |
'value' => 'yes', 'desc_tip' => true,
|
10 |
'description' => __ ( 'If enabled, your site can accept ACH payments through Stripe.', 'woo-stripe-payment' )
|
11 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
'plaid_keys' => array( 'type' => 'title',
|
13 |
'title' => __ ( 'Plaid Keys', 'wo-stripe-paymento' )
|
14 |
),
|
@@ -32,13 +42,13 @@ return array(
|
|
32 |
'type' => 'password', 'default' => '',
|
33 |
'description' => __ ( 'Key that acts as a password when connecting to Plaid\'s sandbox environment.', 'woo-stripe-payment' ),
|
34 |
'desc_tip' => true
|
35 |
-
),
|
36 |
-
|
37 |
-
'title' => __ ( 'Development Secret', 'woo-stripe-payment' ),
|
38 |
-
'type' => 'password', 'default' => '',
|
39 |
-
'description' => __ ( '', 'woo-stripe-payment' ),
|
40 |
-
'desc_tip' => true
|
41 |
-
),
|
42 |
'production_secret' => array(
|
43 |
'title' => __ ( 'Production Secret', 'woo-stripe-payment' ),
|
44 |
'type' => 'password', 'default' => '',
|
9 |
'value' => 'yes', 'desc_tip' => true,
|
10 |
'description' => __ ( 'If enabled, your site can accept ACH payments through Stripe.', 'woo-stripe-payment' )
|
11 |
),
|
12 |
+
'environment' => array( 'type' => 'select',
|
13 |
+
'title' => __ ( 'Plaid Environment', 'woo-stripe-payment' ),
|
14 |
+
'default' => 'production',
|
15 |
+
'options' => array(
|
16 |
+
'sandbox' => __ ( 'Sandbox', 'woo-stripe-payment' ),
|
17 |
+
'development' => __ ( 'Development', 'woo-stripe-payment' ),
|
18 |
+
'production' => __ ( 'Production', 'woo-stripe-payment' )
|
19 |
+
), 'desc_tip' => true,
|
20 |
+
'description' => __ ( 'The active Plaid environment. You must set API mode to live to use Plaid\'s development environment.', 'woo-stripe-payment' )
|
21 |
+
),
|
22 |
'plaid_keys' => array( 'type' => 'title',
|
23 |
'title' => __ ( 'Plaid Keys', 'wo-stripe-paymento' )
|
24 |
),
|
42 |
'type' => 'password', 'default' => '',
|
43 |
'description' => __ ( 'Key that acts as a password when connecting to Plaid\'s sandbox environment.', 'woo-stripe-payment' ),
|
44 |
'desc_tip' => true
|
45 |
+
),
|
46 |
+
'development_secret' => array(
|
47 |
+
'title' => __ ( 'Development Secret', 'woo-stripe-payment' ),
|
48 |
+
'type' => 'password', 'default' => '',
|
49 |
+
'description' => __ ( 'Development allows you to test real bank credentials with test transactions.', 'woo-stripe-payment' ),
|
50 |
+
'desc_tip' => true
|
51 |
+
),
|
52 |
'production_secret' => array(
|
53 |
'title' => __ ( 'Production Secret', 'woo-stripe-payment' ),
|
54 |
'type' => 'password', 'default' => '',
|
includes/gateways/settings/googlepay-settings.php
CHANGED
@@ -91,10 +91,10 @@ return array(
|
|
91 |
'options' => array(
|
92 |
'googlepay_outline' => __ ( 'With Outline', 'woo-stripe-payment' ),
|
93 |
'googlepay_standard' => __ ( 'Standard', 'woo-stripe-payment' )
|
94 |
-
), 'default' => '
|
95 |
'desc_tip' => true,
|
96 |
-
'description' => __ ( 'This is the icon style that appears next to the gateway on the checkout page.', 'woo-stripe-payment' )
|
97 |
-
),
|
98 |
'button_section' => array( 'type' => 'title',
|
99 |
'title' => __ ( 'Button Options', 'woo-stripe-payment' )
|
100 |
),
|
91 |
'options' => array(
|
92 |
'googlepay_outline' => __ ( 'With Outline', 'woo-stripe-payment' ),
|
93 |
'googlepay_standard' => __ ( 'Standard', 'woo-stripe-payment' )
|
94 |
+
), 'default' => 'googlepay_outline',
|
95 |
'desc_tip' => true,
|
96 |
+
'description' => __ ( 'This is the icon style that appears next to the gateway on the checkout page. Google\'s API team typically requires the With Outline option on the checkout page for branding purposes.', 'woo-stripe-payment' )
|
97 |
+
),
|
98 |
'button_section' => array( 'type' => 'title',
|
99 |
'title' => __ ( 'Button Options', 'woo-stripe-payment' )
|
100 |
),
|
includes/tokens/class-wc-payment-token-stripe-ach.php
CHANGED
@@ -9,6 +9,8 @@ class WC_Payment_Token_Stripe_ACH extends WC_Payment_Token_Stripe {
|
|
9 |
|
10 |
protected $type = 'Stripe_ACH';
|
11 |
|
|
|
|
|
12 |
protected $stripe_data = array( 'bank_name' => '',
|
13 |
'routing_number' => '', 'last4' => ''
|
14 |
);
|
9 |
|
10 |
protected $type = 'Stripe_ACH';
|
11 |
|
12 |
+
protected $stripe_payment_type = 'source';
|
13 |
+
|
14 |
protected $stripe_data = array( 'bank_name' => '',
|
15 |
'routing_number' => '', 'last4' => ''
|
16 |
);
|
includes/tokens/class-wc-payment-token-stripe-applepay.php
CHANGED
@@ -11,14 +11,4 @@ if (! class_exists ( 'WC_Payment_Token_Stripe_CC' )) {
|
|
11 |
class WC_Payment_Token_Stripe_ApplePay extends WC_Payment_Token_Stripe_CC {
|
12 |
|
13 |
protected $type = 'Stripe_ApplePay';
|
14 |
-
|
15 |
-
/**
|
16 |
-
*
|
17 |
-
* {@inheritDoc}
|
18 |
-
*
|
19 |
-
* @see WC_Payment_Token_Stripe_CC::details_to_props()
|
20 |
-
*/
|
21 |
-
public function details_to_props($details) {
|
22 |
-
parent::details_to_props ( $details );
|
23 |
-
}
|
24 |
}
|
11 |
class WC_Payment_Token_Stripe_ApplePay extends WC_Payment_Token_Stripe_CC {
|
12 |
|
13 |
protected $type = 'Stripe_ApplePay';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
includes/tokens/class-wc-payment-token-stripe-cc.php
CHANGED
@@ -4,7 +4,7 @@ if (! class_exists ( 'WC_Payment_Token_Stripe' )) {
|
|
4 |
}
|
5 |
/**
|
6 |
* @sin 3.0.0
|
7 |
-
*
|
8 |
* @author PaymentPlugins
|
9 |
* @package Stripe/Tokens
|
10 |
*
|
@@ -15,10 +15,11 @@ class WC_Payment_Token_Stripe_CC extends WC_Payment_Token_Stripe {
|
|
15 |
|
16 |
protected $type = 'Stripe_CC';
|
17 |
|
|
|
|
|
18 |
protected $stripe_data = array( 'brand' => '',
|
19 |
'exp_month' => '', 'exp_year' => '',
|
20 |
-
'last4' => '', '
|
21 |
-
'masked_number' => ''
|
22 |
);
|
23 |
|
24 |
public function details_to_props($details) {
|
@@ -28,7 +29,7 @@ class WC_Payment_Token_Stripe_CC extends WC_Payment_Token_Stripe {
|
|
28 |
if ($details instanceof \Stripe\Card) {
|
29 |
$card = $details;
|
30 |
}
|
31 |
-
$this->set_brand (
|
32 |
$this->set_last4 ( $card[ 'last4' ] );
|
33 |
$this->set_exp_month ( $card[ 'exp_month' ] );
|
34 |
$this->set_exp_year ( $card[ 'exp_year' ] );
|
@@ -51,14 +52,6 @@ class WC_Payment_Token_Stripe_CC extends WC_Payment_Token_Stripe {
|
|
51 |
$this->set_prop ( 'masked_number', $value );
|
52 |
}
|
53 |
|
54 |
-
public function set_fingerprint($value) {
|
55 |
-
$this->set_prop ( 'fingerprint', $value );
|
56 |
-
}
|
57 |
-
|
58 |
-
public function get_fingerprint($context = 'view') {
|
59 |
-
return $this->get_prop ( 'fingerprint', $context );
|
60 |
-
}
|
61 |
-
|
62 |
public function get_exp_year($context = 'view') {
|
63 |
return $this->get_prop ( 'exp_year', $context );
|
64 |
}
|
@@ -76,7 +69,11 @@ class WC_Payment_Token_Stripe_CC extends WC_Payment_Token_Stripe {
|
|
76 |
}
|
77 |
|
78 |
public function get_html_classes() {
|
79 |
-
return sprintf ( '%s', str_replace ( ' ', '',
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
public function get_formats() {
|
4 |
}
|
5 |
/**
|
6 |
* @sin 3.0.0
|
7 |
+
*
|
8 |
* @author PaymentPlugins
|
9 |
* @package Stripe/Tokens
|
10 |
*
|
15 |
|
16 |
protected $type = 'Stripe_CC';
|
17 |
|
18 |
+
protected $stripe_payment_type = 'payment_method';
|
19 |
+
|
20 |
protected $stripe_data = array( 'brand' => '',
|
21 |
'exp_month' => '', 'exp_year' => '',
|
22 |
+
'last4' => '', 'masked_number' => ''
|
|
|
23 |
);
|
24 |
|
25 |
public function details_to_props($details) {
|
29 |
if ($details instanceof \Stripe\Card) {
|
30 |
$card = $details;
|
31 |
}
|
32 |
+
$this->set_brand ( $card[ 'brand' ] );
|
33 |
$this->set_last4 ( $card[ 'last4' ] );
|
34 |
$this->set_exp_month ( $card[ 'exp_month' ] );
|
35 |
$this->set_exp_year ( $card[ 'exp_year' ] );
|
52 |
$this->set_prop ( 'masked_number', $value );
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
public function get_exp_year($context = 'view') {
|
56 |
return $this->get_prop ( 'exp_year', $context );
|
57 |
}
|
69 |
}
|
70 |
|
71 |
public function get_html_classes() {
|
72 |
+
return sprintf ( '%s', str_replace ( ' ', '', strtolower ( $this->get_prop ( 'brand' ) ) ) );
|
73 |
+
}
|
74 |
+
|
75 |
+
public function get_card_type($context = 'view') {
|
76 |
+
return $this->get_brand ( $context );
|
77 |
}
|
78 |
|
79 |
public function get_formats() {
|
includes/tokens/class-wc-payment-token-stripe-googlepay.php
CHANGED
@@ -12,13 +12,5 @@ class WC_Payment_Token_Stripe_GooglePay extends WC_Payment_Token_Stripe_CC {
|
|
12 |
|
13 |
protected $type = 'Stripe_GooglePay';
|
14 |
|
15 |
-
|
16 |
-
*
|
17 |
-
* {@inheritDoc}
|
18 |
-
*
|
19 |
-
* @see WC_Payment_Token_Stripe_CC::details_to_props()
|
20 |
-
*/
|
21 |
-
public function details_to_props($details) {
|
22 |
-
parent::details_to_props ( $details );
|
23 |
-
}
|
24 |
}
|
12 |
|
13 |
protected $type = 'Stripe_GooglePay';
|
14 |
|
15 |
+
protected $stripe_payment_type = 'source';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
includes/traits/wc-stripe-controller-cart-trait.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @since 3.1.0
|
4 |
+
* @author Payment Plugins
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
trait WC_Stripe_Controller_Cart_Trait{
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Method that hooks in to the woocommerce_cart_ready_to_calc_shipping filter.
|
11 |
+
* Purpose is to ensure
|
12 |
+
* true is returned so shipping packages are calculated. Some 3rd party plugins and themes return false
|
13 |
+
* if the current page is the cart because they don't want to display the shipping calculator.
|
14 |
+
*
|
15 |
+
* @since 3.1.0
|
16 |
+
*/
|
17 |
+
public function add_ready_to_calc_shipping() {
|
18 |
+
add_filter ( 'woocommerce_cart_ready_to_calc_shipping', function ($show_shipping) {
|
19 |
+
return true;
|
20 |
+
}, 1000 );
|
21 |
+
}
|
22 |
+
}
|
includes/traits/wc-stripe-payment-traits.php
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @author Payment Plugins
|
5 |
+
* @since 3.1.0
|
6 |
+
* @package Stripe/Trait
|
7 |
+
*/
|
8 |
+
trait WC_Stripe_Payment_Intent_Trait{
|
9 |
+
|
10 |
+
public function get_payment_object() {
|
11 |
+
return new WC_Stripe_Payment_Intent ( $this, WC_Stripe_Gateway::load () );
|
12 |
+
}
|
13 |
+
|
14 |
+
public function get_payment_method_type() {
|
15 |
+
return $this->payment_method_type;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
*
|
20 |
+
* @param WC_Order $order
|
21 |
+
*/
|
22 |
+
public function get_confirmation_method($order) {
|
23 |
+
return 'manual';
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
*
|
28 |
+
* @param \Stripe\PaymentIntent $secret
|
29 |
+
* @param WC_Order $order
|
30 |
+
*/
|
31 |
+
public function get_payment_intent_checkout_url($intent, $order) {
|
32 |
+
// rand is used to generate some random entropy so that window hash events are triggered.
|
33 |
+
return sprintf ( '#response=%s', base64_encode ( wp_json_encode ( [
|
34 |
+
'client_secret' => $intent->client_secret,
|
35 |
+
'order_id' => $order->get_id (),
|
36 |
+
'time' => rand ( 0, 999999 )
|
37 |
+
] ) ) );
|
38 |
+
}
|
39 |
+
}
|
40 |
+
/**
|
41 |
+
*
|
42 |
+
* @author Payment Plugins
|
43 |
+
* @since 3.1.0
|
44 |
+
* @package Stripe/Trait
|
45 |
+
*/
|
46 |
+
trait WC_Stripe_Payment_Charge_Trait{
|
47 |
+
|
48 |
+
public function get_payment_object() {
|
49 |
+
return new WC_Stripe_Payment_Charge ( $this, WC_Stripe_Gateway::load () );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
*
|
55 |
+
* @author Payment Plugins
|
56 |
+
* @since 3.1.0
|
57 |
+
* @package Stripe/Trait
|
58 |
+
*/
|
59 |
+
trait WC_Stripe_Local_Payment_Charge_Trait{
|
60 |
+
use WC_Stripe_Payment_Charge_Trait;
|
61 |
+
|
62 |
+
/**
|
63 |
+
*
|
64 |
+
* @param int $order_id
|
65 |
+
*/
|
66 |
+
public function process_payment($order_id) {
|
67 |
+
$order = wc_get_order ( $order_id );
|
68 |
+
if (! $this->processing_payment) {
|
69 |
+
$source_id = $this->get_new_source_token ();
|
70 |
+
if (! empty ( $source_id )) {
|
71 |
+
// source was created client side.
|
72 |
+
$source = $this->gateway->fetch_payment_source ( $source_id );
|
73 |
+
|
74 |
+
// save the order ID to the session. Stripe doesn't allow the source object's
|
75 |
+
// redirect url to be updated so we can't pass order_id in url params.
|
76 |
+
WC ()->session->set ( 'wc_stripe_order_id', $order_id );
|
77 |
+
} else {
|
78 |
+
// create the source
|
79 |
+
$source = $this->gateway->create_source ( $this->get_source_args ( $order ) );
|
80 |
+
}
|
81 |
+
|
82 |
+
if (is_wp_error ( $source )) {
|
83 |
+
wc_add_notice ( sprintf ( __ ( 'Error creating payment source. Reason: %s', 'woo-stripe-payment' ), $source->get_error_message () ), 'error' );
|
84 |
+
$order->update_status ( 'failed', sprintf ( __ ( 'Error creating payment source. Reason: %s', 'woo-stripe-payment' ), $source->get_error_message () ) );
|
85 |
+
return $this->get_order_error ();
|
86 |
+
}
|
87 |
+
|
88 |
+
$order->update_meta_data ( '_stripe_source_id', $source->id );
|
89 |
+
$order->update_meta_data ( WC_Stripe_Constants::MODE, wc_stripe_mode () );
|
90 |
+
|
91 |
+
$order->save ();
|
92 |
+
|
93 |
+
return [ 'result' => 'success',
|
94 |
+
'redirect' => $this->get_source_redirect_url ( $source, $order )
|
95 |
+
];
|
96 |
+
} else {
|
97 |
+
return parent::process_payment ( $order_id );
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
*
|
104 |
+
* @author Payment Plugins
|
105 |
+
* @since 3.1.0
|
106 |
+
* @package Stripe/Trait
|
107 |
+
*
|
108 |
+
*/
|
109 |
+
trait WC_Stripe_Local_Payment_Intent_Trait {
|
110 |
+
|
111 |
+
use WC_Stripe_Payment_Intent_Trait;
|
112 |
+
|
113 |
+
/**
|
114 |
+
*
|
115 |
+
* @param \Stripe\PaymentIntent $secret
|
116 |
+
* @param WC_Order $order
|
117 |
+
*/
|
118 |
+
public function get_payment_intent_checkout_url($intent, $order) {
|
119 |
+
// rand is used to generate some random entropy so that window hash events are triggered.
|
120 |
+
return sprintf ( '#response=%s', base64_encode ( wp_json_encode ( [
|
121 |
+
'client_secret' => $intent->client_secret,
|
122 |
+
'return_url' => $this->get_local_payment_return_url ( $order ),
|
123 |
+
'time' => rand ( 0, 999999 )
|
124 |
+
] ) ) );
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
*
|
129 |
+
* @param WC_Order $order
|
130 |
+
*/
|
131 |
+
public function get_confirmation_method($order) {
|
132 |
+
return 'automatic';
|
133 |
+
}
|
134 |
+
}
|
includes/traits/wc-stripe-settings-trait.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @author Payment Plugins
|
5 |
+
* @since 3.1.0
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
trait WC_Stripe_Settings_Trait{
|
9 |
+
|
10 |
+
protected $tab_title;
|
11 |
+
|
12 |
+
private $admin_output = false;
|
13 |
+
|
14 |
+
public function admin_nav_tab($tabs) {
|
15 |
+
$tabs[ $this->id ] = $this->tab_title;
|
16 |
+
return $tabs;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function is_active($key) {
|
20 |
+
return $this->get_option ( $key ) === 'yes';
|
21 |
+
}
|
22 |
+
|
23 |
+
public function admin_options() {
|
24 |
+
if ($this->admin_output) {
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
$this->display_errors ();
|
28 |
+
$this->output_settings_nav ();
|
29 |
+
printf ( '<input type="hidden" id="wc_stripe_prefix" name="wc_stripe_prefix" value="%1$s"/>', $this->get_prefix () );
|
30 |
+
echo '<div class="wc-stripe-settings-container ' . $this->id . '">';
|
31 |
+
parent::admin_options ();
|
32 |
+
echo '</div>';
|
33 |
+
$this->admin_output = true;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function output_settings_nav() {
|
37 |
+
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-settings-nav.php';
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Display admin error messages.
|
42 |
+
*/
|
43 |
+
public function display_errors() {
|
44 |
+
if ($this->get_errors ()) {
|
45 |
+
echo '<div id="woocommerce_errors" class="error notice inline is-dismissible">';
|
46 |
+
foreach ( $this->get_errors () as $error ) {
|
47 |
+
echo '<p>' . wp_kses_post ( $error ) . '</p>';
|
48 |
+
}
|
49 |
+
echo '</div>';
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
public function get_prefix() {
|
54 |
+
return $this->plugin_id . $this->id . '_';
|
55 |
+
}
|
56 |
+
|
57 |
+
public function generate_multiselect_html($key, $data) {
|
58 |
+
$value = ( array ) $this->get_option ( $key, array() );
|
59 |
+
$data[ 'options' ] = array_merge ( array_flip ( $value ), $data[ 'options' ] );
|
60 |
+
return parent::generate_multiselect_html ( $key, $data );
|
61 |
+
}
|
62 |
+
|
63 |
+
public function get_custom_attribute_html($attribs) {
|
64 |
+
if (! empty ( $attribs[ 'custom_attributes' ] ) && is_array ( $attribs[ 'custom_attributes' ] )) {
|
65 |
+
foreach ( $attribs[ 'custom_attributes' ] as $k => $v ) {
|
66 |
+
if (is_array ( $v )) {
|
67 |
+
$attribs[ 'custom_attributes' ][ $k ] = htmlspecialchars ( wp_json_encode ( $v ) );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
return parent::get_custom_attribute_html ( $attribs );
|
72 |
+
}
|
73 |
+
|
74 |
+
public function generate_description_html($key, $data) {
|
75 |
+
$field_key = $this->get_field_key ( $key );
|
76 |
+
$data = wp_parse_args ( $data, array(
|
77 |
+
'class' => '', 'style' => '',
|
78 |
+
'description' => ''
|
79 |
+
) );
|
80 |
+
ob_start ();
|
81 |
+
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-description.php';
|
82 |
+
return ob_get_clean ();
|
83 |
+
}
|
84 |
+
|
85 |
+
public function generate_paragraph_html($key, $data) {
|
86 |
+
$field_key = $this->get_field_key ( $key );
|
87 |
+
$defaults = array( 'title' => '', 'label' => '',
|
88 |
+
'class' => '', 'css' => '',
|
89 |
+
'desc_tip' => false, 'description' => '',
|
90 |
+
'custom_attributes' => array()
|
91 |
+
);
|
92 |
+
$data = wp_parse_args ( $data, $defaults );
|
93 |
+
if (! $data[ 'label' ]) {
|
94 |
+
$data[ 'label' ] = $data[ 'title' ];
|
95 |
+
}
|
96 |
+
ob_start ();
|
97 |
+
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-paragraph.php';
|
98 |
+
return ob_get_clean ();
|
99 |
+
}
|
100 |
+
|
101 |
+
public function generate_stripe_button_html($key, $data) {
|
102 |
+
$field_key = $this->get_field_key ( $key );
|
103 |
+
$data = wp_parse_args ( $data, array(
|
104 |
+
'title' => '', 'class' => '', 'style' => '',
|
105 |
+
'description' => '', 'desc_tip' => false,
|
106 |
+
'id' => 'wc-stripe-button_' . $key,
|
107 |
+
'disabled' => false, 'css' => ''
|
108 |
+
) );
|
109 |
+
ob_start ();
|
110 |
+
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-button.php';
|
111 |
+
return ob_get_clean ();
|
112 |
+
}
|
113 |
+
|
114 |
+
public function generate_button_demo_html($key, $data) {
|
115 |
+
$field_key = $this->get_field_key ( $key );
|
116 |
+
$data = wp_parse_args ( $data, array(
|
117 |
+
'title' => '', 'class' => '', 'style' => '',
|
118 |
+
'description' => '', 'desc_tip' => false,
|
119 |
+
'id' => 'wc-stripe-button-demo'
|
120 |
+
) );
|
121 |
+
ob_start ();
|
122 |
+
include wc_stripe ()->plugin_path () . 'includes/admin/views/html-button-demo.php';
|
123 |
+
return ob_get_clean ();
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Added override to provide more control on which fields are saved and which are skipped.
|
128 |
+
* This plugin
|
129 |
+
* has custom setting fields like "paragraph" that are for info display only and not for saving.
|
130 |
+
*
|
131 |
+
* {@inheritDoc}
|
132 |
+
*
|
133 |
+
* @see WC_Settings_API::process_admin_options()
|
134 |
+
*/
|
135 |
+
public function process_admin_options() {
|
136 |
+
$this->init_settings ();
|
137 |
+
|
138 |
+
$post_data = $this->get_post_data ();
|
139 |
+
|
140 |
+
$skip_types = [ 'title', 'paragraph', 'button',
|
141 |
+
'description', 'button_demo',
|
142 |
+
'stripe_button'
|
143 |
+
];
|
144 |
+
|
145 |
+
foreach ( $this->get_form_fields () as $key => $field ) {
|
146 |
+
$skip = isset ( $field[ 'skip' ] ) && $field[ 'skip' ] == true;
|
147 |
+
if (! in_array ( $this->get_field_type ( $field ), $skip_types ) && ! $skip) {
|
148 |
+
try {
|
149 |
+
$this->settings[ $key ] = $this->get_field_value ( $key, $field, $post_data );
|
150 |
+
} catch ( Exception $e ) {
|
151 |
+
$this->add_error ( $e->getMessage () );
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
return update_option ( $this->get_option_key (), apply_filters ( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ), 'yes' );
|
157 |
+
}
|
158 |
+
}
|
includes/updates/update-3.1.0.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// update webhooks to include payment_intent.succeeded
|
3 |
+
$environments = [ 'live', 'test'
|
4 |
+
];
|
5 |
+
|
6 |
+
foreach ( $environments as $env ) {
|
7 |
+
$webhook_id = wc_stripe ()->api_settings->get_option ( "webhook_id_{$env}" );
|
8 |
+
if ($webhook_id) {
|
9 |
+
$gateway = WC_Stripe_Gateway::load ( $env );
|
10 |
+
|
11 |
+
// fetch webhook so we can merge existing events with the new payment_intent.succeeded event
|
12 |
+
$webhook = $gateway->fetch_webhook ( $webhook_id );
|
13 |
+
if (! is_wp_error ( $webhook )) {
|
14 |
+
$events = $webhook[ 'enabled_events' ];
|
15 |
+
$events[] = 'payment_intent.succeeded';
|
16 |
+
|
17 |
+
$result = $gateway->update_webhook ( $webhook_id, [
|
18 |
+
'enabled_events' => $events
|
19 |
+
] );
|
20 |
+
wc_stripe_log_info ( "Webhook {$webhook_id} updated." );
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
update_option ( 'wc_stripe_connect_notice', 'yes' );
|
26 |
+
|
27 |
+
// send email
|
28 |
+
ob_start ();
|
29 |
+
WC_Emails::instance ()->email_header ( __ ( 'Stripe For WooCommerce Update', 'woo-stripe-payment' ) );
|
30 |
+
?>
|
31 |
+
<p><?php _e('Greetings from Payment Plugins,', 'woo-stripe-payment')?></p>
|
32 |
+
<p><?php _e('At Stripe\'s request, we have updated Stripe for WooCommerce to use the new Stripe Connect integration. This new integration offers even more security. Stripe is requesting that all merchants switch.', 'woo-stripe-payment')?></p>
|
33 |
+
<p><?php printf(__('Click %shere%s to be redirected to your Stripe API settings page then click the <strong>Click to Connect</strong> button.', 'woo-stripe-payment'), '<a href="' . admin_url('admin.php?page=wc-settings&tab=checkout§ion=stripe_api') . '" target="_blank">', '</a>')?>
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
<p><?php _e('Kind Regards,', 'woo-stripe-payment')?></p>
|
43 |
+
<p><?php _e('Payment Plugins')?></p>
|
44 |
+
<?php
|
45 |
+
WC_Emails::instance ()->email_footer ();
|
46 |
+
$content = ob_get_clean ();
|
47 |
+
$settings = get_option ( 'woocommerce_new_order_settings', [
|
48 |
+
'recipient' => get_option ( 'admin_email', '' )
|
49 |
+
] );
|
50 |
+
$email = new WC_Email ();
|
51 |
+
$email->email_type = 'html';
|
52 |
+
add_filter('woocommerce_email_from_address', function($from){
|
53 |
+
return 'support@paymentplugins.com';
|
54 |
+
});
|
55 |
+
add_filter('woocommerce_email_from_name', function($name){
|
56 |
+
return 'Payment Plugins';
|
57 |
+
});
|
58 |
+
$email->send ( $settings[ 'recipient' ], __ ( 'Stripe For WooCommerce Update', 'woo-stripe-payment' ), $content, $email->get_headers (), []);
|
includes/wc-stripe-functions.php
CHANGED
@@ -190,10 +190,13 @@ function wc_stripe_log_info($message) {
|
|
190 |
*
|
191 |
* @since 3.0.0
|
192 |
* @package Stripe/Functions
|
193 |
-
* @param WC_Order $order
|
194 |
*/
|
195 |
function wc_stripe_order_mode($order) {
|
196 |
-
|
|
|
|
|
|
|
197 |
}
|
198 |
|
199 |
/**
|
@@ -539,7 +542,7 @@ function wc_stripe_process_shop_subscription_meta($post_id, $post) {
|
|
539 |
if (isset ( $gateways[ $gateway_id ] )) {
|
540 |
$gateway = $gateways[ $gateway_id ];
|
541 |
if ($gateway instanceof WC_Payment_Gateway_Stripe) {
|
542 |
-
$token = $gateway->get_token ( $subscription->get_meta (
|
543 |
if ($token) {
|
544 |
$subscription->set_payment_method_title ( $token->get_payment_method_title () );
|
545 |
$subscription->save ();
|
@@ -663,8 +666,8 @@ function wc_stripe_payment_complete_order_status($order_status, $order_id, $orde
|
|
663 |
}
|
664 |
|
665 |
/**
|
666 |
-
*
|
667 |
-
*
|
668 |
*
|
669 |
* @since 3.0.0
|
670 |
* @package Stripe/Functions
|
@@ -673,13 +676,15 @@ function wc_stripe_payment_complete_order_status($order_status, $order_id, $orde
|
|
673 |
* @return number
|
674 |
*/
|
675 |
function wc_stripe_add_number_precision($value, $round = true) {
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
|
|
682 |
}
|
|
|
683 |
}
|
684 |
|
685 |
/**
|
@@ -798,13 +803,13 @@ function wc_stripe_get_custom_forms() {
|
|
798 |
'cardBrand' => wc_stripe ()->assets_url ( 'img/card_brand.svg' ),
|
799 |
'elementStyles' => [
|
800 |
'base' => [
|
801 |
-
'color' => '#
|
802 |
'fontWeight' => 600,
|
803 |
'fontFamily' => 'Roboto, Open Sans, Segoe UI, sans-serif',
|
804 |
'fontSize' => '16px',
|
805 |
'fontSmoothing' => 'antialiased',
|
806 |
':focus' => [
|
807 |
-
'color' => '#
|
808 |
],
|
809 |
'::placeholder' => [
|
810 |
'color' => '#87BBFD'
|
@@ -817,7 +822,7 @@ function wc_stripe_get_custom_forms() {
|
|
817 |
]
|
818 |
],
|
819 |
'invalid' => [
|
820 |
-
'color' => '#
|
821 |
]
|
822 |
],
|
823 |
'elementOptions' => [
|
@@ -942,7 +947,9 @@ function wc_stripe_get_order_from_transaction($transaction_id) {
|
|
942 |
* to the cart.
|
943 |
*
|
944 |
* @since 3.0.6
|
945 |
-
*
|
|
|
|
|
946 |
* @param WC_Cart $cart
|
947 |
*/
|
948 |
function wc_stripe_stash_cart($cart, $product_cart = true) {
|
@@ -997,4 +1004,37 @@ function wc_stripe_restore_cart_after_product_checkout() {
|
|
997 |
}
|
998 |
WC ()->cart->cart_contents = $cart_contents;
|
999 |
WC ()->cart->calculate_totals ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1000 |
}
|
190 |
*
|
191 |
* @since 3.0.0
|
192 |
* @package Stripe/Functions
|
193 |
+
* @param WC_Order|int $order
|
194 |
*/
|
195 |
function wc_stripe_order_mode($order) {
|
196 |
+
if (is_object ( $order )) {
|
197 |
+
return $order->get_meta ( WC_Stripe_Constants::MODE, true );
|
198 |
+
}
|
199 |
+
return get_post_meta ( $order, WC_Stripe_Constants::MODE, true );
|
200 |
}
|
201 |
|
202 |
/**
|
542 |
if (isset ( $gateways[ $gateway_id ] )) {
|
543 |
$gateway = $gateways[ $gateway_id ];
|
544 |
if ($gateway instanceof WC_Payment_Gateway_Stripe) {
|
545 |
+
$token = $gateway->get_token ( $subscription->get_meta ( WC_Stripe_Constants::PAYMENT_METHOD_TOKEN ), $subscription->get_customer_id () );
|
546 |
if ($token) {
|
547 |
$subscription->set_payment_method_title ( $token->get_payment_method_title () );
|
548 |
$subscription->save ();
|
666 |
}
|
667 |
|
668 |
/**
|
669 |
+
* Converts the amount to cents.
|
670 |
+
* Stripe processes all requests in cents.
|
671 |
*
|
672 |
* @since 3.0.0
|
673 |
* @package Stripe/Functions
|
676 |
* @return number
|
677 |
*/
|
678 |
function wc_stripe_add_number_precision($value, $round = true) {
|
679 |
+
$cent_precision = pow ( 10, 2 );
|
680 |
+
$value = $value * $cent_precision;
|
681 |
+
$value = $round ? round ( $value, wc_get_rounding_precision () - wc_get_price_decimals () ) : $value;
|
682 |
+
|
683 |
+
if (is_numeric ( $value ) && floor ( $value ) != $value) {
|
684 |
+
// there are some decimal points that need to be removed.
|
685 |
+
$value = round ( $value );
|
686 |
}
|
687 |
+
return $value;
|
688 |
}
|
689 |
|
690 |
/**
|
803 |
'cardBrand' => wc_stripe ()->assets_url ( 'img/card_brand.svg' ),
|
804 |
'elementStyles' => [
|
805 |
'base' => [
|
806 |
+
'color' => '#819efc',
|
807 |
'fontWeight' => 600,
|
808 |
'fontFamily' => 'Roboto, Open Sans, Segoe UI, sans-serif',
|
809 |
'fontSize' => '16px',
|
810 |
'fontSmoothing' => 'antialiased',
|
811 |
':focus' => [
|
812 |
+
'color' => '#819efc'
|
813 |
],
|
814 |
'::placeholder' => [
|
815 |
'color' => '#87BBFD'
|
822 |
]
|
823 |
],
|
824 |
'invalid' => [
|
825 |
+
'color' => '#f99393'
|
826 |
]
|
827 |
],
|
828 |
'elementOptions' => [
|
947 |
* to the cart.
|
948 |
*
|
949 |
* @since 3.0.6
|
950 |
+
* @todo Maybe empty cart silently so actions are not triggered that cause session data to be removed
|
951 |
+
* from 3rd party plugins.
|
952 |
+
*
|
953 |
* @param WC_Cart $cart
|
954 |
*/
|
955 |
function wc_stripe_stash_cart($cart, $product_cart = true) {
|
1004 |
}
|
1005 |
WC ()->cart->cart_contents = $cart_contents;
|
1006 |
WC ()->cart->calculate_totals ();
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
/**
|
1010 |
+
*
|
1011 |
+
* @since 3.1.0
|
1012 |
+
* @param WC_Payment_Token[] $tokens
|
1013 |
+
* @param int $user_id
|
1014 |
+
* @param string $gateway_id
|
1015 |
+
* @return WC_Payment_Token[]
|
1016 |
+
*/
|
1017 |
+
function wc_stripe_get_customer_payment_tokens($tokens, $user_id, $gateway_id) {
|
1018 |
+
foreach ( $tokens as $idx => $token ) {
|
1019 |
+
if ($token instanceof WC_Payment_Token_Stripe) {
|
1020 |
+
$mode = wc_stripe_mode ();
|
1021 |
+
if ($token->get_environment () != $mode) {
|
1022 |
+
unset ( $tokens[ $idx ] );
|
1023 |
+
}
|
1024 |
+
}
|
1025 |
+
}
|
1026 |
+
return $tokens;
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
/**
|
1030 |
+
*
|
1031 |
+
* @since 3.1.0
|
1032 |
+
* @param array $labels
|
1033 |
+
* @return string
|
1034 |
+
*/
|
1035 |
+
function wc_stripe_credit_card_labels($labels) {
|
1036 |
+
if (! isset ( $labels[ 'amex' ] )) {
|
1037 |
+
$labels[ 'amex' ] = __ ( 'Amex', 'woocommerce' );
|
1038 |
+
}
|
1039 |
+
return $labels;
|
1040 |
}
|
includes/wc-stripe-hooks.php
CHANGED
@@ -10,6 +10,7 @@ add_action ( 'woocommerce_order_status_completed', 'wc_stripe_order_status_compl
|
|
10 |
*/
|
11 |
add_action ( 'wc_stripe_webhook_source_chargeable', 'wc_stripe_process_source_chargeable', 10, 2 );
|
12 |
add_action ( 'wc_stripe_webhook_charge_succeeded', 'wc_stripe_process_charge_succeeded', 10, 2 );
|
|
|
13 |
|
14 |
/**
|
15 |
* Filters
|
@@ -19,4 +20,6 @@ add_filter ( 'woocommerce_payment_gateways', 'wc_stripe_payment_gateways' );
|
|
19 |
add_filter ( 'woocommerce_available_payment_gateways', 'wc_stripe_available_payment_gateways' );
|
20 |
add_action ( 'woocommerce_process_shop_subscription_meta', 'wc_stripe_process_shop_subscription_meta', 10, 2 );
|
21 |
add_filter ( 'woocommerce_available_payment_gateways', 'wc_stripe_get_available_local_gateways' );
|
22 |
-
add_filter ( 'woocommerce_payment_complete_order_status', 'wc_stripe_payment_complete_order_status', 10, 3 );
|
|
|
|
10 |
*/
|
11 |
add_action ( 'wc_stripe_webhook_source_chargeable', 'wc_stripe_process_source_chargeable', 10, 2 );
|
12 |
add_action ( 'wc_stripe_webhook_charge_succeeded', 'wc_stripe_process_charge_succeeded', 10, 2 );
|
13 |
+
add_action ( 'wc_stripe_webhook_payment_intent_succeeded', 'wc_stripe_process_payment_intent_succeeded', 10, 2 );
|
14 |
|
15 |
/**
|
16 |
* Filters
|
20 |
add_filter ( 'woocommerce_available_payment_gateways', 'wc_stripe_available_payment_gateways' );
|
21 |
add_action ( 'woocommerce_process_shop_subscription_meta', 'wc_stripe_process_shop_subscription_meta', 10, 2 );
|
22 |
add_filter ( 'woocommerce_available_payment_gateways', 'wc_stripe_get_available_local_gateways' );
|
23 |
+
add_filter ( 'woocommerce_payment_complete_order_status', 'wc_stripe_payment_complete_order_status', 10, 3 );
|
24 |
+
add_filter ( 'woocommerce_get_customer_payment_tokens', 'wc_stripe_get_customer_payment_tokens', 10, 3 );
|
25 |
+
add_filter ( 'woocommerce_credit_card_type_labels', 'wc_stripe_credit_card_labels' );
|
includes/wc-stripe-webhook-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/**
|
4 |
* Processes the charge via webhooks for local payment methods like iDEAL, EPS, etc.
|
5 |
-
* @
|
6 |
* @package Stripe/Functions
|
7 |
*
|
8 |
* @param \Stripe\Source $source
|
@@ -41,7 +41,7 @@ function wc_stripe_process_source_chargeable($source, $request) {
|
|
41 |
/**
|
42 |
* When the charge has succeeded, the order should be completed.
|
43 |
*
|
44 |
-
* @
|
45 |
* @package Stripe/Functions
|
46 |
*
|
47 |
* @param \Stripe\Charge $source
|
@@ -72,4 +72,44 @@ function wc_stripe_process_charge_succeeded($charge, $request) {
|
|
72 |
$gateway->save_order_meta ( $order, $charge );
|
73 |
}
|
74 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
2 |
|
3 |
/**
|
4 |
* Processes the charge via webhooks for local payment methods like iDEAL, EPS, etc.
|
5 |
+
* @since 3.0.0
|
6 |
* @package Stripe/Functions
|
7 |
*
|
8 |
* @param \Stripe\Source $source
|
41 |
/**
|
42 |
* When the charge has succeeded, the order should be completed.
|
43 |
*
|
44 |
+
* @since 3.0.5
|
45 |
* @package Stripe/Functions
|
46 |
*
|
47 |
* @param \Stripe\Charge $source
|
72 |
$gateway->save_order_meta ( $order, $charge );
|
73 |
}
|
74 |
}
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
*
|
79 |
+
* @since 3.1.0
|
80 |
+
* @package Stripe/Functions
|
81 |
+
*
|
82 |
+
* @param \Stripe\PaymentIntent $intent
|
83 |
+
* @param WP_REST_Request $request
|
84 |
+
*/
|
85 |
+
function wc_stripe_process_payment_intent_succeeded($intent, $request) {
|
86 |
+
$order = wc_get_order ( $intent->metadata[ 'order_id' ] );
|
87 |
+
if (! $order) {
|
88 |
+
wc_stripe_log_error ( sprintf ( 'Could not complete payment for paymentintent %s. No order ID was found in your Wordpress database.', $intent->id ) );
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
$payment_method = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
|
92 |
+
|
93 |
+
if ($payment_method instanceof WC_Payment_Gateway_Stripe_Local_Payment) {
|
94 |
+
// this webhook is executed immediately by Stripe so add some delay so the redirect
|
95 |
+
// can potentially be used first.
|
96 |
+
sleep ( 1 );
|
97 |
+
|
98 |
+
if ($payment_method->has_order_lock ( $order ) || ( $transaction_id = $order->get_transaction_id () )) {
|
99 |
+
wc_stripe_log_info ( sprintf ( 'payment_intent.succeeded event received. Intent has been completed and been created for order %s. Event exited.', $order->get_id () ) );
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
|
103 |
+
$payment_method->set_order_lock ( $order );
|
104 |
+
|
105 |
+
// want to prevent plugin from processing capture_charge since charge has already been captured.
|
106 |
+
remove_action ( 'woocommerce_order_status_completed', 'wc_stripe_order_status_completed' );
|
107 |
+
|
108 |
+
$payment_method->save_order_meta ( $order, $intent->charges->data[ 0 ] );
|
109 |
+
|
110 |
+
// call payment complete so shipping, emails, etc are triggered.
|
111 |
+
$order->payment_complete ( $intent->charges->data[ 0 ]->id );
|
112 |
+
|
113 |
+
$order->add_order_note ( __ ( 'payment_intent.succeeded webhook recieved. Payment has been completed.', 'woo-stripe-payment' ) );
|
114 |
+
}
|
115 |
}
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: mr.clayton
|
3 |
Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofort
|
4 |
Requires at least: 3.0.1
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 3.0
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -12,6 +12,9 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
12 |
== Description ==
|
13 |
Accept Credit Cards, Google Pay, ApplePay, ACH, P24, Klarna, iDEAL and more all in one plugin for free!
|
14 |
|
|
|
|
|
|
|
15 |
= Boost conversion by offering product and cart page checkout =
|
16 |
Stripe for WooCommerce is made to supercharge your conversion rate by decreasing payment friction for your customer.
|
17 |
Offer Google Pay, Apple Pay, and Stripe's Browser payment methods on product pages, cart pages, and at the top of your checkout page.
|
@@ -53,9 +56,13 @@ If you're site is not loading over https, then Stripe won't render the Payment R
|
|
53 |
7. Payment options at top of checkout page for easy one click checkout
|
54 |
|
55 |
== Changelog ==
|
56 |
-
= 3.0
|
57 |
-
*
|
58 |
-
*
|
|
|
|
|
|
|
|
|
59 |
= 3.0.9 =
|
60 |
* Added - Payment methods with payment sheets like Apple Pay now show order items on order pay page instead of just total.
|
61 |
* Fixed - Error if 100% off coupon is used on checkout page.
|
2 |
Contributors: mr.clayton
|
3 |
Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofort
|
4 |
Requires at least: 3.0.1
|
5 |
+
Tested up to: 5.4
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 3.1.0
|
8 |
Copyright: Payment Plugins
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
== Description ==
|
13 |
Accept Credit Cards, Google Pay, ApplePay, ACH, P24, Klarna, iDEAL and more all in one plugin for free!
|
14 |
|
15 |
+
= Official Stripe Partner =
|
16 |
+
Payment Plugins is an official partner of Stripe.
|
17 |
+
|
18 |
= Boost conversion by offering product and cart page checkout =
|
19 |
Stripe for WooCommerce is made to supercharge your conversion rate by decreasing payment friction for your customer.
|
20 |
Offer Google Pay, Apple Pay, and Stripe's Browser payment methods on product pages, cart pages, and at the top of your checkout page.
|
56 |
7. Payment options at top of checkout page for easy one click checkout
|
57 |
|
58 |
== Changelog ==
|
59 |
+
= 3.1.0 =
|
60 |
+
* Added - FPX payment method
|
61 |
+
* Added - Alipay payment method
|
62 |
+
* Updated - Stripe connect integration
|
63 |
+
* Updated - WeChat support for other countries besides CN
|
64 |
+
* Updated - CSS so prevent theme overrides
|
65 |
+
* Fixed - WeChat QR code
|
66 |
= 3.0.9 =
|
67 |
* Added - Payment methods with payment sheets like Apple Pay now show order items on order pay page instead of just total.
|
68 |
* Fixed - Error if 100% off coupon is used on checkout page.
|
stripe-payments.php
CHANGED
@@ -4,13 +4,13 @@
|
|
4 |
* Plugin Name: Stripe For WooCommerce
|
5 |
* Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
|
6 |
* Description: Accept credit cards, Google Pay, & Apple Pay, ACH, Klarna and more using Stripe.
|
7 |
-
* Version: 3.0
|
8 |
* Author: Payment Plugins, support@paymentplugins.com
|
9 |
* Text Domain: woo-stripe-payment
|
10 |
* Domain Path: /i18n/languages/
|
11 |
-
* Tested up to: 5.
|
12 |
* WC requires at least: 3.0.0
|
13 |
-
* WC tested up to:
|
14 |
*/
|
15 |
function wc_stripe_php_version_notice() {
|
16 |
$message = sprintf ( __ ( 'Your PHP version is %s but Stripe requires version 5.4+.', 'woo-stripe-payment' ), PHP_VERSION );
|
4 |
* Plugin Name: Stripe For WooCommerce
|
5 |
* Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
|
6 |
* Description: Accept credit cards, Google Pay, & Apple Pay, ACH, Klarna and more using Stripe.
|
7 |
+
* Version: 3.1.0
|
8 |
* Author: Payment Plugins, support@paymentplugins.com
|
9 |
* Text Domain: woo-stripe-payment
|
10 |
* Domain Path: /i18n/languages/
|
11 |
+
* Tested up to: 5.4
|
12 |
* WC requires at least: 3.0.0
|
13 |
+
* WC tested up to: 4.0.1
|
14 |
*/
|
15 |
function wc_stripe_php_version_notice() {
|
16 |
$message = sprintf ( __ ( 'Your PHP version is %s but Stripe requires version 5.4+.', 'woo-stripe-payment' ), PHP_VERSION );
|
templates/cc-forms/bootstrap.php
CHANGED
@@ -106,28 +106,33 @@ li.payment_method_stripe_cc .payment_box{
|
|
106 |
position: absolute;
|
107 |
top: .65rem;
|
108 |
left: 15px;
|
109 |
-
-webkit-transition: .
|
110 |
-
-o-transition: .
|
111 |
-
transition: .
|
112 |
cursor: text;
|
113 |
color: #757575;
|
|
|
|
|
114 |
}
|
115 |
-
.wc-stripe-bootstrap-form .md-form.md-outline+label
|
|
|
116 |
font-size: 16px;
|
117 |
-
position: absolute;
|
118 |
top: 50%;
|
|
|
119 |
transform: translateY(-50%);
|
120 |
-webkit-transform: translateY(-50%);
|
121 |
-ms-transform: translateY(-50%);
|
122 |
-moz-transform: translateY(-50%);
|
123 |
-
padding-left: 12px;
|
124 |
-
-webkit-transition: .
|
125 |
-
-o-transition: .
|
126 |
-
transition: .
|
127 |
cursor: text;
|
128 |
color: #495057;
|
129 |
font-weight: 300;
|
130 |
margin: 0;
|
|
|
131 |
}
|
132 |
.wc-stripe-bootstrap-form .md-form.md-outline.focused+label{
|
133 |
color: #4285f4
|
@@ -135,9 +140,9 @@ li.payment_method_stripe_cc .payment_box{
|
|
135 |
.wc-stripe-bootstrap-form .md-form.md-outline.focused+label,
|
136 |
.wc-stripe-bootstrap-form .md-form.md-outline.invalid+label,
|
137 |
.wc-stripe-bootstrap-form .md-form.md-outline.StripeElement--complete+label {
|
138 |
-
-webkit-transform: translateY(-
|
139 |
-
-ms-transform: translateY(-
|
140 |
-
transform: translateY(-
|
141 |
background: #fff !important;
|
142 |
font-weight: 500;
|
143 |
padding-right: 5px;
|
@@ -154,6 +159,7 @@ li.payment_method_stripe_cc .payment_box{
|
|
154 |
}
|
155 |
.wc-stripe-bootstrap-form .md-form.md-outline {
|
156 |
position: relative;
|
|
|
157 |
}
|
158 |
.wc-stripe-bootstrap-form .stripe-input{
|
159 |
-webkit-transition: all .3s;
|
106 |
position: absolute;
|
107 |
top: .65rem;
|
108 |
left: 15px;
|
109 |
+
-webkit-transition: .3s ease-out;
|
110 |
+
-o-transition: .3s ease-out;
|
111 |
+
transition: .3s ease-out;
|
112 |
cursor: text;
|
113 |
color: #757575;
|
114 |
+
pointer-events: none;
|
115 |
+
overflow: hidden;
|
116 |
}
|
117 |
+
.wc-stripe-bootstrap-form .md-form.md-outline+label,
|
118 |
+
.wc-stripe-bootstrap-form .md-form.md-outline.StripeElement+label {
|
119 |
font-size: 16px;
|
120 |
+
position: absolute !important;
|
121 |
top: 50%;
|
122 |
+
transition-property: color, transform;
|
123 |
transform: translateY(-50%);
|
124 |
-webkit-transform: translateY(-50%);
|
125 |
-ms-transform: translateY(-50%);
|
126 |
-moz-transform: translateY(-50%);
|
127 |
+
padding-left: 12px !important;
|
128 |
+
-webkit-transition: .3s ease-out;
|
129 |
+
-o-transition: .3s ease-out;
|
130 |
+
transition: .3s ease-out;
|
131 |
cursor: text;
|
132 |
color: #495057;
|
133 |
font-weight: 300;
|
134 |
margin: 0;
|
135 |
+
pointer-events: none;
|
136 |
}
|
137 |
.wc-stripe-bootstrap-form .md-form.md-outline.focused+label{
|
138 |
color: #4285f4
|
140 |
.wc-stripe-bootstrap-form .md-form.md-outline.focused+label,
|
141 |
.wc-stripe-bootstrap-form .md-form.md-outline.invalid+label,
|
142 |
.wc-stripe-bootstrap-form .md-form.md-outline.StripeElement--complete+label {
|
143 |
+
-webkit-transform: translateY(-35px);
|
144 |
+
-ms-transform: translateY(-35px);
|
145 |
+
transform: translateY(-35px);
|
146 |
background: #fff !important;
|
147 |
font-weight: 500;
|
148 |
padding-right: 5px;
|
159 |
}
|
160 |
.wc-stripe-bootstrap-form .md-form.md-outline {
|
161 |
position: relative;
|
162 |
+
width: 100%;
|
163 |
}
|
164 |
.wc-stripe-bootstrap-form .stripe-input{
|
165 |
-webkit-transition: all .3s;
|
templates/cc-forms/inline.php
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
*/
|
6 |
?>
|
7 |
<div class="wc-stripe-inline-form">
|
8 |
-
<fieldset>
|
9 |
<div class="row">
|
10 |
<label for="stripe-card-number"><?php _e('Card Number', 'woo-stripe-payment')?></label>
|
11 |
<div id="stripe-card-number" class="input"></div>
|
@@ -24,12 +23,14 @@
|
|
24 |
<input type="text" id="stripe-postal-code" class="input empty" placeholder="78703" value="<?php echo WC ()->checkout ()->get_value('billing_postcode')?>"/>
|
25 |
</div>
|
26 |
<?php endif;?>
|
27 |
-
</fieldset>
|
28 |
</div>
|
29 |
<style type="text/css">
|
30 |
.wc-stripe-inline-form {
|
31 |
-
background-color:
|
32 |
-
padding:
|
|
|
|
|
|
|
33 |
}
|
34 |
#stripe-card-number{
|
35 |
position: relative;
|
@@ -41,33 +42,34 @@
|
|
41 |
}
|
42 |
|
43 |
.payment_method_stripe_cc .wc-stripe-inline-form fieldset {
|
44 |
-
margin: 0
|
45 |
padding: 0;
|
46 |
-
border-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
}
|
52 |
-
|
53 |
.wc-stripe-inline-form .row {
|
54 |
display: -ms-flexbox;
|
55 |
display: flex;
|
56 |
-ms-flex-align: center;
|
57 |
align-items: center;
|
58 |
-
margin
|
59 |
-
|
|
|
60 |
}
|
61 |
|
62 |
-
.wc-stripe-inline-form .row
|
63 |
-
border-
|
64 |
}
|
65 |
|
66 |
-
.wc-stripe-inline-form label
|
|
|
67 |
width: 110px;
|
68 |
min-width: 110px;
|
69 |
padding: 11px 0;
|
70 |
-
color: #
|
71 |
overflow: hidden;
|
72 |
text-overflow: ellipsis;
|
73 |
white-space: nowrap;
|
@@ -102,12 +104,14 @@
|
|
102 |
.wc-stripe-inline-form .input {
|
103 |
width: 100%;
|
104 |
padding: 11px 15px 11px 0;
|
105 |
-
color: #fff;
|
106 |
background-color: transparent;
|
107 |
-webkit-animation: 1ms void-animation-out;
|
|
|
|
|
|
|
108 |
}
|
109 |
-
.wc-stripe-inline-form
|
110 |
-
|
111 |
}
|
112 |
.wc-stripe-inline-form input::-webkit-input-placeholder {
|
113 |
color: #87bbfd;
|
@@ -178,10 +182,6 @@
|
|
178 |
.stripe-small .wc-stripe-inline-form .row{
|
179 |
flex-wrap: wrap;
|
180 |
}
|
181 |
-
.stripe-small .wc-stripe-inline-form label{
|
182 |
-
width: 100%;
|
183 |
-
display: none;
|
184 |
-
}
|
185 |
@media screen and (max-width: 490px){
|
186 |
.wc-stripe-inline-form .row{
|
187 |
flex-wrap: wrap;
|
5 |
*/
|
6 |
?>
|
7 |
<div class="wc-stripe-inline-form">
|
|
|
8 |
<div class="row">
|
9 |
<label for="stripe-card-number"><?php _e('Card Number', 'woo-stripe-payment')?></label>
|
10 |
<div id="stripe-card-number" class="input"></div>
|
23 |
<input type="text" id="stripe-postal-code" class="input empty" placeholder="78703" value="<?php echo WC ()->checkout ()->get_value('billing_postcode')?>"/>
|
24 |
</div>
|
25 |
<?php endif;?>
|
|
|
26 |
</div>
|
27 |
<style type="text/css">
|
28 |
.wc-stripe-inline-form {
|
29 |
+
background-color: #fff;
|
30 |
+
padding: 0;
|
31 |
+
}
|
32 |
+
.wc-stripe-inline-form #wc-stripe-card{
|
33 |
+
top: 10px;
|
34 |
}
|
35 |
#stripe-card-number{
|
36 |
position: relative;
|
42 |
}
|
43 |
|
44 |
.payment_method_stripe_cc .wc-stripe-inline-form fieldset {
|
45 |
+
margin: 0;;
|
46 |
padding: 0;
|
47 |
+
border-top: 1px solid #829fff;
|
48 |
+
border-bottom: 1px solid #829fff;
|
49 |
+
}
|
50 |
+
.wc-stripe_cc-container .wc-stripe-inline-form .StripeElement{
|
51 |
+
padding: 0;
|
52 |
}
|
|
|
53 |
.wc-stripe-inline-form .row {
|
54 |
display: -ms-flexbox;
|
55 |
display: flex;
|
56 |
-ms-flex-align: center;
|
57 |
align-items: center;
|
58 |
+
margin: 0 !important;
|
59 |
+
flex-flow: row wrap;
|
60 |
+
width: 100%;
|
61 |
}
|
62 |
|
63 |
+
.wc-stripe-inline-form .row {
|
64 |
+
border-bottom: 1px solid #819efc;
|
65 |
}
|
66 |
|
67 |
+
.wc-stripe-inline-form label,
|
68 |
+
.woocommerce-checkout .woocommerce-checkout #payment ul.payment_methods li .wc-stripe-inline-form label{
|
69 |
width: 110px;
|
70 |
min-width: 110px;
|
71 |
padding: 11px 0;
|
72 |
+
color: #91b5c1;
|
73 |
overflow: hidden;
|
74 |
text-overflow: ellipsis;
|
75 |
white-space: nowrap;
|
104 |
.wc-stripe-inline-form .input {
|
105 |
width: 100%;
|
106 |
padding: 11px 15px 11px 0;
|
|
|
107 |
background-color: transparent;
|
108 |
-webkit-animation: 1ms void-animation-out;
|
109 |
+
box-shadow: none;
|
110 |
+
border: none;
|
111 |
+
color: #819efc;
|
112 |
}
|
113 |
+
.wc-stripe-inline-form input:focus{
|
114 |
+
color: #819efc;
|
115 |
}
|
116 |
.wc-stripe-inline-form input::-webkit-input-placeholder {
|
117 |
color: #87bbfd;
|
182 |
.stripe-small .wc-stripe-inline-form .row{
|
183 |
flex-wrap: wrap;
|
184 |
}
|
|
|
|
|
|
|
|
|
185 |
@media screen and (max-width: 490px){
|
186 |
.wc-stripe-inline-form .row{
|
187 |
flex-wrap: wrap;
|
templates/cc-forms/round.php
CHANGED
@@ -32,7 +32,6 @@
|
|
32 |
font-size: 16px;
|
33 |
font-weight: 600;
|
34 |
}
|
35 |
-
|
36 |
.wc-stripe-round-form .fieldset {
|
37 |
margin: 15px;
|
38 |
padding: 0;
|
@@ -44,6 +43,7 @@
|
|
44 |
-ms-flex-pack: justify;
|
45 |
}
|
46 |
|
|
|
47 |
.wc-stripe-round-form .field {
|
48 |
position: relative;
|
49 |
padding: 10px 20px 11px;
|
32 |
font-size: 16px;
|
33 |
font-weight: 600;
|
34 |
}
|
|
|
35 |
.wc-stripe-round-form .fieldset {
|
36 |
margin: 15px;
|
37 |
padding: 0;
|
43 |
-ms-flex-pack: justify;
|
44 |
}
|
45 |
|
46 |
+
.wc-stripe_cc-container .wc-stripe-round-form .field.StripeElement,
|
47 |
.wc-stripe-round-form .field {
|
48 |
position: relative;
|
49 |
padding: 10px 20px 11px;
|
templates/cc-forms/simple.php
CHANGED
@@ -42,7 +42,8 @@
|
|
42 |
background-color: #fff;
|
43 |
padding: 10px 0;
|
44 |
}
|
45 |
-
.wc-stripe-simple-form .StripeElement
|
|
|
46 |
padding-left: 0px;
|
47 |
}
|
48 |
.wc-stripe-simple-form * {
|
@@ -88,7 +89,8 @@
|
|
88 |
transition: background-color 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
|
89 |
}
|
90 |
|
91 |
-
.wc-stripe-simple-form label
|
|
|
92 |
position: absolute;
|
93 |
width: 100%;
|
94 |
left: 0;
|
@@ -103,6 +105,7 @@
|
|
103 |
transition-duration: 0.3s;
|
104 |
transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
|
105 |
margin-bottom: 0;
|
|
|
106 |
}
|
107 |
|
108 |
.wc-stripe-simple-form .input {
|
@@ -119,7 +122,8 @@
|
|
119 |
}
|
120 |
.wc-stripe-simple-form #stripe-postal-code{
|
121 |
height: 40px;
|
122 |
-
padding
|
|
|
123 |
box-shadow: none;
|
124 |
border: none;
|
125 |
outline: none;
|
42 |
background-color: #fff;
|
43 |
padding: 10px 0;
|
44 |
}
|
45 |
+
.wc-stripe-simple-form .StripeElement,
|
46 |
+
.wc-stripe_cc-container .wc-stripe-simple-form .StripeElement{
|
47 |
padding-left: 0px;
|
48 |
}
|
49 |
.wc-stripe-simple-form * {
|
89 |
transition: background-color 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
|
90 |
}
|
91 |
|
92 |
+
.wc-stripe-simple-form label,
|
93 |
+
.woocommerce-checkout .woocommerce-checkout #payment ul.payment_methods li .wc-stripe-simple-form label{
|
94 |
position: absolute;
|
95 |
width: 100%;
|
96 |
left: 0;
|
105 |
transition-duration: 0.3s;
|
106 |
transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
|
107 |
margin-bottom: 0;
|
108 |
+
padding: 0;
|
109 |
}
|
110 |
|
111 |
.wc-stripe-simple-form .input {
|
122 |
}
|
123 |
.wc-stripe-simple-form #stripe-postal-code{
|
124 |
height: 40px;
|
125 |
+
padding: 0;
|
126 |
+
margin: 0;
|
127 |
box-shadow: none;
|
128 |
border: none;
|
129 |
outline: none;
|