예제 #1
0
        public void CreateVerificationCallTest()
        {
            //Arrange
            string recipient = "601151174973";
            Twizo  twizo     = new Twizo(apiKey, apiHost);

            //Act
            var verification = twizo.CreateVerificationCall(recipient);

            //Assert
            Assert.AreEqual(verification.recipient, recipient);
            Assert.AreEqual(verification.type, Verification.TYPE_CALL);
        }
예제 #2
0
        public void Send()
        {
            //Create entity
            Twizo twizo = new Twizo(this.apiKey, this.apiHost);

            TwizoAPI.Entity.Verification verification;
            if (call)
            {
                verification = twizo.CreateVerificationCall(this.recipient);
            }
            else
            {
                verification = twizo.CreateVerification(this.recipient);
            }

            //Set variables
            verification.type        = this.type;
            verification.tokenLength = this.tokenLength;
            verification.tokenType   = this.tokenType;
            if (this.tag != "")
            {
                verification.tag = this.tag;
            }
            if (this.sessionId != "")
            {
                verification.sessionId = this.sessionId;
            }
            verification.validity     = this.validity;
            verification.bodyTemplate = this.bodyTemplate;
            verification.sender       = this.sender;
            if (this.senderTon >= 0)
            {
                verification.senderTon = this.senderTon;
            }
            if (this.senderTon >= 0)
            {
                verification.senderNpi = this.senderNpi;
            }
            verification.dcs = this.dcs;

            //Send
            verification.Send();

            //Log
            LogResponse(verification);
            this.messageId = verification.messageId;
        }