Skip to content

Commit 47a57f3

Browse files
committed
Merge pull request #9 from illiminable/master
Fix the SDK to address the inconsistent parameter name in the API.
2 parents 53b24ed + 6561fc2 commit 47a57f3

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

src/TeleSign.Services.Verify/RawVerifyService.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,19 @@ private static Dictionary<string, string> ConstructVerifyArgs(
387387
args.Add("verify_code", verifyCode.ToString());
388388
}
389389

390-
args.Add("language", language);
390+
if (!string.IsNullOrEmpty(language))
391+
{
392+
args.Add("language", language);
393+
}
391394

392-
if (verificationMethod == VerificationMethod.Sms || verificationMethod == VerificationMethod.Push || verificationMethod == VerificationMethod.TwoWaySms)
395+
if (verificationMethod == VerificationMethod.Sms || verificationMethod == VerificationMethod.Push)
393396
{
394397
args.Add("template", messageTemplate);
395398
}
396399

397400
if (verificationMethod == VerificationMethod.TwoWaySms)
398401
{
402+
args.Add("message", messageTemplate);
399403
args.Add("validity_period", validityPeriod);
400404
args.Add("ucid", useCaseId);
401405
}

src/TeleSign.TeleSignCmd/Commands.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,32 @@ public static void SendSms(string[] args)
241241
}
242242
}
243243

244+
[CliCommand(HelpString = "Help me")]
245+
public static void SendTwoWaySms(string[] args)
246+
{
247+
CheckArgument.ArrayLengthAtLeast(args, 1, "args");
248+
249+
string phoneNumber = args[0];
250+
string message = string.Empty;
251+
252+
if (args.Length >= 2)
253+
{
254+
message = args[1];
255+
}
256+
257+
try
258+
{
259+
VerifyService verify = new VerifyService(GetConfiguration());
260+
VerifyResponse verifyResponse = null;
261+
verifyResponse = verify.SendTwoWaySms(phoneNumber, message);
262+
Console.WriteLine("Sent two way sms");
263+
}
264+
catch (Exception x)
265+
{
266+
Console.WriteLine("Error: " + x.ToString());
267+
}
268+
}
269+
244270
private static void PerformVerify(string[] args, VerificationMethod method)
245271
{
246272
CheckArgument.ArrayLengthAtLeast(args, 1, "args");

0 commit comments

Comments
 (0)