mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
* Removed unnecessary constructor
* Added function docblocks * Changed class docblock to include link to lists readme
This commit is contained in:
parent
4924b597f4
commit
67ae7c4137
@ -6,17 +6,20 @@ use Mailgun\Messages\Exceptions\InvalidParameter;
|
|||||||
use Mailgun\Messages\Exceptions\TooManyParameters;
|
use Mailgun\Messages\Exceptions\TooManyParameters;
|
||||||
use Mailgun\Messages\Expcetions\InvalidParameterType;
|
use Mailgun\Messages\Expcetions\InvalidParameterType;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
This class is used for creating a unique hash for
|
* This class is used for creating a unique hash for
|
||||||
mailing list subscription double-opt in requests.
|
* mailing list subscription double-opt in requests.
|
||||||
*/
|
*
|
||||||
|
* @link https://github.com/mailgun/mailgun-php/blob/master/src/Mailgun/Lists/README.md
|
||||||
|
*/
|
||||||
class OptInHandler{
|
class OptInHandler{
|
||||||
|
|
||||||
function __construct(){
|
/**
|
||||||
|
* @param string $mailingList
|
||||||
}
|
* @param string $secretAppId
|
||||||
|
* @param string $recipientAddress
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function generateHash($mailingList, $secretAppId, $recipientAddress){
|
public function generateHash($mailingList, $secretAppId, $recipientAddress){
|
||||||
$innerPayload = array('r' => $recipientAddress, 'l' => $mailingList);
|
$innerPayload = array('r' => $recipientAddress, 'l' => $mailingList);
|
||||||
$encodedInnerPayload = base64_encode(json_encode($innerPayload));
|
$encodedInnerPayload = base64_encode(json_encode($innerPayload));
|
||||||
@ -27,6 +30,11 @@ class OptInHandler{
|
|||||||
return urlencode(base64_encode(json_encode($outerPayload)));
|
return urlencode(base64_encode(json_encode($outerPayload)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $secretAppId
|
||||||
|
* @param string $uniqueHash
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
public function validateHash($secretAppId, $uniqueHash){
|
public function validateHash($secretAppId, $uniqueHash){
|
||||||
$decodedOuterPayload = json_decode(base64_decode(urldecode($uniqueHash)), true);
|
$decodedOuterPayload = json_decode(base64_decode(urldecode($uniqueHash)), true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user