| @@ 9-54 (lines=46) @@ | ||
| 6 | use LBHurtado\EngageSpark\EngageSpark; |
|
| 7 | use LBHurtado\Common\Contracts\HttpApiParams; |
|
| 8 | ||
| 9 | class SendHttpApiParams implements HttpApiParams |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @var EngageSpark |
|
| 13 | */ |
|
| 14 | protected $service; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * @var string |
|
| 18 | */ |
|
| 19 | protected $mobile; |
|
| 20 | ||
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | protected $message; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | protected $recipientType = 'mobile_number'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * SendParams constructor. |
|
| 33 | * @param $service |
|
| 34 | * @param $mobile |
|
| 35 | * @param $message |
|
| 36 | */ |
|
| 37 | public function __construct(EngageSpark $service, string $mobile, string $message) |
|
| 38 | { |
|
| 39 | $this->service = $service; |
|
| 40 | $this->mobile = $mobile; |
|
| 41 | $this->message = $message; |
|
| 42 | } |
|
| 43 | ||
| 44 | public function toArray(): array |
|
| 45 | { |
|
| 46 | return [ |
|
| 47 | 'organization_id' => $this->service->getOrgId(), |
|
| 48 | 'mobile_numbers' => Arr::wrap($this->mobile), |
|
| 49 | 'message' => $this->message, |
|
| 50 | 'sender_id' => $this->service->getSenderId(), |
|
| 51 | 'recipient_type' => $this->recipientType, |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||
| @@ 8-60 (lines=53) @@ | ||
| 5 | use LBHurtado\EngageSpark\EngageSpark; |
|
| 6 | use LBHurtado\Common\Contracts\HttpApiParams; |
|
| 7 | ||
| 8 | class TopupHttpApiParams implements HttpApiParams |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var EngageSpark |
|
| 12 | */ |
|
| 13 | protected $service; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @var string |
|
| 17 | */ |
|
| 18 | protected $mobile; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @var int |
|
| 22 | */ |
|
| 23 | protected $amount; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @var string |
|
| 27 | */ |
|
| 28 | protected $recipientType = 'mobile_number'; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @var string |
|
| 32 | */ |
|
| 33 | protected $reference; |
|
| 34 | ||
| 35 | /** |
|
| 36 | * SendParams constructor. |
|
| 37 | * @param $service |
|
| 38 | * @param $mobile_number |
|
| 39 | * @param $amount |
|
| 40 | * @param $reference |
|
| 41 | */ |
|
| 42 | public function __construct(EngageSpark $service, string $mobile, int $amount, string $reference) |
|
| 43 | { |
|
| 44 | $this->service = $service; |
|
| 45 | $this->mobile = $mobile; |
|
| 46 | $this->amount = $amount; |
|
| 47 | $this->reference = $reference; |
|
| 48 | } |
|
| 49 | ||
| 50 | //TODO: make this independent of provider, right now it's engagespark |
|
| 51 | public function toArray(): array |
|
| 52 | { |
|
| 53 | return [ |
|
| 54 | 'organizationId' => $this->service->getOrgId(), |
|
| 55 | 'phoneNumber' => $this->mobile, |
|
| 56 | 'maxAmount' => $this->amount, |
|
| 57 | 'clientRef' => $this->reference, |
|
| 58 | ]; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||