FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sample_code/csharp/sdk/intelligence/SendPNtoInt/Program.cs at master · TeleSign/sample_code · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
TeleSign
/
sample_code
Public
Notifications
You must be signed in to change notification settings
Fork
6
Star
8
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sample_code
/
csharp
/
sdk
/
intelligence
/
SendPNtoInt
/
Program.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (52 loc) · 2.73 KB
Breadcrumbs
sample_code
/
csharp
/
sdk
/
intelligence
/
SendPNtoInt
/
Program.cs
Copy path
File metadata and controls
66 lines (52 loc) · 2.73 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using
System
;
using
Telesign
;
namespace
SendPNtoInt
{
class
SendPNtoInt
{
static
void
Main
(
string
[
]
args
)
{
// Replace the defaults below with your Telesign authentication credentials.
string
customerId
=
"FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
;
string
apiKey
=
"ABC12345yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
;
// Set the default below to your test phone number.
// In your production code, update the phone number dynamically for each transaction.
string
phoneNumber
=
"11234567890"
;
// (Optional) Pull values from environment variables instead of hardcoding them.
if
(
System
.
Environment
.
GetEnvironmentVariable
(
"CUSTOMER_ID"
)
!=
null
)
{
customerId
=
System
.
Environment
.
GetEnvironmentVariable
(
"CUSTOMER_ID"
)
;
}
if
(
System
.
Environment
.
GetEnvironmentVariable
(
"API_KEY"
)
!=
null
)
{
apiKey
=
System
.
Environment
.
GetEnvironmentVariable
(
"API_KEY"
)
;
}
if
(
System
.
Environment
.
GetEnvironmentVariable
(
"PHONE_NUMBER"
)
!=
null
)
{
phoneNumber
=
System
.
Environment
.
GetEnvironmentVariable
(
"PHONE_NUMBER"
)
;
}
// Set a parameter for the account lifecycle stage the end user is in.
string
accountLifecycleEvent
=
"create"
;
// Set a flag to use the latest version of Intelligence.
Dictionary
<
string
,
string
>
OtherParams
=
new
Dictionary
<
string
,
string
>
(
)
;
OtherParams
.
Add
(
"request_risk_insights"
,
"true"
)
;
try
{
// Instantiate an Intelligence client object.
ScoreClient
intClient
=
new
ScoreClient
(
customerId
,
apiKey
)
;
// Make the request and capture the response.
RestClient
.
TelesignResponse
telesignResponse
=
intClient
.
Score
(
phoneNumber
,
accountLifecycleEvent
,
OtherParams
)
;
// Display the response in the console for debugging purposes.
// In your production code, you would likely remove this.
Console
.
WriteLine
(
"
\n
Response HTTP status:
\n
"
+
telesignResponse
.
StatusCode
)
;
Console
.
WriteLine
(
"
\n
Response body:
\n
"
+
telesignResponse
.
Body
)
;
}
catch
(
Exception
e
)
{
Console
.
ForegroundColor
=
ConsoleColor
.
Red
;
Console
.
WriteLine
(
"
\n
An exception occured.
\n
ERROR: "
+
e
.
Message
+
"
\n
"
)
;
Console
.
ResetColor
(
)
;
}
Console
.
WriteLine
(
"Press any key to quit."
)
;
Console
.
ReadKey
(
)
;
return
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL