Skip to content

Commit

Permalink
Merge pull request #9 from illiminable/master
Browse files Browse the repository at this point in the history
Fix the SDK to address the inconsistent parameter name in the API.
  • Loading branch information
illiminable committed Jan 31, 2014
2 parents 53b24ed + 6561fc2 commit 47a57f3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/TeleSign.Services.Verify/RawVerifyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,19 @@ private static Dictionary<string, string> ConstructVerifyArgs(
args.Add("verify_code", verifyCode.ToString());
}

args.Add("language", language);
if (!string.IsNullOrEmpty(language))
{
args.Add("language", language);
}

if (verificationMethod == VerificationMethod.Sms || verificationMethod == VerificationMethod.Push || verificationMethod == VerificationMethod.TwoWaySms)
if (verificationMethod == VerificationMethod.Sms || verificationMethod == VerificationMethod.Push)
{
args.Add("template", messageTemplate);
}

if (verificationMethod == VerificationMethod.TwoWaySms)
{
args.Add("message", messageTemplate);
args.Add("validity_period", validityPeriod);
args.Add("ucid", useCaseId);
}
Expand Down
26 changes: 26 additions & 0 deletions src/TeleSign.TeleSignCmd/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,32 @@ public static void SendSms(string[] args)
}
}

[CliCommand(HelpString = "Help me")]
public static void SendTwoWaySms(string[] args)
{
CheckArgument.ArrayLengthAtLeast(args, 1, "args");

string phoneNumber = args[0];
string message = string.Empty;

if (args.Length >= 2)
{
message = args[1];
}

try
{
VerifyService verify = new VerifyService(GetConfiguration());
VerifyResponse verifyResponse = null;
verifyResponse = verify.SendTwoWaySms(phoneNumber, message);
Console.WriteLine("Sent two way sms");
}
catch (Exception x)
{
Console.WriteLine("Error: " + x.ToString());
}
}

private static void PerformVerify(string[] args, VerificationMethod method)
{
CheckArgument.ArrayLengthAtLeast(args, 1, "args");
Expand Down

0 comments on commit 47a57f3

Please sign in to comment.