1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the smsmode-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2019 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\SMSModeBundle\Factory; |
13
|
|
|
|
14
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\AddingContactInterface; |
15
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\CheckingSMSMessageStatusInterface; |
16
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\CreatingSubAccountInterface; |
17
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\DeletingSMSInterface; |
18
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\DeletingSubAccountInterface; |
19
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\DeliveryReportInterface; |
20
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\RetrievingSMSReplyInterface; |
21
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\SendingSMSBatchInterface; |
22
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\SendingSMSMessageInterface; |
23
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\SendingTextToSpeechSMSInterface; |
24
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\SendingUnicodeSMSInterface; |
25
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\SentSMSMessageListInterface; |
26
|
|
|
use WBW\Bundle\SMSModeBundle\Entity\TransferringCreditsInterface; |
27
|
|
|
use WBW\Library\SMSMode\Model\Request\AccountBalanceRequest; |
28
|
|
|
use WBW\Library\SMSMode\Model\Request\AddingContactRequest; |
29
|
|
|
use WBW\Library\SMSMode\Model\Request\CheckingSMSMessageStatusRequest; |
30
|
|
|
use WBW\Library\SMSMode\Model\Request\CreatingAPIKeyRequest; |
31
|
|
|
use WBW\Library\SMSMode\Model\Request\CreatingSubAccountRequest; |
32
|
|
|
use WBW\Library\SMSMode\Model\Request\DeletingSMSRequest; |
33
|
|
|
use WBW\Library\SMSMode\Model\Request\DeletingSubAccountRequest; |
34
|
|
|
use WBW\Library\SMSMode\Model\Request\DeliveryReportRequest; |
35
|
|
|
use WBW\Library\SMSMode\Model\Request\RetrievingSMSReplyRequest; |
36
|
|
|
use WBW\Library\SMSMode\Model\Request\SendingSMSBatchRequest; |
37
|
|
|
use WBW\Library\SMSMode\Model\Request\SendingSMSMessageRequest; |
38
|
|
|
use WBW\Library\SMSMode\Model\Request\SendingTextToSpeechSMSRequest; |
39
|
|
|
use WBW\Library\SMSMode\Model\Request\SendingUnicodeSMSRequest; |
40
|
|
|
use WBW\Library\SMSMode\Model\Request\SentSMSMessageListRequest; |
41
|
|
|
use WBW\Library\SMSMode\Model\Request\TransferringCreditsRequest; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* sMsmode factory. |
45
|
|
|
* |
46
|
|
|
* @author webeweb <https://github.com/webeweb/> |
47
|
|
|
* @package WBW\Bundle\SMSModeBundle\Factory |
48
|
|
|
*/ |
49
|
|
|
class SMSModeFactory { |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Creates an account balance request. |
53
|
|
|
* |
54
|
|
|
* @return AccountBalanceRequest Returns the account balance request. |
55
|
|
|
*/ |
56
|
|
|
public static function newAccountBalanceRequest() { |
57
|
|
|
return new AccountBalanceRequest(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Creates an adding contact request. |
62
|
|
|
* |
63
|
|
|
* @param AddingContactInterface $addingContact The adding contact. |
64
|
|
|
* @return AddingContactRequest Returns the adding contact request. |
65
|
|
|
*/ |
66
|
|
|
public static function newAddingContactRequest(AddingContactInterface $addingContact) { |
67
|
|
|
|
68
|
|
|
$model = new AddingContactRequest(); |
69
|
|
|
$model->setDate($addingContact->getSMSModeDate()); |
70
|
|
|
$model->setGroupes($addingContact->getSMSModeGroupes()); |
71
|
|
|
$model->setMobile($addingContact->getSMSModeMobile()); |
72
|
|
|
$model->setNom($addingContact->getSMSModeNom()); |
73
|
|
|
$model->setOther($addingContact->getSMSModeOther()); |
74
|
|
|
$model->setPrenom($addingContact->getSMSModePrenom()); |
75
|
|
|
$model->setSociete($addingContact->getSMSModeSociete()); |
76
|
|
|
|
77
|
|
|
return $model; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Creates a checking SMS message status request. |
82
|
|
|
* |
83
|
|
|
* @param CheckingSMSMessageStatusInterface $checkingSMSMessageStatus the checking SMS message status. |
84
|
|
|
* @return CheckingSMSMessageStatusRequest Returns the checking SMS message status request. |
85
|
|
|
*/ |
86
|
|
|
public static function newCheckingSMSMessageStatusRequest(CheckingSMSMessageStatusInterface $checkingSMSMessageStatus) { |
87
|
|
|
|
88
|
|
|
$model = new CheckingSMSMessageStatusRequest(); |
89
|
|
|
$model->setSmsID($checkingSMSMessageStatus->getSMSModeSmsID()); |
90
|
|
|
|
91
|
|
|
return $model; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Creates an creating API key request. |
96
|
|
|
* |
97
|
|
|
* @return CreatingAPIKeyRequest Returns the creating API key request. |
98
|
|
|
*/ |
99
|
|
|
public static function newCreatingAPIKeyRequest() { |
100
|
|
|
return new CreatingAPIKeyRequest(); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Creates a creating sub-account request. |
105
|
|
|
* |
106
|
|
|
* @param CreatingSubAccountInterface $creatingSubAccount the creating sub-account. |
107
|
|
|
* @return CreatingSubAccountRequest Returns the creating sub-account request. |
108
|
|
|
*/ |
109
|
|
|
public static function newCreatingSubAccountRequest(CreatingSubAccountInterface $creatingSubAccount) { |
110
|
|
|
|
111
|
|
|
$model = new CreatingSubAccountRequest(); |
112
|
|
|
$model->setAdresse($creatingSubAccount->getSMSModeAdresse()); |
113
|
|
|
$model->setCodePostal($creatingSubAccount->getSMSModeCodePostal()); |
114
|
|
|
$model->setDate($creatingSubAccount->getSMSModeDate()); |
115
|
|
|
$model->setEmail($creatingSubAccount->getSMSModeEmail()); |
116
|
|
|
$model->setFax($creatingSubAccount->getSMSModeFax()); |
117
|
|
|
$model->setMobile($creatingSubAccount->getSMSModeMobile()); |
118
|
|
|
$model->setNewPass($creatingSubAccount->getSMSModeNewPass()); |
119
|
|
|
$model->setNewPseudo($creatingSubAccount->getSMSModeNewPseudo()); |
120
|
|
|
$model->setNom($creatingSubAccount->getSMSModeNom()); |
121
|
|
|
$model->setPrenom($creatingSubAccount->getSMSModePrenom()); |
122
|
|
|
$model->setReference($creatingSubAccount->getSMSModeReference()); |
123
|
|
|
$model->setSociete($creatingSubAccount->getSMSModeSociete()); |
124
|
|
|
$model->setTelephone($creatingSubAccount->getSMSModeTelephone()); |
125
|
|
|
$model->setVille($creatingSubAccount->getSMSModeVille()); |
126
|
|
|
|
127
|
|
|
return $model; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Creates a deleting SMS request. |
132
|
|
|
* |
133
|
|
|
* @param DeletingSMSInterface $deletingSMS the deleting SMS. |
134
|
|
|
* @return DeletingSMSRequest Returns the deleting SMS request. |
135
|
|
|
*/ |
136
|
|
|
public static function newDeletingSMSRequest(DeletingSMSInterface $deletingSMS) { |
137
|
|
|
|
138
|
|
|
$model = new DeletingSMSRequest(); |
139
|
|
|
$model->setNumero($deletingSMS->getSMSModeNumero()); |
140
|
|
|
$model->setSmsID($deletingSMS->getSMSModeSmsID()); |
141
|
|
|
|
142
|
|
|
return $model; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Creates a deleting sub-account request. |
147
|
|
|
* |
148
|
|
|
* @param DeletingSubAccountInterface $deletingSubAccount the deleting sub-account. |
149
|
|
|
* @return DeletingSubAccountRequest Returns the deleting sub-account status request. |
150
|
|
|
*/ |
151
|
|
|
public static function newDeletingSubAccountRequest(DeletingSubAccountInterface $deletingSubAccount) { |
152
|
|
|
|
153
|
|
|
$model = new DeletingSubAccountRequest(); |
154
|
|
|
$model->setPseudoToDelete($deletingSubAccount->getSMSModePseudoToDelete()); |
155
|
|
|
|
156
|
|
|
return $model; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Creates a delivery report request. |
161
|
|
|
* |
162
|
|
|
* @param DeliveryReportInterface $deliveryReport the delivery report. |
163
|
|
|
* @return DeliveryReportRequest Returns the delivery report request. |
164
|
|
|
*/ |
165
|
|
|
public static function newDeliveryReportRequest(DeliveryReportInterface $deliveryReport) { |
166
|
|
|
|
167
|
|
|
$model = new DeliveryReportRequest(); |
168
|
|
|
$model->setSmsID($deliveryReport->getSMSModeSmsID()); |
169
|
|
|
|
170
|
|
|
return $model; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Creates a retrieving SMS reply request. |
175
|
|
|
* |
176
|
|
|
* @param RetrievingSMSReplyInterface $retrievingSMSReply the retrieving SMS reply. |
177
|
|
|
* @return RetrievingSMSReplyRequest Returns the retrieving SMS reply request. |
178
|
|
|
*/ |
179
|
|
|
public static function newRetrievingSMSReplyRequest(RetrievingSMSReplyInterface $retrievingSMSReply) { |
180
|
|
|
|
181
|
|
|
$model = new RetrievingSMSReplyRequest(); |
182
|
|
|
$model->setOffset($retrievingSMSReply->getSMSModeOffset()); |
183
|
|
|
$model->setEndDate($retrievingSMSReply->getSMSModeEndDate()); |
184
|
|
|
$model->setStart($retrievingSMSReply->getSMSModeStart()); |
185
|
|
|
$model->setStartDate($retrievingSMSReply->getSMSModeStartDate()); |
186
|
|
|
|
187
|
|
|
return $model; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Creates a sending SMS batch request. |
192
|
|
|
* |
193
|
|
|
* @param SendingSMSBatchInterface $sendingSMSBatch the sending SMS batch. |
194
|
|
|
* @return SendingSMSBatchRequest Returns the sending SMS batch request. |
195
|
|
|
*/ |
196
|
|
|
public static function newSendingSMSBatchRequest(SendingSMSBatchInterface $sendingSMSBatch) { |
197
|
|
|
|
198
|
|
|
$model = new SendingSMSBatchRequest(); |
199
|
|
|
$model->setClasseMsg($sendingSMSBatch->getSMSModeClasseMsg()); |
200
|
|
|
$model->setDateEnvoi($sendingSMSBatch->getSMSModeDateEnvoi()); |
201
|
|
|
$model->setEmetteur($sendingSMSBatch->getSMSModeEmetteur()); |
202
|
|
|
$model->setFichier($sendingSMSBatch->getSMSModeFichier()); |
203
|
|
|
$model->setNbrMsg($sendingSMSBatch->getSMSModeNbrMsg()); |
204
|
|
|
$model->setNotificationUrl($sendingSMSBatch->getSMSModeNotificationUrl()); |
205
|
|
|
$model->setRefClient($sendingSMSBatch->getSMSModeRefClient()); |
206
|
|
|
|
207
|
|
|
return $model; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Creates a sending SMS message request. |
212
|
|
|
* |
213
|
|
|
* @param SendingSMSMessageInterface $sendingSMSMessage the sending SMS message. |
214
|
|
|
* @return SendingSMSMessageRequest Returns the sending SMS message request. |
215
|
|
|
*/ |
216
|
|
|
public static function newSendingSMSMessageRequest(SendingSMSMessageInterface $sendingSMSMessage) { |
217
|
|
|
|
218
|
|
|
$model = new SendingSMSMessageRequest(); |
219
|
|
|
$model->setClasseMsg($sendingSMSMessage->getSMSModeClasseMsg()); |
220
|
|
|
$model->setDateEnvoi($sendingSMSMessage->getSMSModeDateEnvoi()); |
221
|
|
|
$model->setEmetteur($sendingSMSMessage->getSMSModeEmetteur()); |
222
|
|
|
$model->setGroupe($sendingSMSMessage->getSMSModeGroupe()); |
223
|
|
|
$model->setMessage($sendingSMSMessage->getSMSModeMessage()); |
224
|
|
|
foreach ($sendingSMSMessage->getSMSModeNumero() as $current) { |
225
|
|
|
$model->addNumero($current); |
226
|
|
|
} |
227
|
|
|
$model->setNbrMsg($sendingSMSMessage->getSMSModeNbrMsg()); |
228
|
|
|
$model->setNotificationUrl($sendingSMSMessage->getSMSModeNotificationUrl()); |
229
|
|
|
$model->setNotificationUrlReponse($sendingSMSMessage->getSMSModeNotificationUrlReponse()); |
230
|
|
|
$model->setRefClient($sendingSMSMessage->getSMSModeRefClient()); |
231
|
|
|
$model->setStop($sendingSMSMessage->getSMSModeStop()); |
232
|
|
|
|
233
|
|
|
return $model; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Creates a sending text-to-speech SMS request. |
238
|
|
|
* |
239
|
|
|
* @param SendingTextToSpeechSMSInterface $sendingTextToSpeechSMS the sending text-to-speech SMS. |
240
|
|
|
* @return SendingTextToSpeechSMSRequest Returns the sending text-to-speech SMS request. |
241
|
|
|
*/ |
242
|
|
|
public static function newSendingTextToSpeechSMSRequest(SendingTextToSpeechSMSInterface $sendingTextToSpeechSMS) { |
243
|
|
|
|
244
|
|
|
$model = new SendingTextToSpeechSMSRequest(); |
245
|
|
|
$model->setDateEnvoi($sendingTextToSpeechSMS->getSMSModeDateEnvoi()); |
246
|
|
|
$model->setLanguage($sendingTextToSpeechSMS->getSMSModeLanguage()); |
247
|
|
|
$model->setMessage($sendingTextToSpeechSMS->getSMSModeMessage()); |
248
|
|
|
foreach ($sendingTextToSpeechSMS->getSMSModeNumero() as $current) { |
249
|
|
|
$model->addNumero($current); |
250
|
|
|
} |
251
|
|
|
$model->setTitle($sendingTextToSpeechSMS->getSMSModeTitle()); |
252
|
|
|
|
253
|
|
|
return $model; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* Creates a sending unicode SMS request. |
258
|
|
|
* |
259
|
|
|
* @param SendingUnicodeSMSInterface $sendingUnicodeSMS the sending unicode SMS. |
260
|
|
|
* @return SendingUnicodeSMSRequest Returns the sending unicode SMS request. |
261
|
|
|
*/ |
262
|
|
|
public static function newSendingUnicodeSMSRequest(SendingUnicodeSMSInterface $sendingUnicodeSMS) { |
263
|
|
|
|
264
|
|
|
$model = new SendingUnicodeSMSRequest(); |
265
|
|
|
$model->setClasseMsg($sendingUnicodeSMS->getSMSModeClasseMsg()); |
266
|
|
|
$model->setDateEnvoi($sendingUnicodeSMS->getSMSModeDateEnvoi()); |
267
|
|
|
$model->setEmetteur($sendingUnicodeSMS->getSMSModeEmetteur()); |
268
|
|
|
$model->setGroupe($sendingUnicodeSMS->getSMSModeGroupe()); |
269
|
|
|
$model->setMessage($sendingUnicodeSMS->getSMSModeMessage()); |
270
|
|
|
foreach ($sendingUnicodeSMS->getSMSModeNumero() as $current) { |
271
|
|
|
$model->addNumero($current); |
272
|
|
|
} |
273
|
|
|
$model->setNbrMsg($sendingUnicodeSMS->getSMSModeNbrMsg()); |
274
|
|
|
$model->setNotificationUrl($sendingUnicodeSMS->getSMSModeNotificationUrl()); |
275
|
|
|
$model->setNotificationUrlReponse($sendingUnicodeSMS->getSMSModeNotificationUrlReponse()); |
276
|
|
|
$model->setRefClient($sendingUnicodeSMS->getSMSModeRefClient()); |
277
|
|
|
$model->setStop($sendingUnicodeSMS->getSMSModeStop()); |
278
|
|
|
|
279
|
|
|
return $model; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* Creates a sent SMS message list request. |
284
|
|
|
* |
285
|
|
|
* @param SentSMSMessageListInterface $sentSMSMessageList the sent SMS message list. |
286
|
|
|
* @return SentSMSMessageListRequest Returns the sent SMS message list request. |
287
|
|
|
*/ |
288
|
|
|
public static function newSentSMSMessageListRequest(SentSMSMessageListInterface $sentSMSMessageList) { |
289
|
|
|
|
290
|
|
|
$model = new SentSMSMessageListRequest(); |
291
|
|
|
$model->setOffset($sentSMSMessageList->getSMSModeOffset()); |
292
|
|
|
|
293
|
|
|
return $model; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* Creates a transferring credits request. |
298
|
|
|
* |
299
|
|
|
* @param TransferringCreditsInterface $transferringCredits the transferring credits. |
300
|
|
|
* @return TransferringCreditsRequest Returns the transferring credits request. |
301
|
|
|
*/ |
302
|
|
|
public static function newTransferringCreditsRequest(TransferringCreditsInterface $transferringCredits) { |
303
|
|
|
|
304
|
|
|
$model = new TransferringCreditsRequest(); |
305
|
|
|
$model->setCreditAmount($transferringCredits->getSMSModeCreditAmount()); |
306
|
|
|
$model->setReference($transferringCredits->getSMSModeReference()); |
307
|
|
|
$model->setTargetPseudo($transferringCredits->getSMSModeTargetPseudo()); |
308
|
|
|
|
309
|
|
|
return $model; |
310
|
|
|
} |
311
|
|
|
} |
312
|
|
|
|