Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public class TollfreeVerificationCreator extends Creator<TollfreeVerificationCre
private String volume;
private String additionalInformation;
private String extraData;
private String termsAndConditionsLink;
private String privacyPolicyLink;
private String optinMessage;
private String helpMessage;
private String callbackUrl;
private String callbackMethod;

Expand Down Expand Up @@ -119,6 +123,42 @@ public TollfreeVerificationCreator extraData(final String extraData) {
return this;
}

public String termsAndConditionsLink() {
return termsAndConditionsLink;
}

public TollfreeVerificationCreator termsAndConditionsLink(final String termsAndConditionsLink) {
this.termsAndConditionsLink = termsAndConditionsLink;
return this;
}

public String privacyPolicyLink() {
return privacyPolicyLink;
}

public TollfreeVerificationCreator privacyPolicyLink(final String privacyPolicyLink) {
this.privacyPolicyLink = privacyPolicyLink;
return this;
}

public String optinMessage() {
return optinMessage;
}

public TollfreeVerificationCreator optinMessage(final String optinMessage) {
this.optinMessage = optinMessage;
return this;
}

public String helpMessage() {
return helpMessage;
}

public TollfreeVerificationCreator helpMessage(final String helpMessage) {
this.helpMessage = helpMessage;
return this;
}

public String additionalInformation() {
return additionalInformation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class TollfreeVerificationUpdater extends Updater<TollfreeVerificationUpd
private String volume;
private String additionalInformation;
private String extraData;
private String termsAndConditionsLink;
private String privacyPolicyLink;
private String optinMessage;
private String helpMessage;
private String callbackURL;
private String callbackMethod;

Expand Down Expand Up @@ -117,6 +121,42 @@ public TollfreeVerificationUpdater extraData(final String extraData) {
return this;
}

public String termsAndConditionsLink() {
return termsAndConditionsLink;
}

public TollfreeVerificationUpdater termsAndConditionsLink(final String termsAndConditionsLink) {
this.termsAndConditionsLink = termsAndConditionsLink;
return this;
}

public String privacyPolicyLink() {
return privacyPolicyLink;
}

public TollfreeVerificationUpdater privacyPolicyLink(final String privacyPolicyLink) {
this.privacyPolicyLink = privacyPolicyLink;
return this;
}

public String optinMessage() {
return optinMessage;
}

public TollfreeVerificationUpdater optinMessage(final String optinMessage) {
this.optinMessage = optinMessage;
return this;
}

public String helpMessage() {
return helpMessage;
}

public TollfreeVerificationUpdater helpMessage(final String helpMessage) {
this.helpMessage = helpMessage;
return this;
}

public String callbackURL() {
return callbackURL;
}
Expand Down
55 changes: 55 additions & 0 deletions src/test/java/com/plivo/api/TollfreeVerificationTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.plivo.api;

import com.fasterxml.jackson.databind.JsonNode;
import com.plivo.api.models.tollfree_verification.TollfreeVerification;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.RecordedRequest;
Expand Down Expand Up @@ -65,6 +66,60 @@ public void tollfreeVerificationCreateWithMandatoryParamsShouldSucceed() throws

assertRequest("POST", "TollfreeVerification/");
}
@Test
public void tollfreeVerificationCreateWithZipwhipFieldsShouldSucceed() throws Exception {
expectResponse("tollfreeVerificationCreateResponse.json", 201);

TollfreeVerification.creator()
.profileUuid("fb239ee1-fb5c-4dd9-b55c-5cf10170e756")
.number("18557312530")
.usecase("FRAUD_ALERT")
.usecaseSummary("summary")
.optinImageUrl("https://wwww.optinurl.com")
.optinType("VERBAL")
.messageSample("message sample")
.volume("10")
.additionalInformation("additional information")
.extraData("extra data")
.termsAndConditionsLink("https://www.example.com/terms")
.privacyPolicyLink("https://www.example.com/privacy")
.optinMessage("Reply YES to opt in")
.helpMessage("Reply HELP for help")
.callbackMethod("POST")
.callbackUrl("https://www.callbackurl.com")
.create();

JsonNode payload = actualRequestPayload();
assertEquals("https://www.example.com/terms", payload.get("terms_and_conditions_link").asText());
assertEquals("https://www.example.com/privacy", payload.get("privacy_policy_link").asText());
assertEquals("Reply YES to opt in", payload.get("optin_message").asText());
assertEquals("Reply HELP for help", payload.get("help_message").asText());
}

@Test
public void tollfreeVerificationUpdateWithZipwhipFieldsShouldSucceed() throws Exception {
String fixtureName = "tollfreeVerificationUpdateResponse.json";
String uuid = "uuid";

server.enqueue(new MockResponse()
.setResponseCode(200)
.setBody(loadFixture(fixtureName))
);

TollfreeVerification.updater(uuid)
.termsAndConditionsLink("https://www.example.com/terms")
.privacyPolicyLink("https://www.example.com/privacy")
.optinMessage("Reply YES to opt in")
.helpMessage("Reply HELP for help")
.update();

JsonNode payload = actualRequestPayload();
assertEquals("https://www.example.com/terms", payload.get("terms_and_conditions_link").asText());
assertEquals("https://www.example.com/privacy", payload.get("privacy_policy_link").asText());
assertEquals("Reply YES to opt in", payload.get("optin_message").asText());
assertEquals("Reply HELP for help", payload.get("help_message").asText());
}

@Test
public void tollfreeVerificationGetShouldSucceed() throws Exception {
String uuid = "uuid";
Expand Down
Loading