diff --git a/core/asset/language/wpshop-fr_FR.mo b/core/asset/language/wpshop-fr_FR.mo index 4bb6f28..9172759 100644 Binary files a/core/asset/language/wpshop-fr_FR.mo and b/core/asset/language/wpshop-fr_FR.mo differ diff --git a/core/asset/language/wpshop-fr_FR.po b/core/asset/language/wpshop-fr_FR.po index 82756dd..a7ed371 100644 --- a/core/asset/language/wpshop-fr_FR.po +++ b/core/asset/language/wpshop-fr_FR.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: wpshop\n" -"POT-Creation-Date: 2021-02-04 12:08+0100\n" -"PO-Revision-Date: 2021-02-04 12:08+0100\n" +"POT-Creation-Date: 2021-07-01 10:55+0200\n" +"PO-Revision-Date: 2021-07-01 10:59+0200\n" "Last-Translator: \n" "Language-Team: Eoxia\n" "Language: fr_FR\n" @@ -18,12 +18,7 @@ msgstr "" "X-Poedit-SearchPath-1: modules\n" "X-Poedit-SearchPathExcluded-0: core/external\n" -#: core/action/class-wpshop-action.php:183 -msgid "WPshop" -msgstr "WPshop" - -#: core/action/class-wpshop-action.php:184 -#: modules/dashboard/view/main.view.php:17 +#: core/action/class-wpshop-action.php:186 msgid "Dashboard" msgstr "Tableau de bord" @@ -31,8 +26,8 @@ msgstr "Tableau de bord" #: modules/dolibarr/doli-sync/class/class-doli-sync.php:64 #: modules/order/action/class-order-action.php:40 #: modules/order/action/class-order-action.php:41 -#: modules/products/action/class-product-action.php:47 -#: modules/products/action/class-product-action.php:114 +#: modules/products/action/class-product-action.php:53 +#: modules/products/action/class-product-action.php:122 #: modules/products/filter/class-product-filter.php:63 #: modules/products/filter/class-product-filter.php:65 #: modules/products/view/main.view.php:34 @@ -45,8 +40,7 @@ msgid "product" msgstr "produit" #: core/filter/class-wpshop-filter.php:137 -#: modules/settings/action/class-settings-action.php:53 -#: modules/settings/view/main.view.php:26 +#: modules/settings/action/class-settings-action.php:56 #: modules/settings/view/payment-method.view.php:30 msgid "Settings" msgstr "Réglages" @@ -130,16 +124,16 @@ msgstr "Produit \"%1$s\" x%2$d ajouté au panier" msgid "View cart" msgstr "Voir le panier" -#: modules/checkout/action/class-checkout-action.php:489 +#: modules/checkout/action/class-checkout-action.php:510 msgid "I accept " msgstr "J'accepte " -#: modules/checkout/action/class-checkout-action.php:493 +#: modules/checkout/action/class-checkout-action.php:514 #, php-format msgid "the %2$s and " msgstr "les %2$s et " -#: modules/checkout/action/class-checkout-action.php:498 +#: modules/checkout/action/class-checkout-action.php:519 #, php-format msgid "the %2$s" msgstr "la %2$s" @@ -277,14 +271,14 @@ msgstr "Adresse postale" msgid "Postcode / ZIP" msgstr "Code postal" -#: modules/checkout/view/frontend/payment.php:26 +#: modules/checkout/view/frontend/payment.php:27 #: modules/dashboard/view/metaboxes/metabox-payment.view.php:34 #: modules/dolibarr/doli-invoice/view/metabox-invoice-details.view.php:29 #: modules/dolibarr/doli-invoice/view/metabox-invoice-details.view.php:44 #: modules/dolibarr/doli-order/view/metabox-order-details.view.php:41 #: modules/proposals/view/metabox-proposal-address.view.php:33 #: modules/proposals/view/metabox-proposal-details.view.php:22 -#: modules/settings/view/main.view.php:43 +#: modules/settings/view/main.view.php:41 #: modules/settings/view/payment-method-single.view.php:24 msgid "Payment method" msgstr "Moyen de paiement" @@ -406,7 +400,7 @@ msgstr "Derniers clients" #: modules/dolibarr/doli-categories/view/item.view.php:42 #: modules/dolibarr/doli-invoice/view/item.view.php:39 #: modules/dolibarr/doli-invoice/view/item.view.php:61 -#: modules/dolibarr/doli-order/view/item.view.php:40 +#: modules/dolibarr/doli-order/view/item.view.php:39 #: modules/dolibarr/doli-proposals/view/item.view.php:38 #: modules/proposals/view/item.view.php:34 msgid "See in Dolibarr" @@ -456,7 +450,7 @@ msgstr "Prix TTC" #: modules/dashboard/view/metaboxes/metabox-invoice.view.php:45 #: modules/dashboard/view/metaboxes/metabox-order.view.php:45 #: modules/dashboard/view/metaboxes/metabox-proposal.view.php:45 -#: modules/dolibarr/doli-order/view/item.view.php:55 +#: modules/dolibarr/doli-order/view/item.view.php:54 #: modules/dolibarr/doli-order/view/metabox-order-details.view.php:37 #: modules/dolibarr/doli-order/view/metabox-order-details.view.php:38 msgid "unknown" @@ -650,12 +644,12 @@ msgstr "Annuler" msgid "Compare elements" msgstr "Comparer les éléments" -#: modules/dolibarr/doli-categories/action/class-doli-categories-action.php:58 +#: modules/dolibarr/doli-categories/action/class-doli-categories-action.php:66 #: modules/dolibarr/doli-categories/view/main.view.php:25 msgid "Categories WPshop" msgstr "" -#: modules/dolibarr/doli-categories/action/class-doli-categories-action.php:161 +#: modules/dolibarr/doli-categories/action/class-doli-categories-action.php:166 #: modules/dolibarr/doli-sync/class/class-doli-sync.php:84 #: modules/products/view/list.view.php:33 msgid "Categories" @@ -680,7 +674,7 @@ msgstr "Modifier" #: modules/dolibarr/doli-categories/view/item.view.php:44 #: modules/dolibarr/doli-invoice/view/item.view.php:37 #: modules/dolibarr/doli-invoice/view/item.view.php:60 -#: modules/dolibarr/doli-order/view/item.view.php:38 +#: modules/dolibarr/doli-order/view/item.view.php:37 #: modules/dolibarr/doli-proposals/view/item.view.php:36 #: modules/proposals/view/item.view.php:32 #: modules/third-parties/view/item.view.php:36 @@ -689,11 +683,11 @@ msgstr "Voir" #: modules/dolibarr/doli-categories/view/list.view.php:31 msgid "Category ID" -msgstr "" +msgstr "ID Catégorie" #: modules/dolibarr/doli-categories/view/list.view.php:33 msgid "Slug" -msgstr "" +msgstr "Slug" #: modules/dolibarr/doli-categories/view/list.view.php:34 #, fuzzy @@ -711,27 +705,26 @@ msgstr "Statut" #: modules/dolibarr/doli-categories/view/main.view.php:29 #: modules/dolibarr/doli-order/view/main.view.php:34 #: modules/dolibarr/doli-proposals/view/main.view.php:35 -#: modules/products/action/class-product-action.php:49 +#: modules/products/action/class-product-action.php:57 #: modules/products/view/main.view.php:37 #: modules/products/view/main.view.php:39 #: modules/third-parties/view/main.view.php:36 msgid "Add" msgstr "Ajouter" -#: modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php:95 +#: modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php:96 #, php-format msgid "Invoice details %s" msgstr "Facture détails %s" -#: modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php:109 +#: modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php:113 #: modules/dolibarr/doli-invoice/filter/class-doli-invoice-filter.php:70 #: modules/dolibarr/doli-invoice/filter/class-doli-invoice-filter.php:72 -#: modules/dolibarr/doli-invoice/view/main.view.php:32 #: modules/my-account/class/class-my-account.php:147 msgid "Invoices" msgstr "Factures" -#: modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php:359 +#: modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php:364 msgid "Invoice not found" msgstr "Facture non trouvée" @@ -807,7 +800,7 @@ msgstr "Facture" msgid "Statut" msgstr "Statut" -#: modules/dolibarr/doli-invoice/view/main.view.php:44 +#: modules/dolibarr/doli-invoice/view/main.view.php:42 #: modules/dolibarr/doli-order/view/main.view.php:47 #: modules/dolibarr/doli-proposals/view/main.view.php:48 #: modules/products/view/main.view.php:52 @@ -817,7 +810,7 @@ msgstr "Statut" msgid "Search" msgstr "Rechercher" -#: modules/dolibarr/doli-invoice/view/main.view.php:54 +#: modules/dolibarr/doli-invoice/view/main.view.php:52 #: modules/dolibarr/doli-order/view/main.view.php:57 #: modules/dolibarr/doli-proposals/view/main.view.php:59 #: modules/products/view/main.view.php:65 @@ -886,20 +879,20 @@ msgstr "Livraison" msgid "Edit in Dolibarr" msgstr "Editer sur Dolibarr" -#: modules/dolibarr/doli-order/action/class-doli-order-action.php:87 +#: modules/dolibarr/doli-order/action/class-doli-order-action.php:88 #: modules/dolibarr/doli-statut/class/class-doli-statut.php:64 #: modules/dolibarr/doli-statut/class/class-doli-statut.php:90 msgid "Delivered" msgstr "Livrée" -#: modules/dolibarr/doli-order/action/class-doli-order-action.php:97 +#: modules/dolibarr/doli-order/action/class-doli-order-action.php:98 #: modules/dolibarr/doli-statut/class/class-doli-statut.php:78 #: modules/dolibarr/doli-statut/class/class-doli-statut.php:112 msgid "Canceled" msgstr "Anulée" -#: modules/dolibarr/doli-order/action/class-doli-order-action.php:133 -#: modules/dolibarr/doli-order/action/class-doli-order-action.php:232 +#: modules/dolibarr/doli-order/action/class-doli-order-action.php:141 +#: modules/dolibarr/doli-order/action/class-doli-order-action.php:237 #: modules/dolibarr/doli-order/filter/class-doli-order-filter.php:47 #: modules/dolibarr/doli-order/filter/class-doli-order-filter.php:49 #: modules/dolibarr/doli-order/view/main.view.php:33 @@ -1048,12 +1041,12 @@ msgstr "Mise à jour du lien de suivi" msgid "Mark as delivery" msgstr "Marquer comme livraison" -#: modules/dolibarr/doli-proposals/action/class-doli-proposals-action.php:70 +#: modules/dolibarr/doli-proposals/action/class-doli-proposals-action.php:78 #: modules/dolibarr/doli-proposals/view/main.view.php:34 msgid "Dolibarr Proposals" msgstr "Propositions commerciales" -#: modules/dolibarr/doli-proposals/action/class-doli-proposals-action.php:88 +#: modules/dolibarr/doli-proposals/action/class-doli-proposals-action.php:93 #, fuzzy #| msgid "Proposals" msgid "Proposals Dolibarr" @@ -1108,10 +1101,8 @@ msgid "Unpaid" msgstr "Impayée" #: modules/dolibarr/doli-statut/class/class-doli-statut.php:104 -#: modules/payment/class/class-payment.php:94 -#: modules/payment/class/class-payment.php:98 -#: modules/payment/class/class-payment.php:102 -#: modules/payment/class/class-payment.php:106 +#: modules/payment/class/class-payment.php:77 +#: modules/payment/class/class-payment.php:81 msgid "Paid" msgstr "Payée" @@ -1120,7 +1111,7 @@ msgid "Abandoned" msgstr "Abondonée" #: modules/dolibarr/doli-sync/class/class-doli-sync.php:54 -#: modules/third-parties/action/class-third-party-action.php:159 +#: modules/third-parties/action/class-third-party-action.php:163 #: modules/third-parties/filter/class-third-party-filter.php:43 #: modules/third-parties/filter/class-third-party-filter.php:45 msgid "Third parties" @@ -1144,24 +1135,24 @@ msgstr "" "Effacer les données pour le tiers %s avec les données de " "dolibarr" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:360 -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:370 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:331 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:341 msgid "WP Object is not equal Dolibarr Object" msgstr "L'objet WordPress n'est pas égal à l'objet Dolibarr" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:384 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:353 msgid "Sync OK" msgstr "Synchronisation OK" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:407 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:376 msgid "Looking for sync status" msgstr "Rechercher un statut de synchronisation" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:418 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:387 msgid "No associated to an ERP Entity" msgstr "Cette entitée n'est pas associé à votre ERP" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:449 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:418 msgid "Error not defined" msgstr "Erreur non définie" @@ -1198,6 +1189,8 @@ msgid "" "Welcome
This email confirms that your account has been created.
" "Thank you for your trust and see you soon on our shop." msgstr "" +"Bienvenue
Cet email confirme que votre compte a été créé.
Merci de " +"votre confiance et à bientôt sur notre boutique." #: modules/emails/class/class-emails.php:53 msgid "Pending order" @@ -1209,6 +1202,9 @@ msgid "" "Hello
We have just recorded your order, thank you to send us your " "payment.
We thank you for your confidence and see you soon on our shop." msgstr "" +"Bonjour
Nous venons d'enregistrer votre commande, merci de nous envoyer " +"votre règlement.
Nous vous remercions de votre confiance et à bientôt " +"sur notre boutique." #: modules/emails/class/class-emails.php:58 msgid "New order" @@ -1220,6 +1216,8 @@ msgid "" "Hello
This email confirms that your payment for your recent order has " "just been validated.
See you soon on our shop." msgstr "" +"Bonjour
Cet email vous confirme que le paiement de votre récente " +"commande vient d'être validé.
À bientôt sur notre boutique." #: modules/emails/class/class-emails.php:71 msgid "Send invoice" @@ -1229,6 +1227,8 @@ msgstr "Votre facture" #: modules/pages/class/class-pages.php:127 msgid "Hello
You can access your invoices by logging in to your account." msgstr "" +"Bonjour
Vous pouvez accéder à vos factures en vous connectant à votre " +"compte." #: modules/emails/view/frontend/order-details.php:32 #, php-format @@ -1253,7 +1253,7 @@ msgid "My account" msgstr "Mon compte" #: modules/my-account/class/class-my-account.php:132 -#: modules/proposals/action/class-proposals-action.php:61 +#: modules/proposals/action/class-proposals-action.php:70 #: modules/proposals/view/main.view.php:21 msgid "Wish List" msgstr "Liste d'envies" @@ -1270,7 +1270,7 @@ msgstr "Téléchargements" msgid "Logout" msgstr "Deconnexion" -#: modules/my-account/class/class-my-account.php:170 +#: modules/my-account/class/class-my-account.php:174 msgid "Switch back" msgstr "Retour" @@ -1416,58 +1416,22 @@ msgid "Pay and pick up directly your products at the shop." msgstr "Payez et retirer vos produits à la boutique." #: modules/payment/class/class-payment.php:67 -msgid "PayPal" -msgstr "PayPal" +msgid "Online payment" +msgstr "Paiement en ligne" #: modules/payment/class/class-payment.php:68 -msgid "Accept payments via PayPal using account balance or credit card." -msgstr "" -"Paiements par PayPal utilisant le solde du compte ou la carte de crédit " -"acceptés." - -#: modules/payment/class/class-payment.php:75 -msgid "Stripe" -msgstr "Stripe" +msgid "Pay your product online." +msgstr "Payer votre produit en ligne." #: modules/payment/class/class-payment.php:76 -#: modules/payment/class/class-payment.php:85 -msgid "Use your credit card to place your order" -msgstr "Utilisez votre carte de crédit pour passer votre commande" - -#: modules/payment/class/class-payment.php:84 -msgid "Carte Bancaire" -msgstr "" - -#: modules/payment/class/class-payment.php:93 msgid "Waiting for the check" msgstr "En attente du chèque" -#: modules/payment/class/class-payment.php:97 -#: modules/payment/class/class-payment.php:101 -#: modules/payment/class/class-payment.php:105 +#: modules/payment/class/class-payment.php:80 msgid "Waiting for the payment" msgstr "En attente du paiement" -#: modules/paypal/filter/class-paypal-filter.php:45 -msgid "" -" SANDBOX ENABLED. You can use sandbox testing accounts only. See the PayPal " -"Sandbox Testing Guide for more details." -msgstr "" -" BAC À SABLE ACTIVÉ. Vous ne pouvez utiliser que des comptes de test de bac " -"à sable. Voir le Guide de test des bacs à sable de PayPal pour " -"plus de détails." - -#: modules/paypal/view/form-setting.view.php:24 -msgid "Paypal email" -msgstr "Email Paypal" - -#: modules/paypal/view/form-setting.view.php:33 -msgid "PayPal Sandbox" -msgstr "Sandbox de PayPal" - -#: modules/products/action/class-product-action.php:348 +#: modules/products/action/class-product-action.php:356 #, php-format msgid "Search result for \"%s\"" msgstr "Résultats de la recherche pour \"%s\"" @@ -1579,10 +1543,8 @@ msgid "Sold out" msgstr "Rupture de stock" #: modules/products/view/frontend/wps-product-grid.php:40 -#, fuzzy -#| msgid "Search a product" msgid "See the product" -msgstr "Rechercher un produit" +msgstr "Voir le produit" #: modules/products/view/frontend/wps-product-grid.php:50 msgid "Add the product to cart" @@ -1652,19 +1614,19 @@ msgstr "Taux de TVA" msgid "+ %s" msgstr "" -#: modules/products/view/metabox/document.view.php:43 +#: modules/products/view/metabox/document.view.php:59 msgid "Modify documents on Dolibarr" msgstr "Modifier les documents sur Dolibarr" -#: modules/products/view/metabox/document.view.php:47 +#: modules/products/view/metabox/document.view.php:63 msgid "Add a file to the document" msgstr "Ajouter un fichier au document" -#: modules/products/view/metabox/gallery.view.php:43 +#: modules/products/view/metabox/gallery.view.php:47 msgid "Modify the gallery on Dolibarr" msgstr "Modifier la galerie sur Dolibarr" -#: modules/products/view/metabox/gallery.view.php:47 +#: modules/products/view/metabox/gallery.view.php:51 msgid "Add an image to the gallery" msgstr "Ajouter une image à la galerie" @@ -1672,7 +1634,7 @@ msgstr "Ajouter une image à la galerie" msgid "To modify the data of this product, go to Dolibarr" msgstr "Pour modifier les données de ce produit, aller sur Dolibarr" -#: modules/proposals/action/class-proposals-action.php:78 +#: modules/proposals/action/class-proposals-action.php:84 msgid "Quotation" msgstr "Devis" @@ -1751,25 +1713,25 @@ msgstr "Nouveau titre" msgid "Title:" msgstr "Titre:" -#: modules/settings/action/class-settings-action.php:152 -#: modules/settings/action/class-settings-action.php:315 +#: modules/settings/action/class-settings-action.php:158 +#: modules/settings/action/class-settings-action.php:321 msgid "WPshop cannot connect to dolibarr. Please check your settings" msgstr "" "WPshop n'est pas connecté à Dolibarr. Veuillez vérifier vos configurations" -#: modules/settings/action/class-settings-action.php:159 -#: modules/settings/action/class-settings-action.php:196 -#: modules/settings/action/class-settings-action.php:229 -#: modules/settings/action/class-settings-action.php:258 -#: modules/settings/action/class-settings-action.php:322 +#: modules/settings/action/class-settings-action.php:165 +#: modules/settings/action/class-settings-action.php:202 +#: modules/settings/action/class-settings-action.php:235 +#: modules/settings/action/class-settings-action.php:264 +#: modules/settings/action/class-settings-action.php:328 msgid "Your settings have been saved." msgstr "Vos réglages ont été enregistrés." -#: modules/settings/class/class-settings.php:145 +#: modules/settings/class/class-settings.php:146 msgid "No page" msgstr "Pas de page" -#: modules/settings/class/class-settings.php:233 +#: modules/settings/class/class-settings.php:234 msgid "No product" msgstr "Aucun produit" @@ -1868,7 +1830,7 @@ msgid "Dolibarr Payments Lists" msgstr "Listes des Paiements Dolibarr" #: modules/settings/view/erp.view.php:187 -#: modules/settings/view/general.view.php:75 +#: modules/settings/view/general.view.php:82 #: modules/settings/view/pages.view.php:66 #: modules/settings/view/payment-method-single.view.php:58 #: modules/settings/view/shipping-cost.view.php:57 @@ -1895,23 +1857,27 @@ msgstr "Activer la liste d'envies" msgid "Split product" msgstr "Séparer les lignes des produits dans le panier" -#: modules/settings/view/general.view.php:70 +#: modules/settings/view/general.view.php:68 +msgid "Mininum price per product" +msgstr "Prix minimun par produit" + +#: modules/settings/view/general.view.php:77 msgid "Debug mode" -msgstr "" +msgstr "Mode debug" -#: modules/settings/view/main.view.php:40 modules/tools/view/main.view.php:29 +#: modules/settings/view/main.view.php:38 modules/tools/view/main.view.php:29 msgid "General" msgstr "Général" -#: modules/settings/view/main.view.php:41 +#: modules/settings/view/main.view.php:39 msgid "Pages" msgstr "Pages" -#: modules/settings/view/main.view.php:42 +#: modules/settings/view/main.view.php:40 msgid "Emails" msgstr "Emails" -#: modules/settings/view/main.view.php:44 +#: modules/settings/view/main.view.php:42 msgid "ERP" msgstr "ERP" @@ -1957,24 +1923,7 @@ msgstr "Sélectionner votre produit \"Frais de livraison\"" msgid "Free delivery starting from (€) HT" msgstr "Livraison gratuite à partir de (€) HT" -#: modules/stripe/filter/class-stripe-filter.php:45 -msgid " SANDBOX ENABLED" -msgstr " BAC À SABLE ACTIVÉ" - -#: modules/stripe/view/form-setting.view.php:24 -msgid "Publish key" -msgstr "Clé publique" - -#: modules/stripe/view/form-setting.view.php:31 -msgid "Secret key" -msgstr "Clé secrète" - -#: modules/stripe/view/form-setting.view.php:40 -msgid "Stripe Sandbox" -msgstr "Bac à sable Stripe" - -#: modules/third-parties/action/class-third-party-action.php:64 -#: modules/third-parties/action/class-third-party-action.php:65 +#: modules/third-parties/action/class-third-party-action.php:76 #: modules/third-parties/view/main.view.php:34 msgid "Third Parties" msgstr "Tiers" @@ -2058,7 +2007,7 @@ msgstr "€ TTC" #: modules/third-parties/view/metaboxes/metabox-tier.view.php:29 msgid "Tiers" -msgstr "" +msgstr "Tiers" #: modules/third-parties/view/single-title-edit.view.php:30 msgid "New third party" @@ -2087,6 +2036,42 @@ msgstr "Importer des produits depuis un CSV" msgid "Tools" msgstr "Outils" +#~ msgid "WPshop" +#~ msgstr "WPshop" + +#~ msgid "Accept payments via PayPal using account balance or credit card." +#~ msgstr "" +#~ "Paiements par PayPal utilisant le solde du compte ou la carte de crédit " +#~ "acceptés." + +#~ msgid "Stripe" +#~ msgstr "Stripe" + +#~ msgid "Use your credit card to place your order" +#~ msgstr "Utilisez votre carte de crédit pour passer votre commande" + +#~ msgid "" +#~ " SANDBOX ENABLED. You can use sandbox testing accounts only. See the PayPal Sandbox Testing Guide for more details." +#~ msgstr "" +#~ " BAC À SABLE ACTIVÉ. Vous ne pouvez utiliser que des comptes de test de " +#~ "bac à sable. Voir le Guide de test des bacs à sable de PayPal pour " +#~ "plus de détails." + +#~ msgid " SANDBOX ENABLED" +#~ msgstr " BAC À SABLE ACTIVÉ" + +#~ msgid "Publish key" +#~ msgstr "Clé publique" + +#~ msgid "Secret key" +#~ msgstr "Clé secrète" + +#~ msgid "Stripe Sandbox" +#~ msgstr "Bac à sable Stripe" + #~ msgid "Waiting for a signature" #~ msgstr "En attente de la signature" diff --git a/modules/api/action/class-api-action.php b/modules/api/action/class-api-action.php index 49a015a..e221f54 100644 --- a/modules/api/action/class-api-action.php +++ b/modules/api/action/class-api-action.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.5.0 */ namespace wpshop; @@ -74,7 +74,7 @@ public function check_cap( $cap, $request ) { * Initialise les routes de l'API. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.5.0 */ public function callback_rest_api_init() { register_rest_route( 'wpshop/v2', '/statut', array( @@ -85,19 +85,12 @@ public function callback_rest_api_init() { }, ) ); - register_rest_route( 'wpshop/v2', '/wps_gateway_paypal', array( - 'methods' => array( 'GET', 'POST' ), - 'callback' => array( $this, 'callback_wps_gateway_paypal' ), - ) ); - - register_rest_route( 'wpshop/v2', '/wps_gateway_stripe', array( - 'methods' => array( 'GET', 'POST' ), - 'callback' => array( $this, 'callback_wps_gateway_stripe' ), - ) ); - register_rest_route( 'wpshop/v2', '/product/search', array( 'methods' => array( 'GET' ), 'callback' => array( $this, 'callback_search' ), + 'permission_callback' => function( $request ) { + return Rest_Class::g()->check_cap( 'get', $request ); + }, ) ); register_rest_route( 'wpshop/v2', '/create/order', array( @@ -139,6 +132,22 @@ public function callback_rest_api_init() { return Rest_Class::g()->check_cap( 'get', $request ); }, ) ); + + register_rest_route( 'wpshop/v2', '/wpml_insert_data', array( + 'methods' => array( 'POST' ), + 'callback' => array( $this, 'callback_wpml_insert_data' ), + 'permission_callback' => function( $request ) { + return Rest_Class::g()->check_cap( 'get', $request ); + }, + ) ); + + register_rest_route( 'wpshop/v2', '/wpml_delete_data', array( + 'methods' => array( 'POST' ), + 'callback' => array( $this, 'callback_wpml_delete_data' ), + 'permission_callback' => function( $request ) { + return Rest_Class::g()->check_cap( 'get', $request ); + }, + ) ); } /** @@ -208,55 +217,6 @@ public function check_statut( $request ) { return new \WP_REST_Response( true ); } - /** - * Gestion de la route Paypal. - * Data is validated in wps_gateway_paypal - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param WP_Request $request L'objet contenant les informations de la requête. - */ - public function callback_wps_gateway_paypal( $request ) { - $data = $request->get_body_params(); - - // translators: Paypal Gateway data: {json_data}. - LOG_Util::log( sprintf( 'Paypal Gateway data: %s', json_encode( $data ) ), 'wpshop2' ); - - $txn_id = get_post_meta( $data['custom'], 'payment_txn_id', true ); - - if ( $txn_id !== $data['txn_id'] ) { - // @todo: Pensé différement, envoyé vers dolibarr ? - update_post_meta( $data['custom'], 'payment_data', $data ); - update_post_meta( $data['custom'], 'payment_txn_id', $data['txn_id'] ); - update_post_meta( $data['custom'], 'payment_method', 'paypal' ); - - do_action( 'wps_gateway_paypal', $data ); - } - } - - /** - * Gestion de la route Stripe. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @todo: Validate data request - * - * @param WP_Request $request L'objet contenant les informations de la requête. - */ - public function callback_wps_gateway_stripe( $request ) { - $param = json_decode( $request->get_body(), true ); - - // translators: Stripe Gateway data: {json_data}. - LOG_Util::log( sprintf( 'Stripe Gateway data: %s', json_encode( $param ) ), 'wpshop2' ); - LOG_Util::log( sprintf( 'Stripe Gateway found dolibarr order id: %s', $param['data']['object']['metadata']['order_id'] ), 'wpshop2' ); - - $param['custom'] = $param['data']['object']['metadata']['order_id']; - - do_action( 'wps_gateway_stripe', $param ); - } - /** * Recherche un produit depuis l'API. * @@ -477,6 +437,72 @@ public function callback_create_payment( $request ) { return $propal; } + + /** + * Gestion de la route pour insérer un post traduit par WPML. + * + * @since 2.5.0 + * @version 2.5.0 + * + * @param WP_REST_Request $request L'objet contenant les informations de la requête. + * + * @return integer l'ID du post crée. + */ + public function callback_wpml_insert_data( $request ) { + $param = $request->get_params(); + + // Create post object + $my_post = array( + 'post_title' => $param['label'], + 'post_content' => $param['description'], + 'post_type' => 'wps-product', + 'post_status' => 'publish', + 'post_author' => 1, + 'post_category' => array(2) + ); + + $output = wp_insert_post($my_post); + + if ( $output ) { + // https://wpml.org/wpml-hook/wpml_element_type/ + $wpml_element_type = apply_filters( 'wpml_element_type', 'wps-product' ); + + // get the language info of the original post + // https://wpml.org/wpml-hook/wpml_element_language_details/ + $get_language_args = array('element_id' => $param['wpshop_id'], 'element_type' => 'wps-product' ); + $original_post_language_info = apply_filters( 'wpml_element_language_details', null, $get_language_args ); + + $set_language_args = array( + 'element_id' => $output, + 'element_type' => 'post_wps-product', + 'trid' => $original_post_language_info->trid, + 'language_code' => $param['language_code'], + 'source_language_code' => $original_post_language_info->language_code + ); + + do_action( 'wpml_set_element_language_details', $set_language_args ); + } + + return $output; + } + + /** + * Gestion de la route pour supprimer un post WPML. + * + * @since 2.5.0 + * @version 2.5.0 + * + * @param WP_REST_Request $request L'objet contenant les informations de la requête. + * + * @return integer L'id du post supprimé. + */ + public function callback_wpml_delete_data( $request ) { + $param = $request->get_params(); + + $output = wp_delete_post($param['id']); + + return $output; + } } new API_Action(); diff --git a/modules/cart/action/class-cart-action.php b/modules/cart/action/class-cart-action.php index ab1b2f2..dfc65da 100644 --- a/modules/cart/action/class-cart-action.php +++ b/modules/cart/action/class-cart-action.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.5.0 */ namespace wpshop; @@ -47,7 +47,7 @@ public function __construct() { * @Todo bouger dans class-cart.php * * @since 2.0.0 - * @version 2.0.0 + * @version 2.5.0 */ public function callback_calculate_totals() { $shipping_cost_option = get_option( 'wps_shipping_cost', Settings::g()->shipping_cost_default_settings ); @@ -71,10 +71,10 @@ public function callback_calculate_totals() { if ( $shipping_cost_option['shipping_product_id'] !== $line['id'] ) { if ( $dolibarr_option['price_min'] > ( $line['price_ttc'] * $line['qty'] ) ) { $tva_amount += $dolibarr_option['price_min'] * $line['tva_tx'] / 100; - $price_no_shipping += $dolibarr_option['price_min'] - $tva_amount; + $price_no_shipping = $price; } else { $tva_amount += $line['tva_amount'] * $line['qty']; - $price_no_shipping += $line['price'] * $line['qty']; + $price_no_shipping = $price; } } } diff --git a/modules/checkout/action/class-checkout-action.php b/modules/checkout/action/class-checkout-action.php index 5076452..b0784a6 100644 --- a/modules/checkout/action/class-checkout-action.php +++ b/modules/checkout/action/class-checkout-action.php @@ -453,6 +453,27 @@ public function callback_checkout_doli_proposal( $third_party, $contact ) { } } + $doli_proposal = Request_Util::get( 'proposals/' . (int) $doli_proposal_id ); +// $doli_proposal->total = number_format((float)Cart_Session::g()->total_price_ttc,8,'.',','); +// $doli_proposal->multicurrency_total_ht = number_format((float)Cart_Session::g()->total_price,8,'.',','); +// $doli_proposal->multicurrency_total_tva = number_format((float)Cart_Session::g()->tva_amount,8,'.',','); +// $doli_proposal->multicurrency_total_ttc = number_format((float)Cart_Session::g()->total_price_ttc,8,'.',','); +// $doli_proposal->total_ht = number_format((float)Cart_Session::g()->total_price,8,'.',','); +// $doli_proposal->total_tva = number_format((float)Cart_Session::g()->tva_amount,8,'.',','); +// $doli_proposal->total_ttc = number_format((float)Cart_Session::g()->total_price_ttc,8,'.',','); +// +// $proposal_data = array( +// 'total' => $doli_proposal->total, +// 'multicurrency_total_ht' => $doli_proposal->multicurrency_total_ht, +// 'multicurrency_total_tva' => $doli_proposal->multicurrency_total_tva, +// 'multicurrency_total_ttc' => $doli_proposal->multicurrency_total_ttc, +// 'total_ht' => $doli_proposal->total_ht, +// 'total_tva' => $doli_proposal->total_tva, +// 'total_ttc' => $doli_proposal->total_ttc, +// ); +// +// $doli_proposal = Request_Util::put( 'proposals/' . (int) $doli_proposal_id, $proposal_data); + $doli_proposal = Request_Util::post( 'proposals/' . (int) $doli_proposal_id . '/validate', array( 'notrigger' => 1, ) ); diff --git a/modules/checkout/class/class-checkout.php b/modules/checkout/class/class-checkout.php index da994dc..345eb3f 100644 --- a/modules/checkout/class/class-checkout.php +++ b/modules/checkout/class/class-checkout.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.5.0 */ namespace wpshop; @@ -181,7 +181,7 @@ public function validate_checkout( &$data, &$errors ) { * Procède au paiement. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.5.0 * * @param Order $order Les données de la commande. */ @@ -200,33 +200,20 @@ public function process_order_payment( $order ) { 'url' => Pages::g()->get_checkout_link() . '/received/order/' . $order->data['external_id'] . '/', ) ); break; - case 'paypal': - $result = Paypal::g()->process_payment( $order ); + case 'online_payment': + $result = Request_Util::g()->get( 'doliwpshop/getOnlinePaymentUrl?doli_id=' . $order->data['external_id'] ); + Cart_Session::g()->destroy(); - if ( ! empty( $result['url'] ) ) { + if ( ! empty( $result ) ) { wp_send_json_success( array( 'namespace' => 'wpshopFrontend', 'module' => 'checkout', 'callback_success' => 'redirectToPayment', - 'url' => $result['url'], - ) ); - } - break; - case 'stripe': - $result = Stripe::g()->process_payment( $order ); - Cart_Session::g()->destroy(); - - if ( ! empty( $result['id'] ) ) { - wp_send_json_success( array( - 'namespace' => 'wpshopFrontend', - 'module' => 'stripe', - 'callback_success' => 'redirectToPayment', - 'id' => $result['id'], + 'url' => $result, ) ); } break; } - } /** diff --git a/modules/dolibarr/doli-categories/class/class-doli-categories.php b/modules/dolibarr/doli-categories/class/class-doli-categories.php index fb6db13..0a0d36c 100644 --- a/modules/dolibarr/doli-categories/class/class-doli-categories.php +++ b/modules/dolibarr/doli-categories/class/class-doli-categories.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.1.0 - * @version 2.1.0 + * @version 2.5.0 */ namespace wpshop; @@ -80,7 +80,7 @@ class Doli_Category extends Term_Class { * * @var integer */ - public $limit = 10; + public $limit = 1000; /** * Le nom de l'option pour la limite par page. @@ -120,6 +120,7 @@ public function display() { $doli_categories = Request_Util::get( $route ); + foreach ( $doli_categories as $key => $doli_category ) { if ( $doli_category->array_options->options__wps_id == 0 ) { unset( $doli_categories[$key] ); diff --git a/modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php b/modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php index ee4df00..a40c4d4 100644 --- a/modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php +++ b/modules/dolibarr/doli-invoice/action/class-doli-invoice-action.php @@ -255,7 +255,7 @@ public function meta_box_product( $invoice ) { * * @todo mettre la langue de l'user API pour la génération du doc * - * @param array $data Data from PayPal. + * @param array $data Data order. */ public function create_invoice( $data ) { $doli_order = Request_Util::get( 'orders/' . (int) $data['custom'] ); diff --git a/modules/dolibarr/doli-order/action/class-doli-order-action.php b/modules/dolibarr/doli-order/action/class-doli-order-action.php index 59f8d87..2e4f449 100644 --- a/modules/dolibarr/doli-order/action/class-doli-order-action.php +++ b/modules/dolibarr/doli-order/action/class-doli-order-action.php @@ -384,7 +384,7 @@ public function metabox_order_related_object( $order ) { * Création d'une commande sur la base d'une proposition commerciale lors du tunnel de vente. * * @since 2.0.0 - * @version 2.1.0 + * @version 2.5.0 * * @todo mettre la langue de l'user API pour la génération du doc * @@ -395,6 +395,18 @@ public function metabox_order_related_object( $order ) { public function create_order( $proposal ) { LOG_Util::log( sprintf( 'Dolibarr call POST /orders/createfromproposal/ with data %s', $proposal->id ), 'wpshop2' ); $doli_order = Request_Util::post( 'orders/createfromproposal/' . $proposal->id ); + +// $order_data = array( +// 'multicurrency_total_ht' => $proposal->multicurrency_total_ht, +// 'multicurrency_total_tva' => $proposal->multicurrency_total_tva, +// 'multicurrency_total_ttc' => $proposal->multicurrency_total_ttc, +// 'total_ht' => $proposal->total_ht, +// 'total_tva' => $proposal->total_tva, +// 'total_ttc' => $proposal->total_ttc, +// ); +// +// $doli_order = Request_Util::put( 'orders/' . (int) $doli_order->id, $order_data); + LOG_Util::log( sprintf( 'Dolibarr call POST /orders/createfromproposal/ response %s', json_encode( $doli_order ) ), 'wpshop2' ); @@ -412,13 +424,13 @@ public function create_order( $proposal ) { $current_user = wp_get_current_user(); - Emails::g()->send_mail( $third_party[0]->data['email'], 'customer_current_order', array( + Emails::g()->send_mail( $third_party->data['email'], 'customer_current_order', array( 'order' => $doli_order, - 'third_party' => $third_party[0]->data, + 'third_party' => $third_party->data, ) ); // translators: Create order 00001 for the third party Eoxia. - LOG_Util::log( sprintf( 'Create order %s for the third party %s', $doli_order->ref, $third_party[0]->data['title'] ), 'wpshop2' ); + LOG_Util::log( sprintf( 'Create order %s for the third party %s', $doli_order->ref, $third_party->data['title'] ), 'wpshop2' ); $wp_order = Doli_Order::g()->get( array( 'schema' => true ), true ); $wp_order = Doli_Order::g()->doli_to_wp( $doli_order, $wp_order, true ); diff --git a/modules/dolibarr/doli-payment/filter/class-doli-payment-filter.php b/modules/dolibarr/doli-payment/filter/class-doli-payment-filter.php index 2b5d0d4..09b6ad7 100644 --- a/modules/dolibarr/doli-payment/filter/class-doli-payment-filter.php +++ b/modules/dolibarr/doli-payment/filter/class-doli-payment-filter.php @@ -39,10 +39,11 @@ public function __construct() { * @return array Le nouveau tableau avec l'entrée doli_type en plus. */ public function add_payment_details( $payment_methods ) { - $payment_methods['paypal']['doli_type'] = 'CB'; - $payment_methods['stripe']['doli_type'] = 'CB'; + //$payment_methods['paypal']['doli_type'] = 'CB'; + //$payment_methods['stripe']['doli_type'] = 'CB'; $payment_methods['cheque']['doli_type'] = 'CHQ'; $payment_methods['payment_in_shop']['doli_type'] = ''; + $payment_methods['online_payment']['doli_type'] = ''; return $payment_methods; } diff --git a/modules/emails/class/class-emails.php b/modules/emails/class/class-emails.php index bbd20d4..3a12ece 100644 --- a/modules/emails/class/class-emails.php +++ b/modules/emails/class/class-emails.php @@ -72,8 +72,12 @@ protected function construct() { 'content' => __( 'Hello
You can access your invoices by logging in to your account.', 'wpshop' ), ); + foreach ( $this->emails as $key => $email ) { + // Définit le contenu des emails en fonction des pages. + $this->emails[$key] = $this->set_email_content( $key, $email ); + } - $wp_upload_dir = wp_upload_dir(); + $wp_upload_dir = wp_upload_dir(); //@todo Permettre le réglages des dossiers et du nom de fichier pour les logs //@todo afficher la taille du fichier @@ -151,6 +155,34 @@ public function log_emails( $data_email ) { fwrite( $log_email_file, $data ); fclose( $log_email_file ); } + + /** + * Définit le contenu des emails en fonction des pages pévues à cet effet + * + * @since 2.4.0 + * @version 2.4.0 + * + * @param array $email Titre et contenu de l'email. + * + * @return array $email Titre et contenu de l'email. + */ + private function set_email_content( $key, $email ) { + if ( empty( $email ) ) { + return; + } + + $page_ids_options = get_option( 'wps_page_ids', Pages::g()->default_options ); + + if ( ! empty( $page_ids_options[$key] ) ) { + $email_page = get_post( $page_ids_options[$key] ); + if ( ! empty( $email_page ) ) { + $email['title'] = $email_page->post_title; + $email['content'] = $email_page->post_content; + } + + return $email; + } + } } Emails::g(); diff --git a/modules/my-account/class/class-my-account.php b/modules/my-account/class/class-my-account.php index e0acf18..58577dc 100644 --- a/modules/my-account/class/class-my-account.php +++ b/modules/my-account/class/class-my-account.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.5.0 */ namespace wpshop; @@ -115,7 +115,7 @@ public function display_lost_password() { * Affiche le menu de navigation. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.5.0 * * @param string $tab Le slug de l'onglet actuel. */ @@ -158,6 +158,10 @@ public function display_navigation( $tab ) { ), ); + if (Settings::g()->dolibarr_is_active()){ + unset($menu_def['quotations']); + } + if ( class_exists( '\user_switching' ) ) { $old_user = \user_switching::get_old_user(); diff --git a/modules/payment/class/class-payment.php b/modules/payment/class/class-payment.php index 4a346d6..28bf8d2 100644 --- a/modules/payment/class/class-payment.php +++ b/modules/payment/class/class-payment.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.3.3 + * @version 2.5.0 */ namespace wpshop; @@ -44,7 +44,7 @@ class Payment extends Singleton_Util { * Le constructeur. * * @since 2.0.0 - * @version 2.3.3 + * @version 2.5.0 */ protected function construct() { $this->default_options = array( @@ -61,28 +61,11 @@ protected function construct() { 'title' => __( 'Payment in shop', 'wpshop' ), 'description' => __( 'Pay and pick up directly your products at the shop.', 'wpshop' ), ), - 'paypal' => array( - 'active' => true, - 'logo' => '', - 'title' => __( 'PayPal', 'wpshop' ), - 'description' => __( 'Accept payments via PayPal using account balance or credit card.', 'wpshop' ), - 'paypal_email' => '', - 'use_paypal_sandbox' => false, - ), - 'stripe' => array( - 'active' => true, - 'logo' => '', - 'title' => __( 'Stripe', 'wpshop' ), - 'description' => __( 'Use your credit card to place your order', 'wpshop' ), - 'publish_key' => '', - 'secret_key' => '', - 'use_stripe_sandbox' => false, - ), - 'carte_bancaire' => array( - 'active' => true, - 'logo' => '', - 'title' => __( 'Carte Bancaire', 'wpshop' ), - 'description' => __( 'Use your credit card to place your order', 'wpshop' ), + 'online_payment' => array( + 'active' => true, + 'logo' => '', + 'title' => __( 'Online payment', 'wpshop' ), + 'description' => __( 'Pay your product online.', 'wpshop' ), ), ); @@ -97,14 +80,6 @@ protected function construct() { 'publish' => __( 'Waiting for the payment', 'wpshop' ), 'billed' => __( 'Paid', 'wpshop' ), ), - 'paypal' => array( - 'publish' => __( 'Waiting for the payment', 'wpshop' ), - 'billed' => __( 'Paid', 'wpshop' ), - ), - 'stripe' => array( - 'publish' => __( 'Waiting for the payment', 'wpshop' ), - 'billed' => __( 'Paid', 'wpshop' ), - ), ); } diff --git a/modules/paypal/action/class-paypal-action.php b/modules/paypal/action/class-paypal-action.php deleted file mode 100644 index 1b9eb84..0000000 --- a/modules/paypal/action/class-paypal-action.php +++ /dev/null @@ -1,156 +0,0 @@ - - * @copyright (c) 2011-2020 Eoxia . - * @since 2.0.0 - * @version 2.0.0 - */ - -namespace wpshop; - -use eoxia\View_Util; - -defined( 'ABSPATH' ) || exit; - -/** - * PayPal Action Class. - */ -class PayPal_Action { - - /** - * Le constructeur. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function __construct() { - add_action( 'wps_setting_payment_method_paypal_after_form', array( $this, 'callback_setting_payment_method' ), 10, 0 ); - add_action( 'wps_update_payment_method_data', array( $this, 'update_method_payment_paypal' ), 10, 2 ); - - add_action( 'wps_gateway_paypal', array( $this, 'callback_wps_gateway_paypal' ) ); - add_action( 'wps_valid_paypal_standard_ipn_request', array( $this, 'callback_wps_valid_paypal_standard_ipn_request' ) ); - } - - /** - * Ajoute la page pour configurer le paiement PayPal. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function callback_setting_payment_method() { - $paypal_options = Payment::g()->get_payment_option( 'paypal' ); - View_Util::exec( 'wpshop', 'paypal', 'form-setting', array( - 'paypal_options' => $paypal_options, - ) ); - } - - /** - * Enregistre les configurations de PayPal en base de donnée. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function update_method_payment_paypal( $data, $type ) { - if ( 'paypal' === $type ) { - $paypal_email = ! empty( $_POST['paypal_email'] ) ? sanitize_text_field( $_POST['paypal_email'] ) : ''; - $use_paypal_sandbox = ( isset( $_POST['use_paypal_sandbox'] ) && 'on' === $_POST['use_paypal_sandbox'] ) ? true : false; - - $data['paypal']['paypal_email'] = $paypal_email; - $data['paypal']['use_paypal_sandbox'] = $use_paypal_sandbox; - } - - return $data; - } - - /** - * Vérifie les données IPN reçu par PayPal. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param array $data Les données reçu par PayPal. - */ - public function callback_wps_gateway_paypal( $data ) { - if ( ! empty( $data ) && $this->validate_ipn( $data ) ) { // WPCS: CSRF ok. - $posted = wp_unslash( $data ); - do_action( 'wps_valid_paypal_standard_ipn_request', $posted ); - } else { - wp_die( 'No IPN' ); - } - } - - /** - * Appel la méthode selon le status du paiement. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param array $posted Les données reçu par PayPal vérifié. - */ - public function callback_wps_valid_paypal_standard_ipn_request( $posted ) { - if ( method_exists( $this, 'payment_status_' . strtolower( $posted['payment_status'] ) ) ) { - call_user_func( array( $this, 'payment_status_' . strtolower( $posted['payment_status'] ) ), $posted ); - } - } - - /** - * Valide les données IPN. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param array $data Les données reçu par PayPal. - * @return boolean True si OK, sinon false. - */ - public function validate_ipn( $data ) { - $paypal_options = Payment::g()->get_payment_option( 'paypal' ); - - $validate_ipn = wp_unslash( $data ); - $validate_ipn['cmd'] = '_notify-validate'; - - $params = array( - 'body' => $validate_ipn, - 'timeout' => 60, - 'httpversion' => '1.1', - 'compress' => false, - 'decompress' => false, - ); - - $response = wp_safe_remote_post( $paypal_options['use_paypal_sandbox'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', $params ); - - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 && strstr( $response['body'], 'VERIFIED' ) ) { - return true; - } - - return false; - } - - /** - * Paiement OK. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param array $posted Les données reçu par PayPal vérifié. - */ - private function payment_status_completed( $posted ) { - do_action( 'wps_payment_complete', $posted ); - } - - /** - * Paiement pas OK. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param array $posted Les données reçu par Paypal vérifié. - */ - private function payment_status_failed( $posted ) { - do_action( 'wps_payment_failed', $posted ); - } -} - -new Paypal_Action(); diff --git a/modules/paypal/action/index.php b/modules/paypal/action/index.php deleted file mode 100644 index 6220032..0000000 --- a/modules/paypal/action/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - * @copyright (c) 2011-2020 Eoxia . - * @since 2.0.0 - * @version 2.0.0 - */ - -namespace wpshop; - -use eoxia\Singleton_Util; - -defined( 'ABSPATH' ) || exit; - -/** - * PayPal Class. - */ -class PayPal extends Singleton_Util { - /** - * L'URL vers la page de paiement. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @var string - */ - protected $request_url; - - /** - * Le constructeur. - * - * @since 2.0.0 - * @version 2.0.0 - */ - protected function construct() {} - - /** - * Prépare l'URL pour aller à la page de paiement. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param Doli_Order $order Les données de la commande. - * - * @return array L'URL pour aller à la page de paiement. - */ - public function process_payment( $order ) { - $paypal_options = Payment::g()->get_payment_option( 'paypal' ); - - $this->request_url = $paypal_options['use_paypal_sandbox'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?'; - $paypal_args = $this->get_paypal_args( $order ); - - return array( - 'url' => $this->request_url . http_build_query( $paypal_args, '', '&' ), - ); - } - - /** - * Récupère les paramètres IPN de PayPal. - * - * @since 2.0.0 - * @version 2.0.0. - * - * @param Doli_Order $order Les données de la commande. - * - * @return array Les données IPN. - */ - protected function get_paypal_args( $order ) { - $paypal_args = apply_filters( 'wps_paypal_args', array_merge( - $this->get_transaction_args( $order ), - $this->get_line_item_args( $order ) - ), $order ); - - return $paypal_args; - } - - /** - * Prépare les données IPN. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param Doli_Order $order Les données de la commande. - * - * @return array Les données IPN. - */ - protected function get_transaction_args( $order ) { - $payment_methods_option = get_option( 'wps_payment_methods', array( - 'paypal' => array(), - 'cheque' => array(), - ) ); - - $third_party = Third_Party::g()->get( array( 'id' => $order->data['parent_id'] ), true ); - $contact = User::g()->get( array( 'id' => end( $third_party->data['contact_ids'] ) ), true ); - - return array( - 'cmd' => '_cart', - 'business' => $payment_methods_option['paypal']['paypal_email'], - 'no_shipping' => 0, - 'lc' => 'fr_FR', - 'no_note' => 0, - 'rm' => 0, - 'currency_code' => 'EUR', - 'charset' => 'utf-8', - 'upload' => 1, - 'return' => Pages::g()->get_checkout_link() . 'received/order/' . $order->data['external_id'], - 'notify_url' => site_url( 'wp-json/wpshop/v2/wps_gateway_paypal' ), - 'cancel_return' => '', - 'email' => $contact->data['email'], - 'custom' => $order->data['external_id'], - ); - } - - /** - * Ajoute les lignes pour le paiement PayPal. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param Doli_Order $order Les données de la commande. - * - * @return array Les lignes pour le paiement PayPal. - */ - protected function get_line_item_args( $order ) { - $line_item_args = array( - 'item_name_1' => $order->data['title'], - 'quantity_1' => 1, - 'amount_1' => $order->data['total_ttc'], - 'item_number_1' => $order->data['title'], - ); - - return $line_item_args; - } -} - -Paypal::g(); diff --git a/modules/paypal/class/index.php b/modules/paypal/class/index.php deleted file mode 100644 index 6220032..0000000 --- a/modules/paypal/class/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - * @copyright (c) 2011-2020 Eoxia . - * @since 2.0.0 - * @version 2.0.0 - */ - -namespace wpshop; - -defined( 'ABSPATH' ) || exit; - -/** - * PayPal Filter Class. - */ -class Paypal_Filter { - - /** - * Le constructeur. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function __construct() { - add_filter( 'wps_payment_method_paypal_description', array( $this, 'more_paypal_description' ) ); - } - - /** - * Ajoute le text pour indiquer que PayPal est en mode sandbox. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param string $description Description actuelle. - * - * @return string Description modifiée. - */ - public function more_paypal_description( $description ) { - $paypal_options = Payment::g()->get_payment_option( 'paypal' ); - - if ( $paypal_options['use_paypal_sandbox'] ) { - $description .= __( ' SANDBOX ENABLED. You can use sandbox testing accounts only. See the PayPal Sandbox Testing Guide for more details.', 'wpshop' ); - } - - return $description; - } -} - -new Paypal_Filter(); diff --git a/modules/paypal/filter/index.php b/modules/paypal/filter/index.php deleted file mode 100644 index 6220032..0000000 --- a/modules/paypal/filter/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - * @copyright (c) 2011-2020 Eoxia . - * @since 2.0.0 - * @version 2.0.0 - */ - -namespace wpshop; - -defined( 'ABSPATH' ) || exit; - -/** - * Documentation des variables utilisées dans la vue. - * - * @var array $paypal_options Le tableau contenant toutes les données de la méthode de paiement Paypal. - */ -?> - -
- - -
- -
-
- name="use_paypal_sandbox" /> - -
-
diff --git a/modules/paypal/view/index.php b/modules/paypal/view/index.php deleted file mode 100644 index 6220032..0000000 --- a/modules/paypal/view/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - * @copyright (c) 2011-2020 Eoxia . - * @since 2.0.0 - * @version 2.0.0 - */ - -namespace wpshop; - -use eoxia\View_Util; - -defined( 'ABSPATH' ) || exit; - -/** - * Stripe Action Class. - */ -class Stripe_Action { - /** - * Le constructeur. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function __construct() { - add_action( 'wp_head', array( $this, 'define_stripe_option' ) ); - - add_action( 'wp_enqueue_scripts', array( $this, 'callback_enqueue_scripts' ), 9 ); - - add_action( 'wps_setting_payment_method_stripe_after_form', array( $this, 'callback_setting_payment_method' ), 10, 0 ); - add_action( 'wps_update_payment_method_data', array( $this, 'update_method_payment_stripe' ), 10, 2 ); - - add_action( 'wps_gateway_stripe', array( $this, 'callback_wps_gateway_stripe' ), 10, 1 ); - } - - /** - * Ajoute la variable stripe_key pour la rendre acessible dans le JS. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function define_stripe_option() { - $stripe_options = Payment::g()->get_payment_option( 'stripe' ); - - echo ''; - } - - /** - * Inclus le JS de stripe. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function callback_enqueue_scripts() { - if ( Pages::g()->is_checkout_page() ) { - wp_enqueue_script( 'wpshop-stripe', 'https://js.stripe.com/v3/', array(), \eoxia\Config_Util::$init['wpshop']->version ); - } - } - - /** - * Ajoute la page pour configurer le paiement Stripe. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function callback_setting_payment_method() { - $stripe_options = Payment::g()->get_payment_option( 'stripe' ); - View_Util::exec( 'wpshop', 'stripe', 'form-setting', array( - 'stripe_options' => $stripe_options, - ) ); - } - - /** - * Met à jour les réglages de Stripe. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param array $data Les données de Stripe. - * @param array $type Le type de méthode de paiement. - * - * @return array Les données de Stripe - */ - public function update_method_payment_stripe( $data, $type ) { - if ( 'stripe' === $type ) { - $publish_key = ! empty( $_POST['publish_key'] ) ? sanitize_text_field( $_POST['publish_key'] ) : ''; - $secret_key = ! empty( $_POST['secret_key'] ) ? sanitize_text_field( $_POST['secret_key'] ) : ''; - $use_stripe_sandbox = ( isset( $_POST['use_stripe_sandbox'] ) && 'on' === $_POST['use_stripe_sandbox'] ) ? true : false; - - $data['stripe']['publish_key'] = $publish_key; - $data['stripe']['secret_key'] = $secret_key; - $data['stripe']['use_stripe_sandbox'] = $use_stripe_sandbox; - } - - return $data; - } - - /** - * Déclenche l'action pour compléter le paiement. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param array $param Les données reçues par Stripe. - */ - public function callback_wps_gateway_stripe( $param ) { - if ( 'order.payment_failed' === $param['type'] ) { - do_action( 'wps_payment_failed', $param ); - } else { - do_action( 'wps_payment_complete', $param ); - } - } -} - -new Stripe_Action(); diff --git a/modules/stripe/action/index.php b/modules/stripe/action/index.php deleted file mode 100644 index 6220032..0000000 --- a/modules/stripe/action/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - * @copyright (c) 2011-2020 Eoxia . - * @since 2.0.0 - * @version 2.0.0 - */ - -namespace wpshop; - -use eoxia\Singleton_Util; - -defined( 'ABSPATH' ) || exit; - -/** - * Stripe Class. - */ -class Stripe extends Singleton_Util { - /** - * Le constructeur. - * - * @since 2.0.0 - * @version 2.0.0 - */ - protected function construct() {} - - /** - * Prépare le paiement stripe. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param Doli_Order $order Les données de la commande. - * - * @return array L'ID de la session Stripe. - */ - public function process_payment( $order ) { - $stripe_options = Payment::g()->get_payment_option( 'stripe' ); - - \Stripe\Stripe::setApiKey( $stripe_options['secret_key'] ); - \Stripe\Stripe::setApiVersion( '2019-03-14; checkout_sessions_beta=v1' ); - - $lines = array( - 'amount' => (int) ( $order->data['total_ttc'] * 100 ), - 'quantity' => 1, - 'name' => $order->data['title'], - 'currency' => 'eur', - ); - - $session = \Stripe\Checkout\Session::create( array( - 'success_url' => Pages::g()->get_checkout_link() . '/received/order/' . $order->data['external_id'], - 'cancel_url' => site_url(), - 'payment_method_types' => array( 'card' ), - 'line_items' => array( $lines ), - 'metadata' => array( 'order_id' => $order->data['external_id'] ), - ) ); - - return array( - 'id' => $session->id, - ); - } -} - -Stripe::g(); diff --git a/modules/stripe/class/index.php b/modules/stripe/class/index.php deleted file mode 100644 index 6220032..0000000 --- a/modules/stripe/class/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - * @copyright (c) 2011-2020 Eoxia . - * @since 2.0.0 - * @version 2.0.0 - */ - -namespace wpshop; - -defined( 'ABSPATH' ) || exit; - -/** - * Stripe Filter Class. - */ -class Stripe_Filter { - - /** - * Le constructeur. - * - * @since 2.0.0 - * @version 2.0.0 - */ - public function __construct() { - add_filter( 'wps_payment_method_stripe_description', array( $this, 'more_stripe_description' ) ); - } - - /** - * Ajoute le text pour indiquer que Stripe est en mode sandbox. - * - * @since 2.0.0 - * @version 2.0.0 - * - * @param string $description Description actuelle. - * - * @return string Description modifiée. - */ - public function more_stripe_description( $description ) { - $stripe_options = Payment::g()->get_payment_option( 'stripe' ); - - if ( $stripe_options['use_stripe_sandbox'] ) { - $description .= __( ' SANDBOX ENABLED', 'wpshop' ); - } - - return $description; - } -} - -new Stripe_Filter(); diff --git a/modules/stripe/filter/index.php b/modules/stripe/filter/index.php deleted file mode 100644 index 6220032..0000000 --- a/modules/stripe/filter/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - * @copyright (c) 2011-2020 Eoxia . - * @since 2.0.0 - * @version 2.0.0 - */ - -namespace wpshop; - -defined( 'ABSPATH' ) || exit; - -/** - * Documentation des variables utilisées dans la vue. - * - * @var array $stripe_options Le tableau contenant toutes les données de la méthode de paiement Stripe. - */ -?> - -
- - -
- -
- - -
- -
-
- name="use_stripe_sandbox" /> - -
-
diff --git a/modules/stripe/view/index.php b/modules/stripe/view/index.php deleted file mode 100644 index 6220032..0000000 --- a/modules/stripe/view/index.php +++ /dev/null @@ -1,2 +0,0 @@ - * Author URI: http://www.eoxia.com/ * License: GPLv3