Extending JSON API: Sending Confirmation Emails After Customer Deletion
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- Paulus-Ragnarr
- Posts: 16
- Joined: 15 Oct 2024, 07:02
Extending JSON API: Sending Confirmation Emails After Customer Deletion
Hello Aimeos,
I'm working on extending the JSON API customer delete function, and I would like to implement a feature that sends a confirmation email to the user after their account is deleted. Could you advise on the best way to achieve this functionality?
CustomerDecorator
Thank you for your assistance!
I'm working on extending the JSON API customer delete function, and I would like to implement a feature that sends a confirmation email to the user after their account is deleted. Could you advise on the best way to achieve this functionality?
CustomerDecorator
Code: Select all
<?php
namespace Aimeos\Client\JsonApi\Customer;
class CustomerDecorator
extends \Aimeos\Client\JsonApi\Base
implements \Aimeos\Client\JsonApi\Iface
{
public function delete()
{
}
}
Re: Extending JSON API: Sending Confirmation Emails After Customer Deletion
Usually, you want to send the e-mail also when the account is deleted in any other way (not only via the JSON:API). Also, doing it async has a lot of performance advantages because you can return immediately a response to the requester. Therefore, adding a message to a new queue for deleted accounts and processing that message by a job controller afterwards is the best and cleanest way.
Example for adding a message to a queue:
https://github.com/aimeos/ai-controller ... d.php#L429
How to create a job controller:
https://aimeos.org/docs/latest/cronjobs ... ontroller/
Example for a job controller using a message queue for sending e-mails:
https://github.com/aimeos/ai-controller ... andard.php
Example for adding a message to a queue:
https://github.com/aimeos/ai-controller ... d.php#L429
How to create a job controller:
https://aimeos.org/docs/latest/cronjobs ... ontroller/
Example for a job controller using a message queue for sending e-mails:
https://github.com/aimeos/ai-controller ... andard.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- Paulus-Ragnarr
- Posts: 16
- Joined: 15 Oct 2024, 07:02
Re: Extending JSON API: Sending Confirmation Emails After Customer Deletion
Hello Aimeos, thank you for the response.
To clarify, am I correct in assuming that I need to extend the delete function found here: https://github.com/aimeos/ai-controller ... d.php#L324 and add a message to a queue within this function?
To clarify, am I correct in assuming that I need to extend the delete function found here: https://github.com/aimeos/ai-controller ... d.php#L324 and add a message to a queue within this function?
Re: Extending JSON API: Sending Confirmation Emails After Customer Deletion
Yes, the customer frontend controller is the best place for that and you can extend it with a decorator, so you don't have to extend the class.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star