Skip to content

Commit

Permalink
O7 Setting to override Stripe Customer email with shop customer address
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Sosnowski committed Nov 27, 2024
1 parent 8fbe69f commit f45c6d8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Application/Model/Request/PaymentIntent.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace OxidSolutionCatalysts\Stripe\Application\Model\Request;

use OxidEsales\EshopCommunity\Core\Registry;
use OxidSolutionCatalysts\Stripe\Application\Helper\Order as OrderHelper;
use OxidSolutionCatalysts\Stripe\Application\Helper\Payment as PaymentHelper;
use OxidSolutionCatalysts\Stripe\Application\Helper\User as UserHelper;
Expand Down Expand Up @@ -48,7 +49,10 @@ public function addRequestParameters(CoreOrder $oOrder, $dAmount, $sReturnUrl, $
$this->addParameter('customer', $sStripeCustomerId);
}

$this->addParameter('receipt_email', $this->getCustomerEmail($oCoreUser));
//task STRIP-47, overriding customer email only if module setting is enabled
if (PaymentHelper::getInstance()->getShopConfVar('sStripeCustomerEmailOverride')) {
$this->addParameter('receipt_email', $this->getCustomerEmail($oCoreUser));
}

if ($oPaymentModel->isRedirectUrlNeeded($oOrder) === true) {
$this->addParameter('return_url', $sReturnUrl);
Expand Down
2 changes: 2 additions & 0 deletions Application/views/admin_twig/de/stripe_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'SHOP_MODULE_sStripeCronSecureKey' => 'Cronjob Sicherheits-Schlüssel',
'SHOP_MODULE_GROUP_STRIPE_WEBHOOKS' => 'Webhooks',
'SHOP_MODULE_sStripeWebhookEndpoint' => 'Webhook Endpoint',
'SHOP_MODULE_sStripeCustomerEmailOverride' => 'Ersetzen Sie die E-Mail-Adresse des Kunden durch die Adresse aus dem Geschäft',

'HELP_SHOP_MODULE_sStripeTestKey' => 'Geben Sie Ihren persönlichen privaten TEST-API-Schlüssel ein, der zum Einrichten des Webhook-Endpunkts verwendet wird.',
'HELP_SHOP_MODULE_sStripeLiveKey' => 'Geben Sie Ihren persönlichen privaten LIVE-API-Schlüssel ein, der zum Einrichten des Webhook-Endpunkts verwendet wird.',
Expand All @@ -52,6 +53,7 @@
'HELP_SHOP_MODULE_sStripeCronSecondChanceActive' => 'Damit dieser Cronjob arbeitet, müssen Sie zusätzlich zu dieser Checkbox noch sicherstellen dass der Stripe Cronjob eingerichtet ist. Mehr dazu erfahren Sie in der README.md Datei des Moduls.',
'HELP_SHOP_MODULE_sStripeCronOrderShipmentActive' => 'Dieser Cronjob ist nur notwendig, wenn der Versandstatus in Ihrem Shop über ein externes System gesetzt wird und NICHT über den "Jetzt versenden" Button im Oxid-Admin. Damit dieser Cronjob arbeitet, müssen Sie zusätzlich zu dieser Checkbox noch sicherstellen dass der Stripe Cronjob eingerichtet ist. Mehr dazu erfahren Sie in der README.md Datei des Moduls.',
'HELP_SHOP_MODULE_sStripeCronSecureKey' => 'Diese Option benötigen Sie nur, wenn Sie den Cronjob per URL aufrufen müssen anstelle von dem Aufruf über die php cli. Konfigurieren Sie hier einen Sicherheitsschlüssel, den Sie über den GET-Parameter "secureKey" an den Aufruf des Cronjobs anfügen. Bsp.: https://YOUR-SHOP-URL-HERE/modules/fc/stripe/cron.php?secureKey=YOUR-SECURE-KEY',
'HELP_SHOP_MODULE_sStripeCustomerEmailOverride' => 'Wenn diese Option aktiviert ist, überschreibt der Shop die Stripe-Kunden-E-Mail mit der im Konto des Shops angegebenen Adresse. Die Benachrichtigungen von Stripe werden an diese Adresse gesendet.',

'STRIPE_YES' => 'Ja',
'STRIPE_NO' => 'Nein',
Expand Down
2 changes: 2 additions & 0 deletions Application/views/admin_twig/en/stripe_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'SHOP_MODULE_sStripeCronSecureKey' => 'Cronjob secure key',
'SHOP_MODULE_GROUP_STRIPE_WEBHOOKS' => 'Webhooks',
'SHOP_MODULE_sStripeWebhookEndpoint' => 'Webhook Endpoint',
'SHOP_MODULE_sStripeCustomerEmailOverride' => 'Replace customer email address with store address',

'HELP_SHOP_MODULE_sStripeTestKey' => 'Fill in your personal TEST private API key that will be used to set up the webhook endpoint.',
'HELP_SHOP_MODULE_sStripeLiveKey' => 'Fill in your personal LIVE private API key that will be used to set up the webhook endpoint.',
Expand All @@ -52,6 +53,7 @@
'HELP_SHOP_MODULE_sStripeCronSecondChanceActive' => 'For this cronjob to work, in addition to this checkbox you have to ensure that the Stripe cronjob is set up properly. You can find information on how to set up the cronjob in the README.md of this module.',
'HELP_SHOP_MODULE_sStripeCronOrderShipmentActive' => 'This cronjob is only needed if the shipping status in your shop is set by an external service and NOT by the "Ship Now" button. For this cronjob to work, in addition to this checkbox you have to ensure that the Stripe cronjob is set up properly. You can find information on how to set up the cronjob in the README.md of this module.',
'HELP_SHOP_MODULE_sStripeCronSecureKey' => 'This option is only needed if you have to call the cronjob via URL instead of the php cli. Configure your secure key here, which you have to add to the cronjob call as the GET parameter "secureKey". Example: https://YOUR-SHOP-URL-HERE/modules/fc/stripe/cron.php?secureKey=YOUR-SECURE-KEY',
'HELP_SHOP_MODULE_sStripeCustomerEmailOverride' => 'With this option enabled the Shop will override the Stripe customer email with the address given in the shop\'s account. The notifications from Stripe will be sent to that address.',

'STRIPE_YES' => 'Yes',
'STRIPE_NO' => 'No',
Expand Down
1 change: 1 addition & 0 deletions metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
['group' => 'STRIPE_GENERAL', 'name' => 'blStripeLogTransactionInfo', 'type' => 'bool', 'value' => '1', 'position' => 34],
['group' => 'STRIPE_GENERAL', 'name' => 'blStripeRemoveByBillingCountry', 'type' => 'bool', 'value' => '1', 'position' => 35],
['group' => 'STRIPE_GENERAL', 'name' => 'blStripeRemoveByBasketCurrency', 'type' => 'bool', 'value' => '1', 'position' => 36],
['group' => 'STRIPE_GENERAL', 'name' => 'sStripeCustomerEmailOverride', 'type' => 'bool', 'value' => '0', 'position' => 37],
['group' => 'STRIPE_STATUS_MAPPING', 'name' => 'sStripeStatusPending', 'type' => 'select', 'value' => '', 'position' => 50],
['group' => 'STRIPE_STATUS_MAPPING', 'name' => 'sStripeStatusProcessing', 'type' => 'select', 'value' => '', 'position' => 60],
['group' => 'STRIPE_STATUS_MAPPING', 'name' => 'sStripeStatusCancelled', 'type' => 'select', 'value' => '', 'position' => 70],
Expand Down

0 comments on commit f45c6d8

Please sign in to comment.