Version Description
- 2021.02.02 =
- Feature - Apple Pay and Google Pay support (US, UK and CA stores only). PR#547
- Fix - Duplicate
idempotency_key
issues caused by order IDs being re-used on the same store URL (i.e. after restoring from a backup). PR#563 - Fix - Don't import item variations from Square that are not available at your store's business location. PR#562
- Fix - Restore stock in Square when processing partial refunds (previously was only restoring stock for full refunds). PR#565
- Fix - Only restore stock if the "Restock refunded items" option is checked when refunding an order. PR#565
- Fix - Fatal errors during the sync and import process caused by unexpected/invalid Square API responses. PR#500
- Fix - Sends only one sync complete email per update to products that are synced with Square. PR#552
- Fix - Allow products with large numbers of categories (600+) to sync to Square when WooCommerce is SOR. PR#568
- Fix - Database related errors with creating the Square customer's table when first installing Square. PR#558
- Fix - Allow variable products with valid variations to import when variations with missing skus are present. PR#573
- Tweak - Update the Customer Profile setting description to make it clear that this setting enables tokenization. PR#576
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Square |
Version | 2.3.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 2.3.0
- apple-developer-merchantid-domain-association +1 -0
- assets/css/frontend/wc-square-digital-wallet.min.css +2 -0
- assets/css/frontend/wc-square-digital-wallet.min.css.map +1 -0
- assets/css/frontend/wc-square-digital-wallet.scss +138 -0
- assets/js/admin/wc-square-admin-settings.coffee +10 -0
- assets/js/admin/wc-square-admin-settings.min.js +1 -1
- assets/js/admin/wc-square-admin-settings.min.js.map +1 -1
- assets/js/frontend/wc-square-digital-wallet.coffee +428 -0
- assets/js/frontend/wc-square-digital-wallet.min.js +2 -0
- assets/js/frontend/wc-square-digital-wallet.min.js.map +1 -0
- i18n/languages/woocommerce-square.pot +266 -443
- includes/Gateway.php +225 -24
- includes/Gateway/API/Requests/Payments.php +1 -1
- includes/Gateway/Customer_Helper.php +4 -14
- includes/Gateway/Digital_Wallet.php +1018 -0
- includes/Handlers/Order.php +5 -0
- includes/Handlers/Products.php +17 -5
- includes/Lifecycle.php +17 -0
- includes/Plugin.php +16 -3
- includes/Sync/Interval_Polling.php +20 -11
- includes/Sync/Manual_Synchronization.php +35 -29
- includes/Sync/Product_Import.php +33 -16
- readme.txt +15 -2
- woocommerce-square.php +2 -2
apple-developer-merchantid-domain-association
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
7B227073704964223A2242383642463746383933373735353242343346373441324434304635313141343141334233383342463146384542463741443644463733303342413638363031222C2276657273696F6E223A312C22637265617465644F6E223A313536383233353938323733352C227369676E6174757265223A2233303830303630393261383634383836663730643031303730326130383033303830303230313031333130663330306430363039363038363438303136353033303430323031303530303330383030363039326138363438383666373064303130373031303030306130383033303832303365333330383230333838613030333032303130323032303834633330343134393531396435343336333030613036303832613836343863653364303430333032333037613331326533303263303630333535303430333063323534313730373036633635323034313730373036633639363336313734363936663665323034393665373436353637373236313734363936663665323034333431323032643230343733333331323633303234303630333535303430623063316434313730373036633635323034333635373237343639363636393633363137343639366636653230343137353734363836663732363937343739333131333330313130363033353530343061306330613431373037303663363532303439366536333265333130623330303930363033353530343036313330323535353333303165313730643331333933303335333133383330333133333332333533373561313730643332333433303335333133363330333133333332333533373561333035663331323533303233303630333535303430333063316336353633363332643733366437303264363237323666366236353732326437333639363736653566353534333334326435303532346634343331313433303132303630333535303430623063306236393466353332303533373937333734363536643733333131333330313130363033353530343061306330613431373037303663363532303439366536333265333130623330303930363033353530343036313330323535353333303539333031333036303732613836343863653364303230313036303832613836343863653364303330313037303334323030303463323135373765646562643663376232323138663638646437303930613132313864633762306264366632633238336438343630393564393461663461353431316238333432306564383131663334303765383333333166316335346333663765623332323064366261643564346566663439323839383933653763306631336133383230323131333038323032306433303063303630333535316431333031303166663034303233303030333031663036303335353164323330343138333031363830313432336632343963343466393365346566323765366334663632383663336661326262666432653462333034353036303832623036303130353035303730313031303433393330333733303335303630383262303630313035303530373330303138363239363837343734373033613266326636663633373337303265363137303730366336353265363336663664326636663633373337303330333432643631373037303663363536313639363336313333333033323330383230313164303630333535316432303034383230313134333038323031313033303832303130633036303932613836343838366637363336343035303133303831666533303831633330363038326230363031303530353037303230323330383162363063383162333532363536633639363136653633363532303666366532303734363836393733323036333635373237343639363636393633363137343635323036323739323036313665373932303730363137323734373932303631373337333735366436353733323036313633363336353730373436313665363336353230366636363230373436383635323037343638363536653230363137303730366336393633363136323663363532303733373436313665363436313732363432303734363537323664373332303631366536343230363336663665363436393734363936663665373332303666363632303735373336353263323036333635373237343639363636393633363137343635323037303666366336393633373932303631366536343230363336353732373436393636363936333631373436393666366532303730373236313633373436393633363532303733373436313734363536643635366537343733326533303336303630383262303630313035303530373032303131363261363837343734373033613266326637373737373732653631373037303663363532653633366636643266363336353732373436393636363936333631373436353631373537343638366637323639373437393266333033343036303335353164316630343264333032623330323961303237613032353836323336383734373437303361326632663633373236633265363137303730366336353265363336663664326636313730373036633635363136393633363133333265363337323663333031643036303335353164306530343136303431343934353764623666643537343831383638393839373632663765353738353037653739623538323433303065303630333535316430663031303166663034303430333032303738303330306630363039326138363438383666373633363430363164303430323035303033303061303630383261383634386365336430343033303230333439303033303436303232313030626530393537316665373165316537333562353565356166616362346337326665623434356633303138353232326337323531303032623631656264366635353032323130306431386233353061356464366464366562313734363033356231316562326365383763666133653661663663626438333830383930646338326364646161363333303832303265653330383230323735613030333032303130323032303834393664326662663361393864613937333030613036303832613836343863653364303430333032333036373331316233303139303630333535303430333063313234313730373036633635323035323666366637343230343334313230326432303437333333313236333032343036303335353034306230633164343137303730366336353230343336353732373436393636363936333631373436393666366532303431373537343638366637323639373437393331313333303131303630333535303430613063306134313730373036633635323034393665363332653331306233303039303630333535303430363133303235353533333031653137306433313334333033353330333633323333333433363333333035613137306433323339333033353330333633323333333433363333333035613330376133313265333032633036303335353034303330633235343137303730366336353230343137303730366336393633363137343639366636653230343936653734363536373732363137343639366636653230343334313230326432303437333333313236333032343036303335353034306230633164343137303730366336353230343336353732373436393636363936333631373436393666366532303431373537343638366637323639373437393331313333303131303630333535303430613063306134313730373036633635323034393665363332653331306233303039303630333535303430363133303235353533333035393330313330363037326138363438636533643032303130363038326138363438636533643033303130373033343230303034663031373131383431396437363438356435316135653235383130373736653838306132656664653762616534646530386466633462393365313333353664353636356233356165323264303937373630643232346537626261303866643736313763653838636237366262363637306265633865383239383466663534343561333831663733303831663433303436303630383262303630313035303530373031303130343361333033383330333630363038326230363031303530353037333030313836326136383734373437303361326632663666363337333730326536313730373036633635326536333666366432663666363337333730333033343264363137303730366336353732366636663734363336313637333333303164303630333535316430653034313630343134323366323439633434663933653465663237653663346636323836633366613262626664326534623330306630363033353531643133303130316666303430353330303330313031666633303166303630333535316432333034313833303136383031346262623064656131353833333838396161343861393964656265626465626166646163623234616233303337303630333535316431663034333033303265333032636130326161303238383632363638373437343730336132663266363337323663326536313730373036633635326536333666366432663631373037303663363537323666366637343633363136373333326536333732366333303065303630333535316430663031303166663034303430333032303130363330313030363061326138363438383666373633363430363032306530343032303530303330306130363038326138363438636533643034303330323033363730303330363430323330336163663732383335313136393962313836666233356333353663613632626666343137656464393066373534646132386562656631396338313565343262373839663839386637396235393966393864353431306438663964653963326665303233303332326464353434323162306133303537373663356466333338336239303637666431373763326332313664393634666336373236393832313236663534663837613764316239396362396230393839323136313036393930663039393231643030303033313832303138643330383230313839303230313031333038313836333037613331326533303263303630333535303430333063323534313730373036633635323034313730373036633639363336313734363936663665323034393665373436353637373236313734363936663665323034333431323032643230343733333331323633303234303630333535303430623063316434313730373036633635323034333635373237343639363636393633363137343639366636653230343137353734363836663732363937343739333131333330313130363033353530343061306330613431373037303663363532303439366536333265333130623330303930363033353530343036313330323535353330323038346333303431343935313964353433363330306430363039363038363438303136353033303430323031303530306130383139353330313830363039326138363438383666373064303130393033333130623036303932613836343838366637306430313037303133303163303630393261383634383836663730643031303930353331306631373064333133393330333933313331333233313330333633323332356133303261303630393261383634383836663730643031303933343331316433303162333030643036303936303836343830313635303330343032303130353030613130613036303832613836343863653364303430333032333032663036303932613836343838366637306430313039303433313232303432303035653263653630303463633537663434663931623466376434383432356565323662623035303037663961343134653537656664376134323536653537373933303061303630383261383634386365336430343033303230343438333034363032323130306537653432343437313461346335656262373966623136313461613439363731366165393364303833343061616339313438333830653462633235333831666530323231303062363564316532353365313135393832623535653834363032636134316536613366363038626562373735336232343130313662386137323637666138356530303030303030303030303030227D
|
assets/css/frontend/wc-square-digital-wallet.min.css
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
#wc-square-digital-wallet{display:none;clear:both;padding-top:1.5em;width:100%;max-width:510px;margin:0 auto}#wc-square-wallet-divider{margin-top:1em;text-align:center}.wc-square-wallet-buttons{width:99%;height:44px;margin:0 0 1em 0;cursor:pointer;display:none}.wc-square-wallet-button-black{background-color:#000}.wc-square-wallet-button-white{background-color:#fff}.google-pay-button{padding:11px 10px;background-origin:content-box;background-position:center;background-repeat:no-repeat;background-size:contain;border:0;border-radius:4px;box-shadow:0 1px 1px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15);outline:0;cursor:pointer}.google-pay-button.wc-square-wallet-button-black{background-image:url(data:image/svg+xml,%3Csvg%20width%3D%22103%22%20height%3D%2217%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cpath%20d%3D%22M.148%202.976h3.766c.532%200%201.024.117%201.477.35.453.233.814.555%201.085.966.27.41.406.863.406%201.358%200%20.495-.124.924-.371%201.288s-.572.64-.973.826v.084c.504.177.912.471%201.225.882.313.41.469.891.469%201.442a2.6%202.6%200%200%201-.427%201.47c-.285.43-.667.763-1.148%201.001A3.5%203.5%200%200%201%204.082%2013H.148V2.976zm3.696%204.2c.448%200%20.81-.14%201.085-.42.275-.28.413-.602.413-.966s-.133-.684-.399-.959c-.266-.275-.614-.413-1.043-.413H1.716v2.758h2.128zm.238%204.368c.476%200%20.856-.15%201.141-.448.285-.299.427-.644.427-1.036%200-.401-.147-.749-.441-1.043-.294-.294-.688-.441-1.183-.441h-2.31v2.968h2.366zm5.379.903c-.453-.518-.679-1.239-.679-2.163V5.86h1.54v4.214c0%20.579.138%201.013.413%201.302.275.29.637.434%201.085.434.364%200%20.686-.096.966-.287.28-.191.495-.446.644-.763a2.37%202.37%200%200%200%20.224-1.022V5.86h1.54V13h-1.456v-.924h-.084c-.196.336-.5.611-.91.826-.41.215-.845.322-1.302.322-.868%200-1.528-.259-1.981-.777zm9.859.161L16.352%205.86h1.722l2.016%204.858h.056l1.96-4.858H23.8l-4.41%2010.164h-1.624l1.554-3.416zm8.266-6.748h1.666l1.442%205.11h.056l1.61-5.11h1.582l1.596%205.11h.056l1.442-5.11h1.638L36.392%2013h-1.624L33.13%207.876h-.042L31.464%2013h-1.596l-2.282-7.14zm12.379-1.337a1%201%200%200%201-.301-.735%201%201%200%200%201%20.301-.735%201%201%200%200%201%20.735-.301%201%201%200%200%201%20.735.301%201%201%200%200%201%20.301.735%201%201%200%200%201-.301.735%201%201%200%200%201-.735.301%201%201%200%200%201-.735-.301zM39.93%205.86h1.54V13h-1.54V5.86zm5.568%207.098a1.967%201.967%200%200%201-.686-.406c-.401-.401-.602-.947-.602-1.638V7.218h-1.246V5.86h1.246V3.844h1.54V5.86h1.736v1.358H45.75v3.36c0%20.383.075.653.224.812.14.187.383.28.728.28.159%200%20.299-.021.42-.063.121-.042.252-.11.392-.203v1.498c-.308.14-.681.21-1.12.21-.317%200-.616-.051-.896-.154zm3.678-9.982h1.54v2.73l-.07%201.092h.07c.205-.336.511-.614.917-.833.406-.22.842-.329%201.309-.329.868%200%201.53.254%201.988.763.457.509.686%201.202.686%202.079V13h-1.54V8.688c0-.541-.142-.947-.427-1.218-.285-.27-.656-.406-1.113-.406-.345%200-.656.098-.931.294a2.042%202.042%200%200%200-.651.777%202.297%202.297%200%200%200-.238%201.029V13h-1.54V2.976zm32.35-.341v4.083h2.518c.6%200%201.096-.202%201.488-.605.403-.402.605-.882.605-1.437%200-.544-.202-1.018-.605-1.422-.392-.413-.888-.62-1.488-.62h-2.518zm0%205.52v4.736h-1.504V1.198h3.99c1.013%200%201.873.337%202.582%201.012.72.675%201.08%201.497%201.08%202.466%200%20.991-.36%201.819-1.08%202.482-.697.665-1.559.996-2.583.996h-2.485v.001zm7.668%202.287c0%20.392.166.718.499.98.332.26.722.391%201.168.391.633%200%201.196-.234%201.692-.701.497-.469.744-1.019.744-1.65-.469-.37-1.123-.555-1.962-.555-.61%200-1.12.148-1.528.442-.409.294-.613.657-.613%201.093m1.946-5.815c1.112%200%201.989.297%202.633.89.642.594.964%201.408.964%202.442v4.932h-1.439v-1.11h-.065c-.622.914-1.45%201.372-2.486%201.372-.882%200-1.621-.262-2.215-.784-.594-.523-.891-1.176-.891-1.96%200-.828.313-1.486.94-1.976s1.463-.735%202.51-.735c.892%200%201.629.163%202.206.49v-.344c0-.522-.207-.966-.621-1.33a2.132%202.132%200%200%200-1.455-.547c-.84%200-1.504.353-1.995%201.062l-1.324-.834c.73-1.045%201.81-1.568%203.238-1.568m11.853.262l-5.02%2011.53H96.42l1.864-4.034-3.302-7.496h1.635l2.387%205.749h.032l2.322-5.75z%22%20fill%3D%22%23FFF%22%2F%3E%3Cpath%20d%3D%22M75.448%207.134c0-.473-.04-.93-.116-1.366h-6.344v2.588h3.634a3.11%203.11%200%200%201-1.344%202.042v1.68h2.169c1.27-1.17%202.001-2.9%202.001-4.944%22%20fill%3D%22%234285F4%22%2F%3E%3Cpath%20d%3D%22M68.988%2013.7c1.816%200%203.344-.595%204.459-1.621l-2.169-1.681c-.603.406-1.38.643-2.29.643-1.754%200-3.244-1.182-3.776-2.774h-2.234v1.731a6.728%206.728%200%200%200%206.01%203.703%22%20fill%3D%22%2334A853%22%2F%3E%3Cpath%20d%3D%22M65.212%208.267a4.034%204.034%200%200%201%200-2.572V3.964h-2.234a6.678%206.678%200%200%200-.717%203.017c0%201.085.26%202.11.717%203.017l2.234-1.731z%22%20fill%3D%22%23FABB05%22%2F%3E%3Cpath%20d%3D%22M68.988%202.921c.992%200%201.88.34%202.58%201.008v.001l1.92-1.918c-1.165-1.084-2.685-1.75-4.5-1.75a6.728%206.728%200%200%200-6.01%203.702l2.234%201.731c.532-1.592%202.022-2.774%203.776-2.774%22%20fill%3D%22%23E94235%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E)}.google-pay-button.wc-square-wallet-button-white{background-image:url(data:image/svg+xml,%3Csvg%20width%3D%22103%22%20height%3D%2217%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cpath%20d%3D%22M.148%202.976h3.766c.532%200%201.024.117%201.477.35.453.233.814.555%201.085.966.27.41.406.863.406%201.358%200%20.495-.124.924-.371%201.288s-.572.64-.973.826v.084c.504.177.912.471%201.225.882.313.41.469.891.469%201.442a2.6%202.6%200%200%201-.427%201.47c-.285.43-.667.763-1.148%201.001A3.5%203.5%200%200%201%204.082%2013H.148V2.976zm3.696%204.2c.448%200%20.81-.14%201.085-.42.275-.28.413-.602.413-.966s-.133-.684-.399-.959c-.266-.275-.614-.413-1.043-.413H1.716v2.758h2.128zm.238%204.368c.476%200%20.856-.15%201.141-.448.285-.299.427-.644.427-1.036%200-.401-.147-.749-.441-1.043-.294-.294-.688-.441-1.183-.441h-2.31v2.968h2.366zm5.379.903c-.453-.518-.679-1.239-.679-2.163V5.86h1.54v4.214c0%20.579.138%201.013.413%201.302.275.29.637.434%201.085.434.364%200%20.686-.096.966-.287.28-.191.495-.446.644-.763a2.37%202.37%200%200%200%20.224-1.022V5.86h1.54V13h-1.456v-.924h-.084c-.196.336-.5.611-.91.826-.41.215-.845.322-1.302.322-.868%200-1.528-.259-1.981-.777zm9.859.161L16.352%205.86h1.722l2.016%204.858h.056l1.96-4.858H23.8l-4.41%2010.164h-1.624l1.554-3.416zm8.266-6.748h1.666l1.442%205.11h.056l1.61-5.11h1.582l1.596%205.11h.056l1.442-5.11h1.638L36.392%2013h-1.624L33.13%207.876h-.042L31.464%2013h-1.596l-2.282-7.14zm12.379-1.337a1%201%200%200%201-.301-.735%201%201%200%200%201%20.301-.735%201%201%200%200%201%20.735-.301%201%201%200%200%201%20.735.301%201%201%200%200%201%20.301.735%201%201%200%200%201-.301.735%201%201%200%200%201-.735.301%201%201%200%200%201-.735-.301zM39.93%205.86h1.54V13h-1.54V5.86zm5.568%207.098a1.967%201.967%200%200%201-.686-.406c-.401-.401-.602-.947-.602-1.638V7.218h-1.246V5.86h1.246V3.844h1.54V5.86h1.736v1.358H45.75v3.36c0%20.383.075.653.224.812.14.187.383.28.728.28.159%200%20.299-.021.42-.063.121-.042.252-.11.392-.203v1.498c-.308.14-.681.21-1.12.21-.317%200-.616-.051-.896-.154zm3.678-9.982h1.54v2.73l-.07%201.092h.07c.205-.336.511-.614.917-.833.406-.22.842-.329%201.309-.329.868%200%201.53.254%201.988.763.457.509.686%201.202.686%202.079V13h-1.54V8.688c0-.541-.142-.947-.427-1.218-.285-.27-.656-.406-1.113-.406-.345%200-.656.098-.931.294a2.042%202.042%200%200%200-.651.777%202.297%202.297%200%200%200-.238%201.029V13h-1.54V2.976zm32.35-.341v4.083h2.518c.6%200%201.096-.202%201.488-.605.403-.402.605-.882.605-1.437%200-.544-.202-1.018-.605-1.422-.392-.413-.888-.62-1.488-.62h-2.518zm0%205.52v4.736h-1.504V1.198h3.99c1.013%200%201.873.337%202.582%201.012.72.675%201.08%201.497%201.08%202.466%200%20.991-.36%201.819-1.08%202.482-.697.665-1.559.996-2.583.996h-2.485v.001zm7.668%202.287c0%20.392.166.718.499.98.332.26.722.391%201.168.391.633%200%201.196-.234%201.692-.701.497-.469.744-1.019.744-1.65-.469-.37-1.123-.555-1.962-.555-.61%200-1.12.148-1.528.442-.409.294-.613.657-.613%201.093m1.946-5.815c1.112%200%201.989.297%202.633.89.642.594.964%201.408.964%202.442v4.932h-1.439v-1.11h-.065c-.622.914-1.45%201.372-2.486%201.372-.882%200-1.621-.262-2.215-.784-.594-.523-.891-1.176-.891-1.96%200-.828.313-1.486.94-1.976s1.463-.735%202.51-.735c.892%200%201.629.163%202.206.49v-.344c0-.522-.207-.966-.621-1.33a2.132%202.132%200%200%200-1.455-.547c-.84%200-1.504.353-1.995%201.062l-1.324-.834c.73-1.045%201.81-1.568%203.238-1.568m11.853.262l-5.02%2011.53H96.42l1.864-4.034-3.302-7.496h1.635l2.387%205.749h.032l2.322-5.75z%22%20fill%3D%22%23000%22%2F%3E%3Cpath%20d%3D%22M75.448%207.134c0-.473-.04-.93-.116-1.366h-6.344v2.588h3.634a3.11%203.11%200%200%201-1.344%202.042v1.68h2.169c1.27-1.17%202.001-2.9%202.001-4.944%22%20fill%3D%22%234285F4%22%2F%3E%3Cpath%20d%3D%22M68.988%2013.7c1.816%200%203.344-.595%204.459-1.621l-2.169-1.681c-.603.406-1.38.643-2.29.643-1.754%200-3.244-1.182-3.776-2.774h-2.234v1.731a6.728%206.728%200%200%200%206.01%203.703%22%20fill%3D%22%2334A853%22%2F%3E%3Cpath%20d%3D%22M65.212%208.267a4.034%204.034%200%200%201%200-2.572V3.964h-2.234a6.678%206.678%200%200%200-.717%203.017c0%201.085.26%202.11.717%203.017l2.234-1.731z%22%20fill%3D%22%23FABB05%22%2F%3E%3Cpath%20d%3D%22M68.988%202.921c.992%200%201.88.34%202.58%201.008v.001l1.92-1.918c-1.165-1.084-2.685-1.75-4.5-1.75a6.728%206.728%200%200%200-6.01%203.702l2.234%201.731c.532-1.592%202.022-2.774%203.776-2.774%22%20fill%3D%22%23E94235%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E)}@supports (-webkit-appearance:-apple-pay-button){.apple-pay-button{-webkit-appearance:-apple-pay-button;cursor:pointer}.apple-pay-button>*{display:none}}@supports not (-webkit-appearance:-apple-pay-button){.apple-pay-button{background-size:100% 60%;background-repeat:no-repeat;background-position:50% 50%;border-radius:5px;padding:0;box-sizing:border-box;min-width:200px;min-height:32px;max-height:64px;cursor:pointer}.apple-pay-button.wc-square-wallet-button-with-text{--apple-pay-scale:1;justify-content:center;font-size:12px;background:0 0}.apple-pay-button.wc-square-wallet-button-with-text .text{font-family:-apple-system;font-size:calc(1em * var(--apple-pay-scale));font-weight:300;align-self:center;margin-right:calc(2px * var(--apple-pay-scale))}.apple-pay-button.wc-square-wallet-button-with-text .logo{width:calc(35px * var(--scale));height:100%;background-size:100% 60%;background-repeat:no-repeat;background-position:0 50%;margin-left:calc(2px * var(--apple-pay-scale));border:none}.apple-pay-button.wc-square-wallet-button-black{background-color:#000;color:#fff}.apple-pay-button.wc-square-wallet-button-black .logo{background-image:-webkit-named-image(apple-pay-logo-white);background-color:#000}.apple-pay-button.wc-square-wallet-button-white{background-color:#fff;color:#000}.apple-pay-button.wc-square-wallet-button-white .logo{background-image:-webkit-named-image(apple-pay-logo-black);background-color:#fff}.apple-pay-button.wc-square-wallet-button-white-outline{background-color:#fff;color:#000;border:.5px solid #000}.apple-pay-button.wc-square-wallet-button-white-outline .logo{background-image:-webkit-named-image(apple-pay-logo-black);background-color:#fff}}
|
2 |
+
/*# sourceMappingURL=wc-square-digital-wallet.min.css.map */
|
assets/css/frontend/wc-square-digital-wallet.min.css.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["wc-square-digital-wallet.scss"],"names":[],"mappings":"AAAA,0BACI,QAAQ,KACR,MAAO,KACP,YAAa,MACb,MAAO,KACP,UAAW,MACX,OAAQ,EAAA,KAGZ,0BACI,WAAW,IACX,WAAW,OAGf,0BACI,MAAO,IACP,OAAQ,KACR,OAAQ,EAAA,EAAA,IAAA,EACR,OAAQ,QACR,QAAS,KAGb,+BACI,iBAAkB,KAGtB,+BACI,iBAAkB,KAMtB,mBACI,QAAS,KAAA,KACT,kBAAmB,YACnB,oBAAqB,OACrB,kBAAmB,UACnB,gBAAiB,QACjB,OAAQ,EACR,cAAe,IACf,WAAY,EAAE,IAAI,IAAI,EAAE,iBAAsB,CAAE,EAAE,IAAI,IAAI,IAAI,mBAC9D,QAAS,EACT,OAAQ,QAVM,iDAaV,iBAAkB,swIAbR,iDA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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#wc-square-digital-wallet {
|
2 |
+
display:none;
|
3 |
+
clear: both;
|
4 |
+
padding-top: 1.5em;
|
5 |
+
width: 100%;
|
6 |
+
max-width: 510px;
|
7 |
+
margin: 0 auto;
|
8 |
+
}
|
9 |
+
|
10 |
+
#wc-square-wallet-divider {
|
11 |
+
margin-top:1em;
|
12 |
+
text-align:center;
|
13 |
+
}
|
14 |
+
|
15 |
+
.wc-square-wallet-buttons {
|
16 |
+
width: 99%; /* Set to 99% so that Google Pay box-shadow styles aren't clipped (visible on white buttons) */
|
17 |
+
height: 44px;
|
18 |
+
margin: 0 0 1em 0;
|
19 |
+
cursor: pointer;
|
20 |
+
display: none;
|
21 |
+
}
|
22 |
+
|
23 |
+
.wc-square-wallet-button-black {
|
24 |
+
background-color: black;
|
25 |
+
}
|
26 |
+
|
27 |
+
.wc-square-wallet-button-white {
|
28 |
+
background-color: white;
|
29 |
+
}
|
30 |
+
|
31 |
+
/*
|
32 |
+
* Google Pay Button Styles
|
33 |
+
*/
|
34 |
+
.google-pay-button {
|
35 |
+
padding: 11px 10px;
|
36 |
+
background-origin: content-box;
|
37 |
+
background-position: center;
|
38 |
+
background-repeat: no-repeat;
|
39 |
+
background-size: contain;
|
40 |
+
border: 0;
|
41 |
+
border-radius: 4px;
|
42 |
+
box-shadow: 0 1px 1px 0 rgba(60, 64, 67, 0.30), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
|
43 |
+
outline: 0;
|
44 |
+
cursor: pointer;
|
45 |
+
|
46 |
+
&.wc-square-wallet-button-black {
|
47 |
+
background-image: url(data:image/svg+xml,%3Csvg%20width%3D%22103%22%20height%3D%2217%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cpath%20d%3D%22M.148%202.976h3.766c.532%200%201.024.117%201.477.35.453.233.814.555%201.085.966.27.41.406.863.406%201.358%200%20.495-.124.924-.371%201.288s-.572.64-.973.826v.084c.504.177.912.471%201.225.882.313.41.469.891.469%201.442a2.6%202.6%200%200%201-.427%201.47c-.285.43-.667.763-1.148%201.001A3.5%203.5%200%200%201%204.082%2013H.148V2.976zm3.696%204.2c.448%200%20.81-.14%201.085-.42.275-.28.413-.602.413-.966s-.133-.684-.399-.959c-.266-.275-.614-.413-1.043-.413H1.716v2.758h2.128zm.238%204.368c.476%200%20.856-.15%201.141-.448.285-.299.427-.644.427-1.036%200-.401-.147-.749-.441-1.043-.294-.294-.688-.441-1.183-.441h-2.31v2.968h2.366zm5.379.903c-.453-.518-.679-1.239-.679-2.163V5.86h1.54v4.214c0%20.579.138%201.013.413%201.302.275.29.637.434%201.085.434.364%200%20.686-.096.966-.287.28-.191.495-.446.644-.763a2.37%202.37%200%200%200%20.224-1.022V5.86h1.54V13h-1.456v-.924h-.084c-.196.336-.5.611-.91.826-.41.215-.845.322-1.302.322-.868%200-1.528-.259-1.981-.777zm9.859.161L16.352%205.86h1.722l2.016%204.858h.056l1.96-4.858H23.8l-4.41%2010.164h-1.624l1.554-3.416zm8.266-6.748h1.666l1.442%205.11h.056l1.61-5.11h1.582l1.596%205.11h.056l1.442-5.11h1.638L36.392%2013h-1.624L33.13%207.876h-.042L31.464%2013h-1.596l-2.282-7.14zm12.379-1.337a1%201%200%200%201-.301-.735%201%201%200%200%201%20.301-.735%201%201%200%200%201%20.735-.301%201%201%200%200%201%20.735.301%201%201%200%200%201%20.301.735%201%201%200%200%201-.301.735%201%201%200%200%201-.735.301%201%201%200%200%201-.735-.301zM39.93%205.86h1.54V13h-1.54V5.86zm5.568%207.098a1.967%201.967%200%200%201-.686-.406c-.401-.401-.602-.947-.602-1.638V7.218h-1.246V5.86h1.246V3.844h1.54V5.86h1.736v1.358H45.75v3.36c0%20.383.075.653.224.812.14.187.383.28.728.28.159%200%20.299-.021.42-.063.121-.042.252-.11.392-.203v1.498c-.308.14-.681.21-1.12.21-.317%200-.616-.051-.896-.154zm3.678-9.982h1.54v2.73l-.07%201.092h.07c.205-.336.511-.614.917-.833.406-.22.842-.329%201.309-.329.868%200%201.53.254%201.988.763.457.509.686%201.202.686%202.079V13h-1.54V8.688c0-.541-.142-.947-.427-1.218-.285-.27-.656-.406-1.113-.406-.345%200-.656.098-.931.294a2.042%202.042%200%200%200-.651.777%202.297%202.297%200%200%200-.238%201.029V13h-1.54V2.976zm32.35-.341v4.083h2.518c.6%200%201.096-.202%201.488-.605.403-.402.605-.882.605-1.437%200-.544-.202-1.018-.605-1.422-.392-.413-.888-.62-1.488-.62h-2.518zm0%205.52v4.736h-1.504V1.198h3.99c1.013%200%201.873.337%202.582%201.012.72.675%201.08%201.497%201.08%202.466%200%20.991-.36%201.819-1.08%202.482-.697.665-1.559.996-2.583.996h-2.485v.001zm7.668%202.287c0%20.392.166.718.499.98.332.26.722.391%201.168.391.633%200%201.196-.234%201.692-.701.497-.469.744-1.019.744-1.65-.469-.37-1.123-.555-1.962-.555-.61%200-1.12.148-1.528.442-.409.294-.613.657-.613%201.093m1.946-5.815c1.112%200%201.989.297%202.633.89.642.594.964%201.408.964%202.442v4.932h-1.439v-1.11h-.065c-.622.914-1.45%201.372-2.486%201.372-.882%200-1.621-.262-2.215-.784-.594-.523-.891-1.176-.891-1.96%200-.828.313-1.486.94-1.976s1.463-.735%202.51-.735c.892%200%201.629.163%202.206.49v-.344c0-.522-.207-.966-.621-1.33a2.132%202.132%200%200%200-1.455-.547c-.84%200-1.504.353-1.995%201.062l-1.324-.834c.73-1.045%201.81-1.568%203.238-1.568m11.853.262l-5.02%2011.53H96.42l1.864-4.034-3.302-7.496h1.635l2.387%205.749h.032l2.322-5.75z%22%20fill%3D%22%23FFF%22%2F%3E%3Cpath%20d%3D%22M75.448%207.134c0-.473-.04-.93-.116-1.366h-6.344v2.588h3.634a3.11%203.11%200%200%201-1.344%202.042v1.68h2.169c1.27-1.17%202.001-2.9%202.001-4.944%22%20fill%3D%22%234285F4%22%2F%3E%3Cpath%20d%3D%22M68.988%2013.7c1.816%200%203.344-.595%204.459-1.621l-2.169-1.681c-.603.406-1.38.643-2.29.643-1.754%200-3.244-1.182-3.776-2.774h-2.234v1.731a6.728%206.728%200%200%200%206.01%203.703%22%20fill%3D%22%2334A853%22%2F%3E%3Cpath%20d%3D%22M65.212%208.267a4.034%204.034%200%200%201%200-2.572V3.964h-2.234a6.678%206.678%200%200%200-.717%203.017c0%201.085.26%202.11.717%203.017l2.234-1.731z%22%20fill%3D%22%23FABB05%22%2F%3E%3Cpath%20d%3D%22M68.988%202.921c.992%200%201.88.34%202.58%201.008v.001l1.92-1.918c-1.165-1.084-2.685-1.75-4.5-1.75a6.728%206.728%200%200%200-6.01%203.702l2.234%201.731c.532-1.592%202.022-2.774%203.776-2.774%22%20fill%3D%22%23E94235%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E);
|
48 |
+
}
|
49 |
+
|
50 |
+
&.wc-square-wallet-button-white {
|
51 |
+
background-image: url(data:image/svg+xml,%3Csvg%20width%3D%22103%22%20height%3D%2217%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cpath%20d%3D%22M.148%202.976h3.766c.532%200%201.024.117%201.477.35.453.233.814.555%201.085.966.27.41.406.863.406%201.358%200%20.495-.124.924-.371%201.288s-.572.64-.973.826v.084c.504.177.912.471%201.225.882.313.41.469.891.469%201.442a2.6%202.6%200%200%201-.427%201.47c-.285.43-.667.763-1.148%201.001A3.5%203.5%200%200%201%204.082%2013H.148V2.976zm3.696%204.2c.448%200%20.81-.14%201.085-.42.275-.28.413-.602.413-.966s-.133-.684-.399-.959c-.266-.275-.614-.413-1.043-.413H1.716v2.758h2.128zm.238%204.368c.476%200%20.856-.15%201.141-.448.285-.299.427-.644.427-1.036%200-.401-.147-.749-.441-1.043-.294-.294-.688-.441-1.183-.441h-2.31v2.968h2.366zm5.379.903c-.453-.518-.679-1.239-.679-2.163V5.86h1.54v4.214c0%20.579.138%201.013.413%201.302.275.29.637.434%201.085.434.364%200%20.686-.096.966-.287.28-.191.495-.446.644-.763a2.37%202.37%200%200%200%20.224-1.022V5.86h1.54V13h-1.456v-.924h-.084c-.196.336-.5.611-.91.826-.41.215-.845.322-1.302.322-.868%200-1.528-.259-1.981-.777zm9.859.161L16.352%205.86h1.722l2.016%204.858h.056l1.96-4.858H23.8l-4.41%2010.164h-1.624l1.554-3.416zm8.266-6.748h1.666l1.442%205.11h.056l1.61-5.11h1.582l1.596%205.11h.056l1.442-5.11h1.638L36.392%2013h-1.624L33.13%207.876h-.042L31.464%2013h-1.596l-2.282-7.14zm12.379-1.337a1%201%200%200%201-.301-.735%201%201%200%200%201%20.301-.735%201%201%200%200%201%20.735-.301%201%201%200%200%201%20.735.301%201%201%200%200%201%20.301.735%201%201%200%200%201-.301.735%201%201%200%200%201-.735.301%201%201%200%200%201-.735-.301zM39.93%205.86h1.54V13h-1.54V5.86zm5.568%207.098a1.967%201.967%200%200%201-.686-.406c-.401-.401-.602-.947-.602-1.638V7.218h-1.246V5.86h1.246V3.844h1.54V5.86h1.736v1.358H45.75v3.36c0%20.383.075.653.224.812.14.187.383.28.728.28.159%200%20.299-.021.42-.063.121-.042.252-.11.392-.203v1.498c-.308.14-.681.21-1.12.21-.317%200-.616-.051-.896-.154zm3.678-9.982h1.54v2.73l-.07%201.092h.07c.205-.336.511-.614.917-.833.406-.22.842-.329%201.309-.329.868%200%201.53.254%201.988.763.457.509.686%201.202.686%202.079V13h-1.54V8.688c0-.541-.142-.947-.427-1.218-.285-.27-.656-.406-1.113-.406-.345%200-.656.098-.931.294a2.042%202.042%200%200%200-.651.777%202.297%202.297%200%200%200-.238%201.029V13h-1.54V2.976zm32.35-.341v4.083h2.518c.6%200%201.096-.202%201.488-.605.403-.402.605-.882.605-1.437%200-.544-.202-1.018-.605-1.422-.392-.413-.888-.62-1.488-.62h-2.518zm0%205.52v4.736h-1.504V1.198h3.99c1.013%200%201.873.337%202.582%201.012.72.675%201.08%201.497%201.08%202.466%200%20.991-.36%201.819-1.08%202.482-.697.665-1.559.996-2.583.996h-2.485v.001zm7.668%202.287c0%20.392.166.718.499.98.332.26.722.391%201.168.391.633%200%201.196-.234%201.692-.701.497-.469.744-1.019.744-1.65-.469-.37-1.123-.555-1.962-.555-.61%200-1.12.148-1.528.442-.409.294-.613.657-.613%201.093m1.946-5.815c1.112%200%201.989.297%202.633.89.642.594.964%201.408.964%202.442v4.932h-1.439v-1.11h-.065c-.622.914-1.45%201.372-2.486%201.372-.882%200-1.621-.262-2.215-.784-.594-.523-.891-1.176-.891-1.96%200-.828.313-1.486.94-1.976s1.463-.735%202.51-.735c.892%200%201.629.163%202.206.49v-.344c0-.522-.207-.966-.621-1.33a2.132%202.132%200%200%200-1.455-.547c-.84%200-1.504.353-1.995%201.062l-1.324-.834c.73-1.045%201.81-1.568%203.238-1.568m11.853.262l-5.02%2011.53H96.42l1.864-4.034-3.302-7.496h1.635l2.387%205.749h.032l2.322-5.75z%22%20fill%3D%22%23000%22%2F%3E%3Cpath%20d%3D%22M75.448%207.134c0-.473-.04-.93-.116-1.366h-6.344v2.588h3.634a3.11%203.11%200%200%201-1.344%202.042v1.68h2.169c1.27-1.17%202.001-2.9%202.001-4.944%22%20fill%3D%22%234285F4%22%2F%3E%3Cpath%20d%3D%22M68.988%2013.7c1.816%200%203.344-.595%204.459-1.621l-2.169-1.681c-.603.406-1.38.643-2.29.643-1.754%200-3.244-1.182-3.776-2.774h-2.234v1.731a6.728%206.728%200%200%200%206.01%203.703%22%20fill%3D%22%2334A853%22%2F%3E%3Cpath%20d%3D%22M65.212%208.267a4.034%204.034%200%200%201%200-2.572V3.964h-2.234a6.678%206.678%200%200%200-.717%203.017c0%201.085.26%202.11.717%203.017l2.234-1.731z%22%20fill%3D%22%23FABB05%22%2F%3E%3Cpath%20d%3D%22M68.988%202.921c.992%200%201.88.34%202.58%201.008v.001l1.92-1.918c-1.165-1.084-2.685-1.75-4.5-1.75a6.728%206.728%200%200%200-6.01%203.702l2.234%201.731c.532-1.592%202.022-2.774%203.776-2.774%22%20fill%3D%22%23E94235%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
/*
|
56 |
+
* Apple Pay Button Styles
|
57 |
+
*/
|
58 |
+
@supports (-webkit-appearance: -apple-pay-button) {
|
59 |
+
.apple-pay-button {
|
60 |
+
-webkit-appearance: -apple-pay-button;
|
61 |
+
cursor: pointer;
|
62 |
+
}
|
63 |
+
|
64 |
+
.apple-pay-button > * {
|
65 |
+
display: none;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
@supports not (-webkit-appearance: -apple-pay-button) {
|
70 |
+
.apple-pay-button {
|
71 |
+
background-size: 100% 60%;
|
72 |
+
background-repeat: no-repeat;
|
73 |
+
background-position: 50% 50%;
|
74 |
+
border-radius: 5px;
|
75 |
+
padding: 0px;
|
76 |
+
box-sizing: border-box;
|
77 |
+
min-width: 200px;
|
78 |
+
min-height: 32px;
|
79 |
+
max-height: 64px;
|
80 |
+
cursor: pointer;
|
81 |
+
|
82 |
+
&.wc-square-wallet-button-with-text {
|
83 |
+
--apple-pay-scale: 1; /* (height / 32) */
|
84 |
+
justify-content: center;
|
85 |
+
font-size: 12px;
|
86 |
+
background: none;
|
87 |
+
|
88 |
+
.text {
|
89 |
+
font-family: -apple-system;
|
90 |
+
font-size: calc(1em * var(--apple-pay-scale));
|
91 |
+
font-weight: 300;
|
92 |
+
align-self: center;
|
93 |
+
margin-right: calc(2px * var(--apple-pay-scale));
|
94 |
+
}
|
95 |
+
|
96 |
+
.logo {
|
97 |
+
width: calc(35px * var(--scale));
|
98 |
+
height: 100%;
|
99 |
+
background-size: 100% 60%;
|
100 |
+
background-repeat: no-repeat;
|
101 |
+
background-position: 0 50%;
|
102 |
+
margin-left: calc(2px * var(--apple-pay-scale));
|
103 |
+
border: none;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
&.wc-square-wallet-button-black {
|
108 |
+
background-color: black;
|
109 |
+
color: white;
|
110 |
+
|
111 |
+
.logo {
|
112 |
+
background-image: -webkit-named-image(apple-pay-logo-white);
|
113 |
+
background-color: black;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
&.wc-square-wallet-button-white {
|
118 |
+
background-color: white;
|
119 |
+
color: black;
|
120 |
+
|
121 |
+
.logo {
|
122 |
+
background-image: -webkit-named-image(apple-pay-logo-black);
|
123 |
+
background-color: white;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
&.wc-square-wallet-button-white-outline {
|
128 |
+
background-color: white;
|
129 |
+
color: black;
|
130 |
+
border: .5px solid black;
|
131 |
+
|
132 |
+
.logo {
|
133 |
+
background-image: -webkit-named-image(apple-pay-logo-black);
|
134 |
+
background-color: white;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
assets/js/admin/wc-square-admin-settings.coffee
CHANGED
@@ -287,3 +287,13 @@ jQuery( document ).ready ( $ ) ->
|
|
287 |
# run once on page load
|
288 |
if wc_square_admin_settings.existing_sync_job_id
|
289 |
getSyncStatus( wc_square_admin_settings.existing_sync_job_id )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
# run once on page load
|
288 |
if wc_square_admin_settings.existing_sync_job_id
|
289 |
getSyncStatus( wc_square_admin_settings.existing_sync_job_id )
|
290 |
+
|
291 |
+
# Show/hide Digital Wallet Settings on Square gateway settings page
|
292 |
+
$( '#woocommerce_square_credit_card_enable_digital_wallets' ).change( ->
|
293 |
+
wallet_settings = $( '.wc-square-digital-wallet-options' )
|
294 |
+
|
295 |
+
if $( '#woocommerce_square_credit_card_enable_digital_wallets' ).is( ':checked' )
|
296 |
+
wallet_settings.closest( 'tr' ).show()
|
297 |
+
else
|
298 |
+
wallet_settings.closest( 'tr' ).hide()
|
299 |
+
).change()
|
assets/js/admin/wc-square-admin-settings.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
"use strict";(function(){jQuery(document).ready(function(e){var s,t,a,r;if(null!=(a=window.typenow)?a:"","woocommerce_page_wc-settings"===(null!=(r=window.pagenow)?r:""))return wc_square_admin_settings.is_sandbox||(e("#wc_square_sandbox_settings").hide(),e("#wc_square_sandbox_settings").next().hide(),e(".wc_square_sandbox_settings").closest("tr").hide()),e("#wc_square_system_of_record").change(function(){var s,t,a;return a=e(this).val(),s=e("#wc_square_enable_inventory_sync"),t=s.closest("tr"),"square"===a||"woocommerce"===a?(s.next("span").html(wc_square_admin_settings.i18n.sync_inventory_label[a]),t.find(".description").html(wc_square_admin_settings.i18n.sync_inventory_description[a]),t.show()):(s.prop("checked",!1),t.hide()),"square"===a?e("#wc_square_hide_missing_products").closest("tr").show():e("#wc_square_hide_missing_products").closest("tr").hide()}).change(),e(".js-import-square-products").on("click",function(s){return s.preventDefault(),new e.WCBackboneModal.View({target:"wc-square-import-products"}),e("#btn-close").on("click",function(s){return s.preventDefault(),e("button.modal-close").trigger("click")})}),e("#wc-square-sync").on("click",function(s){return s.preventDefault(),new e.WCBackboneModal.View({target:"wc-square-sync"}),e("#btn-close").on("click",function(s){return s.preventDefault(),e("button.modal-close").trigger("click")})}),e(document.body).on("wc_backbone_modal_response",function(s,t){var a,r;switch(t){case"wc-square-import-products":e("#wpbody").block({message:null,overlayCSS:{opacity:"0.2"},onBlock:function(){e(".blockUI.blockOverlay").css({position:"fixed"})}}),r=e("#wc-square-import-product-updates").prop("checked"),a={action:"wc_square_import_products_from_square",dispatch:wc_square_admin_settings.sync_in_background,security:wc_square_admin_settings.import_products_from_square,update_during_import:r},e.post(wc_square_admin_settings.ajax_url,a,function(e){var s;return(s=e.data?e.data:null)&&alert(s),location.reload()});break;case"wc-square-sync":e("table.sync").block({message:null,overlayCSS:{opacity:"0.2"}}),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),e("#wc-square_clear-sync-records").prop("disabled",!0),a={action:"wc_square_sync_products_with_square",dispatch:wc_square_admin_settings.sync_in_background,security:wc_square_admin_settings.sync_products_with_square},e.post(wc_square_admin_settings.ajax_url,a,function(s){return s&&s.success?location.reload():(e("#wc-square_clear-sync-records").prop("disabled",!1),e("table.sync").unblock(),e("table.records").unblock())});break;default:return}}),t='<tr><td colspan="4"><em>'+wc_square_admin_settings.i18n.no_records_found+"</em></td></tr>",e("#wc-square_clear-sync-records").on("click",function(s){var a;return s.preventDefault(),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),a={action:"wc_square_handle_sync_records",id:"all",handle:"delete",security:wc_square_admin_settings.handle_sync_with_square_records},e.post(wc_square_admin_settings.ajax_url,a,function(s){return s&&s.success?(e("table.records tbody").html(t),e("#wc-square_clear-sync-records").prop("disabled",!0)):(s.data&&alert(s.data),console.log(s)),e("table.records").unblock()})}),e(".records .actions button.action").on("click",function(s){var a,r,n;return s.preventDefault(),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),n=e(this).data("id"),a=e(this).data("action"),r={action:"wc_square_handle_sync_records",id:n,handle:a,security:wc_square_admin_settings.handle_sync_with_square_records},e.post(wc_square_admin_settings.ajax_url,r,function(s){var r;return s&&s.success?(r="#record-"+n,"delete"===a?(e(r).remove(),e("table.records tbody tr").length||(e("table.records tbody").html(t),e("#wc-square_clear-sync-records").prop("disabled",!0))):"resolve"!==a&&"unsync"!==a||(e(r+" .type").html('<mark class="resolved"><span>'+wc_square_admin_settings.i18n.resolved+"</span></mark>"),e(r+" .actions").html("—"))):(s&&s.data&&alert(s.data),console.log({record:n,action:a,response:s})),e("table.records").unblock()})}),e("form").submit(function(s){var t;return t=e("#wc_square_enable_sandbox").is(":checked")?"sandbox":"production",e(this).append(e("<input>",{type:"hidden",name:"wc_square_environment",value:t}))}),s=function(t){var a,r;return(a=e("span.progress"))&&0!==a.length||(e("p.sync-result").append(' <span class="progress" style="display:block"></span>'),a=e("span.progress")),r={action:"wc_square_get_sync_with_square_status",security:wc_square_admin_settings.get_sync_with_square_status_nonce,job_id:t},e.post(wc_square_admin_settings.ajax_url,r,function(t){var r,n;if(t&&t.data)return t.success&&t.data.id?(e("table.sync .spinner").css("visibility","visible"),e("#wc-square_clear-sync-records").prop("disabled",!0),e("table.records .actions button").prop("disabled",!0),"completed"!==(n=t.data.status)&&"failed"!==n?(r=" ","product_import"===t.data.action?(r+=wc_square_admin_settings.i18n.skipped+": "+parseInt(t.data.skipped_products_count,10)+"<br/>",r+=wc_square_admin_settings.i18n.updated+": "+parseInt(t.data.updated_products_count,10)+"<br/>",r+=wc_square_admin_settings.i18n.imported+": "+parseInt(t.data.imported_products_count,10)):t.data.percentage&&(r+=parseInt(t.data.percentage,10)+"%"),a.html(r),setTimeout(function(){return s(t.data.id)},3e4)):location.reload()):(e("#wc-square_clear-sync-records").prop("disabled",!1),e("table.records .actions button").prop("disabled",!1),e("table.sync .spinner").css("visibility","hidden"),console.log(t))})},wc_square_admin_settings.existing_sync_job_id
|
2 |
//# sourceMappingURL=wc-square-admin-settings.min.js.map
|
1 |
+
"use strict";(function(){jQuery(document).ready(function(e){var s,t,a,r;if(null!=(a=window.typenow)?a:"","woocommerce_page_wc-settings"===(null!=(r=window.pagenow)?r:""))return wc_square_admin_settings.is_sandbox||(e("#wc_square_sandbox_settings").hide(),e("#wc_square_sandbox_settings").next().hide(),e(".wc_square_sandbox_settings").closest("tr").hide()),e("#wc_square_system_of_record").change(function(){var s,t,a;return a=e(this).val(),s=e("#wc_square_enable_inventory_sync"),t=s.closest("tr"),"square"===a||"woocommerce"===a?(s.next("span").html(wc_square_admin_settings.i18n.sync_inventory_label[a]),t.find(".description").html(wc_square_admin_settings.i18n.sync_inventory_description[a]),t.show()):(s.prop("checked",!1),t.hide()),"square"===a?e("#wc_square_hide_missing_products").closest("tr").show():e("#wc_square_hide_missing_products").closest("tr").hide()}).change(),e(".js-import-square-products").on("click",function(s){return s.preventDefault(),new e.WCBackboneModal.View({target:"wc-square-import-products"}),e("#btn-close").on("click",function(s){return s.preventDefault(),e("button.modal-close").trigger("click")})}),e("#wc-square-sync").on("click",function(s){return s.preventDefault(),new e.WCBackboneModal.View({target:"wc-square-sync"}),e("#btn-close").on("click",function(s){return s.preventDefault(),e("button.modal-close").trigger("click")})}),e(document.body).on("wc_backbone_modal_response",function(s,t){var a,r;switch(t){case"wc-square-import-products":e("#wpbody").block({message:null,overlayCSS:{opacity:"0.2"},onBlock:function(){e(".blockUI.blockOverlay").css({position:"fixed"})}}),r=e("#wc-square-import-product-updates").prop("checked"),a={action:"wc_square_import_products_from_square",dispatch:wc_square_admin_settings.sync_in_background,security:wc_square_admin_settings.import_products_from_square,update_during_import:r},e.post(wc_square_admin_settings.ajax_url,a,function(e){var s;return(s=e.data?e.data:null)&&alert(s),location.reload()});break;case"wc-square-sync":e("table.sync").block({message:null,overlayCSS:{opacity:"0.2"}}),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),e("#wc-square_clear-sync-records").prop("disabled",!0),a={action:"wc_square_sync_products_with_square",dispatch:wc_square_admin_settings.sync_in_background,security:wc_square_admin_settings.sync_products_with_square},e.post(wc_square_admin_settings.ajax_url,a,function(s){return s&&s.success?location.reload():(e("#wc-square_clear-sync-records").prop("disabled",!1),e("table.sync").unblock(),e("table.records").unblock())});break;default:return}}),t='<tr><td colspan="4"><em>'+wc_square_admin_settings.i18n.no_records_found+"</em></td></tr>",e("#wc-square_clear-sync-records").on("click",function(s){var a;return s.preventDefault(),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),a={action:"wc_square_handle_sync_records",id:"all",handle:"delete",security:wc_square_admin_settings.handle_sync_with_square_records},e.post(wc_square_admin_settings.ajax_url,a,function(s){return s&&s.success?(e("table.records tbody").html(t),e("#wc-square_clear-sync-records").prop("disabled",!0)):(s.data&&alert(s.data),console.log(s)),e("table.records").unblock()})}),e(".records .actions button.action").on("click",function(s){var a,r,n;return s.preventDefault(),e("table.records").block({message:null,overlayCSS:{opacity:"0.2"}}),n=e(this).data("id"),a=e(this).data("action"),r={action:"wc_square_handle_sync_records",id:n,handle:a,security:wc_square_admin_settings.handle_sync_with_square_records},e.post(wc_square_admin_settings.ajax_url,r,function(s){var r;return s&&s.success?(r="#record-"+n,"delete"===a?(e(r).remove(),e("table.records tbody tr").length||(e("table.records tbody").html(t),e("#wc-square_clear-sync-records").prop("disabled",!0))):"resolve"!==a&&"unsync"!==a||(e(r+" .type").html('<mark class="resolved"><span>'+wc_square_admin_settings.i18n.resolved+"</span></mark>"),e(r+" .actions").html("—"))):(s&&s.data&&alert(s.data),console.log({record:n,action:a,response:s})),e("table.records").unblock()})}),e("form").submit(function(s){var t;return t=e("#wc_square_enable_sandbox").is(":checked")?"sandbox":"production",e(this).append(e("<input>",{type:"hidden",name:"wc_square_environment",value:t}))}),s=function(t){var a,r;return(a=e("span.progress"))&&0!==a.length||(e("p.sync-result").append(' <span class="progress" style="display:block"></span>'),a=e("span.progress")),r={action:"wc_square_get_sync_with_square_status",security:wc_square_admin_settings.get_sync_with_square_status_nonce,job_id:t},e.post(wc_square_admin_settings.ajax_url,r,function(t){var r,n;if(t&&t.data)return t.success&&t.data.id?(e("table.sync .spinner").css("visibility","visible"),e("#wc-square_clear-sync-records").prop("disabled",!0),e("table.records .actions button").prop("disabled",!0),"completed"!==(n=t.data.status)&&"failed"!==n?(r=" ","product_import"===t.data.action?(r+=wc_square_admin_settings.i18n.skipped+": "+parseInt(t.data.skipped_products_count,10)+"<br/>",r+=wc_square_admin_settings.i18n.updated+": "+parseInt(t.data.updated_products_count,10)+"<br/>",r+=wc_square_admin_settings.i18n.imported+": "+parseInt(t.data.imported_products_count,10)):t.data.percentage&&(r+=parseInt(t.data.percentage,10)+"%"),a.html(r),setTimeout(function(){return s(t.data.id)},3e4)):location.reload()):(e("#wc-square_clear-sync-records").prop("disabled",!1),e("table.records .actions button").prop("disabled",!1),e("table.sync .spinner").css("visibility","hidden"),console.log(t))})},wc_square_admin_settings.existing_sync_job_id&&s(wc_square_admin_settings.existing_sync_job_id),e("#woocommerce_square_credit_card_enable_digital_wallets").change(function(){var s;return s=e(".wc-square-digital-wallet-options"),e("#woocommerce_square_credit_card_enable_digital_wallets").is(":checked")?s.closest("tr").show():s.closest("tr").hide()}).change()})}).call(void 0);
|
2 |
//# sourceMappingURL=wc-square-admin-settings.min.js.map
|
assets/js/admin/wc-square-admin-settings.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["wc-square-admin-settings.min.js"],"names":["jQuery","document","ready","$","_getSyncStatus","noRecordsFoundRow","ref","ref1","window","typenow","pagenow","wc_square_admin_settings","is_sandbox","hide","next","closest","change","$inventory_sync","$inventory_sync_row","system_of_record","this","val","html","i18n","sync_inventory_label","find","sync_inventory_description","show","prop","on","e","preventDefault","WCBackboneModal","View","target","trigger","body","data","update_during_import","block","message","overlayCSS","opacity","onBlock","css","position","action","dispatch","sync_in_background","security","import_products_from_square","post","ajax_url","response","alert","location","reload","sync_products_with_square","success","unblock","no_records_found","id","handle","handle_sync_with_square_records","console","log","recordId","rowId","remove","length","resolved","record","submit","environment","is","append","type","name","value","job_id","$progress","get_sync_with_square_status_nonce","progress","ref2","status","skipped","parseInt","skipped_products_count","updated","updated_products_count","imported","imported_products_count","percentage","setTimeout","existing_sync_job_id","call","undefined"],"mappings":"AAAA,cAEA,WAQEA,OAAOC,UAAUC,MAAM,SAAUC,GAQ/B,IAAIC,EAAgBC,EAA4BC,EAAKC,EAIrD,GAHoC,OAAzBD,EAAME,OAAOC,SAAmBH,EAAM,GAG7C,kCAFiC,OAA1BC,EAAOC,OAAOE,SAAmBH,EAAO,
|
1 |
+
{"version":3,"sources":["wc-square-admin-settings.min.js"],"names":["jQuery","document","ready","$","_getSyncStatus","noRecordsFoundRow","ref","ref1","window","typenow","pagenow","wc_square_admin_settings","is_sandbox","hide","next","closest","change","$inventory_sync","$inventory_sync_row","system_of_record","this","val","html","i18n","sync_inventory_label","find","sync_inventory_description","show","prop","on","e","preventDefault","WCBackboneModal","View","target","trigger","body","data","update_during_import","block","message","overlayCSS","opacity","onBlock","css","position","action","dispatch","sync_in_background","security","import_products_from_square","post","ajax_url","response","alert","location","reload","sync_products_with_square","success","unblock","no_records_found","id","handle","handle_sync_with_square_records","console","log","recordId","rowId","remove","length","resolved","record","submit","environment","is","append","type","name","value","job_id","$progress","get_sync_with_square_status_nonce","progress","ref2","status","skipped","parseInt","skipped_products_count","updated","updated_products_count","imported","imported_products_count","percentage","setTimeout","existing_sync_job_id","wallet_settings","call","undefined"],"mappings":"AAAA,cAEA,WAQEA,OAAOC,UAAUC,MAAM,SAAUC,GAQ/B,IAAIC,EAAgBC,EAA4BC,EAAKC,EAIrD,GAHoC,OAAzBD,EAAME,OAAOC,SAAmBH,EAAM,GAG7C,kCAFiC,OAA1BC,EAAOC,OAAOE,SAAmBH,EAAO,IAyQnD,OApQKI,yBAAyBC,aAE5BT,EAAE,+BAA+BU,OACjCV,EAAE,+BAA+BW,OAAOD,OACxCV,EAAE,+BAA+BY,QAAQ,MAAMF,QAGjDV,EAAE,+BAA+Ba,OAAO,WACtC,IAAIC,EAAiBC,EAAqBC,EAc1C,OAbAA,EAAmBhB,EAAEiB,MAAMC,MAC3BJ,EAAkBd,EAAE,oCACpBe,EAAsBD,EAAgBF,QAAQ,MAErB,WAArBI,GAAsD,gBAArBA,GACnCF,EAAgBH,KAAK,QAAQQ,KAAKX,yBAAyBY,KAAKC,qBAAqBL,IACrFD,EAAoBO,KAAK,gBAAgBH,KAAKX,yBAAyBY,KAAKG,2BAA2BP,IACvGD,EAAoBS,SAEpBV,EAAgBW,KAAK,WAAW,GAChCV,EAAoBL,QAGlB,WAAaM,EACRhB,EAAE,oCAAoCY,QAAQ,MAAMY,OAEpD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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
###*
|
2 |
+
# Square Credit Card Digital Wallet Handler class.
|
3 |
+
#
|
4 |
+
# @since 2.3
|
5 |
+
###
|
6 |
+
|
7 |
+
jQuery( document ).ready ( $ ) ->
|
8 |
+
|
9 |
+
"use strict"
|
10 |
+
|
11 |
+
# Square Credit Card Digital Wallet Handler class.
|
12 |
+
#
|
13 |
+
# @since 2.3
|
14 |
+
class window.WC_Square_Digital_Wallet_Handler
|
15 |
+
|
16 |
+
|
17 |
+
# Setup handler
|
18 |
+
#
|
19 |
+
# @since 2.3
|
20 |
+
constructor: ( args ) ->
|
21 |
+
@args = args
|
22 |
+
@payment_request = args.payment_request
|
23 |
+
@wallet = '#wc-square-digital-wallet'
|
24 |
+
@buttons = '.wc-square-wallet-buttons'
|
25 |
+
|
26 |
+
if $( @wallet ).length == 0
|
27 |
+
return
|
28 |
+
|
29 |
+
$( @wallet ).hide()
|
30 |
+
$( @buttons ).hide()
|
31 |
+
|
32 |
+
this.build_digital_wallet()
|
33 |
+
this.attach_page_events()
|
34 |
+
|
35 |
+
|
36 |
+
# Fetch a new payment request object and reload the SqPaymentForm
|
37 |
+
#
|
38 |
+
# @since 2.3
|
39 |
+
build_digital_wallet: ->
|
40 |
+
this.block_ui()
|
41 |
+
|
42 |
+
this.get_payment_request().then ( response ) =>
|
43 |
+
@payment_request = $.parseJSON( response )
|
44 |
+
|
45 |
+
this.load_square_form()
|
46 |
+
this.unblock_ui()
|
47 |
+
|
48 |
+
, ( response ) =>
|
49 |
+
|
50 |
+
this.log( '[Square] Could not build payment request. ' + response.message, 'error' )
|
51 |
+
$( @wallet ).hide()
|
52 |
+
|
53 |
+
|
54 |
+
# Add page event listeners
|
55 |
+
#
|
56 |
+
# @since 2.3
|
57 |
+
attach_page_events: ->
|
58 |
+
|
59 |
+
if @args.context is 'product'
|
60 |
+
addToCartButton = $( '.single_add_to_cart_button' )
|
61 |
+
|
62 |
+
$( '#wc-square-apple-pay, #wc-square-google-pay' ).on 'click', ( e ) =>
|
63 |
+
if addToCartButton.is( '.disabled' )
|
64 |
+
e.stopImmediatePropagation()
|
65 |
+
|
66 |
+
if addToCartButton.is( '.wc-variation-is-unavailable' )
|
67 |
+
window.alert( wc_add_to_cart_variation_params.i18n_unavailable_text )
|
68 |
+
else if addToCartButton.is( '.wc-variation-selection-needed' )
|
69 |
+
window.alert( wc_add_to_cart_variation_params.i18n_make_a_selection_text )
|
70 |
+
|
71 |
+
return
|
72 |
+
|
73 |
+
this.add_to_cart()
|
74 |
+
|
75 |
+
$( document.body ).on 'woocommerce_variation_has_changed', () =>
|
76 |
+
this.build_digital_wallet()
|
77 |
+
|
78 |
+
$( '.quantity' ).on 'input', '.qty', () =>
|
79 |
+
this.build_digital_wallet()
|
80 |
+
|
81 |
+
else if @args.context is 'cart'
|
82 |
+
$( document.body ).on 'updated_cart_totals', () =>
|
83 |
+
this.build_digital_wallet()
|
84 |
+
|
85 |
+
else if @args.context is 'checkout'
|
86 |
+
$( document.body ).on 'updated_checkout', () =>
|
87 |
+
this.build_digital_wallet()
|
88 |
+
|
89 |
+
|
90 |
+
# Load the digital wallet payment form
|
91 |
+
#
|
92 |
+
# @since 2.3
|
93 |
+
load_square_form: ->
|
94 |
+
|
95 |
+
if @payment_form
|
96 |
+
this.log( '[Square] Destroying digital wallet payment form' )
|
97 |
+
@payment_form.destroy()
|
98 |
+
|
99 |
+
this.log( '[Square] Building digital wallet payment form' )
|
100 |
+
@payment_form = new SqPaymentForm( this.get_form_params() )
|
101 |
+
@payment_form.build()
|
102 |
+
|
103 |
+
|
104 |
+
# Gets the Square payment form params.
|
105 |
+
#
|
106 |
+
# @since 2.3
|
107 |
+
get_form_params: =>
|
108 |
+
params = {
|
109 |
+
applicationId: @args.application_id,
|
110 |
+
locationId: @args.location_id,
|
111 |
+
autobuild: false,
|
112 |
+
applePay: {
|
113 |
+
elementId: 'wc-square-apple-pay'
|
114 |
+
},
|
115 |
+
googlePay: {
|
116 |
+
elementId: 'wc-square-google-pay'
|
117 |
+
},
|
118 |
+
callbacks: {
|
119 |
+
paymentFormLoaded: => this.unblock_ui()
|
120 |
+
createPaymentRequest: => this.create_payment_request()
|
121 |
+
methodsSupported: ( methods, unsupportedReason ) => this.methods_supported( methods, unsupportedReason )
|
122 |
+
shippingContactChanged: ( shippingContact, done ) => this.handle_shipping_address_changed( shippingContact, done )
|
123 |
+
shippingOptionChanged: ( shippingOption, done ) => this.handle_shipping_option_changed( shippingOption, done )
|
124 |
+
cardNonceResponseReceived: ( errors, nonce, cardData, billingContact, shippingContact, shippingOption ) => this.handle_card_nonce_response( errors, nonce, cardData, billingContact, shippingContact, shippingOption )
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
# Fix console errors for Google Pay when there are no shipping options set. See note in Square documentation under shippingOptions: https://developer.squareup.com/docs/api/paymentform#paymentrequestfields
|
129 |
+
if @payment_request.requestShippingAddress == false
|
130 |
+
delete params.callbacks.shippingOptionChanged
|
131 |
+
|
132 |
+
# Remove support for Google Pay and/or Apple Pay if chosen in settings
|
133 |
+
if 'google' in @args.hide_button_options
|
134 |
+
delete params.googlePay
|
135 |
+
|
136 |
+
if 'apple' in @args.hide_button_options
|
137 |
+
delete params.applePay
|
138 |
+
|
139 |
+
return params
|
140 |
+
|
141 |
+
|
142 |
+
# Sets the a payment request object for the Square Payment Form
|
143 |
+
#
|
144 |
+
# @since 2.3
|
145 |
+
create_payment_request: ->
|
146 |
+
return @payment_request
|
147 |
+
|
148 |
+
|
149 |
+
# Check which methods are supported and show/hide the correct buttons on frontend
|
150 |
+
# Reference: https://developer.squareup.com/docs/api/paymentform#methodssupported
|
151 |
+
#
|
152 |
+
# @since 2.3
|
153 |
+
methods_supported: ( methods, unsupportedReason ) ->
|
154 |
+
|
155 |
+
if methods.applePay == true or methods.googlePay == true
|
156 |
+
if methods.applePay == true
|
157 |
+
$( '#wc-square-apple-pay' ).show()
|
158 |
+
|
159 |
+
if methods.googlePay == true
|
160 |
+
$( '#wc-square-google-pay' ).show()
|
161 |
+
|
162 |
+
$( @wallet ).show()
|
163 |
+
else
|
164 |
+
this.log( unsupportedReason )
|
165 |
+
|
166 |
+
|
167 |
+
# Get the payment request on a product page
|
168 |
+
#
|
169 |
+
# @since 2.3
|
170 |
+
get_payment_request: => new Promise ( resolve, reject ) =>
|
171 |
+
data = {
|
172 |
+
'context' : @args.context,
|
173 |
+
'security' : @args.payment_request_nonce,
|
174 |
+
}
|
175 |
+
|
176 |
+
if @args.context is 'product'
|
177 |
+
product_data = this.get_product_data()
|
178 |
+
$.extend data, product_data
|
179 |
+
|
180 |
+
# retrieve a payment request object
|
181 |
+
$.post this.get_ajax_url( 'get_payment_request' ), data, ( response ) =>
|
182 |
+
if response.success
|
183 |
+
resolve response.data
|
184 |
+
else
|
185 |
+
reject response.data
|
186 |
+
|
187 |
+
|
188 |
+
# Handle all shipping address recalculations in the Apple/Google Pay window
|
189 |
+
# Reference: https://developer.squareup.com/docs/api/paymentform#shippingcontactchanged
|
190 |
+
#
|
191 |
+
# @since 2.3
|
192 |
+
handle_shipping_address_changed: ( shippingContact, done ) ->
|
193 |
+
data = {
|
194 |
+
'context' : @args.context,
|
195 |
+
'shipping_contact' : shippingContact.data,
|
196 |
+
'security' : @args.recalculate_totals_nonce
|
197 |
+
}
|
198 |
+
|
199 |
+
# send ajax request get_shipping_options
|
200 |
+
this.recalculate_totals( data ).then ( response ) =>
|
201 |
+
done( response )
|
202 |
+
, ( response ) =>
|
203 |
+
done({ error: 'Bad Request' })
|
204 |
+
|
205 |
+
|
206 |
+
# Handle all shipping method changes in the Apple/Google Pay window
|
207 |
+
# Reference: https://developer.squareup.com/docs/api/paymentform#shippingoptionchanged
|
208 |
+
#
|
209 |
+
# @since 2.3
|
210 |
+
handle_shipping_option_changed: ( shippingOption, done ) ->
|
211 |
+
data = {
|
212 |
+
'context' : @args.context,
|
213 |
+
'shipping_option' : shippingOption.data.id,
|
214 |
+
'security' : @args.recalculate_totals_nonce
|
215 |
+
}
|
216 |
+
|
217 |
+
this.recalculate_totals( data ).then ( response ) =>
|
218 |
+
done( response )
|
219 |
+
, ( response ) =>
|
220 |
+
done({ error: 'Bad Request' })
|
221 |
+
|
222 |
+
|
223 |
+
# Handle the payment response.
|
224 |
+
#
|
225 |
+
# On success, set the checkout billing/shipping data and submit the checkout.
|
226 |
+
#
|
227 |
+
# @since 2.3
|
228 |
+
handle_card_nonce_response: ( errors, nonce, cardData, billingContact, shippingContact, shippingOption ) ->
|
229 |
+
|
230 |
+
if errors
|
231 |
+
return this.render_errors( errors )
|
232 |
+
|
233 |
+
if not nonce
|
234 |
+
return this.render_errors( @args.general_error )
|
235 |
+
|
236 |
+
this.block_ui()
|
237 |
+
|
238 |
+
data = {
|
239 |
+
'action' : '',
|
240 |
+
'_wpnonce': @args.process_checkout_nonce,
|
241 |
+
'billing_first_name': if billingContact.givenName then billingContact.givenName else '',
|
242 |
+
'billing_last_name': if billingContact.familyName then billingContact.familyName else '',
|
243 |
+
'billing_company': '',
|
244 |
+
'billing_email': if shippingContact.email then shippingContact.email else '',
|
245 |
+
'billing_phone': if shippingContact.phone then shippingContact.phone else '',
|
246 |
+
'billing_country': if billingContact.country then billingContact.country.toUpperCase() else '',
|
247 |
+
'billing_address_1': if billingContact.addressLines && billingContact.addressLines[0] then billingContact.addressLines[0] else '',
|
248 |
+
'billing_address_2': if billingContact.addressLines && billingContact.addressLines[1] then billingContact.addressLines[1] else '',
|
249 |
+
'billing_city': if billingContact.city then billingContact.city else '',
|
250 |
+
'billing_state': if billingContact.region then billingContact.region else '',
|
251 |
+
'billing_postcode': if billingContact.postalCode then billingContact.postalCode else '',
|
252 |
+
'shipping_first_name': if shippingContact.givenName then shippingContact.givenName else '',
|
253 |
+
'shipping_last_name': if shippingContact.familyName then shippingContact.familyName else '',
|
254 |
+
'shipping_company': '',
|
255 |
+
'shipping_country': if shippingContact.country then shippingContact.country.toUpperCase() else '',
|
256 |
+
'shipping_address_1': if shippingContact.addressLines && shippingContact.addressLines[0] then shippingContact.addressLines[0] else '',
|
257 |
+
'shipping_address_2': if shippingContact.addressLines && shippingContact.addressLines[1] then shippingContact.addressLines[1] else '',
|
258 |
+
'shipping_city': if shippingContact.city then shippingContact.city else '',
|
259 |
+
'shipping_state': if shippingContact.region then shippingContact.region else '',
|
260 |
+
'shipping_postcode': if shippingContact.postalCode then shippingContact.postalCode else '',
|
261 |
+
'shipping_method': [ if not shippingOption then null else shippingOption.id ],
|
262 |
+
'order_comments': '',
|
263 |
+
'payment_method': 'square_credit_card',
|
264 |
+
'ship_to_different_address': 1,
|
265 |
+
'terms': 1,
|
266 |
+
'wc-square-credit-card-payment-nonce': nonce,
|
267 |
+
'wc-square-credit-card-last-four': if cardData.last_4 then cardData.last_4 else null,
|
268 |
+
'wc-square-credit-card-exp-month': if cardData.exp_month then cardData.exp_month else null,
|
269 |
+
'wc-square-credit-card-exp-year': if cardData.exp_year then cardData.exp_year else null,
|
270 |
+
'wc-square-credit-card-payment-postcode': if cardData.billing_postal_code then cardData.billing_postal_code else null,
|
271 |
+
'wc-square-digital-wallet-type': cardData.digital_wallet_type,
|
272 |
+
}
|
273 |
+
|
274 |
+
# handle slightly different mapping for Google Pay (Google returns full name as a single string)
|
275 |
+
if cardData.digital_wallet_type is 'GOOGLE_PAY'
|
276 |
+
if billingContact.givenName
|
277 |
+
data.billing_first_name = billingContact.givenName.split( ' ' ).slice( 0, 1 ).join( ' ' )
|
278 |
+
data.billing_last_name = billingContact.givenName.split( ' ' ).slice( 1 ).join(' ')
|
279 |
+
|
280 |
+
if shippingContact.givenName
|
281 |
+
data.shipping_last_name = shippingContact.givenName.split( ' ' ).slice( 0, 1 ).join( ' ' )
|
282 |
+
data.shipping_last_name = shippingContact.givenName.split( ' ' ).slice( 1 ).join( ' ' )
|
283 |
+
|
284 |
+
# if the billing_phone was not found on shippingContact, use the value on billingContact if that exists
|
285 |
+
if not data.billing_phone && billingContact.phone
|
286 |
+
data.billing_phone = billingContact.phone
|
287 |
+
|
288 |
+
# AJAX process checkout
|
289 |
+
this.process_digital_wallet_checkout( data ).then ( response ) =>
|
290 |
+
window.location = response.redirect
|
291 |
+
|
292 |
+
, ( response ) =>
|
293 |
+
this.log( response, 'error' )
|
294 |
+
this.render_errors_html( response.messages )
|
295 |
+
|
296 |
+
|
297 |
+
# Recalculate totals
|
298 |
+
#
|
299 |
+
# @since 2.3
|
300 |
+
recalculate_totals: ( data ) => new Promise ( resolve, reject ) =>
|
301 |
+
$.post this.get_ajax_url( 'recalculate_totals' ), data, ( response ) =>
|
302 |
+
if response.success
|
303 |
+
resolve response.data
|
304 |
+
else
|
305 |
+
reject response.data
|
306 |
+
|
307 |
+
|
308 |
+
# Get the product data for building the payment request on the product page
|
309 |
+
#
|
310 |
+
# @since 2.3
|
311 |
+
get_product_data: ->
|
312 |
+
product_id = $( '.single_add_to_cart_button' ).val()
|
313 |
+
attributes = {}
|
314 |
+
|
315 |
+
# Check if product is a variable product.
|
316 |
+
if $( '.single_variation_wrap' ).length
|
317 |
+
product_id = $( '.single_variation_wrap' ).find( 'input[name="product_id"]' ).val()
|
318 |
+
|
319 |
+
if $( '.variations_form' ).length
|
320 |
+
$( '.variations_form' ).find( '.variations select' ).each ( index, select ) =>
|
321 |
+
attribute_name = $( select ).data( 'attribute_name' ) || $( select ).attr( 'name' )
|
322 |
+
value = $( select ).val() || ''
|
323 |
+
|
324 |
+
attributes[ attribute_name ] = value;
|
325 |
+
|
326 |
+
return {
|
327 |
+
'product_id' : product_id,
|
328 |
+
'quantity' : $( '.quantity .qty' ).val(),
|
329 |
+
'attributes' : attributes,
|
330 |
+
}
|
331 |
+
|
332 |
+
|
333 |
+
# Add the product to the cart
|
334 |
+
#
|
335 |
+
# @since 2.3
|
336 |
+
add_to_cart: ->
|
337 |
+
data = {
|
338 |
+
'security' : @args.add_to_cart_nonce,
|
339 |
+
}
|
340 |
+
|
341 |
+
product_data = this.get_product_data()
|
342 |
+
$.extend data, product_data
|
343 |
+
|
344 |
+
# retrieve a payment request object
|
345 |
+
$.post this.get_ajax_url( 'add_to_cart' ), data, ( response ) =>
|
346 |
+
if response.error
|
347 |
+
window.alert( response.data )
|
348 |
+
else
|
349 |
+
data = $.parseJSON( response.data )
|
350 |
+
|
351 |
+
@payment_request = data.payment_request
|
352 |
+
@args.payment_request_nonce = data.payment_request_nonce
|
353 |
+
@args.add_to_cart_nonce = data.add_to_cart_nonce
|
354 |
+
@args.recalculate_totals_nonce = data.recalculate_totals_nonce
|
355 |
+
@args.process_checkout_nonce = data.process_checkout_nonce
|
356 |
+
|
357 |
+
|
358 |
+
# Process the digital wallet checkout
|
359 |
+
#
|
360 |
+
# @since 2.3
|
361 |
+
process_digital_wallet_checkout: ( data ) => new Promise ( resolve, reject ) =>
|
362 |
+
$.post this.get_ajax_url( 'process_checkout' ), data, ( response ) =>
|
363 |
+
if response.result is 'success'
|
364 |
+
resolve response
|
365 |
+
else
|
366 |
+
reject response
|
367 |
+
|
368 |
+
|
369 |
+
# Helper function to return the ajax URL for the given request/action
|
370 |
+
#
|
371 |
+
# @since 2.3
|
372 |
+
get_ajax_url: ( request ) ->
|
373 |
+
return @args.ajax_url.replace( '%%endpoint%%', 'square_digital_wallet_' + request )
|
374 |
+
|
375 |
+
|
376 |
+
# Renders errors given the error message HTML
|
377 |
+
#
|
378 |
+
# @since 2.3
|
379 |
+
render_errors_html: ( errors_html ) ->
|
380 |
+
# hide and remove any previous errors
|
381 |
+
$( '.woocommerce-error, .woocommerce-message' ).remove()
|
382 |
+
|
383 |
+
element = if @args.context == 'product' then $( '.product' ) else $( '.shop_table.cart' ).closest( 'form' )
|
384 |
+
|
385 |
+
# add errors
|
386 |
+
element.before errors_html
|
387 |
+
|
388 |
+
# unblock UI
|
389 |
+
this.unblock_ui()
|
390 |
+
|
391 |
+
# scroll to top
|
392 |
+
$( 'html, body' ).animate( { scrollTop: element.offset().top - 100 }, 1000 )
|
393 |
+
|
394 |
+
|
395 |
+
# Renders errors
|
396 |
+
#
|
397 |
+
# @since 2.3
|
398 |
+
render_errors: ( errors ) ->
|
399 |
+
error_message_html = '<ul class="woocommerce-error"><li>' + errors.join( '</li><li>' ) + '</li></ul>'
|
400 |
+
|
401 |
+
this.render_errors_html( error_message_html )
|
402 |
+
|
403 |
+
|
404 |
+
# Block the Apple Pay and Google Pay buttons from being clicked which processing certain actions
|
405 |
+
#
|
406 |
+
# @since 2.3
|
407 |
+
block_ui: ->
|
408 |
+
$( @buttons ).block( { message: null, overlayCSS: background: '#fff', opacity: 0.6 } )
|
409 |
+
|
410 |
+
|
411 |
+
# Unblock the wallet buttons
|
412 |
+
#
|
413 |
+
# @since 2.3
|
414 |
+
unblock_ui: ->
|
415 |
+
$( @buttons ).unblock()
|
416 |
+
|
417 |
+
|
418 |
+
# Logs messages to the console when logging is turned on in the settings
|
419 |
+
#
|
420 |
+
# @since 2.3
|
421 |
+
log: ( message, type = 'notice' ) ->
|
422 |
+
# if logging is disabled, bail
|
423 |
+
return unless @args.logging_enabled
|
424 |
+
|
425 |
+
if type is 'error'
|
426 |
+
console.error message
|
427 |
+
else
|
428 |
+
console.log message
|
assets/js/frontend/wc-square-digital-wallet.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();(function(){var e=[].indexOf;jQuery(document).ready(function(t){return window.WC_Square_Digital_Wallet_Handler=function(){function a(e){_classCallCheck(this,a),this.get_form_params=this.get_form_params.bind(this),this.get_payment_request=this.get_payment_request.bind(this),this.recalculate_totals=this.recalculate_totals.bind(this),this.process_digital_wallet_checkout=this.process_digital_wallet_checkout.bind(this),this.args=e,this.payment_request=e.payment_request,this.wallet="#wc-square-digital-wallet",this.buttons=".wc-square-wallet-buttons",0!==t(this.wallet).length&&(t(this.wallet).hide(),t(this.buttons).hide(),this.build_digital_wallet(),this.attach_page_events())}return _createClass(a,[{key:"build_digital_wallet",value:function(){var e=this;return this.block_ui(),this.get_payment_request().then(function(a){return e.payment_request=t.parseJSON(a),e.load_square_form(),e.unblock_ui()},function(a){return e.log("[Square] Could not build payment request. "+a.message,"error"),t(e.wallet).hide()})}},{key:"attach_page_events",value:function(){var e,a=this;return"product"===this.args.context?(e=t(".single_add_to_cart_button"),t("#wc-square-apple-pay, #wc-square-google-pay").on("click",function(t){return e.is(".disabled")?(t.stopImmediatePropagation(),void(e.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):e.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text))):a.add_to_cart()}),t(document.body).on("woocommerce_variation_has_changed",function(){return a.build_digital_wallet()}),t(".quantity").on("input",".qty",function(){return a.build_digital_wallet()})):"cart"===this.args.context?t(document.body).on("updated_cart_totals",function(){return a.build_digital_wallet()}):"checkout"===this.args.context?t(document.body).on("updated_checkout",function(){return a.build_digital_wallet()}):void 0}},{key:"load_square_form",value:function(){return this.payment_form&&(this.log("[Square] Destroying digital wallet payment form"),this.payment_form.destroy()),this.log("[Square] Building digital wallet payment form"),this.payment_form=new SqPaymentForm(this.get_form_params()),this.payment_form.build()}},{key:"get_form_params",value:function(){var t,a=this;return t={applicationId:this.args.application_id,locationId:this.args.location_id,autobuild:!1,applePay:{elementId:"wc-square-apple-pay"},googlePay:{elementId:"wc-square-google-pay"},callbacks:{paymentFormLoaded:function(){return a.unblock_ui()},createPaymentRequest:function(){return a.create_payment_request()},methodsSupported:function(e,t){return a.methods_supported(e,t)},shippingContactChanged:function(e,t){return a.handle_shipping_address_changed(e,t)},shippingOptionChanged:function(e,t){return a.handle_shipping_option_changed(e,t)},cardNonceResponseReceived:function(e,t,n,r,i,o){return a.handle_card_nonce_response(e,t,n,r,i,o)}}},!1===this.payment_request.requestShippingAddress&&delete t.callbacks.shippingOptionChanged,e.call(this.args.hide_button_options,"google")>=0&&delete t.googlePay,e.call(this.args.hide_button_options,"apple")>=0&&delete t.applePay,t}},{key:"create_payment_request",value:function(){return this.payment_request}},{key:"methods_supported",value:function(e,a){return!0===e.applePay||!0===e.googlePay?(!0===e.applePay&&t("#wc-square-apple-pay").show(),!0===e.googlePay&&t("#wc-square-google-pay").show(),t(this.wallet).show()):this.log(a)}},{key:"get_payment_request",value:function(){var e=this;return new Promise(function(a,n){var r,i;return r={context:e.args.context,security:e.args.payment_request_nonce},"product"===e.args.context&&(i=e.get_product_data(),t.extend(r,i)),t.post(e.get_ajax_url("get_payment_request"),r,function(e){return e.success?a(e.data):n(e.data)})})}},{key:"handle_shipping_address_changed",value:function(e,t){var a;return a={context:this.args.context,shipping_contact:e.data,security:this.args.recalculate_totals_nonce},this.recalculate_totals(a).then(function(e){return t(e)},function(e){return t({error:"Bad Request"})})}},{key:"handle_shipping_option_changed",value:function(e,t){var a;return a={context:this.args.context,shipping_option:e.data.id,security:this.args.recalculate_totals_nonce},this.recalculate_totals(a).then(function(e){return t(e)},function(e){return t({error:"Bad Request"})})}},{key:"handle_card_nonce_response",value:function(e,t,a,n,r,i){var o,s=this;return e?this.render_errors(e):t?(this.block_ui(),o={action:"",_wpnonce:this.args.process_checkout_nonce,billing_first_name:n.givenName?n.givenName:"",billing_last_name:n.familyName?n.familyName:"",billing_company:"",billing_email:r.email?r.email:"",billing_phone:r.phone?r.phone:"",billing_country:n.country?n.country.toUpperCase():"",billing_address_1:n.addressLines&&n.addressLines[0]?n.addressLines[0]:"",billing_address_2:n.addressLines&&n.addressLines[1]?n.addressLines[1]:"",billing_city:n.city?n.city:"",billing_state:n.region?n.region:"",billing_postcode:n.postalCode?n.postalCode:"",shipping_first_name:r.givenName?r.givenName:"",shipping_last_name:r.familyName?r.familyName:"",shipping_company:"",shipping_country:r.country?r.country.toUpperCase():"",shipping_address_1:r.addressLines&&r.addressLines[0]?r.addressLines[0]:"",shipping_address_2:r.addressLines&&r.addressLines[1]?r.addressLines[1]:"",shipping_city:r.city?r.city:"",shipping_state:r.region?r.region:"",shipping_postcode:r.postalCode?r.postalCode:"",shipping_method:[i?i.id:null],order_comments:"",payment_method:"square_credit_card",ship_to_different_address:1,terms:1,"wc-square-credit-card-payment-nonce":t,"wc-square-credit-card-last-four":a.last_4?a.last_4:null,"wc-square-credit-card-exp-month":a.exp_month?a.exp_month:null,"wc-square-credit-card-exp-year":a.exp_year?a.exp_year:null,"wc-square-credit-card-payment-postcode":a.billing_postal_code?a.billing_postal_code:null,"wc-square-digital-wallet-type":a.digital_wallet_type},"GOOGLE_PAY"===a.digital_wallet_type&&(n.givenName&&(o.billing_first_name=n.givenName.split(" ").slice(0,1).join(" "),o.billing_last_name=n.givenName.split(" ").slice(1).join(" ")),r.givenName&&(o.shipping_last_name=r.givenName.split(" ").slice(0,1).join(" "),o.shipping_last_name=r.givenName.split(" ").slice(1).join(" "))),!o.billing_phone&&n.phone&&(o.billing_phone=n.phone),this.process_digital_wallet_checkout(o).then(function(e){return window.location=e.redirect},function(e){return s.log(e,"error"),s.render_errors_html(e.messages)})):this.render_errors(this.args.general_error)}},{key:"recalculate_totals",value:function(e){var a=this;return new Promise(function(n,r){return t.post(a.get_ajax_url("recalculate_totals"),e,function(e){return e.success?n(e.data):r(e.data)})})}},{key:"get_product_data",value:function(){var e,a;return a=t(".single_add_to_cart_button").val(),e={},t(".single_variation_wrap").length&&(a=t(".single_variation_wrap").find('input[name="product_id"]').val(),t(".variations_form").length&&t(".variations_form").find(".variations select").each(function(a,n){var r,i;return r=t(n).data("attribute_name")||t(n).attr("name"),i=t(n).val()||"",e[r]=i})),{product_id:a,quantity:t(".quantity .qty").val(),attributes:e}}},{key:"add_to_cart",value:function(){var e,a,n=this;return e={security:this.args.add_to_cart_nonce},a=this.get_product_data(),t.extend(e,a),t.post(this.get_ajax_url("add_to_cart"),e,function(a){return a.error?window.alert(a.data):(e=t.parseJSON(a.data),n.payment_request=e.payment_request,n.args.payment_request_nonce=e.payment_request_nonce,n.args.add_to_cart_nonce=e.add_to_cart_nonce,n.args.recalculate_totals_nonce=e.recalculate_totals_nonce,n.args.process_checkout_nonce=e.process_checkout_nonce)})}},{key:"process_digital_wallet_checkout",value:function(e){var a=this;return new Promise(function(n,r){return t.post(a.get_ajax_url("process_checkout"),e,function(e){return"success"===e.result?n(e):r(e)})})}},{key:"get_ajax_url",value:function(e){return this.args.ajax_url.replace("%%endpoint%%","square_digital_wallet_"+e)}},{key:"render_errors_html",value:function(e){var a;return t(".woocommerce-error, .woocommerce-message").remove(),(a="product"===this.args.context?t(".product"):t(".shop_table.cart").closest("form")).before(e),this.unblock_ui(),t("html, body").animate({scrollTop:a.offset().top-100},1e3)}},{key:"render_errors",value:function(e){var t;return t='<ul class="woocommerce-error"><li>'+e.join("</li><li>")+"</li></ul>",this.render_errors_html(t)}},{key:"block_ui",value:function(){return t(this.buttons).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return t(this.buttons).unblock()}},{key:"log",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"notice";if(this.args.logging_enabled)return"error"===t?console.error(e):console.log(e)}}]),a}()})}).call(void 0);
|
2 |
+
//# sourceMappingURL=wc-square-digital-wallet.min.js.map
|
assets/js/frontend/wc-square-digital-wallet.min.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["wc-square-digital-wallet.min.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","indexOf","jQuery","document","ready","$","window","WC_Square_Digital_Wallet_Handler","args","this","get_form_params","bind","get_payment_request","recalculate_totals","process_digital_wallet_checkout","payment_request","wallet","buttons","hide","build_digital_wallet","attach_page_events","value","_this","block_ui","then","response","parseJSON","load_square_form","unblock_ui","log","message","addToCartButton","_this2","context","on","e","is","stopImmediatePropagation","alert","wc_add_to_cart_variation_params","i18n_unavailable_text","i18n_make_a_selection_text","add_to_cart","body","payment_form","destroy","SqPaymentForm","build","params","_this3","applicationId","application_id","locationId","location_id","autobuild","applePay","elementId","googlePay","callbacks","paymentFormLoaded","createPaymentRequest","create_payment_request","methodsSupported","methods","unsupportedReason","methods_supported","shippingContactChanged","shippingContact","done","handle_shipping_address_changed","shippingOptionChanged","shippingOption","handle_shipping_option_changed","cardNonceResponseReceived","errors","nonce","cardData","billingContact","handle_card_nonce_response","requestShippingAddress","call","hide_button_options","show","_this4","Promise","resolve","reject","data","product_data","security","payment_request_nonce","get_product_data","extend","post","get_ajax_url","success","shipping_contact","recalculate_totals_nonce","error","shipping_option","id","_this5","render_errors","action","_wpnonce","process_checkout_nonce","billing_first_name","givenName","billing_last_name","familyName","billing_company","billing_email","email","billing_phone","phone","billing_country","country","toUpperCase","billing_address_1","addressLines","billing_address_2","billing_city","city","billing_state","region","billing_postcode","postalCode","shipping_first_name","shipping_last_name","shipping_company","shipping_country","shipping_address_1","shipping_address_2","shipping_city","shipping_state","shipping_postcode","shipping_method","order_comments","payment_method","ship_to_different_address","terms","wc-square-credit-card-payment-nonce","wc-square-credit-card-last-four","last_4","wc-square-credit-card-exp-month","exp_month","wc-square-credit-card-exp-year","exp_year","wc-square-credit-card-payment-postcode","billing_postal_code","wc-square-digital-wallet-type","digital_wallet_type","split","slice","join","location","redirect","render_errors_html","messages","general_error","_this6","attributes","product_id","val","find","each","index","select","attribute_name","attr","quantity","_this7","add_to_cart_nonce","_this8","result","request","ajax_url","replace","errors_html","element","remove","closest","before","animate","scrollTop","offset","top","error_message_html","block","overlayCSS","background","opacity","unblock","type","arguments","undefined","logging_enabled","console"],"mappings":"AAAA,aAIA,SAASA,gBAAgBC,EAAUC,GAAe,KAAMD,aAAoBC,GAAgB,MAAM,IAAIC,UAAU,qCAFhH,IAAIC,aAAe,WAAc,SAASC,EAAiBC,EAAQC,GAAS,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,IAAIE,EAAaH,EAAMC,GAAIE,EAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,UAAWF,IAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAAiB,OAAO,SAAUR,EAAae,EAAYC,GAAiJ,OAA9HD,GAAYZ,EAAiBH,EAAYiB,UAAWF,GAAiBC,GAAab,EAAiBH,EAAagB,GAAqBhB,GAA7gB,IAInB,WAME,IAAIkB,KAAaA,QAEjBC,OAAOC,UAAUC,MAAM,SAAUC,GAM/B,OAAOC,OAAOC,iCAAmC,WAI/C,SAASA,EAAiCC,GACxC3B,gBAAgB4B,KAAMF,GAKtBE,KAAKC,gBAAkBD,KAAKC,gBAAgBC,KAAKF,MAIjDA,KAAKG,oBAAsBH,KAAKG,oBAAoBD,KAAKF,MAIzDA,KAAKI,mBAAqBJ,KAAKI,mBAAmBF,KAAKF,MAIvDA,KAAKK,gCAAkCL,KAAKK,gCAAgCH,KAAKF,MACjFA,KAAKD,KAAOA,EACZC,KAAKM,gBAAkBP,EAAKO,gBAC5BN,KAAKO,OAAS,4BACdP,KAAKQ,QAAU,4BACe,IAA1BZ,EAAEI,KAAKO,QAAQ1B,SAGnBe,EAAEI,KAAKO,QAAQE,OACfb,EAAEI,KAAKQ,SAASC,OAChBT,KAAKU,uBACLV,KAAKW,sBA2eP,OAneAnC,aAAasB,IACXV,IAAK,uBACLwB,MAAO,WACL,IAAIC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AQL7L,IAAK,gBACLwB,MAAO,SAAuBqD,GAC5B,IAAIiH,EAEJ,OADAA,EAAqB,qCAAuCjH,EAAOgF,KAAK,aAAe,aAChFjJ,KAAKoJ,mBAAmB8B,MAQjC9L,IAAK,WACLwB,MAAO,WACL,OAAOhB,EAAEI,KAAKQ,SAAS2K,OACrB9J,QAAS,KACT+J,YACEC,WAAY,OACZC,QAAS,SAUflM,IAAK,aACLwB,MAAO,WACL,OAAOhB,EAAEI,KAAKQ,SAAS+K,aAQzBnM,IAAK,MACLwB,MAAO,SAAaS,GAClB,IAAImK,EAAOC,UAAU5M,OAAS,QAAsB6M,IAAjBD,UAAU,GAAmBA,UAAU,GAAK,SAG/E,GAAKzL,KAAKD,KAAK4L,gBAGf,MAAa,UAATH,EACKI,QAAQnG,MAAMpE,GAEduK,QAAQxK,IAAIC,OAKlBvB,EA5gBwC,OA+gBlDyE,UAAKmH","file":"wc-square-digital-wallet.min.js"}
|
i18n/languages/woocommerce-square.pot
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce Square 2.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-square\n"
|
8 |
-
"POT-Creation-Date:
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"PO-Revision-Date:
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
|
15 |
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
@@ -69,7 +69,7 @@ msgid "Stock must be fetched from Square before editing stock quantity"
|
|
69 |
msgstr ""
|
70 |
|
71 |
#: includes/Admin/Privacy.php:45 includes/Admin/Settings_Page.php:55
|
72 |
-
#: includes/Gateway.php:
|
73 |
msgid "Square"
|
74 |
msgstr ""
|
75 |
|
@@ -434,6 +434,7 @@ msgid "The sync job has failed. Check sync records, or %s."
|
|
434 |
msgstr ""
|
435 |
|
436 |
#: includes/Gateway/API/Requests/Orders.php:88
|
|
|
437 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:555
|
438 |
msgid "Discount"
|
439 |
msgstr ""
|
@@ -443,36 +444,261 @@ msgstr ""
|
|
443 |
msgid "Adjustment"
|
444 |
msgstr ""
|
445 |
|
446 |
-
#: includes/Gateway/
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
msgstr ""
|
449 |
|
450 |
-
#: includes/Gateway/
|
|
|
|
|
|
|
|
|
|
|
451 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:216
|
452 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:2758
|
453 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:376
|
454 |
msgid "An error occurred, please try again or try an alternate form of payment."
|
455 |
msgstr ""
|
456 |
|
457 |
-
#: includes/Gateway.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
msgid "Allow customers to use Square to securely pay with their credit cards"
|
459 |
msgstr ""
|
460 |
|
461 |
-
#: includes/Gateway.php:
|
462 |
msgid "Refunds must be made within %s of the original payment date."
|
463 |
msgstr ""
|
464 |
|
465 |
-
#: includes/Gateway.php:
|
466 |
msgid ""
|
467 |
"Could not find original transaction tender. Please refund this transaction "
|
468 |
"from your Square dashboard."
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: includes/Gateway.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
msgid "Customer Profiles"
|
473 |
msgstr ""
|
474 |
|
475 |
-
#: includes/Gateway.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
msgid " An error occurred, please try again or try an alternate form of payment."
|
477 |
msgstr ""
|
478 |
|
@@ -575,7 +801,7 @@ msgstr ""
|
|
575 |
msgid "This product"
|
576 |
msgstr ""
|
577 |
|
578 |
-
#: includes/Handlers/Products.php:
|
579 |
#. translators: Placeholder: %1$s - date (localized), %2$s - time (localized),
|
580 |
#. %3$s - opening <a> HTML link tag, %4$s closing </a> HTML link tag
|
581 |
msgid ""
|
@@ -591,26 +817,26 @@ msgid_plural "Updated data for %d products."
|
|
591 |
msgstr[0] ""
|
592 |
msgstr[1] ""
|
593 |
|
594 |
-
#: includes/Lifecycle.php:
|
595 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:374
|
596 |
msgid "Awesome"
|
597 |
msgstr ""
|
598 |
|
599 |
-
#: includes/Lifecycle.php:
|
600 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:377
|
601 |
msgid "Congratulations"
|
602 |
msgstr ""
|
603 |
|
604 |
-
#: includes/Lifecycle.php:
|
605 |
msgid "Great"
|
606 |
msgstr ""
|
607 |
|
608 |
-
#: includes/Lifecycle.php:
|
609 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:375
|
610 |
msgid "Fantastic"
|
611 |
msgstr ""
|
612 |
|
613 |
-
#: includes/Lifecycle.php:
|
614 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:385
|
615 |
#. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
|
616 |
#. tag, %4$s - <a> tag, %5$s - </a> tag
|
@@ -875,57 +1101,67 @@ msgstr ""
|
|
875 |
msgid "Import all products from Square"
|
876 |
msgstr ""
|
877 |
|
878 |
-
#: includes/Sync/Interval_Polling.php:
|
879 |
msgid "Updated data for %d category."
|
880 |
msgid_plural "Updated data for %d categories."
|
881 |
msgstr[0] ""
|
882 |
msgstr[1] ""
|
883 |
|
884 |
-
#: includes/Sync/
|
|
|
|
|
|
|
|
|
|
|
|
|
885 |
#. translators: Placeholder: %s - product ID
|
886 |
msgid "Product %s could not be updated in Square."
|
887 |
msgstr ""
|
888 |
|
889 |
-
#: includes/Sync/Product_Import.php:
|
890 |
#. translators: Placeholders: %1$s - Square item name, %2$s - Square item
|
891 |
#. variation name, %3$s - failure reason
|
892 |
msgid "Could not import \"%1$s - %2$s\" from Square. %3$s"
|
893 |
msgstr ""
|
894 |
|
895 |
-
#: includes/Sync/Product_Import.php:
|
896 |
#. translators: Placeholders: %1$s - Square item name, %2$s - failure reason
|
897 |
msgid "Could not import \"%1$s\" from Square. %2$s"
|
898 |
msgstr ""
|
899 |
|
900 |
-
#: includes/Sync/Product_Import.php:
|
901 |
msgid "Items with variable pricing cannot be imported."
|
902 |
msgstr ""
|
903 |
|
904 |
-
#: includes/Sync/Product_Import.php:
|
|
|
|
|
|
|
|
|
905 |
msgid "The SKU already exists on another product"
|
906 |
msgstr ""
|
907 |
|
908 |
-
#: includes/Sync/Product_Import.php:
|
909 |
#. translators: Placeholders: %1$s - variation ID, %2$s - product name
|
910 |
msgid "Variation #%1$s of %2$s"
|
911 |
msgstr ""
|
912 |
|
913 |
-
#: includes/Sync/Product_Import.php:
|
914 |
#. translators: Placeholders: %s - missing parameter name
|
915 |
msgid "Missing parameter %s"
|
916 |
msgstr ""
|
917 |
|
918 |
-
#: includes/Sync/Product_Import.php:
|
919 |
#. translators: Placeholders: %s - comma separated list of valid product types
|
920 |
msgid "Invalid product type - the product type must be any of these: %s"
|
921 |
msgstr ""
|
922 |
|
923 |
-
#: includes/Sync/Product_Import.php:
|
924 |
#. translators: Placeholders: %1$s - Square item name, %2$s - Failure reason
|
925 |
msgid "Could not update %1$s from Square. %2$s"
|
926 |
msgstr ""
|
927 |
|
928 |
-
#: includes/Sync/Product_Import.php:
|
929 |
#. translators: Placeholders: %1$s - Square item name, %2$s - Failure reason
|
930 |
msgid "Could not import %1$s from Square. %2$s"
|
931 |
msgstr ""
|
@@ -1048,49 +1284,42 @@ msgid "Cancel the action now to avoid it being run in future"
|
|
1048 |
msgstr ""
|
1049 |
|
1050 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:143
|
1051 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/cron-command/src/Cron_Event_Command.php:428
|
1052 |
msgid "%s year"
|
1053 |
msgid_plural "%s years"
|
1054 |
msgstr[0] ""
|
1055 |
msgstr[1] ""
|
1056 |
|
1057 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:147
|
1058 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/cron-command/src/Cron_Event_Command.php:429
|
1059 |
msgid "%s month"
|
1060 |
msgid_plural "%s months"
|
1061 |
msgstr[0] ""
|
1062 |
msgstr[1] ""
|
1063 |
|
1064 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:151
|
1065 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/cron-command/src/Cron_Event_Command.php:430
|
1066 |
msgid "%s week"
|
1067 |
msgid_plural "%s weeks"
|
1068 |
msgstr[0] ""
|
1069 |
msgstr[1] ""
|
1070 |
|
1071 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:155
|
1072 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/cron-command/src/Cron_Event_Command.php:431
|
1073 |
msgid "%s day"
|
1074 |
msgid_plural "%s days"
|
1075 |
msgstr[0] ""
|
1076 |
msgstr[1] ""
|
1077 |
|
1078 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:159
|
1079 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/cron-command/src/Cron_Event_Command.php:432
|
1080 |
msgid "%s hour"
|
1081 |
msgid_plural "%s hours"
|
1082 |
msgstr[0] ""
|
1083 |
msgstr[1] ""
|
1084 |
|
1085 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:163
|
1086 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/cron-command/src/Cron_Event_Command.php:433
|
1087 |
msgid "%s minute"
|
1088 |
msgid_plural "%s minutes"
|
1089 |
msgstr[0] ""
|
1090 |
msgstr[1] ""
|
1091 |
|
1092 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:167
|
1093 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/cron-command/src/Cron_Event_Command.php:434
|
1094 |
msgid "%s second"
|
1095 |
msgid_plural "%s seconds"
|
1096 |
msgstr[0] ""
|
@@ -1196,10 +1425,6 @@ msgstr ""
|
|
1196 |
msgid "Complete"
|
1197 |
msgstr ""
|
1198 |
|
1199 |
-
#: vendor/prospress/action-scheduler/classes/ActionScheduler_Store.php:182
|
1200 |
-
msgid "Pending"
|
1201 |
-
msgstr ""
|
1202 |
-
|
1203 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_Store.php:183
|
1204 |
msgid "In-progress"
|
1205 |
msgstr ""
|
@@ -1389,313 +1614,6 @@ msgstr ""
|
|
1389 |
msgid "Action Group"
|
1390 |
msgstr ""
|
1391 |
|
1392 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/basic-theme/exclude/file.php:3
|
1393 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/plugin-include/plugin-include.php:6
|
1394 |
-
msgid "Exclude"
|
1395 |
-
msgstr ""
|
1396 |
-
|
1397 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/plugin-include/include/file.php:2
|
1398 |
-
msgid "Include"
|
1399 |
-
msgstr ""
|
1400 |
-
|
1401 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/add-domain.php:2
|
1402 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:2
|
1403 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:3
|
1404 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:4
|
1405 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-domains.php:2
|
1406 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-domains.php:3
|
1407 |
-
msgid "String"
|
1408 |
-
msgstr ""
|
1409 |
-
|
1410 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:9
|
1411 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:10
|
1412 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:11
|
1413 |
-
msgid "1 Star"
|
1414 |
-
msgid_plural "%s Stars"
|
1415 |
-
msgstr[0] ""
|
1416 |
-
msgstr[1] ""
|
1417 |
-
|
1418 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/translator-comments/translator-comments.php:7
|
1419 |
-
#. translators: A single line translators comment.
|
1420 |
-
msgid "A"
|
1421 |
-
msgstr ""
|
1422 |
-
|
1423 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/translator-comments/translator-comments.php:15
|
1424 |
-
#. translators: A multiline translators comment.
|
1425 |
-
msgid "B"
|
1426 |
-
msgstr ""
|
1427 |
-
|
1428 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/internationalized-plugin.php:11
|
1429 |
-
msgid "This is a dummy plugin"
|
1430 |
-
msgstr ""
|
1431 |
-
|
1432 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/parsers.php:42
|
1433 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/parsers.php:72
|
1434 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/parsers.php:80
|
1435 |
-
msgid "There was an error when reading this WXR file"
|
1436 |
-
msgstr ""
|
1437 |
-
|
1438 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/parsers.php:43
|
1439 |
-
msgid ""
|
1440 |
-
"Details are shown above. The importer will now try again with a different "
|
1441 |
-
"parser..."
|
1442 |
-
msgstr ""
|
1443 |
-
|
1444 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/parsers.php:84
|
1445 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/parsers.php:89
|
1446 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/parsers.php:306
|
1447 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/parsers.php:495
|
1448 |
-
msgid "This does not appear to be a WXR file, missing/invalid WXR version number"
|
1449 |
-
msgstr ""
|
1450 |
-
|
1451 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:132
|
1452 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:141
|
1453 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:192
|
1454 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:196
|
1455 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:205
|
1456 |
-
msgid "Sorry, there has been an error."
|
1457 |
-
msgstr ""
|
1458 |
-
|
1459 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:133
|
1460 |
-
msgid "The file does not exist, please try again."
|
1461 |
-
msgstr ""
|
1462 |
-
|
1463 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:176
|
1464 |
-
msgid "All done."
|
1465 |
-
msgstr ""
|
1466 |
-
|
1467 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:176
|
1468 |
-
msgid "Have fun!"
|
1469 |
-
msgstr ""
|
1470 |
-
|
1471 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:177
|
1472 |
-
msgid "Remember to update the passwords and roles of imported users."
|
1473 |
-
msgstr ""
|
1474 |
-
|
1475 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:197
|
1476 |
-
msgid ""
|
1477 |
-
"The export file could not be found at <code>%s</code>. It is likely that "
|
1478 |
-
"this was caused by a permissions problem."
|
1479 |
-
msgstr ""
|
1480 |
-
|
1481 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:213
|
1482 |
-
msgid ""
|
1483 |
-
"This WXR file (version %s) may not be supported by this version of the "
|
1484 |
-
"importer. Please consider updating."
|
1485 |
-
msgstr ""
|
1486 |
-
|
1487 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:238
|
1488 |
-
msgid ""
|
1489 |
-
"Failed to import author %s. Their posts will be attributed to the current "
|
1490 |
-
"user."
|
1491 |
-
msgstr ""
|
1492 |
-
|
1493 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:264
|
1494 |
-
msgid "Assign Authors"
|
1495 |
-
msgstr ""
|
1496 |
-
|
1497 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:265
|
1498 |
-
msgid ""
|
1499 |
-
"To make it easier for you to edit and save the imported content, you may "
|
1500 |
-
"want to reassign the author of the imported item to an existing user of "
|
1501 |
-
"this site. For example, you may want to import all the entries as "
|
1502 |
-
"<code>admin</code>s entries."
|
1503 |
-
msgstr ""
|
1504 |
-
|
1505 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:267
|
1506 |
-
msgid ""
|
1507 |
-
"If a new user is created by WordPress, a new password will be randomly "
|
1508 |
-
"generated and the new user’s role will be set as %s. Manually "
|
1509 |
-
"changing the new user’s details will be necessary."
|
1510 |
-
msgstr ""
|
1511 |
-
|
1512 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:277
|
1513 |
-
msgid "Import Attachments"
|
1514 |
-
msgstr ""
|
1515 |
-
|
1516 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:280
|
1517 |
-
msgid "Download and import file attachments"
|
1518 |
-
msgstr ""
|
1519 |
-
|
1520 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:284
|
1521 |
-
msgid "Submit"
|
1522 |
-
msgstr ""
|
1523 |
-
|
1524 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:297
|
1525 |
-
msgid "Import author:"
|
1526 |
-
msgstr ""
|
1527 |
-
|
1528 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:308
|
1529 |
-
msgid "or create new user with login name:"
|
1530 |
-
msgstr ""
|
1531 |
-
|
1532 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:311
|
1533 |
-
msgid "as a new user:"
|
1534 |
-
msgstr ""
|
1535 |
-
|
1536 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:319
|
1537 |
-
msgid "assign posts to an existing user:"
|
1538 |
-
msgstr ""
|
1539 |
-
|
1540 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:321
|
1541 |
-
msgid "or assign posts to an existing user:"
|
1542 |
-
msgstr ""
|
1543 |
-
|
1544 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:322
|
1545 |
-
msgid "- Select -"
|
1546 |
-
msgstr ""
|
1547 |
-
|
1548 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:372
|
1549 |
-
msgid ""
|
1550 |
-
"Failed to create new user for %s. Their posts will be attributed to the "
|
1551 |
-
"current user."
|
1552 |
-
msgstr ""
|
1553 |
-
|
1554 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:424
|
1555 |
-
msgid "Failed to import category %s"
|
1556 |
-
msgstr ""
|
1557 |
-
|
1558 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:467
|
1559 |
-
msgid "Failed to import post tag %s"
|
1560 |
-
msgstr ""
|
1561 |
-
|
1562 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:516
|
1563 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:738
|
1564 |
-
msgid "Failed to import %s %s"
|
1565 |
-
msgstr ""
|
1566 |
-
|
1567 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:605
|
1568 |
-
msgid "Failed to import “%s”: Invalid post type %s"
|
1569 |
-
msgstr ""
|
1570 |
-
|
1571 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:642
|
1572 |
-
msgid "%s “%s” already exists."
|
1573 |
-
msgstr ""
|
1574 |
-
|
1575 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:704
|
1576 |
-
msgid "Failed to import %s “%s”"
|
1577 |
-
msgstr ""
|
1578 |
-
|
1579 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:869
|
1580 |
-
msgid "Menu item skipped due to missing menu slug"
|
1581 |
-
msgstr ""
|
1582 |
-
|
1583 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:876
|
1584 |
-
msgid "Menu item skipped due to invalid menu slug: %s"
|
1585 |
-
msgstr ""
|
1586 |
-
|
1587 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:939
|
1588 |
-
msgid "Fetching attachments is not enabled"
|
1589 |
-
msgstr ""
|
1590 |
-
|
1591 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:952
|
1592 |
-
msgid "Invalid file type"
|
1593 |
-
msgstr ""
|
1594 |
-
|
1595 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:996
|
1596 |
-
msgid "Remote server did not respond"
|
1597 |
-
msgstr ""
|
1598 |
-
|
1599 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1002
|
1600 |
-
msgid "Remote server returned error response %1$d %2$s"
|
1601 |
-
msgstr ""
|
1602 |
-
|
1603 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1009
|
1604 |
-
msgid "Remote file is incorrect size"
|
1605 |
-
msgstr ""
|
1606 |
-
|
1607 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1014
|
1608 |
-
msgid "Zero size file downloaded"
|
1609 |
-
msgstr ""
|
1610 |
-
|
1611 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1020
|
1612 |
-
msgid "Remote file is too large, limit is %s"
|
1613 |
-
msgstr ""
|
1614 |
-
|
1615 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1119
|
1616 |
-
msgid "Import WordPress"
|
1617 |
-
msgstr ""
|
1618 |
-
|
1619 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1126
|
1620 |
-
msgid ""
|
1621 |
-
"A new version of this importer is available. Please update to version %s to "
|
1622 |
-
"ensure compatibility with newer export files."
|
1623 |
-
msgstr ""
|
1624 |
-
|
1625 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1141
|
1626 |
-
msgid ""
|
1627 |
-
"Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import "
|
1628 |
-
"the posts, pages, comments, custom fields, categories, and tags into this "
|
1629 |
-
"site."
|
1630 |
-
msgstr ""
|
1631 |
-
|
1632 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1142
|
1633 |
-
msgid "Choose a WXR (.xml) file to upload, then click Upload file and import."
|
1634 |
-
msgstr ""
|
1635 |
-
|
1636 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/plugins/wordpress-importer/wordpress-importer.php:1216
|
1637 |
-
msgid ""
|
1638 |
-
"Import <strong>posts, pages, comments, custom fields, categories, and "
|
1639 |
-
"tags</strong> from a WordPress export file."
|
1640 |
-
msgstr ""
|
1641 |
-
|
1642 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/lucatume/wp-browser/src/data/themedir1/internationalized-theme/functions.php:7
|
1643 |
-
msgid "This is a dummy theme"
|
1644 |
-
msgstr ""
|
1645 |
-
|
1646 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/core-command/src/Core_Command.php:655
|
1647 |
-
msgid "Wildcard DNS may not be configured correctly."
|
1648 |
-
msgstr ""
|
1649 |
-
|
1650 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/entity-command/src/Site_Command.php:118
|
1651 |
-
msgid "Uncategorized"
|
1652 |
-
msgstr ""
|
1653 |
-
|
1654 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/export-command/src/Export_Command.php:339
|
1655 |
-
msgid "Invalid start ID: %d"
|
1656 |
-
msgstr ""
|
1657 |
-
|
1658 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/export-command/src/WP_Export_File_Writer.php:15
|
1659 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/export-command/src/WP_Export_Split_Files_Writer.php:63
|
1660 |
-
msgid "WP Export: error opening %s for writing."
|
1661 |
-
msgstr ""
|
1662 |
-
|
1663 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/export-command/src/WP_Export_File_Writer.php:32
|
1664 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/export-command/src/WP_Export_Split_Files_Writer.php:51
|
1665 |
-
msgid "WP Export: error writing to export file."
|
1666 |
-
msgstr ""
|
1667 |
-
|
1668 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/export-command/src/WP_Export_Query.php:348
|
1669 |
-
msgid "Term is missing a parent: %s (%d)"
|
1670 |
-
msgstr ""
|
1671 |
-
|
1672 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/export-command/src/WP_Export_XML_Over_HTTP.php:19
|
1673 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/export-command/src/WP_Export_XML_Over_HTTP.php:23
|
1674 |
-
msgid "Export Error"
|
1675 |
-
msgstr ""
|
1676 |
-
|
1677 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/extension-command/src/WP_CLI/CommandWithUpgrade.php:607
|
1678 |
-
msgid " Try again"
|
1679 |
-
msgstr ""
|
1680 |
-
|
1681 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/extension-command/src/WP_CLI/CommandWithUpgrade.php:612
|
1682 |
-
msgid "API error. Try Again."
|
1683 |
-
msgstr ""
|
1684 |
-
|
1685 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/media-command/src/Media_Command.php:142
|
1686 |
-
msgid "image"
|
1687 |
-
msgid_plural "images"
|
1688 |
-
msgstr[0] ""
|
1689 |
-
msgstr[1] ""
|
1690 |
-
|
1691 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/wp-cli/php/utils-wp.php:192
|
1692 |
-
msgid "Inactive Widgets"
|
1693 |
-
msgstr ""
|
1694 |
-
|
1695 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/wp-cli/php/utils-wp.php:195
|
1696 |
-
msgid "Drag widgets here to remove them from the sidebar but keep their settings."
|
1697 |
-
msgstr ""
|
1698 |
-
|
1699 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:376
|
1700 |
msgid "Cowabunga"
|
1701 |
msgstr ""
|
@@ -2200,11 +2118,6 @@ msgstr ""
|
|
2200 |
msgid "Displays whether or not tokenization is enabled for this gateway."
|
2201 |
msgstr ""
|
2202 |
|
2203 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php:75
|
2204 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1197
|
2205 |
-
msgid "Debug Mode"
|
2206 |
-
msgstr ""
|
2207 |
-
|
2208 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php:76
|
2209 |
msgid "Displays whether or not debug logging is enabled for this gateway."
|
2210 |
msgstr ""
|
@@ -2217,16 +2130,6 @@ msgstr ""
|
|
2217 |
msgid "Display at Checkout"
|
2218 |
msgstr ""
|
2219 |
|
2220 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php:83
|
2221 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1205
|
2222 |
-
msgid "Save to Log"
|
2223 |
-
msgstr ""
|
2224 |
-
|
2225 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php:85
|
2226 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1203
|
2227 |
-
msgid "Off"
|
2228 |
-
msgstr ""
|
2229 |
-
|
2230 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-order-partial-capture.php:30
|
2231 |
msgid "Authorization total"
|
2232 |
msgstr ""
|
@@ -2389,11 +2292,6 @@ msgstr ""
|
|
2389 |
msgid "Apple Pay"
|
2390 |
msgstr ""
|
2391 |
|
2392 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:107
|
2393 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1143
|
2394 |
-
msgid "Enable / Disable"
|
2395 |
-
msgstr ""
|
2396 |
-
|
2397 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:108
|
2398 |
msgid "Accept Apple Pay"
|
2399 |
msgstr ""
|
@@ -2528,14 +2426,6 @@ msgstr ""
|
|
2528 |
msgid "Subtotal"
|
2529 |
msgstr ""
|
2530 |
|
2531 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:565
|
2532 |
-
msgid "Shipping"
|
2533 |
-
msgstr ""
|
2534 |
-
|
2535 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:575
|
2536 |
-
msgid "Fees"
|
2537 |
-
msgstr ""
|
2538 |
-
|
2539 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:585
|
2540 |
msgid "Taxes"
|
2541 |
msgstr ""
|
@@ -3027,52 +2917,6 @@ msgstr ""
|
|
3027 |
msgid "Pay securely using your checking account."
|
3028 |
msgstr ""
|
3029 |
|
3030 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1144
|
3031 |
-
msgid "Enable this gateway"
|
3032 |
-
msgstr ""
|
3033 |
-
|
3034 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1150
|
3035 |
-
msgid "Title"
|
3036 |
-
msgstr ""
|
3037 |
-
|
3038 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1152
|
3039 |
-
msgid "Payment method title that the customer will see during checkout."
|
3040 |
-
msgstr ""
|
3041 |
-
|
3042 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1157
|
3043 |
-
msgid "Description"
|
3044 |
-
msgstr ""
|
3045 |
-
|
3046 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1159
|
3047 |
-
msgid "Payment method description that the customer will see during checkout."
|
3048 |
-
msgstr ""
|
3049 |
-
|
3050 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1188
|
3051 |
-
msgid "Detailed Decline Messages"
|
3052 |
-
msgstr ""
|
3053 |
-
|
3054 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1190
|
3055 |
-
msgid ""
|
3056 |
-
"Check to enable detailed decline messages to the customer during checkout "
|
3057 |
-
"when possible, rather than a generic decline message."
|
3058 |
-
msgstr ""
|
3059 |
-
|
3060 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1200
|
3061 |
-
#. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
|
3062 |
-
msgid ""
|
3063 |
-
"Show Detailed Error Messages and API requests/responses on the checkout "
|
3064 |
-
"page and/or save them to the %1$sdebug log%2$s"
|
3065 |
-
msgstr ""
|
3066 |
-
|
3067 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1204
|
3068 |
-
msgid "Show on Checkout Page"
|
3069 |
-
msgstr ""
|
3070 |
-
|
3071 |
-
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1207
|
3072 |
-
#. translators: show debugging information on both checkout page and in the log
|
3073 |
-
msgid "Both"
|
3074 |
-
msgstr ""
|
3075 |
-
|
3076 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1270
|
3077 |
msgid "Select the gateway environment to use for transactions."
|
3078 |
msgstr ""
|
@@ -3440,27 +3284,6 @@ msgctxt "Admin menu name"
|
|
3440 |
msgid "Scheduled Actions"
|
3441 |
msgstr ""
|
3442 |
|
3443 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:6
|
3444 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:7
|
3445 |
-
#: vendor/skyverge/wc-plugin-framework/node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-all-domains.php:8
|
3446 |
-
msgctxt "a string"
|
3447 |
-
msgid "String"
|
3448 |
-
msgstr ""
|
3449 |
-
|
3450 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/core-command/src/Core_Command.php:431
|
3451 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/core-command/src/Core_Command.php:505
|
3452 |
-
#. translators: placeholder is blog name
|
3453 |
-
#. translators: placeholder is user supplied title
|
3454 |
-
msgctxt "Default network name"
|
3455 |
-
msgid "%s Sites"
|
3456 |
-
msgstr ""
|
3457 |
-
|
3458 |
-
#: vendor/skyverge/wc-plugin-framework/vendor/wp-cli/entity-command/src/Site_Command.php:121
|
3459 |
-
#. translators: Default category slug
|
3460 |
-
msgctxt "Default category slug"
|
3461 |
-
msgid "Uncategorized"
|
3462 |
-
msgstr ""
|
3463 |
-
|
3464 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php:397
|
3465 |
msgctxt "enhanced select"
|
3466 |
msgid "No matches found"
|
1 |
+
# Copyright (C) 2021 WooCommerce
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Square 2.3.0\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-square\n"
|
8 |
+
"POT-Creation-Date: 2021-02-02 00:43:23+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
|
15 |
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
69 |
msgstr ""
|
70 |
|
71 |
#: includes/Admin/Privacy.php:45 includes/Admin/Settings_Page.php:55
|
72 |
+
#: includes/Gateway.php:80 includes/Settings.php:223 includes/Settings.php:757
|
73 |
msgid "Square"
|
74 |
msgstr ""
|
75 |
|
434 |
msgstr ""
|
435 |
|
436 |
#: includes/Gateway/API/Requests/Orders.php:88
|
437 |
+
#: includes/Gateway/Digital_Wallet.php:411
|
438 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:555
|
439 |
msgid "Discount"
|
440 |
msgstr ""
|
444 |
msgid "Adjustment"
|
445 |
msgstr ""
|
446 |
|
447 |
+
#: includes/Gateway/Digital_Wallet.php:110
|
448 |
+
#. Translators: %1$s: expected location of apple pay verification file, %2$s:
|
449 |
+
#. opening href tag with link to Square documentation, %3$s: closing href tag
|
450 |
+
msgid ""
|
451 |
+
"Apple Pay is not available with Square. We cannot confirm the Apple Pay "
|
452 |
+
"domain verification file is at the expected location: %1$s. For more "
|
453 |
+
"information, please read our documentation on %2$sSetting up Apple Pay%3$s."
|
454 |
+
msgstr ""
|
455 |
+
|
456 |
+
#: includes/Gateway/Digital_Wallet.php:126
|
457 |
+
#. Translators: %1$s: opening bold tags, %2$s: closing strong/bold tags, %3$s:
|
458 |
+
#. expected location of apple pay verification file, %4$s: opening href tag
|
459 |
+
#. with link to Square documentation, %5$s: closing href tag
|
460 |
+
msgid ""
|
461 |
+
"Apple Pay is not available with Square - there was a problem with "
|
462 |
+
"registering your store domain with Square/Apple Pay. %1$sView the Square "
|
463 |
+
"logs%2$s to find out what caused the registration to fail."
|
464 |
msgstr ""
|
465 |
|
466 |
+
#: includes/Gateway/Digital_Wallet.php:174
|
467 |
+
msgid "OR"
|
468 |
+
msgstr ""
|
469 |
+
|
470 |
+
#: includes/Gateway/Digital_Wallet.php:204
|
471 |
+
#: includes/Gateway/Payment_Form.php:240 includes/Gateway.php:245
|
472 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:216
|
473 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:2758
|
474 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:376
|
475 |
msgid "An error occurred, please try again or try an alternate form of payment."
|
476 |
msgstr ""
|
477 |
|
478 |
+
#: includes/Gateway/Digital_Wallet.php:269
|
479 |
+
#. translators: product ID
|
480 |
+
msgid "Product with the ID (%d) cannot be found."
|
481 |
+
msgstr ""
|
482 |
+
|
483 |
+
#: includes/Gateway/Digital_Wallet.php:285
|
484 |
+
#. translators: 1: product name 2: quantity in stock
|
485 |
+
msgid ""
|
486 |
+
"You cannot add that amount of \"%1$s\"; to the cart because there is not "
|
487 |
+
"enough stock (%2$s remaining)."
|
488 |
+
msgstr ""
|
489 |
+
|
490 |
+
#: includes/Gateway/Digital_Wallet.php:307
|
491 |
+
#: includes/Gateway/Digital_Wallet.php:403
|
492 |
+
msgid "Tax"
|
493 |
+
msgstr ""
|
494 |
+
|
495 |
+
#: includes/Gateway/Digital_Wallet.php:342
|
496 |
+
msgid "This payment method cannot be used for multiple shipments."
|
497 |
+
msgstr ""
|
498 |
+
|
499 |
+
#: includes/Gateway/Digital_Wallet.php:353
|
500 |
+
#: vendor/prospress/action-scheduler/classes/ActionScheduler_Store.php:182
|
501 |
+
msgid "Pending"
|
502 |
+
msgstr ""
|
503 |
+
|
504 |
+
#: includes/Gateway/Digital_Wallet.php:395
|
505 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:565
|
506 |
+
msgid "Shipping"
|
507 |
+
msgstr ""
|
508 |
+
|
509 |
+
#: includes/Gateway/Digital_Wallet.php:419
|
510 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:575
|
511 |
+
msgid "Fees"
|
512 |
+
msgstr ""
|
513 |
+
|
514 |
+
#: includes/Gateway/Digital_Wallet.php:453
|
515 |
+
msgid ""
|
516 |
+
"Invalid request. Could not fetch the payment request data to be use in the "
|
517 |
+
"Square digital wallet."
|
518 |
+
msgstr ""
|
519 |
+
|
520 |
+
#: includes/Gateway/Digital_Wallet.php:647
|
521 |
+
msgid "Empty cart"
|
522 |
+
msgstr ""
|
523 |
+
|
524 |
+
#: includes/Gateway/Digital_Wallet.php:776
|
525 |
+
msgid "Unable to verify domain - missing access token."
|
526 |
+
msgstr ""
|
527 |
+
|
528 |
+
#: includes/Gateway/Payment_Form.php:182
|
529 |
+
msgid "Postal code"
|
530 |
+
msgstr ""
|
531 |
+
|
532 |
+
#: includes/Gateway.php:81
|
533 |
msgid "Allow customers to use Square to securely pay with their credit cards"
|
534 |
msgstr ""
|
535 |
|
536 |
+
#: includes/Gateway.php:443
|
537 |
msgid "Refunds must be made within %s of the original payment date."
|
538 |
msgstr ""
|
539 |
|
540 |
+
#: includes/Gateway.php:467
|
541 |
msgid ""
|
542 |
"Could not find original transaction tender. Please refund this transaction "
|
543 |
"from your Square dashboard."
|
544 |
msgstr ""
|
545 |
|
546 |
+
#: includes/Gateway.php:580 includes/Gateway.php:750
|
547 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:107
|
548 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1143
|
549 |
+
msgid "Enable / Disable"
|
550 |
+
msgstr ""
|
551 |
+
|
552 |
+
#: includes/Gateway.php:581
|
553 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1144
|
554 |
+
msgid "Enable this gateway"
|
555 |
+
msgstr ""
|
556 |
+
|
557 |
+
#: includes/Gateway.php:587
|
558 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1150
|
559 |
+
msgid "Title"
|
560 |
+
msgstr ""
|
561 |
+
|
562 |
+
#: includes/Gateway.php:589
|
563 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1152
|
564 |
+
msgid "Payment method title that the customer will see during checkout."
|
565 |
+
msgstr ""
|
566 |
+
|
567 |
+
#: includes/Gateway.php:594
|
568 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1157
|
569 |
+
msgid "Description"
|
570 |
+
msgstr ""
|
571 |
+
|
572 |
+
#: includes/Gateway.php:596
|
573 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1159
|
574 |
+
msgid "Payment method description that the customer will see during checkout."
|
575 |
+
msgstr ""
|
576 |
+
|
577 |
+
#: includes/Gateway.php:623
|
578 |
+
msgid "Advanced Settings"
|
579 |
+
msgstr ""
|
580 |
+
|
581 |
+
#: includes/Gateway.php:630
|
582 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1188
|
583 |
+
msgid "Detailed Decline Messages"
|
584 |
+
msgstr ""
|
585 |
+
|
586 |
+
#: includes/Gateway.php:632
|
587 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1190
|
588 |
+
msgid ""
|
589 |
+
"Check to enable detailed decline messages to the customer during checkout "
|
590 |
+
"when possible, rather than a generic decline message."
|
591 |
+
msgstr ""
|
592 |
+
|
593 |
+
#: includes/Gateway.php:639
|
594 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php:75
|
595 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1197
|
596 |
+
msgid "Debug Mode"
|
597 |
+
msgstr ""
|
598 |
+
|
599 |
+
#: includes/Gateway.php:642
|
600 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1200
|
601 |
+
#. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
|
602 |
+
msgid ""
|
603 |
+
"Show Detailed Error Messages and API requests/responses on the checkout "
|
604 |
+
"page and/or save them to the %1$sdebug log%2$s"
|
605 |
+
msgstr ""
|
606 |
+
|
607 |
+
#: includes/Gateway.php:645
|
608 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php:85
|
609 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1203
|
610 |
+
msgid "Off"
|
611 |
+
msgstr ""
|
612 |
+
|
613 |
+
#: includes/Gateway.php:646
|
614 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1204
|
615 |
+
msgid "Show on Checkout Page"
|
616 |
+
msgstr ""
|
617 |
+
|
618 |
+
#: includes/Gateway.php:647
|
619 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php:83
|
620 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1205
|
621 |
+
msgid "Save to Log"
|
622 |
+
msgstr ""
|
623 |
+
|
624 |
+
#: includes/Gateway.php:649
|
625 |
+
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1207
|
626 |
+
#. translators: show debugging information on both checkout page and in the log
|
627 |
+
msgid "Both"
|
628 |
+
msgstr ""
|
629 |
+
|
630 |
+
#: includes/Gateway.php:685
|
631 |
msgid "Customer Profiles"
|
632 |
msgstr ""
|
633 |
|
634 |
+
#: includes/Gateway.php:686
|
635 |
+
msgid ""
|
636 |
+
"Check to enable tokenization and allow customers to securely save their "
|
637 |
+
"payment details for future checkout."
|
638 |
+
msgstr ""
|
639 |
+
|
640 |
+
#: includes/Gateway.php:744
|
641 |
+
msgid "Digital Wallet Settings"
|
642 |
+
msgstr ""
|
643 |
+
|
644 |
+
#: includes/Gateway.php:745
|
645 |
+
msgid "Take payments on your store with Apple Pay and Google Pay."
|
646 |
+
msgstr ""
|
647 |
+
|
648 |
+
#: includes/Gateway.php:752
|
649 |
+
#. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
|
650 |
+
msgid ""
|
651 |
+
"Allow customers to pay with Apple Pay or Google Pay from your Product, Cart "
|
652 |
+
"and Checkout pages. Read more about the availablity of digital wallets in "
|
653 |
+
"our %1$sdocumentation%2$s."
|
654 |
+
msgstr ""
|
655 |
+
|
656 |
+
#: includes/Gateway.php:755
|
657 |
+
msgid "Enable digital wallets"
|
658 |
+
msgstr ""
|
659 |
+
|
660 |
+
#: includes/Gateway.php:759
|
661 |
+
msgid "Button Type"
|
662 |
+
msgstr ""
|
663 |
+
|
664 |
+
#: includes/Gateway.php:760
|
665 |
+
msgid ""
|
666 |
+
"This setting only applies to the Apple Pay button. When Google Pay is "
|
667 |
+
"available, the Google Pay button will always have the \"Buy with\" button "
|
668 |
+
"text."
|
669 |
+
msgstr ""
|
670 |
+
|
671 |
+
#: includes/Gateway.php:761
|
672 |
+
msgid "Select which text is displayed on the digital wallet buttons."
|
673 |
+
msgstr ""
|
674 |
+
|
675 |
+
#: includes/Gateway.php:773
|
676 |
+
msgid "Apple Pay Button Color"
|
677 |
+
msgstr ""
|
678 |
+
|
679 |
+
#: includes/Gateway.php:774
|
680 |
+
msgid "Select the color of the Apple Pay button."
|
681 |
+
msgstr ""
|
682 |
+
|
683 |
+
#: includes/Gateway.php:786
|
684 |
+
msgid "Google Pay Button Color"
|
685 |
+
msgstr ""
|
686 |
+
|
687 |
+
#: includes/Gateway.php:787
|
688 |
+
msgid "Select the color of the Google Pay button."
|
689 |
+
msgstr ""
|
690 |
+
|
691 |
+
#: includes/Gateway.php:798
|
692 |
+
msgid "Hide Digital Wallet Buttons"
|
693 |
+
msgstr ""
|
694 |
+
|
695 |
+
#: includes/Gateway.php:799
|
696 |
+
msgid ""
|
697 |
+
"Select any digital wallet buttons you don't want to be displayed on your "
|
698 |
+
"store."
|
699 |
+
msgstr ""
|
700 |
+
|
701 |
+
#: includes/Gateway.php:1082
|
702 |
msgid " An error occurred, please try again or try an alternate form of payment."
|
703 |
msgstr ""
|
704 |
|
801 |
msgid "This product"
|
802 |
msgstr ""
|
803 |
|
804 |
+
#: includes/Handlers/Products.php:677
|
805 |
#. translators: Placeholder: %1$s - date (localized), %2$s - time (localized),
|
806 |
#. %3$s - opening <a> HTML link tag, %4$s closing </a> HTML link tag
|
807 |
msgid ""
|
817 |
msgstr[0] ""
|
818 |
msgstr[1] ""
|
819 |
|
820 |
+
#: includes/Lifecycle.php:185
|
821 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:374
|
822 |
msgid "Awesome"
|
823 |
msgstr ""
|
824 |
|
825 |
+
#: includes/Lifecycle.php:186
|
826 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:377
|
827 |
msgid "Congratulations"
|
828 |
msgstr ""
|
829 |
|
830 |
+
#: includes/Lifecycle.php:187
|
831 |
msgid "Great"
|
832 |
msgstr ""
|
833 |
|
834 |
+
#: includes/Lifecycle.php:188
|
835 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:375
|
836 |
msgid "Fantastic"
|
837 |
msgstr ""
|
838 |
|
839 |
+
#: includes/Lifecycle.php:195
|
840 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:385
|
841 |
#. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
|
842 |
#. tag, %4$s - <a> tag, %5$s - </a> tag
|
1101 |
msgid "Import all products from Square"
|
1102 |
msgstr ""
|
1103 |
|
1104 |
+
#: includes/Sync/Interval_Polling.php:101
|
1105 |
msgid "Updated data for %d category."
|
1106 |
msgid_plural "Updated data for %d categories."
|
1107 |
msgstr[0] ""
|
1108 |
msgstr[1] ""
|
1109 |
|
1110 |
+
#: includes/Sync/Interval_Polling.php:111
|
1111 |
+
msgid ""
|
1112 |
+
"Product category data could not be updated from Square. Invalid API "
|
1113 |
+
"response."
|
1114 |
+
msgstr ""
|
1115 |
+
|
1116 |
+
#: includes/Sync/Manual_Synchronization.php:1141
|
1117 |
#. translators: Placeholder: %s - product ID
|
1118 |
msgid "Product %s could not be updated in Square."
|
1119 |
msgstr ""
|
1120 |
|
1121 |
+
#: includes/Sync/Product_Import.php:560
|
1122 |
#. translators: Placeholders: %1$s - Square item name, %2$s - Square item
|
1123 |
#. variation name, %3$s - failure reason
|
1124 |
msgid "Could not import \"%1$s - %2$s\" from Square. %3$s"
|
1125 |
msgstr ""
|
1126 |
|
1127 |
+
#: includes/Sync/Product_Import.php:605
|
1128 |
#. translators: Placeholders: %1$s - Square item name, %2$s - failure reason
|
1129 |
msgid "Could not import \"%1$s\" from Square. %2$s"
|
1130 |
msgstr ""
|
1131 |
|
1132 |
+
#: includes/Sync/Product_Import.php:634
|
1133 |
msgid "Items with variable pricing cannot be imported."
|
1134 |
msgstr ""
|
1135 |
|
1136 |
+
#: includes/Sync/Product_Import.php:638
|
1137 |
+
msgid "Variations with missing SKUs cannot be imported."
|
1138 |
+
msgstr ""
|
1139 |
+
|
1140 |
+
#: includes/Sync/Product_Import.php:731 includes/Sync/Product_Import.php:1002
|
1141 |
msgid "The SKU already exists on another product"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
+
#: includes/Sync/Product_Import.php:918
|
1145 |
#. translators: Placeholders: %1$s - variation ID, %2$s - product name
|
1146 |
msgid "Variation #%1$s of %2$s"
|
1147 |
msgstr ""
|
1148 |
|
1149 |
+
#: includes/Sync/Product_Import.php:1296
|
1150 |
#. translators: Placeholders: %s - missing parameter name
|
1151 |
msgid "Missing parameter %s"
|
1152 |
msgstr ""
|
1153 |
|
1154 |
+
#: includes/Sync/Product_Import.php:1302
|
1155 |
#. translators: Placeholders: %s - comma separated list of valid product types
|
1156 |
msgid "Invalid product type - the product type must be any of these: %s"
|
1157 |
msgstr ""
|
1158 |
|
1159 |
+
#: includes/Sync/Product_Import.php:1353
|
1160 |
#. translators: Placeholders: %1$s - Square item name, %2$s - Failure reason
|
1161 |
msgid "Could not update %1$s from Square. %2$s"
|
1162 |
msgstr ""
|
1163 |
|
1164 |
+
#: includes/Sync/Product_Import.php:1356
|
1165 |
#. translators: Placeholders: %1$s - Square item name, %2$s - Failure reason
|
1166 |
msgid "Could not import %1$s from Square. %2$s"
|
1167 |
msgstr ""
|
1284 |
msgstr ""
|
1285 |
|
1286 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:143
|
|
|
1287 |
msgid "%s year"
|
1288 |
msgid_plural "%s years"
|
1289 |
msgstr[0] ""
|
1290 |
msgstr[1] ""
|
1291 |
|
1292 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:147
|
|
|
1293 |
msgid "%s month"
|
1294 |
msgid_plural "%s months"
|
1295 |
msgstr[0] ""
|
1296 |
msgstr[1] ""
|
1297 |
|
1298 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:151
|
|
|
1299 |
msgid "%s week"
|
1300 |
msgid_plural "%s weeks"
|
1301 |
msgstr[0] ""
|
1302 |
msgstr[1] ""
|
1303 |
|
1304 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:155
|
|
|
1305 |
msgid "%s day"
|
1306 |
msgid_plural "%s days"
|
1307 |
msgstr[0] ""
|
1308 |
msgstr[1] ""
|
1309 |
|
1310 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:159
|
|
|
1311 |
msgid "%s hour"
|
1312 |
msgid_plural "%s hours"
|
1313 |
msgstr[0] ""
|
1314 |
msgstr[1] ""
|
1315 |
|
1316 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:163
|
|
|
1317 |
msgid "%s minute"
|
1318 |
msgid_plural "%s minutes"
|
1319 |
msgstr[0] ""
|
1320 |
msgstr[1] ""
|
1321 |
|
1322 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_ListTable.php:167
|
|
|
1323 |
msgid "%s second"
|
1324 |
msgid_plural "%s seconds"
|
1325 |
msgstr[0] ""
|
1425 |
msgid "Complete"
|
1426 |
msgstr ""
|
1427 |
|
|
|
|
|
|
|
|
|
1428 |
#: vendor/prospress/action-scheduler/classes/ActionScheduler_Store.php:183
|
1429 |
msgid "In-progress"
|
1430 |
msgstr ""
|
1614 |
msgid "Action Group"
|
1615 |
msgstr ""
|
1616 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1617 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/Lifecycle.php:376
|
1618 |
msgid "Cowabunga"
|
1619 |
msgstr ""
|
2118 |
msgid "Displays whether or not tokenization is enabled for this gateway."
|
2119 |
msgstr ""
|
2120 |
|
|
|
|
|
|
|
|
|
|
|
2121 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php:76
|
2122 |
msgid "Displays whether or not debug logging is enabled for this gateway."
|
2123 |
msgstr ""
|
2130 |
msgid "Display at Checkout"
|
2131 |
msgstr ""
|
2132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2133 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-order-partial-capture.php:30
|
2134 |
msgid "Authorization total"
|
2135 |
msgstr ""
|
2292 |
msgid "Apple Pay"
|
2293 |
msgstr ""
|
2294 |
|
|
|
|
|
|
|
|
|
|
|
2295 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:108
|
2296 |
msgid "Accept Apple Pay"
|
2297 |
msgstr ""
|
2426 |
msgid "Subtotal"
|
2427 |
msgstr ""
|
2428 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2429 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:585
|
2430 |
msgid "Taxes"
|
2431 |
msgstr ""
|
2917 |
msgid "Pay securely using your checking account."
|
2918 |
msgstr ""
|
2919 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2920 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:1270
|
2921 |
msgid "Select the gateway environment to use for transactions."
|
2922 |
msgstr ""
|
3284 |
msgid "Scheduled Actions"
|
3285 |
msgstr ""
|
3286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3287 |
#: vendor/skyverge/wc-plugin-framework/woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php:397
|
3288 |
msgctxt "enhanced select"
|
3289 |
msgid "No matches found"
|
includes/Gateway.php
CHANGED
@@ -32,6 +32,7 @@ use WooCommerce\Square\Gateway\Customer_Helper;
|
|
32 |
use WooCommerce\Square\Gateway\Payment_Form;
|
33 |
use WooCommerce\Square\Handlers\Product;
|
34 |
use WooCommerce\Square\Utilities\Money_Utility;
|
|
|
35 |
|
36 |
/**
|
37 |
* The Square payment gateway class.
|
@@ -108,10 +109,13 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
108 |
add_action( 'woocommerce_new_order_item', array( $this, 'store_new_order_item_square_meta' ), 10, 3 );
|
109 |
|
110 |
// restore refunded Square inventory
|
111 |
-
add_action( '
|
112 |
|
113 |
// AJAX Checkout validation handler.
|
114 |
add_action( 'wc_ajax_' . $this->get_id() . '_checkout_handler', array( $this, 'wc_ajax_square_checkout_handler' ) );
|
|
|
|
|
|
|
115 |
}
|
116 |
|
117 |
|
@@ -190,8 +194,8 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
190 |
* @since 2.0.0
|
191 |
*/
|
192 |
protected function enqueue_gateway_assets() {
|
193 |
-
// bail if *not* on add payment method page or checkout page
|
194 |
-
if ( ! ( is_add_payment_method_page() || is_checkout() ) ) {
|
195 |
return;
|
196 |
}
|
197 |
|
@@ -479,6 +483,7 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
479 |
* @param int $refund_id refund ID
|
480 |
*/
|
481 |
public function restore_refunded_inventory( $order_id, $refund_id ) {
|
|
|
482 |
|
483 |
// no handling if inventory sync is disabled
|
484 |
if ( ! $this->get_plugin()->get_settings_handler()->is_inventory_sync_enabled() ) {
|
@@ -487,40 +492,41 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
487 |
|
488 |
$order = wc_get_order( $order_id );
|
489 |
|
490 |
-
if ( ! $order instanceof \WC_Order ) {
|
491 |
-
return;
|
492 |
-
}
|
493 |
-
|
494 |
// check that the order was paid using our gateway
|
495 |
-
if ( $order->get_payment_method() !== $this->get_id() ) {
|
496 |
return;
|
497 |
}
|
498 |
|
499 |
-
|
500 |
-
|
501 |
-
if ( ! $refund instanceof \WC_Order_Refund ) {
|
502 |
return;
|
503 |
}
|
504 |
|
505 |
-
|
506 |
-
|
507 |
-
if ( ! $item instanceof \WC_Order_Item_Product ) {
|
508 |
-
continue;
|
509 |
-
}
|
510 |
-
|
511 |
-
// if this item has an associated Square ID, send a stock adjustment
|
512 |
-
if ( $square_id = $item->get_meta( Product::SQUARE_VARIATION_ID_META_KEY ) ) {
|
513 |
|
514 |
-
|
515 |
|
516 |
-
|
|
|
|
|
517 |
|
518 |
-
|
|
|
519 |
|
520 |
-
|
|
|
|
|
|
|
521 |
}
|
522 |
}
|
523 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
}
|
525 |
|
526 |
|
@@ -560,6 +566,107 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
560 |
/** Admin methods *************************************************************************************************/
|
561 |
|
562 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
/**
|
564 |
* Adds the tokenization form fields to the gateway settings.
|
565 |
*
|
@@ -576,6 +683,7 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
576 |
|
577 |
if ( ! empty( $form_fields['tokenization'] ) ) {
|
578 |
$form_fields['tokenization']['title'] = __( 'Customer Profiles', 'woocommerce-square' );
|
|
|
579 |
}
|
580 |
|
581 |
return $form_fields;
|
@@ -623,6 +731,83 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
623 |
return $form_fields;
|
624 |
}
|
625 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
626 |
|
627 |
/** Conditional methods *******************************************************************************************/
|
628 |
|
@@ -694,6 +879,22 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
694 |
return apply_filters( 'wc_square_is_3d_secure_enabled', $sca_enabled_currencies, $this );
|
695 |
}
|
696 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
697 |
|
698 |
/** Getter methods ************************************************************************************************/
|
699 |
|
@@ -934,7 +1135,7 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
|
|
934 |
// keep track of the retry count
|
935 |
$this->update_order_meta( $order, 'retry_count', $retry_count );
|
936 |
|
937 |
-
$order->unique_transaction_ref = $order_id . ( $retry_count >= 0 ? '
|
938 |
return $order;
|
939 |
}
|
940 |
}
|
32 |
use WooCommerce\Square\Gateway\Payment_Form;
|
33 |
use WooCommerce\Square\Handlers\Product;
|
34 |
use WooCommerce\Square\Utilities\Money_Utility;
|
35 |
+
use WooCommerce\Square\Gateway\Digital_Wallet;
|
36 |
|
37 |
/**
|
38 |
* The Square payment gateway class.
|
109 |
add_action( 'woocommerce_new_order_item', array( $this, 'store_new_order_item_square_meta' ), 10, 3 );
|
110 |
|
111 |
// restore refunded Square inventory
|
112 |
+
add_action( 'woocommerce_order_refunded', array( $this, 'restore_refunded_inventory' ), 10, 2 );
|
113 |
|
114 |
// AJAX Checkout validation handler.
|
115 |
add_action( 'wc_ajax_' . $this->get_id() . '_checkout_handler', array( $this, 'wc_ajax_square_checkout_handler' ) );
|
116 |
+
|
117 |
+
// Init Square digital wallets
|
118 |
+
new Digital_Wallet( $this );
|
119 |
}
|
120 |
|
121 |
|
194 |
* @since 2.0.0
|
195 |
*/
|
196 |
protected function enqueue_gateway_assets() {
|
197 |
+
// bail if *not* on add payment method page or checkout page or not on the product or cart when digital wallets are enabled
|
198 |
+
if ( ! ( is_add_payment_method_page() || is_checkout() || ( 'yes' === $this->get_option( 'enable_digital_wallets', 'yes' ) && ( is_product() || is_cart() ) ) ) ) {
|
199 |
return;
|
200 |
}
|
201 |
|
483 |
* @param int $refund_id refund ID
|
484 |
*/
|
485 |
public function restore_refunded_inventory( $order_id, $refund_id ) {
|
486 |
+
$inventory_adjustments = array();
|
487 |
|
488 |
// no handling if inventory sync is disabled
|
489 |
if ( ! $this->get_plugin()->get_settings_handler()->is_inventory_sync_enabled() ) {
|
492 |
|
493 |
$order = wc_get_order( $order_id );
|
494 |
|
|
|
|
|
|
|
|
|
495 |
// check that the order was paid using our gateway
|
496 |
+
if ( ! $order instanceof \WC_Order || $order->get_payment_method() !== $this->get_id() ) {
|
497 |
return;
|
498 |
}
|
499 |
|
500 |
+
// don't refund items if the "Restock refunded items" option is unchecked - maintains backwards compatibility if this function is called outside of the `woocommerce_order_refunded` do_action
|
501 |
+
if ( check_ajax_referer( 'order-item', 'security', false ) && isset( $_POST['restock_refunded_items'] ) && 'false' === $_POST['restock_refunded_items'] ) {
|
|
|
502 |
return;
|
503 |
}
|
504 |
|
505 |
+
$refund = wc_get_order( $refund_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
|
507 |
+
if ( $refund instanceof \WC_Order_Refund ) {
|
508 |
|
509 |
+
foreach ( $refund->get_items() as $item ) {
|
510 |
+
if ( $item->is_type( 'line_item' ) ) {
|
511 |
+
$product = $item->get_product();
|
512 |
|
513 |
+
if ( $product ) {
|
514 |
+
$inventory_adjustment = Product::get_inventory_change_adjustment_type( $product, absint( $item->get_quantity() ) );
|
515 |
|
516 |
+
if ( ! empty( $inventory_adjustment ) ) {
|
517 |
+
$inventory_adjustments[] = $inventory_adjustment;
|
518 |
+
}
|
519 |
+
}
|
520 |
}
|
521 |
}
|
522 |
}
|
523 |
+
|
524 |
+
if ( ! empty( $inventory_adjustments ) ) {
|
525 |
+
wc_square()->get_api()->batch_change_inventory(
|
526 |
+
wc_square()->get_idempotency_key( $refund_id . '_' . time() . '_change_inventory' ),
|
527 |
+
$inventory_adjustments
|
528 |
+
);
|
529 |
+
}
|
530 |
}
|
531 |
|
532 |
|
566 |
/** Admin methods *************************************************************************************************/
|
567 |
|
568 |
|
569 |
+
/**
|
570 |
+
* Initialize payment gateway settings fields
|
571 |
+
*
|
572 |
+
* @since 2.3.0
|
573 |
+
* @see WC_Settings_API::init_form_fields()
|
574 |
+
*/
|
575 |
+
public function init_form_fields() {
|
576 |
+
|
577 |
+
// common top form fields
|
578 |
+
$this->form_fields = array(
|
579 |
+
'enabled' => array(
|
580 |
+
'title' => esc_html__( 'Enable / Disable', 'woocommerce-square' ),
|
581 |
+
'label' => esc_html__( 'Enable this gateway', 'woocommerce-square' ),
|
582 |
+
'type' => 'checkbox',
|
583 |
+
'default' => 'no',
|
584 |
+
),
|
585 |
+
|
586 |
+
'title' => array(
|
587 |
+
'title' => esc_html__( 'Title', 'woocommerce-square' ),
|
588 |
+
'type' => 'text',
|
589 |
+
'desc_tip' => esc_html__( 'Payment method title that the customer will see during checkout.', 'woocommerce-square' ),
|
590 |
+
'default' => $this->get_default_title(),
|
591 |
+
),
|
592 |
+
|
593 |
+
'description' => array(
|
594 |
+
'title' => esc_html__( 'Description', 'woocommerce-square' ),
|
595 |
+
'type' => 'textarea',
|
596 |
+
'desc_tip' => esc_html__( 'Payment method description that the customer will see during checkout.', 'woocommerce-square' ),
|
597 |
+
'default' => $this->get_default_description(),
|
598 |
+
),
|
599 |
+
|
600 |
+
);
|
601 |
+
|
602 |
+
// both credit card authorization & charge supported
|
603 |
+
if ( $this->supports_credit_card_authorization() && $this->supports_credit_card_charge() ) {
|
604 |
+
$this->form_fields = $this->add_authorization_charge_form_fields( $this->form_fields );
|
605 |
+
}
|
606 |
+
|
607 |
+
// card types support
|
608 |
+
if ( $this->supports_card_types() ) {
|
609 |
+
$this->form_fields = $this->add_card_types_form_fields( $this->form_fields );
|
610 |
+
}
|
611 |
+
|
612 |
+
// tokenization support
|
613 |
+
if ( $this->supports_tokenization() ) {
|
614 |
+
$this->form_fields = $this->add_tokenization_form_fields( $this->form_fields );
|
615 |
+
}
|
616 |
+
|
617 |
+
// Square digital wallet (Apple Pay and Google Pay settings)
|
618 |
+
if ( $this->is_digital_wallet_available() ) {
|
619 |
+
$this->form_fields = $this->add_digital_wallets_form_fields( $this->form_fields );
|
620 |
+
}
|
621 |
+
|
622 |
+
$this->form_fields['advanced_settings_title'] = array(
|
623 |
+
'title' => esc_html__( 'Advanced Settings', 'woocommerce-square' ),
|
624 |
+
'type' => 'title',
|
625 |
+
);
|
626 |
+
|
627 |
+
// add "detailed customer decline messages" option if the feature is supported
|
628 |
+
if ( $this->supports( self::FEATURE_DETAILED_CUSTOMER_DECLINE_MESSAGES ) ) {
|
629 |
+
$this->form_fields['enable_customer_decline_messages'] = array(
|
630 |
+
'title' => esc_html__( 'Detailed Decline Messages', 'woocommerce-square' ),
|
631 |
+
'type' => 'checkbox',
|
632 |
+
'label' => esc_html__( 'Check to enable detailed decline messages to the customer during checkout when possible, rather than a generic decline message.', 'woocommerce-square' ),
|
633 |
+
'default' => 'no',
|
634 |
+
);
|
635 |
+
}
|
636 |
+
|
637 |
+
// debug mode
|
638 |
+
$this->form_fields['debug_mode'] = array(
|
639 |
+
'title' => esc_html__( 'Debug Mode', 'woocommerce-square' ),
|
640 |
+
'type' => 'select',
|
641 |
+
/* translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag */
|
642 |
+
'desc' => sprintf( esc_html__( 'Show Detailed Error Messages and API requests/responses on the checkout page and/or save them to the %1$sdebug log%2$s', 'woocommerce-square' ), '<a href="' . Framework\SV_WC_Helper::get_wc_log_file_url( $this->get_id() ) . '">', '</a>' ),
|
643 |
+
'default' => self::DEBUG_MODE_OFF,
|
644 |
+
'options' => array(
|
645 |
+
self::DEBUG_MODE_OFF => esc_html__( 'Off', 'woocommerce-square' ),
|
646 |
+
self::DEBUG_MODE_CHECKOUT => esc_html__( 'Show on Checkout Page', 'woocommerce-square' ),
|
647 |
+
self::DEBUG_MODE_LOG => esc_html__( 'Save to Log', 'woocommerce-square' ),
|
648 |
+
/* translators: show debugging information on both checkout page and in the log */
|
649 |
+
self::DEBUG_MODE_BOTH => esc_html__( 'Both', 'woocommerce-square' ),
|
650 |
+
),
|
651 |
+
);
|
652 |
+
|
653 |
+
// if there is more than just the production environment available
|
654 |
+
if ( count( $this->get_environments() ) > 1 ) {
|
655 |
+
$this->form_fields = $this->add_environment_form_fields( $this->form_fields );
|
656 |
+
}
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Payment Gateway Form Fields Filter.
|
660 |
+
*
|
661 |
+
* Actors can use this to add, remove, or tweak gateway form fields
|
662 |
+
*
|
663 |
+
* @since 4.0.0
|
664 |
+
* @param array $form_fields array of form fields in format required by WC_Settings_API
|
665 |
+
* @param \SV_WC_Payment_Gateway $this gateway instance
|
666 |
+
*/
|
667 |
+
$this->form_fields = apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_form_fields', $this->form_fields, $this );
|
668 |
+
}
|
669 |
+
|
670 |
/**
|
671 |
* Adds the tokenization form fields to the gateway settings.
|
672 |
*
|
683 |
|
684 |
if ( ! empty( $form_fields['tokenization'] ) ) {
|
685 |
$form_fields['tokenization']['title'] = __( 'Customer Profiles', 'woocommerce-square' );
|
686 |
+
$form_fields['tokenization']['label'] = __( 'Check to enable tokenization and allow customers to securely save their payment details for future checkout.', 'woocommerce-square' );
|
687 |
}
|
688 |
|
689 |
return $form_fields;
|
731 |
return $form_fields;
|
732 |
}
|
733 |
|
734 |
+
/**
|
735 |
+
* Adds the Digital Wallet setting fields.
|
736 |
+
*
|
737 |
+
* @since 2.3.0
|
738 |
+
*
|
739 |
+
* @param array $form_fields
|
740 |
+
* @return array
|
741 |
+
*/
|
742 |
+
protected function add_digital_wallets_form_fields( $form_fields ) {
|
743 |
+
$form_fields['digital_wallet_settings'] = array(
|
744 |
+
'title' => esc_html__( 'Digital Wallet Settings', 'woocommerce-square' ),
|
745 |
+
'description' => esc_html__( 'Take payments on your store with Apple Pay and Google Pay.', 'woocommerce-square' ),
|
746 |
+
'type' => 'title',
|
747 |
+
);
|
748 |
+
|
749 |
+
$form_fields['enable_digital_wallets'] = array(
|
750 |
+
'title' => esc_html__( 'Enable / Disable', 'woocommerce-square' ),
|
751 |
+
/* translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag */
|
752 |
+
'description' => sprintf( esc_html__( 'Allow customers to pay with Apple Pay or Google Pay from your Product, Cart and Checkout pages. Read more about the availablity of digital wallets in our %1$sdocumentation%2$s.', 'woocommerce-square' ), '<a href="https://docs.woocommerce.com/document/woocommerce-square/">', '</a>' ),
|
753 |
+
'type' => 'checkbox',
|
754 |
+
'default' => 'yes',
|
755 |
+
'label' => esc_html__( 'Enable digital wallets', 'woocommerce-square' ),
|
756 |
+
);
|
757 |
+
|
758 |
+
$form_fields['digital_wallets_button_type'] = array(
|
759 |
+
'title' => esc_html__( 'Button Type', 'woocommerce-square' ),
|
760 |
+
'description' => esc_html__( 'This setting only applies to the Apple Pay button. When Google Pay is available, the Google Pay button will always have the "Buy with" button text.', 'woocommerce-square' ),
|
761 |
+
'desc_tip' => esc_html__( 'Select which text is displayed on the digital wallet buttons.', 'woocommerce-square' ),
|
762 |
+
'type' => 'select',
|
763 |
+
'default' => 'buy',
|
764 |
+
'class' => 'wc-enhanced-select wc-square-digital-wallet-options',
|
765 |
+
'options' => array(
|
766 |
+
'buy' => 'Buy Now',
|
767 |
+
'donate' => 'Donate',
|
768 |
+
'plain' => 'No Text',
|
769 |
+
),
|
770 |
+
);
|
771 |
+
|
772 |
+
$form_fields['digital_wallets_apple_pay_button_color'] = array(
|
773 |
+
'title' => esc_html__( 'Apple Pay Button Color', 'woocommerce-square' ),
|
774 |
+
'desc_tip' => esc_html__( 'Select the color of the Apple Pay button.', 'woocommerce-square' ),
|
775 |
+
'type' => 'select',
|
776 |
+
'default' => 'black',
|
777 |
+
'class' => 'wc-enhanced-select wc-square-digital-wallet-options',
|
778 |
+
'options' => array(
|
779 |
+
'black' => 'Black',
|
780 |
+
'white' => 'White',
|
781 |
+
'white-outline' => 'White with outline',
|
782 |
+
),
|
783 |
+
);
|
784 |
+
|
785 |
+
$form_fields['digital_wallets_google_pay_button_color'] = array(
|
786 |
+
'title' => esc_html__( 'Google Pay Button Color', 'woocommerce-square' ),
|
787 |
+
'desc_tip' => esc_html__( 'Select the color of the Google Pay button.', 'woocommerce-square' ),
|
788 |
+
'type' => 'select',
|
789 |
+
'default' => 'black',
|
790 |
+
'class' => 'wc-enhanced-select wc-square-digital-wallet-options',
|
791 |
+
'options' => array(
|
792 |
+
'black' => 'Black',
|
793 |
+
'white' => 'White',
|
794 |
+
),
|
795 |
+
);
|
796 |
+
|
797 |
+
$form_fields['digital_wallets_hide_button_options'] = array(
|
798 |
+
'title' => esc_html__( 'Hide Digital Wallet Buttons', 'woocommerce-square' ),
|
799 |
+
'desc_tip' => esc_html__( 'Select any digital wallet buttons you don\'t want to be displayed on your store.', 'woocommerce-square' ),
|
800 |
+
'type' => 'multiselect',
|
801 |
+
'default' => '',
|
802 |
+
'class' => 'wc-enhanced-select wc-square-digital-wallet-options',
|
803 |
+
'options' => array(
|
804 |
+
'apple' => 'Apple Pay',
|
805 |
+
'google' => 'Google Pay',
|
806 |
+
),
|
807 |
+
);
|
808 |
+
|
809 |
+
return $form_fields;
|
810 |
+
}
|
811 |
|
812 |
/** Conditional methods *******************************************************************************************/
|
813 |
|
879 |
return apply_filters( 'wc_square_is_3d_secure_enabled', $sca_enabled_currencies, $this );
|
880 |
}
|
881 |
|
882 |
+
/**
|
883 |
+
* Determines if digital wallets are available.
|
884 |
+
*
|
885 |
+
* @since 2.3
|
886 |
+
* @return bool
|
887 |
+
*/
|
888 |
+
public function is_digital_wallet_available() {
|
889 |
+
$is_available = false;
|
890 |
+
$base_location = wc_get_base_location();
|
891 |
+
|
892 |
+
if ( wc_site_is_https() && in_array( get_woocommerce_currency(), array( 'USD', 'GBP', 'CAD' ), true ) && ( ! empty( $base_location['country'] ) && in_array( $base_location['country'], array( 'US', 'GB', 'CA' ), true ) ) ) {
|
893 |
+
$is_available = true;
|
894 |
+
}
|
895 |
+
|
896 |
+
return $is_available;
|
897 |
+
}
|
898 |
|
899 |
/** Getter methods ************************************************************************************************/
|
900 |
|
1135 |
// keep track of the retry count
|
1136 |
$this->update_order_meta( $order, 'retry_count', $retry_count );
|
1137 |
|
1138 |
+
$order->unique_transaction_ref = $order->get_date_created()->getTimestamp() . '-' . $order_id . ( $retry_count >= 0 ? '-' . $retry_count : '' );
|
1139 |
return $order;
|
1140 |
}
|
1141 |
}
|
includes/Gateway/API/Requests/Payments.php
CHANGED
@@ -74,7 +74,7 @@ class Payments extends \WooCommerce\Square\API\Request {
|
|
74 |
$this->square_api_method = 'createPayment';
|
75 |
$this->square_request = new SquareModel\CreatePaymentRequest();
|
76 |
|
77 |
-
$this->square_request->setIdempotencyKey( wc_square()->get_idempotency_key( $order->unique_transaction_ref ) );
|
78 |
$this->square_request->setAmountMoney( Utilities\Money_Utility::amount_to_money( $order->payment_total, $order->get_currency() ) );
|
79 |
$this->square_request->setReferenceId( $order->get_order_number() );
|
80 |
|
74 |
$this->square_api_method = 'createPayment';
|
75 |
$this->square_request = new SquareModel\CreatePaymentRequest();
|
76 |
|
77 |
+
$this->square_request->setIdempotencyKey( wc_square()->get_idempotency_key( $order->unique_transaction_ref, false ) );
|
78 |
$this->square_request->setAmountMoney( Utilities\Money_Utility::amount_to_money( $order->payment_total, $order->get_currency() ) );
|
79 |
$this->square_request->setReferenceId( $order->get_order_number() );
|
80 |
|
includes/Gateway/Customer_Helper.php
CHANGED
@@ -16,9 +16,6 @@
|
|
16 |
* versions in the future. If you wish to customize WooCommerce Square for your
|
17 |
* needs please refer to https://docs.woocommerce.com/document/woocommerce-square/
|
18 |
*
|
19 |
-
* @author WooCommerce
|
20 |
-
* @copyright Copyright: (c) 2019, Automattic, Inc.
|
21 |
-
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
22 |
*/
|
23 |
|
24 |
namespace WooCommerce\Square\Gateway;
|
@@ -61,9 +58,9 @@ class Customer_Helper {
|
|
61 |
$query .= implode( ', ', $placeholders );
|
62 |
|
63 |
// update the Square ID value when duplicate email addresses are present
|
64 |
-
$query .= " ON DUPLICATE KEY UPDATE email_address = VALUES(email_address)";
|
65 |
|
66 |
-
$wpdb->query( $wpdb->prepare( $query, $values ) );
|
67 |
}
|
68 |
|
69 |
|
@@ -180,16 +177,9 @@ class Customer_Helper {
|
|
180 |
$collate = $wpdb->get_charset_collate();
|
181 |
}
|
182 |
|
183 |
-
$schema = "
|
184 |
-
CREATE TABLE IF NOT EXISTS {$wpdb->prefix}woocommerce_square_customers (
|
185 |
-
square_id varchar(191) NOT NULL,
|
186 |
-
email_address varchar(200) NOT NULL,
|
187 |
-
user_id BIGINT UNSIGNED NOT NULL,
|
188 |
-
PRIMARY KEY (square_id)
|
189 |
-
) $collate;
|
190 |
-
";
|
191 |
|
192 |
-
require_once
|
193 |
|
194 |
dbDelta( $schema );
|
195 |
}
|
16 |
* versions in the future. If you wish to customize WooCommerce Square for your
|
17 |
* needs please refer to https://docs.woocommerce.com/document/woocommerce-square/
|
18 |
*
|
|
|
|
|
|
|
19 |
*/
|
20 |
|
21 |
namespace WooCommerce\Square\Gateway;
|
58 |
$query .= implode( ', ', $placeholders );
|
59 |
|
60 |
// update the Square ID value when duplicate email addresses are present
|
61 |
+
$query .= " ON DUPLICATE KEY UPDATE email_address = VALUES(email_address)"; //phpcs:ignore Squiz.Strings.DoubleQuoteUsage.NotRequired
|
62 |
|
63 |
+
$wpdb->query( $wpdb->prepare( $query, $values ) ); //phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
64 |
}
|
65 |
|
66 |
|
177 |
$collate = $wpdb->get_charset_collate();
|
178 |
}
|
179 |
|
180 |
+
$schema = $wpdb->prepare( "CREATE TABLE {$wpdb->prefix}woocommerce_square_customers (`square_id` varchar(191) NOT NULL, `email_address` varchar(200) NOT NULL, `user_id` BIGINT UNSIGNED NOT NULL, PRIMARY KEY (`square_id`) ) %1s", $collate ); //phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
183 |
|
184 |
dbDelta( $schema );
|
185 |
}
|
includes/Gateway/Digital_Wallet.php
ADDED
@@ -0,0 +1,1018 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Square
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@woocommerce.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade WooCommerce Square to newer
|
16 |
+
* versions in the future. If you wish to customize WooCommerce Square for your
|
17 |
+
* needs please refer to https://docs.woocommerce.com/document/woocommerce-square/
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace WooCommerce\Square\Gateway;
|
21 |
+
|
22 |
+
defined( 'ABSPATH' ) || exit;
|
23 |
+
|
24 |
+
use WooCommerce\Square\Plugin;
|
25 |
+
|
26 |
+
class Digital_Wallet {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var Gateway $gateway
|
30 |
+
*/
|
31 |
+
public $gateway = null;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var String $page - Current page
|
35 |
+
*/
|
36 |
+
public $page = null;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var bool $is_available - Is Apple Pay and Google Pay available
|
40 |
+
*/
|
41 |
+
public $is_available = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Setup the Digital Wallet class
|
45 |
+
*
|
46 |
+
* @since 2.3
|
47 |
+
*/
|
48 |
+
public function __construct( $gateway ) {
|
49 |
+
$this->gateway = $gateway;
|
50 |
+
|
51 |
+
if ( 'yes' === $gateway->get_option( 'enabled', 'no' ) && 'yes' === $gateway->get_option( 'enable_digital_wallets', 'yes' ) && $gateway->is_digital_wallet_available() ) {
|
52 |
+
add_action( 'wp', array( $this, 'init' ) );
|
53 |
+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( is_admin() && ( $gateway->get_plugin()->is_gateway_settings() || $gateway->get_plugin()->is_plugin_settings() ) ) {
|
57 |
+
add_action( 'init', array( $this, 'apple_pay_domain_registration' ) );
|
58 |
+
}
|
59 |
+
|
60 |
+
// WC AJAX
|
61 |
+
add_action( 'wc_ajax_square_digital_wallet_get_payment_request', array( $this, 'ajax_get_payment_request' ) );
|
62 |
+
add_action( 'wc_ajax_square_digital_wallet_add_to_cart', array( $this, 'ajax_add_to_cart' ) );
|
63 |
+
add_action( 'wc_ajax_square_digital_wallet_recalculate_totals', array( $this, 'ajax_recalculate_totals' ) );
|
64 |
+
add_action( 'wc_ajax_square_digital_wallet_process_checkout', array( $this, 'ajax_process_checkout' ) );
|
65 |
+
|
66 |
+
// Calculate the value of option `wc_square_apple_pay_enabled` which is not stored in the DB for WC Admin inbox notifications
|
67 |
+
add_filter( 'pre_option_wc_square_apple_pay_enabled', array( $this, 'get_option_is_apple_pay_enabled' ), 10, 1 );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Initialize the digital wallet class
|
72 |
+
*
|
73 |
+
* @since 2.3
|
74 |
+
*/
|
75 |
+
public function init() {
|
76 |
+
$available_pages = $this->get_available_pages();
|
77 |
+
|
78 |
+
if ( in_array( 'product', $available_pages, true ) ) {
|
79 |
+
add_action( 'woocommerce_after_add_to_cart_quantity', array( $this, 'render_button' ) );
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( in_array( 'cart', $available_pages, true ) ) {
|
83 |
+
add_action( 'woocommerce_proceed_to_checkout', array( $this, 'render_button' ) );
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( in_array( 'checkout', $available_pages, true ) ) {
|
87 |
+
add_action( 'woocommerce_before_checkout_form', array( $this, 'render_button' ), 15 );
|
88 |
+
}
|
89 |
+
|
90 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Display admin notices related to Square digital wallets
|
95 |
+
*
|
96 |
+
* @since 2.3
|
97 |
+
* @return void
|
98 |
+
*/
|
99 |
+
public function admin_notices() {
|
100 |
+
|
101 |
+
// Apple Pay notices - Only shown when digital wallets are enabled and Apple isn't in list of hidden button options
|
102 |
+
if ( ! in_array( 'apple', $this->gateway->get_option( 'digital_wallets_hide_button_options', array() ), true ) ) {
|
103 |
+
$apple_pay_verification_file_location = $this->apple_pay_verification_file_location();
|
104 |
+
|
105 |
+
// Verification file is missing
|
106 |
+
if ( ! empty( $apple_pay_verification_file_location ) && ! file_exists( $apple_pay_verification_file_location ) ) {
|
107 |
+
wc_square()->get_admin_notice_handler()->add_admin_notice(
|
108 |
+
sprintf(
|
109 |
+
/* Translators: %1$s: expected location of apple pay verification file, %2$s: opening href tag with link to Square documentation, %3$s: closing href tag */
|
110 |
+
__( 'Apple Pay is not available with Square. We cannot confirm the Apple Pay domain verification file is at the expected location: %1$s. For more information, please read our documentation on %2$sSetting up Apple Pay%3$s.', 'woocommerce-square' ),
|
111 |
+
'<code>' . $apple_pay_verification_file_location . '</code>',
|
112 |
+
'<a href="https://docs.woocommerce.com/document/woocommerce-square/">',
|
113 |
+
'</a>'
|
114 |
+
),
|
115 |
+
'wc-square-apple-pay-file-missing',
|
116 |
+
array(
|
117 |
+
'notice_class' => 'notice-warning',
|
118 |
+
)
|
119 |
+
);
|
120 |
+
|
121 |
+
} elseif ( 'no' === $this->gateway->get_option( 'apple_pay_domain_registered', '' ) ) {
|
122 |
+
// Domain failed to register
|
123 |
+
wc_square()->get_admin_notice_handler()->add_admin_notice(
|
124 |
+
sprintf(
|
125 |
+
/* Translators: %1$s: opening bold tags, %2$s: closing strong/bold tags, %3$s: expected location of apple pay verification file, %4$s: opening href tag with link to Square documentation, %5$s: closing href tag */
|
126 |
+
__( 'Apple Pay is not available with Square - there was a problem with registering your store domain with Square/Apple Pay. %1$sView the Square logs%2$s to find out what caused the registration to fail.', 'woocommerce-square' ),
|
127 |
+
'<a href="' . esc_url( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) . '">',
|
128 |
+
'</a>'
|
129 |
+
),
|
130 |
+
'wc-square-apple-pay-domain-registered',
|
131 |
+
array(
|
132 |
+
'notice_class' => 'notice-warning',
|
133 |
+
)
|
134 |
+
);
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Render the Digital Wallet buttons (Apple Pay) on the Product, Cart or Checkout pages
|
141 |
+
*
|
142 |
+
* @since 2.3
|
143 |
+
* @return void
|
144 |
+
*/
|
145 |
+
public function render_button() {
|
146 |
+
|
147 |
+
$apple_pay_classes = $google_pay_classes = array( 'wc-square-wallet-buttons' );
|
148 |
+
$button_type = $this->gateway->get_option( 'digital_wallets_button_type', 'buy' );
|
149 |
+
$apple_button_style = $this->gateway->get_option( 'digital_wallets_apple_pay_button_color', 'black' );
|
150 |
+
|
151 |
+
// set button text
|
152 |
+
switch ( $button_type ) {
|
153 |
+
case 'donate':
|
154 |
+
case 'buy':
|
155 |
+
$button_text = ucfirst( $button_type ) . ' with';
|
156 |
+
$apple_pay_classes[] = 'wc-square-wallet-button-with-text';
|
157 |
+
break;
|
158 |
+
|
159 |
+
default:
|
160 |
+
$button_text = '';
|
161 |
+
}
|
162 |
+
|
163 |
+
$apple_pay_classes[] = 'wc-square-wallet-button-' . $apple_button_style;
|
164 |
+
$google_pay_classes[] = 'wc-square-wallet-button-' . $this->gateway->get_option( 'digital_wallets_google_pay_button_color', 'black' );
|
165 |
+
|
166 |
+
?>
|
167 |
+
<div id="wc-square-digital-wallet" style="display:none;">
|
168 |
+
<div id="wc-square-apple-pay" class="apple-pay-button <?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $apple_pay_classes ) ) ); ?>" lang="<?php echo esc_attr( substr( get_locale(), 0, 2 ) ); ?>" style="-apple-pay-button-type: <?php echo esc_attr( $button_type ); ?>; -apple-pay-button-style: <?php echo esc_attr( $apple_button_style ); ?>">
|
169 |
+
<span class="text"><?php echo esc_html( $button_text ); ?></span>
|
170 |
+
<span class="logo"></span>
|
171 |
+
</div>
|
172 |
+
|
173 |
+
<div id="wc-square-google-pay" class="google-pay-button <?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $google_pay_classes ) ) ); ?>" lang="<?php echo esc_attr( substr( get_locale(), 0, 2 ) ); ?>"></div>
|
174 |
+
<p id="wc-square-wallet-divider">– <?php esc_html_e( 'OR', 'woocommerce-square' ); ?> –</p>
|
175 |
+
</div>
|
176 |
+
<?php
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Load Square wallet scripts and styles
|
181 |
+
*
|
182 |
+
* @since 2.3
|
183 |
+
* @return void
|
184 |
+
*/
|
185 |
+
public function enqueue_scripts() {
|
186 |
+
$page = $this->get_current_page();
|
187 |
+
|
188 |
+
if ( ! $page || ! $this->is_available() ) {
|
189 |
+
return;
|
190 |
+
}
|
191 |
+
|
192 |
+
wp_enqueue_style( 'wc-square-digital-wallet', $this->gateway->get_plugin()->get_plugin_url() . '/assets/css/frontend/wc-square-digital-wallet.min.css', array(), Plugin::VERSION );
|
193 |
+
wp_enqueue_script( 'wc-square-digital-wallet', $this->gateway->get_plugin()->get_plugin_url() . '/assets/js/frontend/wc-square-digital-wallet.min.js', array( 'jquery' ), Plugin::VERSION, true );
|
194 |
+
|
195 |
+
$args = apply_filters(
|
196 |
+
'wc_square_digital_wallet_js_args',
|
197 |
+
array(
|
198 |
+
'application_id' => $this->gateway->get_application_id(),
|
199 |
+
'location_id' => wc_square()->get_settings_handler()->get_location_id(),
|
200 |
+
'gateway_id' => $this->gateway->get_id(),
|
201 |
+
'gateway_id_dasherized' => $this->gateway->get_id_dasherized(),
|
202 |
+
'payment_request' => $this->get_payment_request_for_context( $page ),
|
203 |
+
'context' => $page,
|
204 |
+
'general_error' => __( 'An error occurred, please try again or try an alternate form of payment.', 'woocommerce-square' ),
|
205 |
+
'ajax_url' => \WC_AJAX::get_endpoint( '%%endpoint%%' ),
|
206 |
+
'payment_request_nonce' => wp_create_nonce( 'wc-square-get-payment-request' ),
|
207 |
+
'add_to_cart_nonce' => wp_create_nonce( 'wc-square-add-to-cart' ),
|
208 |
+
'recalculate_totals_nonce' => wp_create_nonce( 'wc-square-recalculate-totals' ),
|
209 |
+
'process_checkout_nonce' => wp_create_nonce( 'woocommerce-process_checkout' ),
|
210 |
+
'logging_enabled' => $this->gateway->debug_log(),
|
211 |
+
'hide_button_options' => $this->get_hidden_button_options(),
|
212 |
+
)
|
213 |
+
);
|
214 |
+
|
215 |
+
wc_enqueue_js( sprintf( 'window.wc_square_digital_wallet_handler = new WC_Square_Digital_Wallet_Handler( %s );', wp_json_encode( $args ) ) );
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Build the payment request object for the given context (i.e. product, cart or checkout page)
|
220 |
+
*
|
221 |
+
* Payment request objects are used by the SqPaymentForm and need to be in a specific format.
|
222 |
+
* Reference: https://developer.squareup.com/docs/api/paymentform#paymentform-paymentrequestobjects
|
223 |
+
*
|
224 |
+
* @since 2.3
|
225 |
+
* @param string $context
|
226 |
+
* @return array
|
227 |
+
*/
|
228 |
+
public function get_payment_request_for_context( $context ) {
|
229 |
+
$payment_request = array();
|
230 |
+
|
231 |
+
switch ( $context ) {
|
232 |
+
case 'product':
|
233 |
+
$payment_request = $this->get_product_payment_request( get_the_ID() );
|
234 |
+
break;
|
235 |
+
|
236 |
+
case 'cart':
|
237 |
+
case 'checkout':
|
238 |
+
if ( isset( WC()->cart ) ) {
|
239 |
+
WC()->cart->calculate_totals();
|
240 |
+
$payment_request = $this->build_payment_request( WC()->cart->total );
|
241 |
+
}
|
242 |
+
|
243 |
+
break;
|
244 |
+
}
|
245 |
+
|
246 |
+
return $payment_request;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Build a payment request object to be sent to SqPaymentForm on the product page
|
251 |
+
*
|
252 |
+
* Documentation: https://developer.squareup.com/docs/api/paymentform#paymentform-paymentrequestobjects
|
253 |
+
*
|
254 |
+
* @since 2.3
|
255 |
+
* @param int $product_id
|
256 |
+
* @param bool $add_to_cart - whether or not the product needs to be added to the cart before building the payment request
|
257 |
+
* @return array
|
258 |
+
*/
|
259 |
+
public function get_product_payment_request( $product_id = 0, $quantity = 1, $attributes = array(), $add_to_cart = false ) {
|
260 |
+
$data = array();
|
261 |
+
$attributes = array();
|
262 |
+
$items = array();
|
263 |
+
$product_id = ! empty( $product_id ) ? $product_id : get_the_ID();
|
264 |
+
$product = wc_get_product( $product_id );
|
265 |
+
$variation_id = 0;
|
266 |
+
|
267 |
+
if ( ! is_a( $product, 'WC_Product' ) ) {
|
268 |
+
/* translators: product ID */
|
269 |
+
throw new \Exception( sprintf( __( 'Product with the ID (%d) cannot be found.', 'woocommerce-square' ), $product_id ) );
|
270 |
+
}
|
271 |
+
|
272 |
+
$quantity = $product->is_sold_individually() ? 1 : $quantity;
|
273 |
+
|
274 |
+
if ( 'variable' === $product->get_type() && ! empty( $attributes ) ) {
|
275 |
+
$data_store = \WC_Data_Store::load( 'product' );
|
276 |
+
$variation_id = $data_store->find_matching_product_variation( $product, $attributes );
|
277 |
+
|
278 |
+
if ( ! empty( $variation_id ) ) {
|
279 |
+
$product = wc_get_product( $variation_id );
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
if ( ! $product->has_enough_stock( $quantity ) ) {
|
284 |
+
/* translators: 1: product name 2: quantity in stock */
|
285 |
+
throw new \Exception( sprintf( __( 'You cannot add that amount of "%1$s"; to the cart because there is not enough stock (%2$s remaining).', 'woocommerce-square' ), $product->get_name(), wc_format_stock_quantity_for_display( $product->get_stock_quantity(), $product ) ) );
|
286 |
+
}
|
287 |
+
|
288 |
+
if ( $add_to_cart ) {
|
289 |
+
WC()->cart->empty_cart();
|
290 |
+
WC()->cart->add_to_cart( $product->get_id(), $quantity, $variation_id, $attributes );
|
291 |
+
|
292 |
+
WC()->cart->calculate_totals();
|
293 |
+
return $this->build_payment_request( WC()->cart->total );
|
294 |
+
}
|
295 |
+
|
296 |
+
$amount = number_format( $quantity * $product->get_price(), 2, '.', '' );
|
297 |
+
$quantity_label = 1 < $quantity ? ' x ' . $quantity : '';
|
298 |
+
|
299 |
+
$items[] = array(
|
300 |
+
'label' => $product->get_name() . $quantity_label,
|
301 |
+
'amount' => $amount,
|
302 |
+
'pending' => false,
|
303 |
+
);
|
304 |
+
|
305 |
+
if ( wc_tax_enabled() ) {
|
306 |
+
$items[] = array(
|
307 |
+
'label' => __( 'Tax', 'woocommerce-square' ),
|
308 |
+
'amount' => '0.00',
|
309 |
+
'pending' => true,
|
310 |
+
);
|
311 |
+
}
|
312 |
+
|
313 |
+
$data['requestShippingAddress'] = wc_shipping_enabled() && $product->needs_shipping() ? true : false;
|
314 |
+
$data['lineItems'] = $items;
|
315 |
+
|
316 |
+
return $this->build_payment_request( $amount, $data );
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Build a payment request object to be sent to SqPaymentForm.
|
321 |
+
*
|
322 |
+
* Documentation: https://developer.squareup.com/docs/api/paymentform#paymentform-paymentrequestobjects
|
323 |
+
*
|
324 |
+
* @since 2.3
|
325 |
+
* @param string $amount - format '100.00'
|
326 |
+
* @param array $data
|
327 |
+
* @return array
|
328 |
+
*/
|
329 |
+
public function build_payment_request( $amount, $data = array() ) {
|
330 |
+
$data = wp_parse_args(
|
331 |
+
$data,
|
332 |
+
array(
|
333 |
+
'requestShippingAddress' => wc_shipping_enabled() && isset( WC()->cart ) && WC()->cart->needs_shipping(),
|
334 |
+
'requestBillingInfo' => true,
|
335 |
+
'requestEmailAddress' => true,
|
336 |
+
'countryCode' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
|
337 |
+
'currencyCode' => get_woocommerce_currency(),
|
338 |
+
)
|
339 |
+
);
|
340 |
+
|
341 |
+
if ( count( WC()->shipping->get_packages() ) > 1 ) {
|
342 |
+
throw new \Exception( __( 'This payment method cannot be used for multiple shipments.', 'woocommerce-square' ) );
|
343 |
+
}
|
344 |
+
|
345 |
+
if ( ! isset( $data['lineItems'] ) ) {
|
346 |
+
$data['lineItems'] = $this->build_payment_request_line_items();
|
347 |
+
}
|
348 |
+
|
349 |
+
if ( true === $data['requestShippingAddress'] ) {
|
350 |
+
$data['shippingOptions'] = array(
|
351 |
+
array(
|
352 |
+
'id' => '0',
|
353 |
+
'label' => __( 'Pending', 'woocommerce-square' ),
|
354 |
+
'amount' => '0.00',
|
355 |
+
'pending' => false,
|
356 |
+
),
|
357 |
+
);
|
358 |
+
}
|
359 |
+
|
360 |
+
$data['total'] = array(
|
361 |
+
'label' => get_bloginfo( 'name', 'display' ) . ' (via WooCommerce)',
|
362 |
+
'amount' => number_format( $amount, 2, '.', '' ),
|
363 |
+
'pending' => false,
|
364 |
+
);
|
365 |
+
|
366 |
+
return $data;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Builds an array of line items/totals to be sent back to Square in the lineItems array.
|
371 |
+
*
|
372 |
+
* @since 2.3
|
373 |
+
* @param array $cart_totals
|
374 |
+
* @return array
|
375 |
+
*/
|
376 |
+
public function build_payment_request_line_items( $cart_totals = array() ) {
|
377 |
+
$cart_totals = empty( $cart_totals ) ? $this->get_cart_totals() : $cart_totals;
|
378 |
+
$line_items = array();
|
379 |
+
|
380 |
+
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
|
381 |
+
$amount = number_format( $cart_item['line_subtotal'], 2, '.', '' );
|
382 |
+
$quantity_label = 1 < $cart_item['quantity'] ? ' x ' . $cart_item['quantity'] : '';
|
383 |
+
|
384 |
+
$item = array(
|
385 |
+
'label' => $cart_item['data']->get_name() . $quantity_label,
|
386 |
+
'amount' => $amount,
|
387 |
+
'pending' => false,
|
388 |
+
);
|
389 |
+
|
390 |
+
$line_items[] = $item;
|
391 |
+
}
|
392 |
+
|
393 |
+
if ( $cart_totals['shipping'] > 0 ) {
|
394 |
+
$line_items[] = array(
|
395 |
+
'label' => __( 'Shipping', 'woocommerce-square' ),
|
396 |
+
'amount' => number_format( $cart_totals['shipping'], 2, '.', '' ),
|
397 |
+
'pending' => false,
|
398 |
+
);
|
399 |
+
}
|
400 |
+
|
401 |
+
if ( $cart_totals['taxes'] > 0 ) {
|
402 |
+
$line_items[] = array(
|
403 |
+
'label' => __( 'Tax', 'woocommerce-square' ),
|
404 |
+
'amount' => number_format( $cart_totals['taxes'], 2, '.', '' ),
|
405 |
+
'pending' => false,
|
406 |
+
);
|
407 |
+
}
|
408 |
+
|
409 |
+
if ( $cart_totals['discount'] > 0 ) {
|
410 |
+
$line_items[] = array(
|
411 |
+
'label' => __( 'Discount', 'woocommerce-square' ),
|
412 |
+
'amount' => number_format( $cart_totals['discount'], 2, '.', '' ),
|
413 |
+
'pending' => false,
|
414 |
+
);
|
415 |
+
}
|
416 |
+
|
417 |
+
if ( $cart_totals['fees'] > 0 ) {
|
418 |
+
$line_items[] = array(
|
419 |
+
'label' => __( 'Fees', 'woocommerce-square' ),
|
420 |
+
'amount' => number_format( $cart_totals['fees'], 2, '.', '' ),
|
421 |
+
'pending' => false,
|
422 |
+
);
|
423 |
+
}
|
424 |
+
|
425 |
+
return $line_items;
|
426 |
+
}
|
427 |
+
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Get the payment request object in an ajax request
|
431 |
+
*
|
432 |
+
* @since 2.3
|
433 |
+
* @return void
|
434 |
+
*/
|
435 |
+
public function ajax_get_payment_request() {
|
436 |
+
check_ajax_referer( 'wc-square-get-payment-request', 'security' );
|
437 |
+
|
438 |
+
$payment_request = array();
|
439 |
+
$context = ! empty( $_POST['context'] ) ? wc_clean( wp_unslash( $_POST['context'] ) ) : '';
|
440 |
+
|
441 |
+
try {
|
442 |
+
if ( 'product' === $context ) {
|
443 |
+
$product_id = ! empty( $_POST['product_id'] ) ? wc_clean( wp_unslash( $_POST['product_id'] ) ) : 0;
|
444 |
+
$quantity = ! empty( $_POST['quantity'] ) ? wc_clean( wp_unslash( $_POST['quantity'] ) ) : 1;
|
445 |
+
$attributes = ! empty( $_POST['attributes'] ) ? wc_clean( wp_unslash( $_POST['attributes'] ) ) : array();
|
446 |
+
$payment_request = $this->get_product_payment_request( $product_id, $quantity, $attributes );
|
447 |
+
|
448 |
+
} else {
|
449 |
+
$payment_request = $this->get_payment_request_for_context( $context );
|
450 |
+
}
|
451 |
+
|
452 |
+
if ( empty( $payment_request ) ) {
|
453 |
+
throw new \Exception( esc_html__( 'Invalid request. Could not fetch the payment request data to be use in the Square digital wallet.', 'woocommerce-square' ) );
|
454 |
+
}
|
455 |
+
} catch ( \Exception $e ) {
|
456 |
+
wp_send_json_error( $e->getMessage() );
|
457 |
+
}
|
458 |
+
|
459 |
+
wp_send_json_success( wp_json_encode( $payment_request ) );
|
460 |
+
}
|
461 |
+
|
462 |
+
/**
|
463 |
+
* When the digital wallet button is pressed, add the product to cart and generate a new payment request.
|
464 |
+
* We need to add the product the cart to help with shipping/tax calculations.
|
465 |
+
*
|
466 |
+
* @since 2.3
|
467 |
+
* @return void
|
468 |
+
*/
|
469 |
+
public function ajax_add_to_cart() {
|
470 |
+
check_ajax_referer( 'wc-square-add-to-cart', 'security' );
|
471 |
+
|
472 |
+
try {
|
473 |
+
$product_id = ! empty( $_POST['product_id'] ) ? wc_clean( wp_unslash( $_POST['product_id'] ) ) : 0;
|
474 |
+
$quantity = ! empty( $_POST['quantity'] ) ? wc_clean( wp_unslash( $_POST['quantity'] ) ) : 1;
|
475 |
+
$attributes = ! empty( $_POST['attributes'] ) ? wc_clean( wp_unslash( $_POST['attributes'] ) ) : array();
|
476 |
+
|
477 |
+
$response = array(
|
478 |
+
'payment_request' => $this->get_product_payment_request( $product_id, $quantity, $attributes, true ),
|
479 |
+
// We need to generate a new set of nonces now that a WC customer session exists after a product was added to the cart
|
480 |
+
'payment_request_nonce' => wp_create_nonce( 'wc-square-get-payment-request' ),
|
481 |
+
'add_to_cart_nonce' => wp_create_nonce( 'wc-square-add-to-cart' ),
|
482 |
+
'recalculate_totals_nonce' => wp_create_nonce( 'wc-square-recalculate-totals' ),
|
483 |
+
'process_checkout_nonce' => wp_create_nonce( 'woocommerce-process_checkout' ),
|
484 |
+
);
|
485 |
+
|
486 |
+
wp_send_json_success( wp_json_encode( $response ) );
|
487 |
+
} catch ( \Exception $e ) {
|
488 |
+
wp_send_json_error( $e->getMessage() );
|
489 |
+
}
|
490 |
+
}
|
491 |
+
|
492 |
+
/**
|
493 |
+
* Updates shipping method in WC session
|
494 |
+
*
|
495 |
+
* @since 2.3
|
496 |
+
* @param array $shipping_methods Array of selected shipping methods ids
|
497 |
+
* @return void
|
498 |
+
*/
|
499 |
+
public function update_shipping_method( $shipping_methods ) {
|
500 |
+
$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
|
501 |
+
|
502 |
+
if ( is_array( $shipping_methods ) ) {
|
503 |
+
foreach ( $shipping_methods as $i => $value ) {
|
504 |
+
$chosen_shipping_methods[ $i ] = wc_clean( $value );
|
505 |
+
}
|
506 |
+
}
|
507 |
+
|
508 |
+
WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Reset shipping and calculate the latest shipping options/package with the given address.
|
513 |
+
*
|
514 |
+
* If no address, use the store's base address as default.
|
515 |
+
*
|
516 |
+
* @since 2.3
|
517 |
+
* @param array $address
|
518 |
+
* @return void
|
519 |
+
*/
|
520 |
+
public function calculate_shipping( $address = array() ) {
|
521 |
+
WC()->shipping->reset_shipping();
|
522 |
+
|
523 |
+
if ( $address['country'] ) {
|
524 |
+
WC()->customer->set_location( strtoupper( $address['country'] ), $address['region'], $address['postalCode'], $address['city'] );
|
525 |
+
WC()->customer->set_shipping_location( strtoupper( $address['country'] ), $address['region'], $address['postalCode'], $address['city'] );
|
526 |
+
} else {
|
527 |
+
WC()->customer->set_billing_address_to_base();
|
528 |
+
WC()->customer->set_shipping_address_to_base();
|
529 |
+
}
|
530 |
+
|
531 |
+
WC()->customer->set_calculated_shipping( true );
|
532 |
+
WC()->customer->save();
|
533 |
+
|
534 |
+
$packages = array();
|
535 |
+
$packages[0]['contents'] = WC()->cart->get_cart();
|
536 |
+
$packages[0]['contents_cost'] = 0;
|
537 |
+
$packages[0]['applied_coupons'] = WC()->cart->applied_coupons;
|
538 |
+
$packages[0]['user']['ID'] = get_current_user_id();
|
539 |
+
$packages[0]['destination']['country'] = $address['country'];
|
540 |
+
$packages[0]['destination']['state'] = $address['region'];
|
541 |
+
$packages[0]['destination']['postcode'] = $address['postalCode'];
|
542 |
+
$packages[0]['destination']['city'] = $address['city'];
|
543 |
+
$packages[0]['destination']['address'] = $address['address'];
|
544 |
+
$packages[0]['destination']['address_2'] = $address['address_2'];
|
545 |
+
|
546 |
+
foreach ( WC()->cart->get_cart() as $item ) {
|
547 |
+
if ( $item['data']->needs_shipping() ) {
|
548 |
+
if ( isset( $item['line_total'] ) ) {
|
549 |
+
$packages[0]['contents_cost'] += $item['line_total'];
|
550 |
+
}
|
551 |
+
}
|
552 |
+
}
|
553 |
+
|
554 |
+
$packages = apply_filters( 'woocommerce_cart_shipping_packages', $packages );
|
555 |
+
|
556 |
+
WC()->shipping->calculate_shipping( $packages );
|
557 |
+
}
|
558 |
+
|
559 |
+
/**
|
560 |
+
* Recalculate shipping methods and cart totals and send the updated information
|
561 |
+
* data as a square payment request json object.
|
562 |
+
*
|
563 |
+
* @since 2.3
|
564 |
+
* @return void
|
565 |
+
*/
|
566 |
+
public function ajax_recalculate_totals() {
|
567 |
+
check_ajax_referer( 'wc-square-recalculate-totals', 'security' );
|
568 |
+
|
569 |
+
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
|
570 |
+
$shipping_address = array();
|
571 |
+
$payment_request = array();
|
572 |
+
|
573 |
+
if ( ! empty( $_POST['shipping_contact'] ) ) {
|
574 |
+
$shipping_address = wp_parse_args(
|
575 |
+
wc_clean( wp_unslash( $_POST['shipping_contact'] ) ),
|
576 |
+
array(
|
577 |
+
'country' => null,
|
578 |
+
'region' => null,
|
579 |
+
'city' => null,
|
580 |
+
'postalCode' => null,
|
581 |
+
'address' => null,
|
582 |
+
'address_2' => null,
|
583 |
+
)
|
584 |
+
);
|
585 |
+
|
586 |
+
$this->calculate_shipping( $shipping_address );
|
587 |
+
|
588 |
+
$packages = WC()->shipping->get_packages();
|
589 |
+
|
590 |
+
if ( ! empty( $packages ) ) {
|
591 |
+
foreach ( $packages[0]['rates'] as $method ) {
|
592 |
+
$payment_request['shippingOptions'][] = array(
|
593 |
+
'id' => $method->id,
|
594 |
+
'label' => $method->get_label(),
|
595 |
+
'amount' => number_format( $method->cost, 2, '.', '' ),
|
596 |
+
);
|
597 |
+
}
|
598 |
+
}
|
599 |
+
|
600 |
+
// sort the shippingOptions so that the default/chosen shipping method is the first option so that it's displayed first in the Apple Pay/Google Pay window
|
601 |
+
if ( isset( $payment_request['shippingOptions'][0] ) ) {
|
602 |
+
if ( isset( $chosen_methods[0] ) ) {
|
603 |
+
$chosen_method_id = $chosen_methods[0];
|
604 |
+
$compare_shipping_options = function ( $a, $b ) use ( $chosen_method_id ) {
|
605 |
+
if ( $a['id'] === $chosen_method_id ) {
|
606 |
+
return -1;
|
607 |
+
}
|
608 |
+
|
609 |
+
if ( $b['id'] === $chosen_method_id ) {
|
610 |
+
return 1;
|
611 |
+
}
|
612 |
+
|
613 |
+
return 0;
|
614 |
+
};
|
615 |
+
|
616 |
+
usort( $payment_request['shippingOptions'], $compare_shipping_options );
|
617 |
+
}
|
618 |
+
|
619 |
+
$first_shipping_method_id = $payment_request['shippingOptions'][0]['id'];
|
620 |
+
$this->update_shipping_method( array( $first_shipping_method_id ) );
|
621 |
+
}
|
622 |
+
} elseif ( ! empty( $_POST['shipping_option'] ) ) {
|
623 |
+
$chosen_methods = array( wc_clean( wp_unslash( $_POST['shipping_option'] ) ) );
|
624 |
+
$this->update_shipping_method( $chosen_methods );
|
625 |
+
}
|
626 |
+
|
627 |
+
WC()->cart->calculate_totals();
|
628 |
+
|
629 |
+
$payment_request['lineItems'] = $this->build_payment_request_line_items();
|
630 |
+
$payment_request['total'] = array(
|
631 |
+
'label' => get_bloginfo( 'name', 'display' ) . ' (via WooCommerce)',
|
632 |
+
'amount' => number_format( WC()->cart->total, 2, '.', '' ),
|
633 |
+
'pending' => false,
|
634 |
+
);
|
635 |
+
|
636 |
+
wp_send_json_success( $payment_request );
|
637 |
+
}
|
638 |
+
|
639 |
+
/**
|
640 |
+
* Process the digital wallet checkout
|
641 |
+
*
|
642 |
+
* @since 2.3
|
643 |
+
* @return void
|
644 |
+
*/
|
645 |
+
public function ajax_process_checkout() {
|
646 |
+
if ( WC()->cart->is_empty() ) {
|
647 |
+
wp_send_json_error( __( 'Empty cart', 'woocommerce-square' ) );
|
648 |
+
}
|
649 |
+
|
650 |
+
if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
|
651 |
+
define( 'WOOCOMMERCE_CHECKOUT', true );
|
652 |
+
}
|
653 |
+
|
654 |
+
WC()->checkout()->process_checkout();
|
655 |
+
|
656 |
+
die( 0 );
|
657 |
+
}
|
658 |
+
|
659 |
+
|
660 |
+
/** Helper methods *******************************************************************************************/
|
661 |
+
|
662 |
+
|
663 |
+
/**
|
664 |
+
* Helper function to return the expected location of the apple-developer verification file on the server.
|
665 |
+
*
|
666 |
+
* @since 2.3
|
667 |
+
* @return string
|
668 |
+
*/
|
669 |
+
public function apple_pay_verification_file_location() {
|
670 |
+
return ! empty( $_SERVER['DOCUMENT_ROOT'] ) ? untrailingslashit( wc_clean( wp_unslash( $_SERVER['DOCUMENT_ROOT'] ) ) ) . '/.well-known/apple-developer-merchantid-domain-association' : '';
|
671 |
+
}
|
672 |
+
|
673 |
+
/**
|
674 |
+
* Checks for the existance of Apple Pay verification domain file at:
|
675 |
+
* SERVER_ROOT/.well-known/apple-developer-merchantid-domain-association
|
676 |
+
*
|
677 |
+
* If the file doesn't exist or the contents has been modified, copy the file from the plugin
|
678 |
+
* directory to the expected verification domain file location.
|
679 |
+
*
|
680 |
+
* @since 2.3
|
681 |
+
* @return bool
|
682 |
+
*/
|
683 |
+
public function check_apple_pay_verification_file() {
|
684 |
+
if ( empty( $_SERVER['DOCUMENT_ROOT'] ) ) {
|
685 |
+
return false;
|
686 |
+
}
|
687 |
+
|
688 |
+
$path = untrailingslashit( wc_clean( wp_unslash( $_SERVER['DOCUMENT_ROOT'] ) ) );
|
689 |
+
$dir = '.well-known';
|
690 |
+
$file = 'apple-developer-merchantid-domain-association';
|
691 |
+
$fullpath = $path . '/' . $dir . '/' . $file;
|
692 |
+
$plugin_path = $this->gateway->get_plugin()->get_plugin_path();
|
693 |
+
$existing_contents = @file_get_contents( $fullpath ); // @codingStandardsIgnoreLine
|
694 |
+
$new_contents = @file_get_contents( $plugin_path . '/' . $file ); // @codingStandardsIgnoreLine
|
695 |
+
|
696 |
+
if ( $existing_contents && $existing_contents === $new_contents ) {
|
697 |
+
return true;
|
698 |
+
}
|
699 |
+
|
700 |
+
if ( ! file_exists( $path . '/' . $dir ) ) {
|
701 |
+
if ( ! @mkdir( $path . '/' . $dir, 0755 ) ) { // @codingStandardsIgnoreLine
|
702 |
+
$this->gateway->get_plugin()->log( 'Unable to create domain association folder to domain root.' );
|
703 |
+
return false;
|
704 |
+
}
|
705 |
+
}
|
706 |
+
|
707 |
+
if ( ! @copy( $plugin_path . '/' . $file, $fullpath ) ) { // @codingStandardsIgnoreLine
|
708 |
+
$this->gateway->get_plugin()->log( 'Unable to copy domain association file to domain root.' );
|
709 |
+
return false;
|
710 |
+
}
|
711 |
+
|
712 |
+
$this->gateway->get_plugin()->log( 'Apple Pay Domain association file updated.' );
|
713 |
+
return true;
|
714 |
+
}
|
715 |
+
|
716 |
+
/**
|
717 |
+
* When loading the settings page this function, tries to register the current store domain with Square/Apple Pay.
|
718 |
+
*
|
719 |
+
* If digital wallets and Apple Pay is enabled, check that the domain verification file exist and check
|
720 |
+
* the gateway settings for `apple_pay_domain_registered` to confirm that this domain has been successfully registered with Square/Apple Pay.
|
721 |
+
*
|
722 |
+
* If the store has been registered, keep verifying the registration of the current connected account and domain every hour.
|
723 |
+
*
|
724 |
+
* @since 2.3
|
725 |
+
* @return string
|
726 |
+
*/
|
727 |
+
public function apple_pay_domain_registration() {
|
728 |
+
// Only register the store url with Apple Pay if the gateway and digital wallets are enable (check POST data to account for the page load when settings are being saved).
|
729 |
+
if ( ( 'no' === $this->gateway->get_option( 'enabled', 'no' ) && empty( $_POST['woocommerce_square_credit_card_enabled'] ) ) || ( 'no' === $this->gateway->get_option( 'enable_digital_wallets', 'yes' ) && empty( $_POST['woocommerce_square_credit_card_enable_digital_wallets'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
|
730 |
+
return;
|
731 |
+
}
|
732 |
+
|
733 |
+
// when settings are being saved, make sure we use the latest values from POST data to check if Apple isn't one of the hidden wallet options
|
734 |
+
$hidden_wallet_options = ! isset( $_POST['woocommerce_square_credit_card_enable_digital_wallets'] ) ? $this->gateway->get_option( 'digital_wallets_hide_button_options', array() ) : ( ! empty( $_POST['woocommerce_square_credit_card_digital_wallets_hide_button_options'] ) ? wc_clean( wp_unslash( $_POST['woocommerce_square_credit_card_digital_wallets_hide_button_options'] ) ) : array() ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
|
735 |
+
if ( in_array( 'apple', $hidden_wallet_options, true ) ) {
|
736 |
+
return;
|
737 |
+
}
|
738 |
+
|
739 |
+
if ( ! $this->check_apple_pay_verification_file() ) {
|
740 |
+
$this->gateway->update_option( 'apple_pay_domain_registered', 'no' );
|
741 |
+
return;
|
742 |
+
}
|
743 |
+
|
744 |
+
try {
|
745 |
+
$recently_registered = get_transient( 'wc_square_check_apple_pay_domain_registration' );
|
746 |
+
|
747 |
+
if ( 'no' === $this->gateway->get_option( 'apple_pay_domain_registered', 'no' ) || ! $recently_registered ) {
|
748 |
+
$this->register_apple_pay_domain();
|
749 |
+
|
750 |
+
$this->gateway->update_option( 'apple_pay_domain_registered', 'yes' );
|
751 |
+
$this->gateway->get_plugin()->log( 'Your domain has been verified with Apple Pay!' );
|
752 |
+
|
753 |
+
// avoid API rate limits by limiting the request to checking every hour
|
754 |
+
set_transient( 'wc_square_check_apple_pay_domain_registration', true, HOUR_IN_SECONDS );
|
755 |
+
}
|
756 |
+
} catch ( \Exception $e ) {
|
757 |
+
$this->gateway->update_option( 'apple_pay_domain_registered', 'no' );
|
758 |
+
$this->gateway->get_plugin()->log( 'Error: ' . $e->getMessage() );
|
759 |
+
}
|
760 |
+
}
|
761 |
+
|
762 |
+
/**
|
763 |
+
* Sends an API request to endpoint v2/apple-pay/domains to register the store's domain with Square/Apple Pay.
|
764 |
+
*
|
765 |
+
* Reference: https://developer.squareup.com/docs/payment-form/cookbook/apple-pay-register-domains
|
766 |
+
*
|
767 |
+
* @since 2.3
|
768 |
+
* @throws \Exception on error
|
769 |
+
* @return void
|
770 |
+
*/
|
771 |
+
private function register_apple_pay_domain() {
|
772 |
+
$access_token = $this->gateway->get_plugin()->get_settings_handler()->get_access_token();
|
773 |
+
$is_sandbox = $this->gateway->get_plugin()->get_settings_handler()->is_sandbox();
|
774 |
+
|
775 |
+
if ( empty( $access_token ) ) {
|
776 |
+
throw new Exception( __( 'Unable to verify domain - missing access token.', 'woocommerce-square' ) );
|
777 |
+
}
|
778 |
+
|
779 |
+
$response = wp_remote_post(
|
780 |
+
'https://connect.squareup' . ( $is_sandbox ? 'sandbox' : '' ) . '.com/v2/apple-pay/domains',
|
781 |
+
array(
|
782 |
+
'headers' => array(
|
783 |
+
'Square-Version' => '2020-10-28',
|
784 |
+
'Authorization' => 'Bearer ' . $access_token,
|
785 |
+
'Content-Type' => 'application/json',
|
786 |
+
),
|
787 |
+
'body' => wp_json_encode(
|
788 |
+
array(
|
789 |
+
'domain_name' => ! empty( $_SERVER['HTTP_HOST'] ) ? wc_clean( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '',
|
790 |
+
)
|
791 |
+
),
|
792 |
+
)
|
793 |
+
);
|
794 |
+
|
795 |
+
if ( is_wp_error( $response ) ) {
|
796 |
+
/* translators: error message */
|
797 |
+
throw new \Exception( sprintf( 'Unable to verify domain - %s', $response->get_error_message() ) );
|
798 |
+
}
|
799 |
+
|
800 |
+
$parsed_response = json_decode( $response['body'], true );
|
801 |
+
|
802 |
+
if ( 200 !== $response['response']['code'] || empty( $parsed_response['status'] ) || 'VERIFIED' !== $parsed_response['status'] ) {
|
803 |
+
/* translators: error message */
|
804 |
+
throw new \Exception( sprintf( 'Unable to verify domain - %s', $parsed_response['errors'][0]['detail'] ) );
|
805 |
+
}
|
806 |
+
}
|
807 |
+
|
808 |
+
/**
|
809 |
+
* Returns an array of pages that digital wallets are loaded/available on.
|
810 |
+
* Defaults to product, cart and checkout pages.
|
811 |
+
*
|
812 |
+
* @since 2.3
|
813 |
+
* @return array
|
814 |
+
*/
|
815 |
+
public function get_available_pages() {
|
816 |
+
return apply_filters(
|
817 |
+
'wc_square_display_digital_wallet_on_pages',
|
818 |
+
array(
|
819 |
+
'product',
|
820 |
+
'cart',
|
821 |
+
'checkout',
|
822 |
+
),
|
823 |
+
$this
|
824 |
+
);
|
825 |
+
}
|
826 |
+
|
827 |
+
/**
|
828 |
+
* Returns the current page.
|
829 |
+
*
|
830 |
+
* Stores the result in $this->page to avoid recalculating multiple times per request
|
831 |
+
*
|
832 |
+
* @since 2.3
|
833 |
+
* @return string
|
834 |
+
*/
|
835 |
+
public function get_current_page() {
|
836 |
+
if ( null === $this->page ) {
|
837 |
+
$is_cart = is_cart() && ! WC()->cart->is_empty();
|
838 |
+
$is_product = is_product() || wc_post_content_has_shortcode( 'product_page' );
|
839 |
+
$this->page = $is_cart ? 'cart' : ( $is_product ? 'product' : ( is_checkout() ? 'checkout' : null ) );
|
840 |
+
}
|
841 |
+
|
842 |
+
return $this->page;
|
843 |
+
}
|
844 |
+
|
845 |
+
/**
|
846 |
+
* Returns cart totals in an array format
|
847 |
+
*
|
848 |
+
* @since 2.3
|
849 |
+
* @throws \Exception if no cart is found
|
850 |
+
* @return array
|
851 |
+
*/
|
852 |
+
public function get_cart_totals() {
|
853 |
+
if ( ! isset( WC()->cart ) ) {
|
854 |
+
throw new \Exception( 'Cart data cannot be found.' );
|
855 |
+
}
|
856 |
+
|
857 |
+
return array(
|
858 |
+
'subtotal' => WC()->cart->subtotal_ex_tax,
|
859 |
+
'discount' => WC()->cart->get_cart_discount_total(),
|
860 |
+
'shipping' => WC()->cart->shipping_total,
|
861 |
+
'fees' => WC()->cart->fee_total,
|
862 |
+
'taxes' => WC()->cart->tax_total + WC()->cart->shipping_tax_total,
|
863 |
+
);
|
864 |
+
}
|
865 |
+
|
866 |
+
/**
|
867 |
+
* Returns a list of hidden digital wallet options
|
868 |
+
*
|
869 |
+
* If Apple Pay domain hasn't been registered, force Apple Pay to be hidden.
|
870 |
+
*
|
871 |
+
* @since 2.3
|
872 |
+
* @return array
|
873 |
+
*/
|
874 |
+
public function get_hidden_button_options() {
|
875 |
+
$hidden_options = $this->gateway->get_option( 'digital_wallets_hide_button_options', array() );
|
876 |
+
|
877 |
+
if ( ( ! is_array( $hidden_options ) || ! in_array( 'apple', $hidden_options, true ) ) && 'no' === $this->gateway->get_option( 'apple_pay_domain_registered', 'no' ) ) {
|
878 |
+
$hidden_options[] = 'apple';
|
879 |
+
}
|
880 |
+
|
881 |
+
return $hidden_options;
|
882 |
+
}
|
883 |
+
|
884 |
+
/**
|
885 |
+
* Returns a list the supported product types that can be used to purchase a digital wallet
|
886 |
+
*
|
887 |
+
* @since 2.3
|
888 |
+
* @return array
|
889 |
+
*/
|
890 |
+
public function supported_product_types() {
|
891 |
+
return apply_filters(
|
892 |
+
'wc_square_digital_wallets_supported_product_types',
|
893 |
+
array(
|
894 |
+
'simple',
|
895 |
+
'variable',
|
896 |
+
'variation',
|
897 |
+
'subscription',
|
898 |
+
'variable-subscription',
|
899 |
+
'subscription_variation',
|
900 |
+
'booking',
|
901 |
+
'bundle',
|
902 |
+
'composite',
|
903 |
+
'mix-and-match',
|
904 |
+
)
|
905 |
+
);
|
906 |
+
}
|
907 |
+
|
908 |
+
/**
|
909 |
+
* Checks if digital wallets are allowed to be used to purchase the current product.
|
910 |
+
*
|
911 |
+
* @since 2.3
|
912 |
+
* @return bool
|
913 |
+
*/
|
914 |
+
public function allowed_for_product_page() {
|
915 |
+
global $post;
|
916 |
+
|
917 |
+
$product = wc_get_product( $post->ID );
|
918 |
+
|
919 |
+
if ( ! is_object( $product ) || ! in_array( $product->get_type(), $this->supported_product_types(), true ) ) {
|
920 |
+
return false;
|
921 |
+
}
|
922 |
+
|
923 |
+
// Trial subscriptions with shipping are not supported
|
924 |
+
if ( class_exists( 'WC_Subscriptions_Order' ) && $product->needs_shipping() && \WC_Subscriptions_Product::get_trial_length( $product ) > 0 ) {
|
925 |
+
return false;
|
926 |
+
}
|
927 |
+
|
928 |
+
// Pre Orders charge upon release not supported.
|
929 |
+
if ( class_exists( 'WC_Pre_Orders_Order' ) && \WC_Pre_Orders_Product::product_is_charged_upon_release( $product ) ) {
|
930 |
+
return false;
|
931 |
+
}
|
932 |
+
|
933 |
+
// File upload addon not supported
|
934 |
+
if ( class_exists( 'WC_Product_Addons_Helper' ) ) {
|
935 |
+
$product_addons = \WC_Product_Addons_Helper::get_product_addons( $product->get_id() );
|
936 |
+
foreach ( $product_addons as $addon ) {
|
937 |
+
if ( 'file_upload' === $addon['type'] ) {
|
938 |
+
return false;
|
939 |
+
}
|
940 |
+
}
|
941 |
+
}
|
942 |
+
|
943 |
+
return true;
|
944 |
+
}
|
945 |
+
|
946 |
+
/**
|
947 |
+
* Checks the cart to see if Square Digital Wallets is allowed to purchase all cart items.
|
948 |
+
*
|
949 |
+
* @since 2.3
|
950 |
+
* @return bool
|
951 |
+
*/
|
952 |
+
public function allowed_for_cart() {
|
953 |
+
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
|
954 |
+
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
|
955 |
+
|
956 |
+
if ( ! in_array( $_product->get_type(), $this->supported_product_types(), true ) ) {
|
957 |
+
return false;
|
958 |
+
}
|
959 |
+
|
960 |
+
// Trial subscriptions with shipping are not supported
|
961 |
+
if ( class_exists( 'WC_Subscriptions_Order' ) && \WC_Subscriptions_Cart::cart_contains_subscription() && $_product->needs_shipping() && \WC_Subscriptions_Product::get_trial_length( $_product ) > 0 ) {
|
962 |
+
return false;
|
963 |
+
}
|
964 |
+
|
965 |
+
// Pre Orders compatbility where we don't support charge upon release.
|
966 |
+
if ( class_exists( 'WC_Pre_Orders_Order' ) && \WC_Pre_Orders_Cart::cart_contains_pre_order() && \WC_Pre_Orders_Product::product_is_charged_upon_release( \WC_Pre_Orders_Cart::get_pre_order_product() ) ) {
|
967 |
+
return false;
|
968 |
+
}
|
969 |
+
}
|
970 |
+
|
971 |
+
return true;
|
972 |
+
}
|
973 |
+
|
974 |
+
/**
|
975 |
+
* Returns if Google Pay and/or Apple Pay is available by checking the following:
|
976 |
+
* - setting is enabled
|
977 |
+
* - country and currency is supported
|
978 |
+
* - square is connected and location is set
|
979 |
+
* - current page/cart has items that can be purchased with a digital wallet
|
980 |
+
*
|
981 |
+
* Sets $this->is_available so that it's only checked once per request/page load
|
982 |
+
*
|
983 |
+
* @since 2.3
|
984 |
+
* @return bool
|
985 |
+
*/
|
986 |
+
public function is_available() {
|
987 |
+
if ( null === $this->is_available ) {
|
988 |
+
$available_pages = $this->get_available_pages();
|
989 |
+
$current_page = $this->get_current_page();
|
990 |
+
|
991 |
+
if ( is_array( $available_pages ) && $current_page && in_array( $current_page, $available_pages, true ) ) {
|
992 |
+
$this->is_available = ( 'yes' === $this->gateway->get_option( 'enable_digital_wallets', 'yes' ) && $this->gateway->is_digital_wallet_available() && $this->gateway->is_available() && ( 'product' === $current_page ? $this->allowed_for_product_page() : $this->allowed_for_cart() ) ) ? true : false;
|
993 |
+
} else {
|
994 |
+
$this->is_available = false;
|
995 |
+
}
|
996 |
+
}
|
997 |
+
|
998 |
+
return $this->is_available;
|
999 |
+
}
|
1000 |
+
|
1001 |
+
/**
|
1002 |
+
* This function calculates the value returned by get_option( 'wc_square_apple_pay_enabled', $default )
|
1003 |
+
* and is used by WC Admin's Remote Inbox Notifications for marketing purposes.
|
1004 |
+
*
|
1005 |
+
* Returns either 1 or 2 if Apple Pay is enabled on the store, or $value (false) if not
|
1006 |
+
*
|
1007 |
+
* @since 2.3
|
1008 |
+
* @param $value
|
1009 |
+
* @return int|mixed
|
1010 |
+
*/
|
1011 |
+
public function get_option_is_apple_pay_enabled( $value ) {
|
1012 |
+
if ( $this->gateway->is_digital_wallet_available() && 'yes' === $this->gateway->get_option( 'enable_digital_wallets', 'yes' ) && ! in_array( 'apple', $this->gateway->get_option( 'digital_wallets_hide_button_options', array() ), true ) ) {
|
1013 |
+
$value = wp_rand( 1, 2 );
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
return $value;
|
1017 |
+
}
|
1018 |
+
}
|
includes/Handlers/Order.php
CHANGED
@@ -272,6 +272,11 @@ class Order {
|
|
272 |
return;
|
273 |
}
|
274 |
|
|
|
|
|
|
|
|
|
|
|
275 |
$refund = new \WC_Order_Refund( $refund_id );
|
276 |
$inventory_adjustments = array();
|
277 |
foreach ( $refund->get_items() as $item ) {
|
272 |
return;
|
273 |
}
|
274 |
|
275 |
+
// don't refund items if the "Restock refunded items" option is unchecked - maintains backwards compatibility if this function is called outside of the `woocommerce_order_refunded` do_action
|
276 |
+
if ( check_ajax_referer( 'order-item', 'security', false ) && isset( $_POST['restock_refunded_items'] ) && 'false' === $_POST['restock_refunded_items'] ) {
|
277 |
+
return;
|
278 |
+
}
|
279 |
+
|
280 |
$refund = new \WC_Order_Refund( $refund_id );
|
281 |
$inventory_adjustments = array();
|
282 |
foreach ( $refund->get_items() as $item ) {
|
includes/Handlers/Products.php
CHANGED
@@ -388,15 +388,27 @@ class Products {
|
|
388 |
* @param WC_Product $product the product object
|
389 |
*/
|
390 |
public function maybe_stage_product_for_sync( $product ) {
|
391 |
-
if ( ! defined( 'DOING_SQUARE_SYNC' ) && ! in_array( $product->get_id(), $this->products_to_sync ) ) {
|
392 |
|
393 |
-
|
|
|
|
|
394 |
|
395 |
-
|
396 |
-
|
397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
}
|
399 |
}
|
|
|
|
|
|
|
|
|
400 |
}
|
401 |
|
402 |
|
388 |
* @param WC_Product $product the product object
|
389 |
*/
|
390 |
public function maybe_stage_product_for_sync( $product ) {
|
|
|
391 |
|
392 |
+
if ( ! $product || ! Product::is_synced_with_square( $product ) || in_array( $product->get_id(), $this->products_to_sync, true ) ) {
|
393 |
+
return;
|
394 |
+
}
|
395 |
|
396 |
+
$in_progress = wc_square()->get_sync_handler()->get_job_in_progress();
|
397 |
+
|
398 |
+
if ( $in_progress ) {
|
399 |
+
// return early if an import that is updating existing products is in progress.
|
400 |
+
if ( isset( $in_progress->update_products_during_import ) && $in_progress->update_products_during_import ) {
|
401 |
+
return;
|
402 |
+
}
|
403 |
+
|
404 |
+
if ( in_array( $product->get_id(), $in_progress->product_ids, true ) ) {
|
405 |
+
return;
|
406 |
}
|
407 |
}
|
408 |
+
|
409 |
+
// the triggering action for this method can be called multiple times in a single request - keep track
|
410 |
+
// of product IDs that have been scheduled for sync here to avoid multiple syncs on the same request
|
411 |
+
$this->products_to_sync[] = $product->get_id();
|
412 |
}
|
413 |
|
414 |
|
includes/Lifecycle.php
CHANGED
@@ -55,6 +55,7 @@ class Lifecycle extends Framework\Plugin\Lifecycle {
|
|
55 |
'2.0.4',
|
56 |
'2.1.5',
|
57 |
'2.2.0',
|
|
|
58 |
);
|
59 |
}
|
60 |
|
@@ -217,6 +218,22 @@ class Lifecycle extends Framework\Plugin\Lifecycle {
|
|
217 |
update_option( 'wc_square_settings', $v2_settings );
|
218 |
}
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
/**
|
221 |
* Migrates plugin settings from v1 to v2.
|
222 |
*
|
55 |
'2.0.4',
|
56 |
'2.1.5',
|
57 |
'2.2.0',
|
58 |
+
'2.3.0',
|
59 |
);
|
60 |
}
|
61 |
|
218 |
update_option( 'wc_square_settings', $v2_settings );
|
219 |
}
|
220 |
|
221 |
+
/**
|
222 |
+
* Upgrades to version 2.3.0.
|
223 |
+
*
|
224 |
+
* @since 2.3.0
|
225 |
+
*/
|
226 |
+
protected function upgrade_to_2_3_0() {
|
227 |
+
// Set `enable_digital_wallets` default to no for existing stores
|
228 |
+
$gateway_settings = get_option( 'woocommerce_square_credit_card_settings', array() );
|
229 |
+
|
230 |
+
if ( ! isset( $gateway_settings['enable_digital_wallets'] ) ) {
|
231 |
+
$gateway_settings['enable_digital_wallets'] = 'no';
|
232 |
+
}
|
233 |
+
|
234 |
+
update_option( 'woocommerce_square_credit_card_settings', $gateway_settings );
|
235 |
+
}
|
236 |
+
|
237 |
/**
|
238 |
* Migrates plugin settings from v1 to v2.
|
239 |
*
|
includes/Plugin.php
CHANGED
@@ -42,7 +42,7 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
|
|
42 |
|
43 |
|
44 |
/** plugin version number */
|
45 |
-
const VERSION = '2.
|
46 |
|
47 |
/** plugin ID */
|
48 |
const PLUGIN_ID = 'square';
|
@@ -613,9 +613,10 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
|
|
613 |
* @since 2.0.0
|
614 |
*
|
615 |
* @param string $key_input
|
|
|
616 |
* @return string
|
617 |
*/
|
618 |
-
public function get_idempotency_key( $key_input = '' ) {
|
619 |
|
620 |
if ( '' === $key_input ) {
|
621 |
$key_input = uniqid( '', false );
|
@@ -628,7 +629,7 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
|
|
628 |
*
|
629 |
* @param string $key_input
|
630 |
*/
|
631 |
-
return apply_filters( 'wc_square_idempotency_key',
|
632 |
}
|
633 |
|
634 |
|
@@ -647,6 +648,18 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
|
|
647 |
return parent::is_plugin_settings() || ( isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && self::PLUGIN_ID === $_GET['tab'] );
|
648 |
}
|
649 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
|
651 |
/** Getter methods ************************************************************************************************/
|
652 |
|
42 |
|
43 |
|
44 |
/** plugin version number */
|
45 |
+
const VERSION = '2.3.0';
|
46 |
|
47 |
/** plugin ID */
|
48 |
const PLUGIN_ID = 'square';
|
613 |
* @since 2.0.0
|
614 |
*
|
615 |
* @param string $key_input
|
616 |
+
* @param bool $append_key_input
|
617 |
* @return string
|
618 |
*/
|
619 |
+
public function get_idempotency_key( $key_input = '', $append_key_input = true ) {
|
620 |
|
621 |
if ( '' === $key_input ) {
|
622 |
$key_input = uniqid( '', false );
|
629 |
*
|
630 |
* @param string $key_input
|
631 |
*/
|
632 |
+
return apply_filters( 'wc_square_idempotency_key', sha1( get_option( 'siteurl' ) . $key_input ) . ( $append_key_input ? ':' . $key_input : '' ) );
|
633 |
}
|
634 |
|
635 |
|
648 |
return parent::is_plugin_settings() || ( isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && self::PLUGIN_ID === $_GET['tab'] );
|
649 |
}
|
650 |
|
651 |
+
/**
|
652 |
+
* Determines if viewing the gateway settings.
|
653 |
+
*
|
654 |
+
* @since 2.3.0
|
655 |
+
*
|
656 |
+
* @return bool
|
657 |
+
*/
|
658 |
+
public function is_gateway_settings() {
|
659 |
+
|
660 |
+
return isset( $_GET['page'], $_GET['tab'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'checkout' === $_GET['tab'] && self::GATEWAY_ID === $_GET['section'];
|
661 |
+
}
|
662 |
+
|
663 |
|
664 |
/** Getter methods ************************************************************************************************/
|
665 |
|
includes/Sync/Interval_Polling.php
CHANGED
@@ -85,21 +85,30 @@ class Interval_Polling extends Stepped_Job {
|
|
85 |
)
|
86 |
);
|
87 |
|
88 |
-
|
|
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
Records::set_record(
|
96 |
array(
|
97 |
-
'type' => '
|
98 |
-
'message' =>
|
99 |
-
/* translator: Placeholder %d number of categories */
|
100 |
-
_n( 'Updated data for %d category.', 'Updated data for %d categories.', count( $categories ), 'woocommerce-square' ),
|
101 |
-
count( $categories )
|
102 |
-
),
|
103 |
)
|
104 |
);
|
105 |
}
|
85 |
)
|
86 |
);
|
87 |
|
88 |
+
if ( $response->get_data() instanceof SearchCatalogObjectsResponse ) {
|
89 |
+
$categories = $response->get_data()->getObjects();
|
90 |
|
91 |
+
if ( $categories && is_array( $categories ) ) {
|
92 |
+
foreach ( $categories as $category ) {
|
93 |
+
Category::import_or_update( $category );
|
94 |
+
}
|
95 |
|
96 |
+
Records::set_record(
|
97 |
+
array(
|
98 |
+
'type' => 'info',
|
99 |
+
'message' => sprintf(
|
100 |
+
/* translator: Placeholder %d number of categories */
|
101 |
+
_n( 'Updated data for %d category.', 'Updated data for %d categories.', count( $categories ), 'woocommerce-square' ),
|
102 |
+
count( $categories )
|
103 |
+
),
|
104 |
+
)
|
105 |
+
);
|
106 |
+
}
|
107 |
+
} else {
|
108 |
Records::set_record(
|
109 |
array(
|
110 |
+
'type' => 'alert',
|
111 |
+
'message' => esc_html__( 'Product category data could not be updated from Square. Invalid API response.', 'woocommerce-square' ),
|
|
|
|
|
|
|
|
|
112 |
)
|
113 |
);
|
114 |
}
|
includes/Sync/Manual_Synchronization.php
CHANGED
@@ -26,9 +26,11 @@ namespace WooCommerce\Square\Sync;
|
|
26 |
use SkyVerge\WooCommerce\PluginFramework\v5_4_0 as Framework;
|
27 |
use SquareConnect\Model\BatchRetrieveInventoryCountsResponse;
|
28 |
use SquareConnect\Model\BatchUpsertCatalogObjectsResponse;
|
|
|
29 |
use SquareConnect\Model\CatalogObject;
|
30 |
use SquareConnect\Model\CatalogObjectBatch;
|
31 |
use SquareConnect\Model\SearchCatalogObjectsResponse;
|
|
|
32 |
use SquareConnect\ObjectSerializer;
|
33 |
use WooCommerce\Square\Handlers\Category;
|
34 |
use WooCommerce\Square\Handlers\Product;
|
@@ -94,7 +96,7 @@ class Manual_Synchronization extends Stepped_Job {
|
|
94 |
|
95 |
$catalog_info = wc_square()->get_api()->catalog_info();
|
96 |
|
97 |
-
if ( $catalog_info->get_data() && $catalog_info->get_data()->getLimits() ) {
|
98 |
|
99 |
$limits = $catalog_info->get_data()->getLimits();
|
100 |
|
@@ -191,9 +193,12 @@ class Manual_Synchronization extends Stepped_Job {
|
|
191 |
$mapped_category_audit[ $mapped_category['square_id'] ] = $mapped_category_id;
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
194 |
// handle response
|
195 |
if ( is_array( $response->get_data()->getObjects() ) ) {
|
196 |
-
|
197 |
foreach ( $response->get_data()->getObjects() as $category ) {
|
198 |
|
199 |
// don't check for the name, it will get overwritten by the Woo value anyway
|
@@ -274,7 +279,7 @@ class Manual_Synchronization extends Stepped_Job {
|
|
274 |
);
|
275 |
|
276 |
$category_map = Category::get_map();
|
277 |
-
$categories = $response->get_data()->getObjects();
|
278 |
|
279 |
if ( is_array( $categories ) ) {
|
280 |
|
@@ -301,7 +306,7 @@ class Manual_Synchronization extends Stepped_Job {
|
|
301 |
$this->set_attr( 'mapped_categories', $mapped_categories );
|
302 |
$this->set_attr( 'unmapped_categories', $unmapped_categories );
|
303 |
|
304 |
-
$cursor = $response->get_data()->getCursor();
|
305 |
$this->set_attr( 'unmapped_categories_cursor', $cursor );
|
306 |
|
307 |
if ( empty( $cursor ) ) {
|
@@ -359,35 +364,36 @@ class Manual_Synchronization extends Stepped_Job {
|
|
359 |
$batches[] = new \SquareConnect\Model\CatalogObjectBatch( array( 'objects' => array( new \SquareConnect\Model\CatalogObject( $catalog_object_data ) ) ) );
|
360 |
}
|
361 |
|
362 |
-
|
|
|
|
|
363 |
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
if ( $id_mappings = $result->get_data()->getIdMappings() ) {
|
368 |
-
|
369 |
-
foreach ( $id_mappings as $id_mapping ) {
|
370 |
|
371 |
-
|
372 |
-
$remote_object_id = $id_mapping->getObjectId();
|
373 |
|
374 |
-
|
|
|
|
|
|
|
375 |
|
376 |
-
|
377 |
-
|
|
|
|
|
378 |
}
|
379 |
}
|
380 |
-
}
|
381 |
-
|
382 |
-
foreach ( $result->get_data()->getObjects() as $upserted_category ) {
|
383 |
|
384 |
-
|
385 |
-
|
|
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
}
|
392 |
}
|
393 |
|
@@ -463,7 +469,7 @@ class Manual_Synchronization extends Stepped_Job {
|
|
463 |
|
464 |
$api_response = wc_square()->get_api()->batch_retrieve_catalog_objects( $square_ids );
|
465 |
|
466 |
-
if ( ! $api_response->get_data() ) {
|
467 |
throw new Framework\SV_WC_API_Exception( 'Response data is missing' );
|
468 |
}
|
469 |
|
@@ -586,7 +592,7 @@ class Manual_Synchronization extends Stepped_Job {
|
|
586 |
|
587 |
$response = wc_square()->get_api()->batch_retrieve_catalog_objects( $square_ids );
|
588 |
|
589 |
-
if ( ! $response->get_data() ) {
|
590 |
throw new Framework\SV_WC_API_Exception( 'Response data is missing' );
|
591 |
}
|
592 |
|
@@ -675,7 +681,7 @@ class Manual_Synchronization extends Stepped_Job {
|
|
675 |
$in_progress['unprocessed_search_response'] = json_encode( json_decode( $search_response . '', true ) );
|
676 |
}
|
677 |
|
678 |
-
if ( ! $search_response ) {
|
679 |
throw new Framework\SV_WC_API_Exception( 'Response data is missing' );
|
680 |
}
|
681 |
|
@@ -1777,7 +1783,7 @@ class Manual_Synchronization extends Stepped_Job {
|
|
1777 |
*/
|
1778 |
protected function get_max_objects_per_upsert() {
|
1779 |
|
1780 |
-
$max = $this->get_attr( 'max_objects_per_upsert',
|
1781 |
|
1782 |
/**
|
1783 |
* Filters the maximum number of objects per upsert in a single request.
|
26 |
use SkyVerge\WooCommerce\PluginFramework\v5_4_0 as Framework;
|
27 |
use SquareConnect\Model\BatchRetrieveInventoryCountsResponse;
|
28 |
use SquareConnect\Model\BatchUpsertCatalogObjectsResponse;
|
29 |
+
use SquareConnect\Model\BatchRetrieveCatalogObjectsResponse;
|
30 |
use SquareConnect\Model\CatalogObject;
|
31 |
use SquareConnect\Model\CatalogObjectBatch;
|
32 |
use SquareConnect\Model\SearchCatalogObjectsResponse;
|
33 |
+
use SquareConnect\Model\CatalogInfoResponse;
|
34 |
use SquareConnect\ObjectSerializer;
|
35 |
use WooCommerce\Square\Handlers\Category;
|
36 |
use WooCommerce\Square\Handlers\Product;
|
96 |
|
97 |
$catalog_info = wc_square()->get_api()->catalog_info();
|
98 |
|
99 |
+
if ( $catalog_info->get_data() instanceof CatalogInfoResponse && $catalog_info->get_data()->getLimits() ) {
|
100 |
|
101 |
$limits = $catalog_info->get_data()->getLimits();
|
102 |
|
193 |
$mapped_category_audit[ $mapped_category['square_id'] ] = $mapped_category_id;
|
194 |
}
|
195 |
|
196 |
+
if ( ! $response->get_data() instanceof BatchRetrieveCatalogObjectsResponse ) {
|
197 |
+
throw new Framework\SV_WC_API_Exception( 'Could not fetch category data from Square. Response data is missing' );
|
198 |
+
}
|
199 |
+
|
200 |
// handle response
|
201 |
if ( is_array( $response->get_data()->getObjects() ) ) {
|
|
|
202 |
foreach ( $response->get_data()->getObjects() as $category ) {
|
203 |
|
204 |
// don't check for the name, it will get overwritten by the Woo value anyway
|
279 |
);
|
280 |
|
281 |
$category_map = Category::get_map();
|
282 |
+
$categories = $response->get_data() instanceof SearchCatalogObjectsResponse ? $response->get_data()->getObjects() : null;
|
283 |
|
284 |
if ( is_array( $categories ) ) {
|
285 |
|
306 |
$this->set_attr( 'mapped_categories', $mapped_categories );
|
307 |
$this->set_attr( 'unmapped_categories', $unmapped_categories );
|
308 |
|
309 |
+
$cursor = $response->get_data() instanceof SearchCatalogObjectsResponse ? $response->get_data()->getCursor() : null;
|
310 |
$this->set_attr( 'unmapped_categories_cursor', $cursor );
|
311 |
|
312 |
if ( empty( $cursor ) ) {
|
364 |
$batches[] = new \SquareConnect\Model\CatalogObjectBatch( array( 'objects' => array( new \SquareConnect\Model\CatalogObject( $catalog_object_data ) ) ) );
|
365 |
}
|
366 |
|
367 |
+
foreach ( array_chunk( $batches, $this->get_max_objects_per_upsert() ) as $batch ) {
|
368 |
+
$idempotency_key = wc_square()->get_idempotency_key( md5( serialize( $batch ) . $this->get_attr( 'id' ) ) . '_upsert_categories' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
|
369 |
+
$result = wc_square()->get_api()->batch_upsert_catalog_objects( $idempotency_key, $batch );
|
370 |
|
371 |
+
if ( ! $result->get_data() instanceof BatchUpsertCatalogObjectsResponse ) {
|
372 |
+
throw new Framework\SV_WC_API_Exception( 'Response data is invalid' );
|
373 |
+
}
|
|
|
|
|
|
|
374 |
|
375 |
+
$id_mappings = $result->get_data()->getIdMappings(); // new entries to Square will return in the ID Mapping.
|
|
|
376 |
|
377 |
+
if ( ! empty( $id_mappings ) ) {
|
378 |
+
foreach ( $id_mappings as $id_mapping ) {
|
379 |
+
$client_object_id = $id_mapping->getClientObjectId();
|
380 |
+
$remote_object_id = $id_mapping->getObjectId();
|
381 |
|
382 |
+
if ( isset( $reverse_map[ $client_object_id ] ) ) {
|
383 |
+
$reverse_map[ $remote_object_id ] = $reverse_map[ $client_object_id ];
|
384 |
+
unset( $reverse_map[ $client_object_id ] );
|
385 |
+
}
|
386 |
}
|
387 |
}
|
|
|
|
|
|
|
388 |
|
389 |
+
foreach ( $result->get_data()->getObjects() as $upserted_category ) {
|
390 |
+
$id = $upserted_category->getId();
|
391 |
+
$version = $upserted_category->getVersion();
|
392 |
|
393 |
+
if ( isset( $reverse_map[ $id ] ) ) {
|
394 |
+
Category::update_mapping( $reverse_map[ $id ], $id, $version );
|
395 |
+
unset( $reverse_map[ $id ] );
|
396 |
+
}
|
397 |
}
|
398 |
}
|
399 |
|
469 |
|
470 |
$api_response = wc_square()->get_api()->batch_retrieve_catalog_objects( $square_ids );
|
471 |
|
472 |
+
if ( ! $api_response->get_data() instanceof BatchRetrieveCatalogObjectsResponse ) {
|
473 |
throw new Framework\SV_WC_API_Exception( 'Response data is missing' );
|
474 |
}
|
475 |
|
592 |
|
593 |
$response = wc_square()->get_api()->batch_retrieve_catalog_objects( $square_ids );
|
594 |
|
595 |
+
if ( ! $response->get_data() instanceof BatchRetrieveCatalogObjectsResponse ) {
|
596 |
throw new Framework\SV_WC_API_Exception( 'Response data is missing' );
|
597 |
}
|
598 |
|
681 |
$in_progress['unprocessed_search_response'] = json_encode( json_decode( $search_response . '', true ) );
|
682 |
}
|
683 |
|
684 |
+
if ( ! $search_response instanceof SearchCatalogObjectsResponse ) {
|
685 |
throw new Framework\SV_WC_API_Exception( 'Response data is missing' );
|
686 |
}
|
687 |
|
1783 |
*/
|
1784 |
protected function get_max_objects_per_upsert() {
|
1785 |
|
1786 |
+
$max = $this->get_attr( 'max_objects_per_upsert', 500 );
|
1787 |
|
1788 |
/**
|
1789 |
* Filters the maximum number of objects per upsert in a single request.
|
includes/Sync/Product_Import.php
CHANGED
@@ -101,6 +101,10 @@ class Product_Import extends Stepped_Job {
|
|
101 |
)
|
102 |
);
|
103 |
|
|
|
|
|
|
|
|
|
104 |
$related_objects = $response->get_data()->getRelatedObjects();
|
105 |
$categories = array();
|
106 |
|
@@ -139,7 +143,7 @@ class Product_Import extends Stepped_Job {
|
|
139 |
$item_id = $catalog_object->getId();
|
140 |
|
141 |
// Ignore items that are available at all locations, but absent at ours.
|
142 |
-
if (
|
143 |
$skipped_products[ $item_id ] = null;
|
144 |
continue;
|
145 |
}
|
@@ -150,12 +154,6 @@ class Product_Import extends Stepped_Job {
|
|
150 |
continue;
|
151 |
}
|
152 |
|
153 |
-
// Ignore items that are missing a sku.
|
154 |
-
if ( $this->item_variation_has_missing_sku( $catalog_object ) ) {
|
155 |
-
$skipped_products[ $item_id ] = null;
|
156 |
-
continue;
|
157 |
-
}
|
158 |
-
|
159 |
$product_id = (int) Product::get_product_id_by_square_id( $item_id );
|
160 |
$product = ! empty( $product_id ) ? wc_get_product( $product_id ) : null;
|
161 |
|
@@ -207,7 +205,7 @@ class Product_Import extends Stepped_Job {
|
|
207 |
if ( $product_id ) {
|
208 |
$updated_product_ids[] = $product_id;
|
209 |
}
|
210 |
-
} elseif ( $this->item_variation_has_matching_sku( $
|
211 |
// look in variation SKUs for a match - if so, skip the parent item, a normal sync should link it automatically
|
212 |
continue;
|
213 |
} else {
|
@@ -261,6 +259,10 @@ class Product_Import extends Stepped_Job {
|
|
261 |
)
|
262 |
);
|
263 |
|
|
|
|
|
|
|
|
|
264 |
$cursor = $search_result->get_data()->getCursor();
|
265 |
$variation_ids = array_map(
|
266 |
static function( \SquareConnect\Model\CatalogObject $catalog_object ) {
|
@@ -329,19 +331,20 @@ class Product_Import extends Stepped_Job {
|
|
329 |
*
|
330 |
* @since 2.0.0
|
331 |
*
|
332 |
-
* @param
|
333 |
* @return bool
|
334 |
*/
|
335 |
-
private function item_variation_has_matching_sku( $
|
336 |
-
|
337 |
-
foreach ( $catalog_object->getItemData()->getVariations() as $variation ) {
|
338 |
|
339 |
-
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
}
|
344 |
-
|
345 |
return false;
|
346 |
}
|
347 |
|
@@ -532,6 +535,16 @@ class Product_Import extends Stepped_Job {
|
|
532 |
continue;
|
533 |
}
|
534 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
try {
|
536 |
|
537 |
$data['variations'][] = $this->extract_square_item_variation_data( $variation );
|
@@ -621,6 +634,10 @@ class Product_Import extends Stepped_Job {
|
|
621 |
throw new Framework\SV_WC_Plugin_Exception( __( 'Items with variable pricing cannot be imported.', 'woocommerce-square' ) );
|
622 |
}
|
623 |
|
|
|
|
|
|
|
|
|
624 |
$data = array(
|
625 |
'name' => $variation_data->getName(),
|
626 |
'sku' => $variation_data->getSku(),
|
101 |
)
|
102 |
);
|
103 |
|
104 |
+
if ( ! $response->get_data() instanceof SearchCatalogObjectsResponse ) {
|
105 |
+
throw new Framework\SV_WC_API_Exception( 'API response data is invalid' );
|
106 |
+
}
|
107 |
+
|
108 |
$related_objects = $response->get_data()->getRelatedObjects();
|
109 |
$categories = array();
|
110 |
|
143 |
$item_id = $catalog_object->getId();
|
144 |
|
145 |
// Ignore items that are available at all locations, but absent at ours.
|
146 |
+
if ( is_array( $catalog_object->getAbsentAtLocationIds() ) && in_array( wc_square()->get_settings_handler()->get_location_id(), $catalog_object->getAbsentAtLocationIds(), true ) ) {
|
147 |
$skipped_products[ $item_id ] = null;
|
148 |
continue;
|
149 |
}
|
154 |
continue;
|
155 |
}
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
$product_id = (int) Product::get_product_id_by_square_id( $item_id );
|
158 |
$product = ! empty( $product_id ) ? wc_get_product( $product_id ) : null;
|
159 |
|
205 |
if ( $product_id ) {
|
206 |
$updated_product_ids[] = $product_id;
|
207 |
}
|
208 |
+
} elseif ( $this->item_variation_has_matching_sku( $data ) ) {
|
209 |
// look in variation SKUs for a match - if so, skip the parent item, a normal sync should link it automatically
|
210 |
continue;
|
211 |
} else {
|
259 |
)
|
260 |
);
|
261 |
|
262 |
+
if ( ! $search_result->get_data() instanceof SearchCatalogObjectsResponse ) {
|
263 |
+
throw new Framework\SV_WC_API_Exception( 'API response data is invalid' );
|
264 |
+
}
|
265 |
+
|
266 |
$cursor = $search_result->get_data()->getCursor();
|
267 |
$variation_ids = array_map(
|
268 |
static function( \SquareConnect\Model\CatalogObject $catalog_object ) {
|
331 |
*
|
332 |
* @since 2.0.0
|
333 |
*
|
334 |
+
* @param array $data the catalog object data
|
335 |
* @return bool
|
336 |
*/
|
337 |
+
private function item_variation_has_matching_sku( $data ) {
|
|
|
|
|
338 |
|
339 |
+
if ( 'simple' === $data['type'] ) {
|
340 |
+
return (bool) wc_get_product_id_by_sku( $data['sku'] );
|
341 |
+
} else {
|
342 |
+
foreach ( $data['variations'] as $variation ) {
|
343 |
+
if ( wc_get_product_id_by_sku( $variation['sku'] ) ) {
|
344 |
+
return true;
|
345 |
+
}
|
346 |
}
|
347 |
}
|
|
|
348 |
return false;
|
349 |
}
|
350 |
|
535 |
continue;
|
536 |
}
|
537 |
|
538 |
+
// Ignore variations that are available at all locations, but absent at ours.
|
539 |
+
if ( is_array( $variation->getAbsentAtLocationIds() ) && in_array( wc_square()->get_settings_handler()->get_location_id(), $variation->getAbsentAtLocationIds(), true ) ) {
|
540 |
+
continue;
|
541 |
+
}
|
542 |
+
|
543 |
+
// Ignore variations that are not available at our location.
|
544 |
+
if ( ! $variation->getPresentAtAllLocations() && ( ! is_array( $variation->getPresentAtLocationIds() ) || ! in_array( wc_square()->get_settings_handler()->get_location_id(), $variation->getPresentAtLocationIds(), true ) ) ) {
|
545 |
+
continue;
|
546 |
+
}
|
547 |
+
|
548 |
try {
|
549 |
|
550 |
$data['variations'][] = $this->extract_square_item_variation_data( $variation );
|
634 |
throw new Framework\SV_WC_Plugin_Exception( __( 'Items with variable pricing cannot be imported.', 'woocommerce-square' ) );
|
635 |
}
|
636 |
|
637 |
+
if ( in_array( $variation_data->getSku(), array( '', null ) ) ) {
|
638 |
+
throw new Framework\SV_WC_Plugin_Exception( __( 'Variations with missing SKUs cannot be imported.', 'woocommerce-square' ) );
|
639 |
+
}
|
640 |
+
|
641 |
$data = array(
|
642 |
'name' => $variation_data->getName(),
|
643 |
'sku' => $variation_data->getSku(),
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: woocommerce, automattic, royho, woothemes, bor0, mattdallan, menakas, chickenn00dle, jorgeatorres, jamesgallan, achyuthajoy
|
3 |
Tags: credit card, square, woocommerce, inventory sync
|
4 |
Requires at least: 4.6
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -72,6 +72,19 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
= 2.2.5 - 2020.11.24 =
|
76 |
* Fix - Correctly saves inventory sync time when sync fails so items are re-synced on next attempt. PR#448
|
77 |
* Fix - Fixes warnings introduced with PHP 8. PR#533
|
2 |
Contributors: woocommerce, automattic, royho, woothemes, bor0, mattdallan, menakas, chickenn00dle, jorgeatorres, jamesgallan, achyuthajoy
|
3 |
Tags: credit card, square, woocommerce, inventory sync
|
4 |
Requires at least: 4.6
|
5 |
+
Tested up to: 5.6
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 2.3.0
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 2.3.0 - 2021.02.02 =
|
76 |
+
* Feature - Apple Pay and Google Pay support (US, UK and CA stores only). PR#547
|
77 |
+
* Fix - Duplicate `idempotency_key` issues caused by order IDs being re-used on the same store URL (i.e. after restoring from a backup). PR#563
|
78 |
+
* Fix - Don't import item variations from Square that are not available at your store's business location. PR#562
|
79 |
+
* Fix - Restore stock in Square when processing partial refunds (previously was only restoring stock for full refunds). PR#565
|
80 |
+
* Fix - Only restore stock if the "Restock refunded items" option is checked when refunding an order. PR#565
|
81 |
+
* Fix - Fatal errors during the sync and import process caused by unexpected/invalid Square API responses. PR#500
|
82 |
+
* Fix - Sends only one sync complete email per update to products that are synced with Square. PR#552
|
83 |
+
* Fix - Allow products with large numbers of categories (600+) to sync to Square when WooCommerce is SOR. PR#568
|
84 |
+
* Fix - Database related errors with creating the Square customer's table when first installing Square. PR#558
|
85 |
+
* Fix - Allow variable products with valid variations to import when variations with missing skus are present. PR#573
|
86 |
+
* Tweak - Update the Customer Profile setting description to make it clear that this setting enables tokenization. PR#576
|
87 |
+
|
88 |
= 2.2.5 - 2020.11.24 =
|
89 |
* Fix - Correctly saves inventory sync time when sync fails so items are re-synced on next attempt. PR#448
|
90 |
* Fix - Fixes warnings introduced with PHP 8. PR#533
|
woocommerce-square.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Square
|
4 |
-
* Version: 2.
|
5 |
* Plugin URI: https://woocommerce.com/products/square/
|
6 |
* Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
|
7 |
* Author: WooCommerce
|
@@ -19,7 +19,7 @@
|
|
19 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
20 |
*
|
21 |
* WC requires at least: 3.0
|
22 |
-
* WC tested up to: 4.
|
23 |
*/
|
24 |
|
25 |
defined( 'ABSPATH' ) || exit;
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Square
|
4 |
+
* Version: 2.3.0
|
5 |
* Plugin URI: https://woocommerce.com/products/square/
|
6 |
* Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
|
7 |
* Author: WooCommerce
|
19 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
20 |
*
|
21 |
* WC requires at least: 3.0
|
22 |
+
* WC tested up to: 4.9
|
23 |
*/
|
24 |
|
25 |
defined( 'ABSPATH' ) || exit;
|