-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prompting Updates, slight reorg on SMS functions
- Loading branch information
Showing
10 changed files
with
155 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
ChatGPT/src/main/java/cloud/cleo/squareup/functions/PrivateShoppingLinkVoice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package cloud.cleo.squareup.functions; | ||
|
||
import static cloud.cleo.squareup.functions.AbstractFunction.mapper; | ||
import java.util.function.Function; | ||
|
||
/** | ||
* | ||
* @author sjensen | ||
*/ | ||
public class PrivateShoppingLinkVoice extends PrivateShoppingLink implements SendSMS { | ||
|
||
@Override | ||
protected String getDescription() { | ||
return "Sends the caller the direct URL to book private shopping"; | ||
} | ||
|
||
@Override | ||
protected Function getExecutor() { | ||
return (var r) -> { | ||
final var callingNumber = getCallingNumber(); | ||
|
||
// Only send SMS to validated US Phone Numbers (in case callerID block, or some weird deal) | ||
if (!hasValidUSE164Number()) { | ||
return mapper.createObjectNode().put("status", "FAILED").put("message", "Calling number is not a valid US phone number"); | ||
} | ||
|
||
// Do not attempt to send to non-mobile numbers | ||
if (!hasValidUSMobileNumber()) { | ||
return mapper.createObjectNode().put("status", "FAILED").put("message", "Caller is not calling from a mobile device"); | ||
} | ||
|
||
return SendSMS.sendSMS(callingNumber, PRIVATE_SHOPPING_URL); | ||
}; | ||
} | ||
|
||
/** | ||
* This function is Voice only so don't use this for text interface | ||
* | ||
* @return | ||
*/ | ||
@Override | ||
protected boolean isText() { | ||
return false; | ||
} | ||
} |
Oops, something went wrong.