Introduction
API Endpoint - replace {ENDPOINT} with desired ENDPOINT
https://staging.uportal360.com/service/rest/v1.0/{ENDPOINT}
Welcome to the UGA API
The documentation references API Keys, Location, and Program Numbers. These values do work in our Staging environment. So you can use them to test the endpoints.
Any questions? Visit our website.
API Endpoint Design
Our goal is to leverage API RESTful Standards. We support multi-level resources with standard HTTP Verb usage. This design is also described in this article by apigee Restful API Design
Resource (crud) | Post (create) | Get (read) | Put (update) | Delete (delete) |
---|---|---|---|---|
/endpoints | Create New endpoint | list all endpoints | bulk update endpoints (typically not supported) | delete all endpoints (typically not supported) |
/endpoints/ID1 | invalid | show info about ID1 | if ID1 exists, update ID1, if ID1 does not exists then Error | delete ID1 |
HTTP Status Codes
Standard API Status Codes are leveraged Wikipedia HTTP Status Codes.
Code | Category |
---|---|
1xx | Informational responses. |
2xx | Success. |
3xx | Redirection. |
4xx | Client errors. |
5xx | Server errors. |
Endpoints
customers
The customers Endpoint allows you to Create (POST) new customers or retrieve (GET) details about existing customers. Customers are equivalent to Accounts in our system. A customer can have one to many Contracts, Subscriptions and POS transactions. All these activities are related to a Customer.
Resource (crud) | Post (create) | Get (read) | Put (update) | Delete (delete) |
---|---|---|---|---|
/customers | Insert New Customer | Not Supported | Not Supported | Not Supported |
/customers/ABC1234 | invalid | Show info about Customer ABC1234 | Not Supported | Not Supported |
POST customers
An example response
{
"api_key": "THISISADEMOKEYNOTFORPROD",
"location_id": "T9679DF",
"client_external_id": "123456",
"first_name": "Marisol",
"middle_initial": "L",
"last_name": "Testcase",
"phone_primary_number": "111-111-1111",
"phone_primary_type": "Home",
"phone_secondary_number": "222-222-2222",
"phone_secondary_type": "Mobile",
"street": "220 LOCUST AVE",
"street2": "",
"city": "Anthill",
"state": "MO",
"zip": "65488",
"country": "UNITED STATES",
"email": "email@example.com"
}
hurl-it Settings
Destination Type: Post
Destination Value: https://staging.uPortal360.com/service/rest/v1.0/customers
Authentication: N/A
Headers: Set Content-Type to Application/JSon
Body: Copy the Example Request Body above
HTTP Request
POST https://staging.uportal360.com/service/rest/v1.0/customers
JSON Body Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
location_id | (String, 7) Alphanumeric Provided | |
client_external_id | (String, 80) Your Unique ID for the Consumer. | |
first_name | (String, Min 2, Max 16) Alphabetic Only except spaces, periods, and hyphens. | * |
middle_initial | (String, 1) | |
last_name | (String, Min 2, Max 32) Alphabetic Only except spaces, periods, and hyphens. | * |
phone_primary_number | (String, Min 10, Max 15) Phone Number Format | * |
phone_primary_type | (String) Valid Values: Mobile, Home | * |
phone_secondary_number | (String, Min 10, Max 15) Phone Number Format Cannot Match Primary Number | Req’d if phone_secondary_type value is entered |
phone_secondary_type | (String) Valid Values: Mobile, Home | Req’d if phone_secondary_number value is entered |
street | (String, 255) | * |
street2 | (String, 255) | |
city | (String, 40) | * |
state | (String, 2) State Abbreviations | * |
zip | (String, Min 5, Max 5) | * |
country | (String, 40) Country Names | * |
(String, 80) must be valid email Email Format | * |
POST customers Response
An example response
{
"success": "true",
"uas_account_number": "TTM1SZQ"
}
An example error response
{
"errors_size": "1",
"errors": "{\"email\":\"Duplicate email found.\"}"
}
An example error response
{
"field":"email",
"rejectedValue":"email@example.com",
"message":"Email must be unique. This email is already in our system."
}
Parameter | Description | Example |
---|---|---|
success | Result of new customer account creation | true |
uas_account_number | UAS ID for Customer’s Account | ABC1234 |
GET customers
An example request:
"https://staging.uportal360.com/service/rest/v1.0/customers/ABC1234?api_key=THISISADEMOKEYNOTFORPROD"
hurl-it Settings
Destination Type: GET
Destination Value: https://staging.uportal360.com/service/rest/v1.0/customers/ABC1234?api_key=THISISADEMOKEYNOTFORPROD
Authentication: N/A
Headers: N/A
Body: N/A
This endpoint retrieves a specific customer. You must specify the customer ID in the GET request and add your API Key. See our examples for more details.
HTTP Request
GET https://staging.uPortal360.com/service/rest/v1.0/customers/{customer_id}?api_key={api_key}
replace customer_id and api_key with customer values
URL Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
customer_id | (String, 7) Alphanumeric Provided | * |
GET customers Response
An example response:
{
"first_name": "APIDemo",
"last_name": "Customer",
"contracts": "[
{
\"contract_number\":\"ABC1234LOA01\",
\"applicant_name\":
\"APIDemo Customer\",
\"status\":\"Active\",
\"substatus\":\"Past Due\",
\"code\":\"SRV\",
\"active_date\":\"08/24/2017\",
\"note_date\":\"08/24/2017\",
\"apr\":0.0,\"term\":12,
\"first_payment_date\":\"09/24/2017\",
\"next_payment_date\":\"01/24/2018\",\"payment\":50.0,
\"payment_override\":0.0,\"past_due_amount\":207.5,
\"minimum_payment_due\":257.5,
\"delinquent_date\":\"09/24/2017\",
\"delinquent_days\":109,
\"autopay_type\":\"NONE\",
\"credit_line\":1200.0,
\"credit_available\":590.0,
\"amount_financed\":600.0,
\"principal_balance\":600.0,
\"interest_bal\":0.0,
\"fees_balance\":10.0,
\"payoff_amount\":610.0
}
]",
"html": "<div><table><tr><td><b>Name: </b></td><td>APIDemo Customer</td><td></td><td></td><td></td><td></td></tr><tr><td><b>Contract #:
</b></td><td>ABC1234LOA01</td><td></td><td></td><td></td><td></td></tr><tr><td><b>Status: </b></td><td>Active</td><td><b>Principal Balance: </b></td><td>$600.00</td><td><b>Term: </b></td><td>12</td><td><b>Past Due Amount: </b></td><td>$207.50</td></tr><tr><td><b>Sub-Status: </b></td><td>Past Due</td><td><b>Interest Balance: </b></td><td>$0.00</td><td><b>APR: </b></td><td>0.0%</td><td><b>Minimum Payment Due: </b></td><td>$257.50</td></tr><tr><td><b>Code: </b></td><td>SRV</td><td><b>Fees Balance: </b></td><td>$10.00</td><td><b>First Payment Date: </b></td><td>09/24/2017</td><td><b>Delinquent Date: </b></td><td>09/24/2017</td></tr><tr><td><b>Autopay Type: </b></td><td>NONE</td><td><b>Payoff Amount: </b></td><td>$610.00</td><td><b>Active Date: </b></td><td>08/24/2017</td><td><b>Delinquent Days: </b></td><td>109.0</td></tr><tr><td><b>Payment: </b></td><td>$50.00</td><td><b>Amount Financed: </b></td><td>$600.00</td><td><b>Note Date: </b></td><td>08/24/2017</td><td><b>Next Payment Date: </b></td><td>01/24/2018</td></tr><tr><td><b>Payment Override: </b></td><td>$0.00</td><td><b>Credit Available: </b></td><td>$590.00</td><td><b>Credit Line: </b></td><td>$1,200.00</td><td></td><td></td></tr></table></div>"
}
Parameter | Description | Example |
---|---|---|
first_name | First Name of Customer | APIDemo |
last_name | Last Name of Customer | LastName |
uas_account_number | UAS ID for Customer’s Account | ABC1234 |
contracts | Object - 1 to Many Contracts | Contract Details Below |
Items Returned in Contract Object | ||
contract_number | Contract Number | ABC1234LOA01 |
applicantName | Consumer’s Name | APIDemo Customer |
status | See Status Table | Active |
substatus | See Sub Status Table | Current |
code | SRV - Servicing or PUR for Purchased | SRV |
activeDate | Date contract went active in UAS | 24/08/2017 |
noteDate | Date contract agreement starts | 24/08/2017 |
apr | Interest Rate - Shown as whole number | 0 |
term | Payments 12, 24, 36 | 12 |
firstPaymentDate | Date of 1st Payment | 24/09/2017 |
nextPaymentDate | Next Payment Due Date | 24/01/2018 |
payment | Payment Amount | 50 |
paymentOverride | Override Payment Amount - If N/A it will be 0.00 | 0 |
pastDueAmount | Amount contract is currently past due | 207.5 |
minimumPaymentDue | payment plus past due amount | 257.5 |
delinquentDays | days contract is delinquent | 0 |
autopayType | If on AutoPay a Card Name or ACH Type | NONE |
creditLine | Credit Line | 1200 |
creditAvailable | Available Credit | 590 |
amountFinanced | Original Amount Financed | 600 |
principalBalance | Current Principal Balance | 600 |
interestBal | Curent Interest Balance | 0 |
feesBalance | Current Fees Due | 10 |
payoffAmount | Amount Due to Payoff Contract | 610 |
html | formatted HTML of Contract details |
An example response:
{
"first_name": "APIDemo",
"last_name": "Customer",
"contracts": "[
{
\"contract_number\":\"ABC1234LOA01\",
\"applicant_name\":
\"APIDemo Customer\",
\"status\":\"Active\",
\"substatus\":\"Past Due\",
\"code\":\"SRV\",
\"active_date\":\"08/24/2017\",
\"note_date\":\"08/24/2017\",
\"apr\":0.0,\"term\":12,
\"first_payment_date\":\"09/24/2017\",
\"next_payment_date\":\"01/24/2018\",\"payment\":50.0,
\"payment_override\":0.0,\"past_due_amount\":207.5,
\"minimum_payment_due\":257.5,
\"delinquent_date\":\"09/24/2017\",
\"delinquent_days\":109,
\"autopay_type\":\"NONE\",
\"credit_line\":1200.0,
\"credit_available\":590.0,
\"amount_financed\":600.0,
\"principal_balance\":600.0,
\"interest_bal\":0.0,
\"fees_balance\":10.0,
\"payoff_amount\":610.0
}
]",
"html": "<div><table><tr><td><b>Name: </b></td><td>APIDemo Customer</td><td></td><td></td><td></td><td></td></tr><tr><td><b>Contract #:
</b></td><td>ABC1234LOA01</td><td></td><td></td><td></td><td></td></tr><tr><td><b>Status: </b></td><td>Active</td><td><b>Principal Balance: </b></td><td>$600.00</td><td><b>Term: </b></td><td>12</td><td><b>Past Due Amount: </b></td><td>$207.50</td></tr><tr><td><b>Sub-Status: </b></td><td>Past Due</td><td><b>Interest Balance: </b></td><td>$0.00</td><td><b>APR: </b></td><td>0.0%</td><td><b>Minimum Payment Due: </b></td><td>$257.50</td></tr><tr><td><b>Code: </b></td><td>SRV</td><td><b>Fees Balance: </b></td><td>$10.00</td><td><b>First Payment Date: </b></td><td>09/24/2017</td><td><b>Delinquent Date: </b></td><td>09/24/2017</td></tr><tr><td><b>Autopay Type: </b></td><td>NONE</td><td><b>Payoff Amount: </b></td><td>$610.00</td><td><b>Active Date: </b></td><td>08/24/2017</td><td><b>Delinquent Days: </b></td><td>109.0</td></tr><tr><td><b>Payment: </b></td><td>$50.00</td><td><b>Amount Financed: </b></td><td>$600.00</td><td><b>Note Date: </b></td><td>08/24/2017</td><td><b>Next Payment Date: </b></td><td>01/24/2018</td></tr><tr><td><b>Payment Override: </b></td><td>$0.00</td><td><b>Credit Available: </b></td><td>$590.00</td><td><b>Credit Line: </b></td><td>$1,200.00</td><td></td><td></td></tr></table></div>"
}
contracts
contracts Endpoint allows you to (GET) details about existing customer contracts. Contracts can be Retail Installment Contracts or Open-End Retail Installment Credit Agreements.
Resource (crud) | Post (create) | Get (read) | Put (update) | Delete (delete) |
---|---|---|---|---|
/customers | Use creditApplication or checkout to create Contracts | Not Supported | Not Supported | Not Supported |
/customers/ABC1234 | invalid | Get Contract Details | Not Supported | Not Supported |
GET contracts
An example request:
"https://staging.uPortal360.com/service/rest/v1.0/contracts/AX2CDXXLOA01?api_key=THISISADEMOKEYNOTFORPROD"
hurl-it Settings
Destination Type: GET
Destination Value: https://staging.uPortal360.com/service/rest/v1.0/contracts/AX2CDXXLOA01?api_key=THISISADEMOKEYNOTFORPROD
Authentication: N/A
Headers: N/A
Body: N/A
This endpoint retrieves a specific contract. You must specify the customer ID in the GET request and add your API Key. See our examples for more details.
HTTP Request
GET https://staging.uPortal360.com/service/rest/v1.0/contracts/{contract_Number}?api_key={api_key}
replace contract_Number and api_key with customer values
URL Parameters
Parameter | Validations | Required |
---|---|---|
contract_number | (String, 12) Alphanumeric Provided | * |
api_key | (String, 80) Provided | * |
GET contracts Response
An example response:
{
"contract_number": "AX2CDXXLOA01",
"applicant_name": "MARISOL TESTCASE",
"status": "Active",
"substatus": "Past Due",
"code": "SRV",
"active_date": "2016-04-25",
"note_date": "2016-04-25",
"term": "24",
"first_payment_date": "2016-05-25",
"next_payment_date": "2018-05-25",
"payment": "30",
"payment_override": "0",
"past_due_amount": "480",
"minimum_payment_due": "510",
"delinquent_date": "2018-03-25",
"delinquent_days": "59",
"autopay_type": "NONE",
"credit_available": "0",
"amount_financed": "1300",
"principal_balance": "2570",
"interest_bal": "992.48",
"fees_balance": "420",
"payoff_amount": "3982.48"
}
Parameter | Description | Example |
---|---|---|
contract_number | Contract Number | ABC1234LOA01 |
applicantName | Consumer’s Name | APIDemo Customer |
status | See Status Table | Active |
substatus | See Sub Status Table | Current |
code | SRV - Servicing or PUR for Purchased | SRV |
activeDate | Date contract went active in UAS | 24/08/2017 |
noteDate | Date contract agreement starts | 24/08/2017 |
term | Payments 12, 24, 36 | 12 |
firstPaymentDate | Date of 1st Payment | 24/09/2017 |
nextPaymentDate | Next Payment Due Date | 24/01/2018 |
payment | Payment Amount | 50 |
paymentOverride | Override Payment Amount - If N/A it will be 0.00 | 0 |
pastDueAmount | Amount contract is currently past due | 207.5 |
minimumPaymentDue | payment plus past due amount | 257.5 |
delinquent_date | date contract went Delinquent | 24/01/2018 |
delinquentDays | days contract is delinquent | 0 |
autopayType | If on AutoPay a Card Name or ACH Type | NONE |
creditAvailable | Available Credit | 590 |
amountFinanced | Original Amount Financed | 600 |
principalBalance | Current Principal Balance | 600 |
interestBal | Curent Interest Balance | 0 |
feesBalance | Current Fees Due | 10 |
payoffAmount | Amount Due to Payoff Contract | 610 |
creditApplication
You can use this endpoint to start a credit application or to submit a completed credit application and return a credit decision. The paramater “retrieve_decision” allows you to control whether or not we will try to process the application. Sending TRUE, we will process and return either a list of errors or a decision. If the processing is successful you will get a decision of “Declined” or If you just want to start the application and finish it on uPortal360, then you can post with retrieve_decision set to FALSE. We will package a client_url in the response that will allow you to redirect a user to uPortal360 to pick up the application process in uPortal360.
Resource (crud) | Post (create) | Get (read) | Put (update) | Delete (delete) |
---|---|---|---|---|
/creditApplication | Insert New Application | Not Supported | Update Application | Not Supported |
POST creditApplication
An example request:
{
"api_key": "THISISADEMOKEYNOTFORPROD",
"location_id": "T9679DF",
"program_number": "TC2AX",
"retrieve_decision": "true",
"credit_check_override": "false",
"redirect_uri": "https://google.com",
"client_external_id": "123456",
"first_name": "Marisol",
"middle_initial": "L",
"last_name": "Testcase",
"phone_primary_number": "111-222-3333",
"phone_primary_type": "Home",
"phone_secondary_number": "333-222-1111",
"phone_secondary_type": "Mobile",
"include_coapplicant": "true",
"ca_first_name": "Joseph",
"ca_middle_initial": "M",
"ca_last_name": "Testcase",
"ca_phone_primary_number": "816-000-0002",
"ca_phone_primary_type": "Home",
"ca_phone_secondary_number": "816-000-0003",
"ca_phone_secondary_type": "Mobile",
"ca_email": "ugademo@ugafinance.com",
"relationship": "Parent",
"ca_ssn": "000-00-0002",
"ca_date_of_birth": "08/19/1978",
"ca_employer_name": "Test, INC",
"ca_employment_date": "11/09/2015",
"ca_employment_position": "Sales Associate",
"ca_employment_status": "Employed",
"ca_doing_business_as": "",
"ca_monthly_income": "2000",
"ca_other_income": "",
"ca_other_income_source": "",
"ca_mortgage_lease_amount": "800",
"ca_rent_or_own": "Rent",
"ca_phone_work_number": "123-456-7891",
"ca_phone_work_extension": "",
"street": "220 Locust Ave",
"street2": "",
"city": "Anthill",
"state": "MO",
"zip": "65488",
"country": "United States",
"email": "ugademo@ugafinance.com",
"cash_price": "2500",
"down_payment": "200",
"other_down_payment": "",
"other_down_payment_source": "",
"description": "",
"ssn": "000-00-0001",
"date_of_birth": "05/27/1980",
"employer_name": "Test, INC",
"employment_date": "11/09/2015",
"employment_position": "Sales Manager",
"employment_status": "Employed",
"doing_business_as": "",
"monthly_income": "5000",
"other_income": "",
"other_income_source": "",
"mortgage_lease_amount": "800",
"rent_or_own": "Rent",
"phone_work_number": "123-456-7891",
"phone_work_extension": "",
"gors_start_date": "",
"gors_end_date": "",
"gors_recipient_date_of_birth": "",
"gors_recipient_first_name": "",
"gors_recipient_last_name": "",
"gors_recipient_middle_initial": ""
}
hurl-it Settings
Destination Type: POST
Destination Value: https://staging.uportal360.com/service/rest/v1.0/creditApplication
Authentication: N/A
Headers: Set Key to Content-Type and Value to Application/JSon
Body: Copy the Example Request Body above
HTTP Request
POST https://staging.uportal360.com/service/rest/v1.0/creditApplication
JSON Body Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
location_id | (String, 7) Alphanumeric Provided | * |
program_number | (String, 5) Alphanumeric Provided | * |
retrieve_decision | (true, false) Default is false | |
credit_check_override | (TRUE, FALSE) Default is FALSE | |
redirect_uri | (URL) URL Can contain custom params - e.g. ?param1=value1 | Required if Using consumer_url |
client_external_id | (String, 80) Your Unique ID for the Consumer. | |
first_name | (String, Min 2, Max 16) Alphabetic Only except spaces, periods, and hyphens. | * |
middle_initial | (String, 1) Alphabetic Only | |
last_name | (String, Min 2, Max 32) Alphabetic Only except spaces, periods, and hyphens. | * |
phone_primary_number | (String, Min 10, Max 15) Phone Number Format | * |
phone_primary_type | (String) Valid Values: Mobile, Home, Work, Other | * |
phone_secondary_number | (String, Min 10, Max 15) Phone Number Format Cannot Match Primary Number. | Req’d if phone_secondary_type value is entered |
phone_secondary_type | (String) Valid Values: Mobile, Home, Work, Other | Req’d if phone_secondary_number value is entered |
street | (String, 255) | * |
street2 | (String, 255) | |
city | (String, 40) | * |
state | (String, 2) State Abbreviations | * |
zip | (String, Min 5, Max 5) | * |
country | (String, 40) Country Names | * |
(String, 80) must be valid email Email Format | * | |
ssn | (String - Format: ###-##-####) REGEX: ^\d{3}-\d{2}-\d{4}$ | Req’d if retrieve_decision is TRUE |
date_of_birth | (Date) Date Format | Req’d if retrieve_decision is TRUE |
employment_status | (String, Case-Sensitive) Valid Values: Employed, Homemaker, Retired, Self Employed, Social Security/Disability, Unemployed | Req’d if retrieve_decision is TRUE |
employer_name | (String, 255) | Req’d if employment_status is Employed or Self Employed |
employment_date | (Date) Date Format | Req’d if employment_status is Employed, Retired, Self Employed, or Social Security/Disability |
employment_position | (String, 255) | Req’d if employment_status is Employed or Self Employed |
doing_business_as | (String, 100) | |
monthly_income | (Currency) Currency Format | Req’d if employment_status is Employed, Self Employed, Retired or Social Security/Disability |
other_income | (Currency) Currency Format | |
other_income_source | (String, 80) NO Special Characters! | |
mortgage_lease_amount | (Currency) Currency Format | Req’d if retrieve_decision is TRUE |
rent_or_own | (String) Valid Values: Rent, Own | Req’d if retrieve_decision is TRUE |
phone_work_number | (String, Min 10, Max 15) Phone Number Format | Req’d if employment_status is Employed or Self Employed |
phone_work_extension | (String, 6) | |
include_coapplicant | (true, false) Default is false | |
relationship | Coapplicant’s Relationship to Applicant (Text - Values: Parent, Grandparent, Child, Legal Guardian, Spouse, Other) | |
ca_first_name | (String, Min 2, Max 16) Alphabetic Only except spaces, periods, and hyphens. | Req’d if include_coapplicant is TRUE |
ca_middle_initial | (String, 1) | |
ca_last_name | (String, Min 2, Max 32) Alphabetic Only except spaces, periods, and hyphens. | Req’d if include_coapplicant is TRUE |
ca_phone_primary_number | (String, Min 10, Max 15) Phone Number Format | Req’d if include_coapplicant is TRUE |
ca_phone_primary_type | (String, Mobile, Work, Home, Other) | Req’d if include_coapplicant is TRUE |
ca_phone_secondary_number | (String, Min 10, Max 15) Phone Number Format Cannot Match Primary Number. | Req’d if ca_phone_secondary_type value is entered |
ca_phone_secondary_type | (String, Mobile, Work, Home, Other) | Req’d if ca_phone_secondary_number value is entered |
ca_email | (String, 80) must be valid email “@” and “Domain.extension” Required | Req’d if include_coapplicant is TRUE |
ca_ssn | (String - Format: ###-##-####) | Req’d if include_coapplicant is TRUE |
ca_date_of_birth | (Date) Date Format | Req’d if include_coapplicant is TRUE |
ca_employment_status | (String) Valid Values: Employed, Homemaker, Retired, Self Employed, Social Security/Disability, Unemployed | Req’d if include_coapplicant is TRUE |
ca_employer_name | (String, 255) | Req’d if include_coapplicant is TRUE and employment_status is Employed |
ca_employment_date | (Date) Date Format | Req’d if include_coapplicant is TRUE and employment_status is Employed, Retired, Self Employed, or Social Security/Disability |
ca_employment_position | (String, 255) | Req’d if include_coapplicant is TRUE and employment_status is Employed or Self Employed |
ca_doing_business_as | (String, 100) | |
ca_monthly_income | (Currency) Currency Format | Req’d if include_coapplicant is TRUE and employement_status is Employed, Retired, Self Employed or Social Security/Disability |
ca_other_income | (Currency) Currency Format | |
ca_other_income_source | (Currency) Currency Format | |
ca_mortgage_lease_amount | (Currency) Currency Format | Req’d if include_coapplicant is TRUE |
ca_rent_or_own | (String) Valid Values: Rent or Own | Req’d if include_coapplicant is TRUE |
ca_phone_work_number | (String, Min 10, Max 15) Phone Number Format | Req’d if include_coapplicant is TRUE and employment_status is Employed or Self Employed |
ca_phone_work_extension | (String, 6) | |
cash_price | (Currency) Currency Format | Required if Using consumer_url |
down_payment | (Currency) Currency Format | Required if Using consumer_url |
other_down_payment | (Currency) Currency Format | |
other_down_payment_source | (String) | |
description | (String, 255) | Required if Using consumer_url |
gors_start_date | (Date) Date Format | |
gors_end_date | (Date) Date Format | |
gors_recipient_date_of_birth | (Date) Date Format | |
gors_recipient_first_name | (String, Min 2, Max 16) Alphabetic Only except spaces, periods, and hyphens. | |
gors_recipient_last_name | (String, Min 2, Max 32) Alphabetic Only except spaces, periods, and hyphens. | |
gors_recipient_middle_initial | (String, 1) |
POST creditApplication Response
An example response for Declined application:
{
"uas_account_number":"TNKXU5V",
"applicant_id":"TNKXU5VPRA",
"co_applicant_id":"TNKXU5VCOA",
"contract_number":"TNKXU5VLOA01",
"decision":"Declined",
"client_url":"https://staging.uportal360.com/navigation/TNKXU5V",
"consumer_url":"https://staging.uportal360.com/registration?registrationToken=TRQD6UNUC9ZBJFGZ65CNKYHMXXUQYGFX&retURL=https://www.google.com",
"credit_line": "6000",
"interest_rate": "42.7"
}
An example response for Purchasing application:
{
"uas_account_number": "T5LYXBQ",
"applicant_id": "T5LYXBQPRA",
"contract_number": "T5LYXBQLOA01",
"decision": "Purchasing",
"client_url": "https://staging.uportal360.com/navigation/T5LYXBQ",
"consumer_url": "https://staging.uportal360.com/registration?registrationToken=T7CBLLRV8YYAJZGAGMZ7QD8NYACRLUMZ&retURL=https://google.com",
"credit_line": "6000",
"interest_rate": "17.9"
}
An example response for Servicing application:
{
"uas_account_number": "T5LYXBQ",
"applicant_id": "T5LYXBQPRA",
"contract_number": "T5LYXBQLOA01",
"decision": "Servicing",
"client_url": "https://staging.uportal360.com/navigation/T5LYXBQ",
"consumer_url": "https://staging.uportal360.com/registration?registrationToken=T7CBLLRV8YYAJZGAGMZ7QD8NYACRLUMZ&retURL=https://google.com",
"credit_line": "6000",
"interest_rate": "21.3"
}
Parameter | Description | Example |
---|---|---|
uas_account_number | UAS ID for Customer’s Account | ABC1234 |
applicant_id | Id for Applicant | ABC1234PRA |
co_applicant_id | Id for Co-Applicant | ABC1234COA |
contract_number | contract number | ABC1234LOA01 |
decision | Declined = Consumer was not approved. If you see Purchasing or Servicing, then consumer is approved. | Declined, Purchasing, Servicing |
client_url | Link to redirect user to uPortal360 directly to this Application | https://staging.uportal360.com/navigation/ABC1234 |
consumer_url | Link to redirect consumer to uportal360 | https://staging.uportal360.com/registration?registrationToken=TOKENNUMBER&retURL=https://site.com |
interest_rate | Interest Rate for consumer’s credit tier | 17.9 |
creditApplication - Redirect URI Events
Here are the four possible values for the event url parameter returned from our api.
Example: https://ugafinance.com/recipe_response/?event=PARAMETER FROM BELOW HERE
- credit_declined
- Consumer’s Credit Application was Declined.
- complete
- Consumer’s Credit Application was Approved and documents were signed.
- finish_later
- Consumer’s Credit Application was Approved, They created a DocuSign Envelope and decided not to sign the Credit Agreement at this time.
- decline_sign
- Consumer’s Credit Application was Approved, They created a DocuSign Envelope and decided not DECLINE to sign the Credit Agreement.
PUT creditApplication
An example request for PUT:
{
"api_key": "THISISADEMOKEYNOTFORPROD",
"location_id": "T9679DF",
"program_number": "TC2AX",
"retrieve_decision":"true",
"credit_check_override":"false",
"redirect_uri": "https://google.com",
"client_external_id": "123456",
"first_name": "Marisol",
"middle_initial": "L",
"last_name": "Testcase",
"phone_primary_number": "111-222-3333",
"phone_primary_type": "Home",
"phone_secondary_number": "333-222-1111",
"phone_secondary_type": "Mobile",
"include_coapplicant": "true",
"ca_first_name": "Joseph",
"ca_middle_initial": "M",
"ca_last_name": "Testcase",
"ca_phone_primary_number": "816-000-0002",
"ca_phone_primary_type": "Home",
"ca_phone_secondary_number": "816-000-0003",
"ca_phone_secondary_type": "Mobile",
"ca_email": "ugademo@ugafinance.com",
"relationship": "Parent",
"ca_ssn": "000-00-0002",
"ca_date_of_birth": "08/19/1978",
"ca_employer_name": "Test, INC",
"ca_employment_date": "11/09/2015",
"ca_employment_position": "Sales Associate",
"ca_employment_status": "Employed",
"ca_doing_business_as": "",
"ca_monthly_income": "2000",
"ca_other_income": "",
"ca_other_income_source": "",
"ca_mortgage_lease_amount": "800",
"ca_rent_or_own": "Rent",
"ca_phone_work_number": "123-456-7891",
"ca_phone_work_extension": "",
"street": "220 Locust Ave",
"street2": "",
"city": "Anthill",
"state": "MO",
"zip": "65488",
"country": "United States",
"email": "ugademo@ugafinance.com",
"cash_price": "2500",
"down_payment": "200",
"other_down_payment": "",
"other_down_payment_source": "",
"description": "",
"ssn": "000-00-0001",
"date_of_birth": "05/27/1980",
"employer_name": "Test, INC",
"employment_date": "11/09/2015",
"employment_position": "Sales Manager",
"employment_status": "Employed",
"doing_business_as": "",
"monthly_income": "5000",
"other_income": "",
"other_income_source": "",
"mortgage_lease_amount": "800",
"rent_or_own": "Rent",
"phone_work_number": "123-456-7891",
"phone_work_extension": "",
"gors_start_date": "",
"gors_end_date": "",
"gors_recipient_date_of_birth": "",
"gors_recipient_first_name": "",
"gors_recipient_last_name": "",
"gors_recipient_middle_initial": "",
"account_id": "",
"applicant_id": "",
"co_app_id": "",
"contract_number": ""
}
hurl-it Settings
Destination Type: PUT
Destination Value: https://staging.uportal360.com/service/rest/v1.0/creditApplication
Authentication: N/A
Headers: Set Key to Content-Type and Value to Application/JSon
Body: Copy the Example Request Body above
On a put, you must pass back the IDs you wish to update. account_id is required on every PUT.
“applicant_id”: used if you want to update information on the Applicant “co_app_id”: used if you want to update information on the CoApplicant “contract_number”: used if you want to update information on the Contract
HTTP Request
PUT https://staging.uportal360.com/service/rest/v1.0/creditApplication
JSON Body Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
location_id | (String, 7) Alphanumeric Provided | * |
program_number | (String, 5) Alphanumeric Provided | * |
contract_number | (String, 12) ex: ABC1234LOA01 | * |
retrieve_decision | (TRUE, FALSE) Default is FALSE | |
credit_check_override | (TRUE, FALSE) Default is FALSE | |
client_external_id | (String, 80) Your Unique ID for the Consumer. | |
first_name | (String, Min 2, Max 16) Alphabetic Only except spaces, periods, and hyphens. | * |
middle_initial | (String, 1) | |
last_name | (String, Min 2, Max 32) Alphabetic Only except spaces, periods, and hyphens. | * |
phone_primary_number | (String, Min 10, Max 15) Phone Number Format | Req’d if phone_primary_number value is entered |
phone_primary_type | (String) Valid Values: Mobile, Home, Work, Other | Req’d if phone_primary_type value is entered |
phone_secondary_number | (String, Min 10, Max 15) Phone Number Format Cannot Match Primary Number | Req’d if phone_secondary_type value is entered |
phone_secondary_type | (String) Valid Values: Mobile, Home, Work, Other | Req’d if phone_secondary_number value is entered |
street | (String, 255) | * |
street2 | (String, 255) | |
city | (String, 40) | * |
state | (String, 2) State Abbreviations | * |
zip | (String, Min 5, Max 5) | * |
country | (String, 40) Country Names | * |
(String, 80) must be valid email Email Format | * | |
ssn | (String - Format: ###-##-####) REGEX: ^\d{3}-\d{2}-\d{4}$ | Req’d if retrieve_decision is TRUE |
date_of_birth | (Date) Date Format | Req’d if retrieve_decision is TRUE |
employment_status | (String) Valid Values: Employed, Homemaker, Retired, Self Employed, Social Security/Disability, Unemployed | Req’d if retrieve_decision is TRUE |
employer_name | (String, 255) | Req’d if retrieve_decision is TRUE and Employment_status is Employed or Self Employed |
employment_date | (Date) Date Format | Req’d if retrieve_decision is TRUE and Employment_status is Employed,Social Security/Disability, Retired, or Self Employed |
employment_position | (String, 255) | Req’d if retrieve_decision is TRUE and employment_status is Employed or Self Employed |
doing_business_as | (String, 100) | |
monthly_income | (Currency) Currency Format | Req’d if retrieve_decision is TRUE and if employment_status is Employed, Self Employed, Retired, or Social Security/Disability |
other_income | (Currency) Currency Format | |
other_income_source | (String, 80) NO Special Characters! | |
mortgage_lease_amount | (Currency) Currency Format | Req’d if retrieve_decision is TRUE |
rent_or_own | (String) Valid Values: Rent, Own | Req’d if retrieve_decision is TRUE |
phone_work_number | (String, Min 10, Max 15) Phone Number Format | Req’d if employment_status is Employed or Self Employed |
phone_work_extension | (String, 6) | |
include_coapplicant | (true, false) Default is false. | |
relationship | Coapplicant’s Relationship to Applicant (Text - Values: Parent, Grandparent, Child, Legal Guardian, Spouse, Other) | Req’d if include_coapplicant is TRUE |
ca_first_name | (String, Min 2, Max 16) Alphabetic Only except spaces, periods, and hyphens. | Req’d if include_coapplicant is TRUE |
ca_middle_initial | (String, 1) | |
ca_last_name | (String, Min 2, Max 32) Alphabetic Only except spaces, periods, and hyphens. | Req’d if include_coapplicant is TRUE |
ca_phone_primary_number | (String, Min 10, Max 15) Phone Number Format | Req’d if include_coapplicant is TRUE |
ca_phone_primary_type | (String, Mobile, Work, Home, Other) | Req’d if include_coapplicant is TRUE |
ca_phone_secondary_number | (String, Min 10, Max 15) Phone Number Format Cannot Match Primary Number | Req’d if ca_phone_secondary_type value is entered |
ca_phone_secondary_type | (String, Mobile, Work, Home, Other) | Req’d if ca_phone_secondary_number value is entered |
ca_email | (String, 80) must be valid email “@” and “Domain.extension” Required | Req’d if include_coapplicant is TRUE |
ca_ssn | (String - Format: ###-##-####) | Req’d if include_coapplicant is TRUE and retrieve_decision is TRUE |
ca_date_of_birth | (Date) Date Format | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE |
ca_employment_status | (String) Valid Values: Employed, Homemaker, Retired, Self Employed, Social Security/Disability, Unemployed | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE |
ca_employer_name | (String, 255) | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE and ca_employment_status is Employed or Self Employed |
ca_employment_date | (Date) Date Format | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE and ca_employment_status is Self Employed, Employed, Retired, or Social Security/Disability |
ca_employment_position | (String, 255) | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE and ca_employment_status is Employed or Self Employed |
ca_doing_business_as | (String, 100) | |
ca_monthly_income | (Currency) Currency Format | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE and ca_employment_status is Employed, Self Employed, retired, or Social Security/Disability |
ca_other_income | (Currency) Currency Format | |
ca_other_income_source | (Currency) Currency Format | |
ca_mortgage_lease_amount | (Currency) Currency Format | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE |
ca_rent_or_own | (String) Valid Values: Rent or Own | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE |
ca_phone_work_number | (String, Min 10, Max 15) Phone Number Format | Req’d if retrieve_decision is TRUE and include_coapplicant is TRUE and ca_employment_status is Employed or Self Employed |
ca_phone_work_extension | (String, 6) | |
cash_price | (Currency) Currency Format | |
down_payment | (Currency) Currency Format | |
other_down_payment | (Currency) Currency Format | |
other_down_payment_source | (String) | |
description | (String, 255) | |
gors_start_date | (Date) Date Format | |
gors_end_date | (Date) Date Format | |
gors_recipient_date_of_birth | (Date) Date Format | |
gors_recipient_first_name | (String, Min 2, Max 16) Alphabetic Only except spaces, periods, and hyphens. | |
gors_recipient_last_name | (String, Min 2, Max 32) Alphabetic Only except spaces, periods, and hyphens. | |
gors_recipient_middle_initial | (String, 1) |
PUT creditApplication Response
An example request for PUT:
{
"uas_account_number": "T5LYXBQ",
"applicant_id": "T5LYXBQPRA",
"client_url": "https://staging.uportal360.com/navigation/T5LYXBQ",
"consumer_url": "https://staging.uportal360.com/registration?registrationToken=T7CBLLRV8YYAJZGAGMZ7QD8NYACRLUMZ&retURL=https://google.com"
}
Parameter | Description | Example |
---|---|---|
uas_account_number | UAS ID for Customer’s Account | ABC1234 |
applicant_id | ID of Location | ABC1234PRA |
client_url | Link to redirect user to uPortal360 directly to this Application | https://staging.uportal360.com/navigation/ABC1234 |
consumer_url | Link to redirect consumer to uportal36 | https://staging.uportal360.com/registration?registrationToken=TOKENNUMBER&retURL=https://site.com |
chargeSlips
With the chargeSlips endpoint you can start the process to add a charge against an open line of credit contract. The consumer’s contract must be in an Active Current (open and not past due) status and your charge amount must be less than the available credit. For some programs, the uPortal360 user interface will allow you to make adjustments to the credit line to support purchase amounts that exceed available credit.
Resource (crud) | Post (create) | Get (read) | Put (update) | Delete (delete) |
---|---|---|---|---|
contracts/{contract_number}/chargeSlips | Insert New Charge Slip | Not Supported | Update Charge Slip | Not Supported |
contracts/{contract_number}/chargeSlips/{charge_slip_id} | invalid | Show info about Charge Slip | Not Supported | Not Supported |
POST chargeSlips
An example request:
{
"api_key": "THISISADEMOKEYNOTFORPROD",
"cash_price": "4999.99",
"down_payment": "459.49",
"description": "This is a test charge slip"
}
hurl-it Settings
Destination Type: POST
Destination Value: https://staging.uPortal360.com/service/rest/v1.0/contracts/1C387BXLOA01/chargeSlips/
Authentication: N/A
Headers: Set Key to Content-Type and Value to Application/JSon
Body: Copy the Example Request Body above
HTTP Request
POST https://staging.uPortal360.com/service/rest/v1.0/contracts/{contract_number}}/chargeSlips/
replace contract_number with customer value
URL Parameters
Parameter | Validations | Required |
---|---|---|
contract_number | (String, 12) Alphanumeric Provided | * |
JSON Boy Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
cash_price | (Currency) Currency Format | * |
down_payment | (Currency) Currency Format | * |
description | (String, 255) | * |
Tips
- Cash Price: This is the Retail Price of the Good or Service being sold.
- Down Payment: Amount consumer has paid toward the Cash Price.
- Amount Financed: We calculate this by taking cash_price less down_payment
- Description: Should represent the Good or Service being sold and also not include anything that would violate sensitive data like PII or HIPPA.
POST chargeSlips Response
An example response:
{
"charge_slip_number": "1C387BXLOA01-010",
"uas_account_number": "1C387BX",
"client_url": "https://staging.uportal360.com/chargeSlip/addCharge/start/1C387BXLOA01"
}
Parameter | Description | Example |
---|---|---|
charge_slip_number | Unique number for a charge | ABC1234lOAO1-001 |
uas_account_number | UAS ID for Customer’s Account | ABC1234 |
client_url | Link to redirect user to uPortal360 directly to this Application | https://staging.uportal360.com/navigation/ABC1234 |
An example 400 response:
HTTP STATUS: "400" - BAD REQUEST
{
"errors": [
"null_request_body: The request body received was null. See documentation here: http://universalaccountservicing.com/docs/"
"contract_number: contract_number is a required. See documentation here: http://universalaccountservicing.com/docs/",
"charge_slip_id: We could not find a charge slip with id specified. Are you attempting to create a new charge slip with the PUT method instead of the POST? See documentation here: http://universalaccountservicing.com/docs/",
"contract_id: We could not find a contract with the specified id.",
"past_due: A charge cannot be added to a past due contract.",
"closed_account: A charge cannot be added to a closed account.",
"invalid_cash_price: Cash price cannot be less than a penny.",
"invalid_cash_price: Cash price cannot be less than or equal to the down payment.",
"invalid_down_payment: Down payment cannot be less than a penny if not zero.",
"not_enough_credit", "This consumer does not have enough credit available for this charge.",
]
}
An example 401 response:
HTTP STATUS: "401" - UNAUTHORIZED
{
"errors": [
"api_key_not_sent: Request was sent without an api key. The request will be ignored. See documentation here: http://universalaccountservicing.com/docs/",
"api_key_invalid", "Request was sent with an invalid api key. The request will be ignored."
]
}
An example 500 response:
HTTP STATUS: "500" - INTERNAL SERVER ERROR
"error": {
"code": "500",
"message": "An internal server error was thrown.",
"errors": [
{
"message": "An unexpected exception was thrown"
}
],
"extendedHelp": "http://universalaccountservicing.com/docs/"
}
PUT chargeSlips
An example request:
{
"api_key": "THISISADEMOKEYNOTFORPROD",
"cash_price": "4999.99",
"down_payment": "459.49",
"description": "This is a test charge slip",
"delivery_date": "07/13/2018",
"shipment_tracking_number": "ABC123"
}
hurl-it Settings
Destination Type: PUT
Destination Value: https://staging.uPortal360.com/service/rest/v1.0/contracts/1C387BXLOA01/chargeSlips/1C387BXLOA01-010
Headers: Set Key to Content-Type and Value to Application/JSon
Body: Copy the Example Request Body above
To change values on a Charge Slip, use PUT. The Endpoint contains the Charge Slip ID that will be updated.
HTTP Request
PUT https://staging.uPortal360.com/service/rest/v1.0/contracts/{contract_number}/chargeSlips/{charge_slip_id}
replace contract_number and charge_slip_id with customer values
URL Parameters
Parameter | Validations | Required |
---|---|---|
contract_number | (String, 12) Alphanumeric Provided | * |
charge_slip_id | (String, 16) Alphanumeric Provided | * |
JSON Body Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
cash_price | (Currency) Currency Format | |
down_payment | (Currency) Currency Format | |
description | (String, 255) | |
delivery_date | (Date) Date Format | Used to Activate a Charge if your Finance Program has Future Delivery Date setup. |
shipment_tracking_number | (String, 40) | If your Finance Program is setup with the “Type of Service Confirmation” of Shipment Tracking Number, we will require a Shipping Number along with a Delivery Date to Activate the Charge. |
PUT chargeSlips Response
An example response:
{
"id": "TMV5UPPLOA01-002",
"uas_account_number": "TMV5UPP",
"client_url": "https://staging.uportal360.com/chargeSlip/addCharge/start/TMV5UPPLOA01"
}
Parameter | Description | Example |
---|---|---|
id | (String, 80) | TMV5UPPLOA01-002 |
uas_account_number | (String, 7) Alphanumeric UAS ID for Customer’s Account | ABC1234 |
client_url | Link to redirect user to uPortal360 directly to this Application | https://staging.uportal360.com/navigation/ABC1234 |
An example 400 response:
{
"error": {
"code": "400",
"message": "request validation error(s)",
"errors": [
{
"field": "shipment_tracking_number",
"rejectedValue": "",
"message": "shipment tracking number is required"
}
],
"extendedHelp": "http://universalaccountservicing.com/docs/"
}
}
GET chargeSlips
An example request:
"https://staging.uportal360.com/service/rest/v1.0/contracts/ABC1234LOA01/chargeSlips/ABC1234LOA01-001?api_key=THISISADEMOKEYNOTFORPROD"
hurl-it Settings
Destination Type: GET
Destination Value: https://staging.uportal360.com/service/rest/v1.0/contracts/ABC1234LOA01/chargeSlips/ABC1234LOA01-001?api_key=THISISADEMOKEYNOTFORPROD
Authentication: N/A
Headers: N/A
Body: N/A
You can leverage GET to pull current information about a charge slip. The endpoint will contain the charge slip record you are getting, you just add your API key to the request.
HTTP Request
GET https://staging.uPortal360.com/service/rest/v1.0/contracts/{contract_number}/chargeSlips/{charge_slip_id}?api_key={api_key}
Replace contract_number, charge_slip_id, and api_key with customer values
URL Parameters
Parameter | Validations | Required |
---|---|---|
contract_number | (String, 12) Alphanumeric Provided | * |
charge_slip_id | (String, 15) Alphanumeric Provided | * |
api_key | (String, 80) Provided | * |
GET chargeSlips Response
An example response:
{
"uas_account_number": "ABC1234",
"contract_number": "ABC1234LOA01",
"applicant_name": "APIDemo Customer",
"code": "SRV",
"status": "Open",
"date": "24/08/2017",
"cash_price": 600,
"down_payment": 0,
"financed_amount": 600,
"payments": 12,
"promo_end_date": "24/10/2017",
"current_balance": 600,
"attachments": [
{
"id": "00P4F000000T6AwUAK",
"name": "Envelope f448f1f6-bbbd-445f-9176-4bcb4a6e5307_Completed.pdf",
"href": "https://staging.uportal360.com/service/rest/v1.0/attachments/00P4F000000T6AwUAK"
}
]
}
Parameter | Description | Example |
---|---|---|
account_number | UAS ID for Customer’s Account | ABC1234 |
contract_number | ID number of charge slip belongs to | ABC1234 |
applicantName | Consumer’s Name | APIDemo Customer |
client_external_id | (String, 80) Your Unique ID for the Consumer. | |
code | SRV - Servicing or PUR for Purchased | SRV |
status | See Status Table | Active |
date | Date of charge slip creation | Date Format Tips |
cash_price | (Currency) Currency Format | Required if Using consumer_url |
down_payment | (Currency) Currency Format | Required if Using consumer_url |
financed_amount | Original Amount Financed | 600 |
promo_end_date | Date of last valid promo offer | Date Format Tips |
current_balance | Current Balance | 600 |
attachments | List of attachment id’s, name and href | See sample response |
checkout
With the checkout endpoint you are able to submit a complete credit application, finance amounts, autopay and term selection and in return we will pass back a link to a DocuSign session to execute a complete agreement based on the information you supplied in the POST.
Resource (crud) | Post (create) | Get (read) | Put (update) | Delete (delete) |
---|---|---|---|---|
/checkout | Create New Contract | Not Supported | Not Supported | Not Supported |
/checkout/ABC1234 | invalid | Not Supported | Not Supported | Not Supported |
POST checkout
An example request:
{
"api_key": "THISISADEMOKEYNOTFORPROD",
"location_id": "T9679DF",
"program_number": "TC2AX",
"client_external_id" : "ABC-123",
"first_name": "Marisol",
"middle_initial": "L",
"last_name": "Testcase",
"email": "ugademo@ugafinance.com",
"phone_primary_number": "1231231234",
"phone_primary_type": "Home",
"street": "220 Locust Ave",
"city": "Anthill",
"state": "MO",
"zip": "65488",
"country": "United States",
"cash_price": "4684.23",
"down_payment": "525.50",
"description": "Premium Financing and Servicing Solution",
"ssn": "000-00-0001",
"date_of_birth": "05/27/1980",
"monthly_income": "1681.23",
"term": "12",
"credit_card_number": "4444-3333-2222-1111",
"credit_card_expiration_month": "01",
"credit_card_expiration_year":"2019",
"signature_delivery_type": "In Person",
"rent_or_own": "rent",
"mortgage_lease_amount": "600",
"employment_status": "Employed",
"employment_date": "06/02/2018",
"employer_name": "UGA Finance",
"phone_work_number": "555-444-666",
"employment_position": "IT",
"return_url": "https://ugafinance.com/recipe_response/"
}
hurl-it Settings
Destination Type: POST
Destination Value: https://staging.uportal360.com/service/rest/v1.0/checkout
Headers: Set Key to Content-Type and Value to Application/JSon
Body: Copy the Example Request Body above
HTTP Request
POST https://staging.uportal360.com/service/rest/v1.0/checkout
JSON Body Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
location_id | (String, 7) Alphanumeric Provided | * |
program_number | (String, 5) Alphanumeric Provided | * |
client_external_id | (String, 80) Your Unique ID for the Consumer. | |
first_name | (String, Min 2, Max 16) Alphabetic Only except spaces, periods, and hyphens. | * |
middle_initial | (String, 1) Alphabetic Only | |
last_name | (String, Min 2, Max 32) Alphabetic Only except spaces, periods, and hyphens. | * |
phone_primary_number | (String, Min 10, Max 15) Phone Number Format | * |
phone_primary_type | (String) Valid Values: Mobile, Home, Work, Other | * |
phone_secondary_number | (String, Min 10, Max 15) Phone Number Format Cannot Match Primary Number | Req’d if phone_secondary_type value is entered |
phone_secondary_type | (String) Valid Values: Mobile, Home, Work, Other | Req’d if phone_secondary_number value is entered |
street | (String, 255) | * |
street2 | (String, 255) | |
city | (String, 40) | * |
state | (String, 2) State Abbreviations | * |
zip | (String, Min 5, Max 5) | * |
country | (String, 40) Country Names | * |
(String, 80) must be valid email Email Format | * | |
cash_price | (Currency) Currency Format | * |
down_payment | (Currency) Currency Format | * |
other_down_payment | (Currency) Currency Format | |
other_down_payment_source | (String, 80) NO Special Characters! | |
description | (String, 255) NO Special Characters! | * |
ssn | (String - Format: ###-##-####) REGEX: ^\d{3}-\d{2}-\d{4}$ | * |
date_of_birth | (Date, MM/DD/YYYY) Date Format Tips | * |
employment_status | (String, Case-Sensitive) Valid Values: Employed, Homemaker, Retired, Self Employed, Social Security/Disability, Unemployed | * |
employer_name | (String, 255) | Req’d if employment_status is Self Employed or Employed |
employment_date | (Date, MM/DD/YYYY) Date Format Tips | Req’d if employment_status is Self Employed, Employed, Retired, or Social Security/Disability |
employment_position | (String, 255) | Req’d if employment_status is Employed or Self Employed |
doing_business_as | (String, 100) | |
monthly_income | (Currency) Currency Format | Req’d if employment_status is Employed, Self Employed, Retired, or Social Security/Disability |
other_income | (Currency) Currency Format | * |
other_income_source | (String, 80) NO Special Characters! | * |
mortgage_lease_amount | (Currency) Currency Format | * |
rent_or_own | (String) Valid Values: Rent, Own | * |
phone_work_number | (String, Min 10, Max 15) Phone Number Format | Req’d if employment_status is Employed or Self Employed |
phone_work_extension | (String, 6) | |
term | Numeric 2 Digits | * |
signature_delivery_type | (String) Values: Email, In Person | * |
credit_card_number | Must be Valid Card Number | |
credit_card_expiration_month | Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 | |
credit_card_expiration_year | values: 2018, 2019, 2020, … | |
ach_account_number | (Numeric, Min 4 max 12) | |
routing_number | (Numeric, 9) must be valid Bank | |
return_url | URL to return consumer after DocuSign signing process. Response Codes | * |
POST checkout Response
An example response
{
"redirect_url": "https://demo.docusign.net/Signing/StartInSession.aspx?t=5a702062-ed67-40e7-9dae-0330e55c78d0",
"uas_account_number": "TGLQ4AJ",
"contract_number": "TGLQ4AJLOA01",
"applicant_id": "T1YWAHLPRA",
"charge_slip_id": "TGLQ4AJLOA01-001",
"decision": "Servicing"
}
An example 200 response: Declined Credit Application
{
"uas_account_number": "T1YWAHL",
"contract_number": "T1YWAHLLOA01",
"applicant_id": "T1YWAHLPRA",
"decision": "Declined"
}
An example 200 response: Duplicate: We received your request and cannot process it as there was already an attempt to create a contract for this email address.
{
"redirect_url": "https://ugafinance.com/recipe_response/?event=duplicate",
"event": "duplicate"
}
An example 400 response: On empty or invalid request body: Bad Request
{
"field": "Request Body",
"message": "Cannot parse request body."
}
An example 400 response: On invalid field, invalid field format, or missing required fields (by program): 400 : Bad Request
"error": {
"code": "400",
"message": "request validation error(s)",
"errors": [
{
"field": "last_name",
"rejectedValue": "123",
"message": "cannot contain numbers or special characters"
},
{
"field": "email",
"rejectedValue": "",
"message": "this field is required"
}
],
"extendedHelp": "http://universalaccountservicing.com/docs/"
}
An example 400 response: On invalid api key: 401 : Unauthorized
"error": {
"code": "401",
"message": "Invalid credentials",
"errors": [
{
"message": "Could not log in with the api key provided"
}
],
"extendedHelp": "http://universalaccountservicing.com/docs/"
}
An example 400 response: On missing ‘Content-Type’ header: 415 : Unsupported Media Type
"error": {
"code": "415",
"message": "Unsupported media type. Make sure to include the request header Content Type with the value application/json",
"errors": [
{
"field": "Content Type",
"message": "Content Type header must be set to application/json"
}
],
"extendedHelp": "http://universalaccountservicing.com/docs/"
}
An example 500 response: On server error: 500 : Internal Server Error
"error": {
"code": "500",
"message": "An internal server error was thrown.",
"errors": [
{
"message": "An unexpected exception was thrown"
}
],
"extendedHelp": "http://universalaccountservicing.com/docs/"
}
An example 500 response: On configuration errors: 500 : Internal Server Error: Issue with field maps related to Finance Program
"error": {
"code": "500",
"message": "There is a configuration error. If the program_number included is correct, contact UGA to correct your configuration.",
"errors": [
{
"message": "An unexpected exception was thrown"
}
],
"extendedHelp": "http://universalaccountservicing.com/docs/"
}
An example 500 response: Issue with finding a Term option
"error": {
"code": "500",
"message": "There is a configuration error. Could not find a valid term. If the included term field is correct, contact UGA to correct your configuration",
"errors": [
{
"message": "An unexpected exception was thrown"
}
],
"extendedHelp": "http://universalaccountservicing.com/docs/"
}
Parameter | Description | Example |
---|---|---|
redirect_url | (String, 80) | https://demo.docusign.net/Signing/StartInSession.aspx?t=5a702062-ed67-40e7-9dae-0330e55c78d0 |
uas_account_number | UAS ID for Customer’s Account | ABC1234 |
contract_number | ID number of Contract | ABC1234 |
applicant_id | ID to represent Consumer Applying for Credit | T1YWAHLPRA |
charge_slip_id | ID number of charge slip belongs to | TGLQ4AJLOA01-001 |
decision | Declined = Consumer was not approved. If you see Purchasing or Servicing, then consumer is approved. | Declined, Purchasing, Servicing |
financePrograms
financePrograms Endpoint allows you to GET a list of valid Finance Programs that can be used to originate contracts for the User that corresponds to the API key you passed.
Resource (crud) | Post (create) | Get (read) | Put (update) | Delete (delete) |
---|---|---|---|---|
/financePrograms | Not Supported | List of Valid Programs | Not Supported | Not Supported |
GET financePrograms
An example request:
"https://staging.uportal360.com/service/rest/v1.0/financePrograms?api_key=THISISADEMOKEYNOTFORPROD"
hurl-it Settings
Destination Type: GET
Destination Value: https://staging.uportal360.com/service/rest/v1.0/financePrograms?api_key=THISISADEMOKEYNOTFORPROD
Authentication: N/A
Headers: N/A
Parameters: N/A
HTTP Request
GET https://staging.uPortal360.com/service/rest/v1.0/financePrograms?api_key={api_key}
Replace api_key with customer value
URL Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
GET financePrograms Response
An example response:
{
"metadata": {
"id": "fc7d078e-0ed6-4bdd-9797-8b97b671a577",
"timestamp": "1522777532733",
"apiVersion": "1.0",
"method": "financePrograms.get"
},
"data": {
"size": "2",
"finance_programs": [
{
"program_number": "TF44C",
"name": "RIC - Future Delivery Date"
},
{
"program_number": "TD1A6",
"name": "RIC - Retail Installment Contract"
},
{
"program_number": "TC2AX",
"name": "RICA - Open Line of Credit"
}
]
}
}
Parameter | Description | Example |
---|---|---|
program_number | ID of Program | TC2AX |
name | Name of Program | RICA - Open Line of Credit |
locations
locations Endpoint allows you to GET a list of valid locations based on the API Key of the User you sent with your request.
Resource (crud) | Post (create) | Get (read) | Put (update) | Delete (delete) |
---|---|---|---|---|
/locations | Not Supported | List of Valid Programs | Not Supported | Not Supported |
GET locations
An example request:
"https://staging.uPortal360.com/service/rest/v1.0/locations?api_key=THISISADEMOKEYNOTFORPROD"
hurl-it Settings
Destination Type: GET
Destination Value: https://staging.uPortal360.com/service/rest/v1.0/locations?api_key=THISISADEMOKEYNOTFORPROD
Authentication: N/A
Headers: N/A
Parameters: N/A
HTTP Request
GET https://staging.uPortal360.com/service/rest/v1.0/locations?api_key={api_key}
Replace api_key with customer value
URL Parameters
Parameter | Validations | Required |
---|---|---|
api_key | (String, 80) Provided | * |
GET locations Response
An example response:
{
"metadata": {
"id": "487ae7fd-2ab8-441e-9318-285d6be92a84",
"timestamp": "1522777618139",
"apiVersion": "1.0",
"method": "locations.get"
},
"data": {
"size": "2",
"locations": [
{
"id": "T9679DF",
"location_number": "1",
"name": "Kansas City"
},
{
"id": "T9679D4",
"location_number": "1",
"name": "St. Joseph"
}
]
}
}
Parameter | Description | Example |
---|---|---|
id | ID of Location | T9679DF |
location_number | Client’s Custom Location Number | 1 |
name | Name of Location | Kansas City |
Formatting Tips
Tips
- Cash Price: This is the Retail Price of the Good or Service being sold.
- Down Payment: Amount consumer has paid toward the Cash Price.
- Amount Financed: We calculate this by taking cash_price less down_payment
- Description: Should represent the Good or Service being sold and also not include anything that would violate sensitive data like PII or HIPPA.
Date
- Must be a date in the following format:
MM/dd/yyyy
- Example:
March 1st, 1985
would be03/01/1985
- The zeroes prefixing single digit months/days are required, for example:
3/1/1985
invalid03/01/1985
is valid
Phone Number
- Valid Formats:
5554446666
555-444-6666
(555) 444-6666
(555)444-6666
1(555)444-6666
15554446666
Currency
- Valid characters:
1
,2
,3
,4
,5
,6
,7
,8
,9
,0
, and.
- Should NOT include a currency symbol.
- All currency fields are assumed USD. This cannot be overidden.
- Should not include anything after the hundredths place, for example:
486.452
invalid486.45
is valid
- Never include
,
. Only include.
when specifying partial USD, for example:5,256.54
invalid5.256,54
invalid5256.54
is valid
SSN
- Must pass the following Regular Expression check:
-
^\\d{3}-\\d{2}-\\d{4}$
- Example:
999-99-9999
- Need help? Visit https://regexr.com/ to learn more about regular expressions and a sandbox for testing.
- Example:
-
State Abbreviations
- State Abbreviations: USPS Column - USPS Abbreviations
Country Names
United States is the only allowed Country currently. Please use “United States”
- If you are able to use built in validation with jQuery or JavaScript, that is ideal.
- Regex - refer to this website: emailregex.com
DocuSign Standard Responses
We leverage DocuSign for electronic signature. With our checkout endpoint you have a return URL that will receive this response. You’ll want to design your code to take appropriate action based on the response.
Example
- If the response code is “signing_complete”, then this indicates a fully executed contract and your message would explain next steps to the consumer.
- If the response code is “decline”, then consumer Declined to sign the contract and thus didn’t accept the financing option. Your message should represent this scenario and you would want to make sure any other systems you are updating treat this as decline and not a success.
From DocuSign Documentation
Determining Recipient Action
Once the embedded signing workflow is complete the recipient is re-directed to the value you provided through the returnUrl parameter. A query parameter in the form of ?event={event_type} is appended to the return url and can be parsed by your app to determine what action the recipient took. For example, if the return url is http://www.acme.com and the recipient signed the document the value would be:
http://www.acme.com?event=signing_complete
There are numerous actions the embedded recipient might take:
- cancel - the recipient decides to finish later
- decline - the recipient declines signing
- exception - a processing error occurs during the signing session
- fax_pending - if the recipient choses to print, sign and fax back
- id_check_failed - if authentication was added to the document, this is when the recipient fails
- session_timeout - the signing session times out when recipient goes idle
- signing_complete - the recipient completed signing
- ttl_expired - the token was not used within the timeout period or the token was already accessed
- viewing_complete - a recipient that does not need to sign completes the viewing ceremony
Errors
The UGA API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request – Something went wrong |
401 | Unauthorized – Your API key is wrong |
403 | Forbidden – The page requested is hidden for administrators only |
404 | Not Found – The specified page could not be found |
405 | Method Not Allowed – You tried to access an endpoint with an invalid method |
406 | Not Acceptable – You requested a format that isn’t json |
410 | Gone – The page requested has been removed from our servers |
418 | |
429 | Too Many Requests – You’re requesting too many processes! Slow down! |
500 | Internal Server Error – We had a problem with our server. Try again later. |
503 | Service Unavailable – We’re temporarily offline for maintenance. Please try again later. |
Testing
uPortal360 Test Account
To access uPortal360, you can use our API Demo user. See login information below.
Site: https://staging.uportal360.com/login Username: apidemo@ugafinance.com Password: Password1!
Users
Name | Birthday | Address | SSN | FICO Score |
---|---|---|---|---|
Marisol L Testcase | 1980-05-27 | 220 Locust Ave. Anthill, MO 65488 |
000-00-0001 | ~720 |
David C Testcase | 1972-01-30 | 504 N Grandview St. #2 Anthill, MO 65488 |
000-00-0002 | ~660 |
Janet X Testcase | 1947-01-22 | 19 Forest Dr. Anthill, MO 65488 |
000-00-0003 | ~640 |
Joseph M Testcase | 1978-08-18 | 13743 Bluewater Circle Anthill, MO 65488 |
000-00-0004 | ~620 |
Maria A Testcase | 1969-07-10 | 5524 Eastbource Dr. Anthill, MO 65488 |
000-00-0005 | ~550 |
Carlos E Testcase | 1958-11-15 | 9614 Oriole Lane Anthill, MO 65488 |
000-00-0006 | ~500 |
Nicole S Testcase | 1954-01-09 | 8315 Bunker Hill Rd. Anthill, MO 65488 |
000-00-0007 | ~500 |
Sarah D Testcase | 1977-11-14 | 171 Glenwood Dr. Anthill, MO 65488 |
000-00-0008 | <500 |
Luis T Testcase | 1950-05-07 | 5002 Banner Ct. Anthill, MO 65488 |
000-00-0009 | <500 |
Melinda R Testcase | 1947-05-10 | 854 Grindstone Dr. Anthill, MO 65488 |
000-00-0010 | <500 |
Payment Methods
Checking Account Information |
---|
Routing Number -104000016 |
Account - 123456789 |
Credit Card Information |
---|
Number - 4444333322221111 |
Exp. Must be month and year greater than today. EX. If today is 9/1/2017 then use 10/2017 |
CVV 999 |
Scenarios
Credit Application Approved
You can use any of the test users above. When specifing employment status you CANNOT choose “UNEMPLOYED”.
Credit Application Declined
You can use any of the test users above. When specifing employment status you MUST choose “UNEMPLOYED”. The employment status of UNEMPLOYED is set up to automatically decline the credit application.
Quick Start Guide
Please view and print our quick start guides. They are designed to answer common questions related to processing credit applications on our platform.
Quick Start Guide for our NEW uPortal360 platform can be found here
Contract Status and Sub Status
Status | Sub Status | Definition | Actions |
---|---|---|---|
Credit Application | |||
VOID | Declined | Applicant was Declined for Credit | Contact Credit if decline reason needed |
Incomplete | Credit App | Incomplete Credit Application cannot be completely processed or has not been submitted for processing. | Review Application |
Pending | Credit Review | Manual Credit review in Progress. | Call Credit for status. |
Pending | Contract Document Creation | A Credit Application has been completed but the agreements have not been created. | Select Term, 1st PMT Date, Cash Price, Down Payment, etc and Send Contract for Signature. |
Agreements | Pending Signature | ||
Pending | Signatures | Waiting for the Applicant, CoApplicant or Seller to Sign | Contact Signer(s), Use Needs Signing Queue to manage agreement. |
Agreements Signed | Not Active in Servicing System | ||
Pending | GorS Delivery | GorS (Goods or Service) Fully executed contract, but the goods or services have not been delivered. | Client will release to Active status once services or goods are delivered - Use Delivery Confirmation to manage entry of Delivery Dates. |
Pending | Future Note Date | Fully executed contract with a Note Date in the future. | Once Note Date arrives this becomes an Active contract. |
Pending | Print Verification | Awaiting receipt or review of printed contract to confirm all signatures have been collected | Fax Signed Contract using DocuSign Cover Letter. |
Active Contracts | |||
Assignment | Welcome Call | Completed in 1 - 5 Business Days, Reaching out to Consumer for Welcome Call. | Contact Credit Department for more details. |
Assignment | Credit Review | Completed in 1 Business Day or Less, Review for Purchasing | Contact Credit Department for more details. |
Assignment | Processing | Completed in 1 Business Day or Less - Assigning Contract. | Contact Credit Department for more details. |
Active | Current | Contract is being serviced | Review Details in uPortal360. |
Active | Past Due | If a Minimum Payment is not made on time, the Account will be set to Past Due. | Review Details in uPortal360. |
Active | LOC Closed | Active contract but consumer cannot use line of credit for additional purchases | Review Details in uPortal360. |
Closed Contracts | |||
Closed | Various | Attorney Retained, Bankruptcy, Buyback, Canceled, Client Cancel, Contract Error, Deceased, Fraud, Paid, Refund, Refusal, Rewrite, Sent to Collection Agency, Skip, Small Balance Write-Off, Transfer Account, Write-Off | Review Details in uPortal360. |
VOID | VOID | Removed from System, Never made it past Credit Application or was set to VOID. | N/A |
Charge Slip Statuses
Status | Definition | Actions |
---|---|---|
Incomplete | Started but never sent for Signature. | Use To Do Queue to Manage. |
Print Verification | waiting receipt or review of printed Charge Slip to confirm all signatures have been collected | Fax Signed Charge Slip using DocuSign Cover Letter. |
Pending Delivery | Fully executed Charge Slip, but the goods or services have not been delivered. | Client will release to Active status once services or goods are delivered - Use Delivery Confirmation to manage entry of Delivery Dates. |
Open | Charge Slip is being serviced | Review Details in uPortal360. |
Paid | Charge Slip has been Paid in Full | Review Details in uPortal360. |
Write-Off | Closed with a Write-Off Reason | Review Details in uPortal360. |
VOID | Removed from System, Never made it past Credit Application or was set to VOID. | N/A |
Sample Projects
Automatic Login
While a Customer maybe added or Credit Application started via an API Endpoint, your employees may have to login to uPortal360 to complete the origination process. uPortal360 supports an Auto Login option by passing parameters to our login page.
Example
Example:
https://staging.uportal360.com/logInAs?id=T5C73DXX67&key=THISISADEMOKEYNOTFORPROD
Log in as url format:
https://uportal360.com/logInAs?id={ContactCustomerNumber}&key={API KEY}
Example: https://staging.uportal360.com/logInAs?id=T5C73DXX67&key=THISISADEMOKEYNOTFORPROD
Automatic Login with Redirect
If you want to navigate to a specific account in uPortal360, you can add the redirect param to our autologin url and navigate a user directly to an account.
Example
Example:
https://staging.uportal360.com/logInAs?id=T5C73DXX67&key=THISISADEMOKEYNOTFORPROD&redirect=/navigation/34223A9
Log in as url format:
https://uportal360.com/logInAs?id={ContactCustomerNumber}&key={API KEY}&redirect=/navigation/{UAS_Account_Number}
- Notice the new “redirect” parameter at the end
- This allows any redirect after login.
- To navigate to an application after login, send the “redirect” parameter with a value of “/navigation/{uas_account_number}”
- Make sure to replace the {uas_account_number} with the actual account number from the /creditApplication response.
Consumer - Start A Credit Application
This sample project leverages a hosted javascript form that is prebuilt with validations and integration to our API. This is best used to save a consumer from having to manually complete a written form or having your employees have to re-key or type in the consumers information. Instead you can use this form and host it on your website as “Apply for Financing”. Upon completion of the form, you have control of the message to the consumer for their next steps. The credit application will show up in your To Do queue in uPortal360.
Demo
You can view a demo of this code here: Sample API Project - creditApplications
HTML Code
javascript - add to the bottom of your page
<html>
<body>
<!-- Add this in your HTML Body -->
<div style="width:75%; margin-left:12.5%;">
<script src="https://staging.uPortal360.com/web-resources/uas/js/api/UGAPostCustomerCreditAppJS.js" type="text/javascript"></script>
<param id="ugaapi_key" title="THISISADEMOKEYNOTFORPROD" style="display:none;"/>
<param id="ugalocation_id" title="T9679DF" style="display:none;"/>
<param id="ugaprogram_number" title="TD1A6" style="display:none;"/>
<param id="uga_environment" title="staging" style="display:none" />
<param id="uga_retrieve_decision" title="false" style="display:none" />
<div id="ugaForm"></div>
</div>
</body>
</html>
<!-- Please add this script to the bottom of your HTML file -->
<script type="text/javascript">
var onUgaResponse = function(response, statusCode, approvalStatus) {
// Parameter explanation
// 1. response - the raw response body from UGA server
// 2. statusCode - the http status code returned from UGA
// a. Possible Values: 200, 400, 500
// 3. approvalStatus - Describes whether they were declined or approved with either servicing or purchasing approvalStatus
// a. Possible values: Servicing, Purchasing, Declined
// Additional Data that can be used in response messages
// The api response has the account #, the loan #, and the applicant id available.
// The account number is used in sample response below, but you can also use:
// 1. response.uas_account_number
// 2. response.contract_number
// 3. response.applicant_id
// 4. response.credit_line
var message_200 = 'Congratulations! Your application has been submitted! The next step is to call one of our sales people to finish your application. Your account number is: ' + response.uas_account_number;
var message_200_servicing = 'Congratulations! Your application has been processed and you have been approved! The next step is to call one of our sales people to finish your application. Your account number is: ' + response.uas_account_number;
var message_200_purchasing = 'Congratulations! Your application has been processed and you have been approved! The next step is to call one of our sales people to finish your application. Your account number is: ' + response.uas_account_number;
var message_200_declined = 'Unfortunately, your application has been processed and you have been declined. Please try one of our other great ways to pay!';
var message_400 = 'Uh oh! We had a hard time processing the information you submitted! Please call the following number to contact a salesperson who may help you finish your application.';
var message_500 = 'Uh oh! We had a hard time processing the information you submitted! Please call the following number to contact a salesperson who may help you finish your application.';
var message_unknown = 'Uh oh! We had a hard time processing the information you submitted! Please call the following number to contact a salesperson who may help you finish your application.';
var message;
switch(statusCode) {
case 200:
if(approvalStatus) {
if(approvalStatus == 'Servicing') {
message = message_200_servicing;
} else if(approvalStatus == 'Purchasing') {
message = message_200_purchasing;
} else if(approvalStatus == 'Declined') {
message = message_200_declined;
}
} else {
message = message_200;
}
break;
case 400:
message = message_400;
break;
case 500:
message = message_500;
break;
default:
message = message_unknown;
}
document.getElementById("ugaForm").innerHTML = "<p>" + message + "</p>";
}
</script>
Add this code to your website and our creditApplication form will display. code is setup to work in our staging environment
Migrate to production
- Request your API Key and Program Keys from your Sales contact
- See table below for Params to change
- MODIFY our canned repsonse messages
- example “const message_200_servicing”
- our canned message “Congratulations! Your application has been processed and you have been approved! The next step is to call one of our sales people to finish your application.”
- Modify this to list a phone number or more specific steps you would want your consumer to see.
- Our Support team will run a few test with your and you are ready to go!
Param | Description | Required |
---|---|---|
ugaapi_key | (String, 80) Provided | * |
ugalocation_id | (String, 7) Alphanumeric Provided | * |
ugaprogram_number | (String, 5) Alphanumeric Provided | * |
uga_environment | “staging” for testing or “production” | defaults to “staging” |
uga_retrieve_decision | “false” to just save as a draft, “true” to process application and get a decision (Servicing, Purchasing, Declined) | defaults to “false” |
Consumer - Credit Application with Descision
This sample project leverages a hosted javascript form that is prebuilt with validations and integration to our API. This is best used to save a consumer from having to manually complete a written form or having your employees have to re-key or type in the consumers information. Instead you can use this form and host it on your website as “Apply for Financing”. Upon completion of the form, you have control of the message to the consumer for their next steps. The credit application will show up in your To Do queue in uPortal360.
Demo
You can view a demo of this code here: Sample API Project - creditApplications with Credit Descision
HTML Code
javascript - add to the bottom of your page
<html>
<body>
<!-- Add this in your HTML Body -->
<div style="width:75%; margin-left:12.5%;">
<script src="https://staging.uPortal360.com/web-resources/uas/js/api/UGAPostCustomerCreditAppJS.js" type="text/javascript"></script>
<param id="ugaapi_key" title="THISISADEMOKEYNOTFORPROD" style="display:none;"/>
<param id="ugalocation_id" title="T9679DF" style="display:none;"/>
<param id="ugaprogram_number" title="TD1A6" style="display:none;"/>
<param id="uga_environment" title="staging" style="display:none" />
<param id="uga_retrieve_decision" title="true" style="display:none" />
<param id="cash_price" title="3000" style="display:none;"/>
<param id="description" title="This is a description of Service" style="display:none;"/>
<div id="ugaForm"></div>
</div>
</body>
</html>
<!-- Please add this script to the bottom of your HTML file -->
<script type="text/javascript">
var onUgaResponse = function(response, statusCode, approvalStatus) {
// Parameter explanation
// 1. response - the raw response body from UGA server
// 2. statusCode - the http status code returned from UGA
// a. Possible Values: 200, 400, 500
// 3. approvalStatus - Describes whether they were declined or approved with either servicing or purchasing approvalStatus
// a. Possible values: Servicing, Purchasing, Declined
// Additional Data that can be used in response messages
// The api response has the account #, the loan #, and the applicant id available.
// The account number is used in sample response below, but you can also use:
// 1. response.uas_account_number
// 2. response.contract_number
// 3. response.applicant_id
// 4. response.credit_line
var message_200 = 'Congratulations! Your application has been submitted! The next step is to call one of our sales people to finish your application. Your account number is: ' + response.uas_account_number;
var message_200_servicing = 'Congratulations! Your application has been processed and you have been approved! The next step is to call one of our sales people to finish your application. Your account number is: ' + response.uas_account_number;
var message_200_purchasing = 'Congratulations! Your application has been processed and you have been approved! The next step is to call one of our sales people to finish your application. Your account number is: ' + response.uas_account_number;
var message_200_declined = 'Unfortunately, your application has been processed and you have been declined. Please try one of our other great ways to pay!';
var message_400 = 'Uh oh! We had a hard time processing the information you submitted! Please call the following number to contact a salesperson who may help you finish your application.';
var message_500 = 'Uh oh! We had a hard time processing the information you submitted! Please call the following number to contact a salesperson who may help you finish your application.';
var message_unknown = 'Uh oh! We had a hard time processing the information you submitted! Please call the following number to contact a salesperson who may help you finish your application.';
var message;
switch(statusCode) {
case 200:
if(approvalStatus) {
if(approvalStatus == 'Servicing') {
message = message_200_servicing;
} else if(approvalStatus == 'Purchasing') {
message = message_200_purchasing;
} else if(approvalStatus == 'Declined') {
message = message_200_declined;
}
} else {
message = message_200;
}
break;
case 400:
message = message_400;
break;
case 500:
message = message_500;
break;
default:
message = message_unknown;
}
document.getElementById("ugaForm").innerHTML = "<p>" + message + "</p>";
}
</script>
Add this code to your website and our creditApplication form will display. code is setup to work in our staging environment
Migrate to production
- Request your API Key and Program Keys from your Sales contact
- See table below for Params to change
- MODIFY our canned repsonse messages
- example “const message_200_servicing”
- our canned message “Congratulations! Your application has been processed and you have been approved! The next step is to call one of our sales people to finish your application.”
- Modify this to list a phone number or more specific steps you would want your consumer to see.
- Our Support team will run a few test with your and you are ready to go!
Param | Description | Required |
---|---|---|
ugaapi_key | (String, 80) Provided | * |
ugalocation_id | (String, 7) Alphanumeric Provided | * |
ugaprogram_number | (String, 5) Alphanumeric Provided | * |
uga_environment | “staging” for testing or “production” | defaults to “staging” |
uga_retrieve_decision | “false” to just save as a draft, “true” to process application and get a decision (Servicing, Purchasing, Declined) | defaults to “false” |
Salesforce
Follow the steps described below to embed a visualforce page onto a contact object that has the ability to:
- Create a customer with UGA
- Obtain a unique account number for the newly created customer
- View the customer in uPortal360
- Retrieve a customer summary
Demonstration
- Contact without a uPortal360 Customer Account
- No information will be displayed as an Account does not exist
- “Add Customer” will use information from the contact record and pass to uPortal360 to create a new Customer Account.
- Customer Account without Contracts, Subscriptions or POS Transactions
- We display the Customer Account number
- The button “View in uPortal360” will launch you into uPortal360 and allow you to start a Credit Application, Subscription or POS Transaction based on the Programs available to you.
- :warning: Your browser may have Pop-Up Blocking, you’ll have to allow the Pop-Up for this to work.
- Customer Account with a Contract that is in progress
- The page displays the Customer Account and summary of any related Contracts
- This customer has a contract in “Incomplete” status
- The button “View in uPortal360” will launch you back into uPortal360 and navigate you to this contract to complete the process
- Customer Account with an Active Contract
- The page displays the Customer account and any contracts current summary information
- To see more details about the Contract, just use the “View in uPortal360” button and uPortal360 will navigate you to the Contract
- In uPortal360, you can all the details about the contract (Statemetns, Payment History, Notes, Cases, etc.)
Implementation Steps
To implement the embedded VisualForce page in your instance of Salesforce, you must be a Salesforce Administrator. The guide below assumes some familiarity with Salesforce and creating fields and deploying code.
Create Fields and Custom Setting
- Create a custom Contact Field
- In Setup - Search for “Contacts” - Select “Fields”
- Create a New Text Field
- We recommend the field is Unique (case insensitive)
- you could also set it to an External ID
Data Type | Field Label | Length | Field Name |
---|---|---|---|
Text | UAS Account Number | 7 | UAS_Account_Number |
Description/Help Text |
---|
Account number with Universal Account Servicing (UAS) uPortal360 Platform |
- Create a Custom Setting
- In Setup - Search for “Custom Settings”
- Create a New custom setting
Field Label | Field - Object Name | Setting Type | Visibility |
---|---|---|---|
uPortal360 Credentials | uPortal360_Credentials |
Hierarchy | Protected |
Description |
---|
Credentials used when logging into uPortal360 from Salesforce. |
- In the newly created “uPortal360 Credentials” custom setting - Create 1 New Fields
Data Type | Field Label | Length | Field Name |
---|---|---|---|
Text | uPortal360 API Token | 50 | uPortal360_API_Token |
Description/Help Text |
---|
API Token - Provided by UAS |
- Back on the “uPortal360 Credentials” custom setting click Manage
- Click “New”
- DO NOT USE a Default Organization Level Value
- There are two “New” buttons on the page, use the one lower on the screen.
- Location - Select “User”
- Find User in Salesforce
- While testing, use the following credentials:
- uPortal360 API Token:
THISISADEMOKEYNOTFORPROD
- Click “New”
- :pencil: Our example assumes that every Salesforce User will be a uPortal360 user as well. So, you will create a Custom Setting - uPortal360 Credentials" record for each user. UAS will provide the API Keys for your users.
Add Remote Site Access for uPoratl360
- :warning: Remote Site URL is case sensitive - please ensure you are using uportal360 where the “p” is in lower case.
- Create 2 Remote Site settings
- In Setup - Search for “Remote Site Settings” and select it from results
- Click on New Remote Site
- Add the 2 sites below
Production
Remote Site Name Remote Site URL Description Active uPortal360_Production https://uportal360.com uPortal360 Production Checked - Sandbox
Remote Site Name Remote Site URL Description Active uPortal360_Staging https://staging.uportal360.com uPortal360 Staging Checked
Create an Apex class
- In Setup - Search for “Apex Classes” and select it from results
- Select New To create a new Class
- Copy/Paste Code (see below code on right or click here.)
Create a VisualForce Page
- In Setup - Search for “Visualforce Page” and select it from results
- Select New to create a new page
- Label: vf_uPortal360
- Name: vf_uPortal360
- Description: Custom VF Page for integration with UAS uPortal360
- Create a visualforce page (see below on right or click here)
Add VisualForce Page to Contact Page Layout
- In Setup - Search for “Contacts” - Select “Page Layouts” Under Contacts
- Edit the contact layout
- Drag and drop a new section onto the layout
- Name the section “uPortal360”
- Display Section Header ON
Detail Page: checked
Edit Page: unchcecked
Layout: 1-Column
- On the left hand side, click ‘Visualforce Pages’
- Drag the vf_u360 page into the new section “uPortal360”
- Edit the properties of the visualforce page by hovering over the top right of the vf_page and clicck on the wrench, under the properties of the section it is in
Width: 100%
Height: 200
Show scrollbars: checked
Show label: unchecked
- Add the UAS Account Number field to the same section above the visualforce page
- Save the layout
Run a Test
You can leverage our Test Users by clicking here or navigate to “Testing” in the navigation bar on the left of the screen.
To add a customer, the following fields need to be filled out:
- Contact
First Name
Last Name
Mailing Street
Mailing City
Mailing State
Mailing Postal Code
country
Email
Phone Number
- Any of the following standard phone number fields can be filled out. Only one number will be sent and the first one filled out in the order below will be considered the “primary number”
Mobile Phone
Phone
Home Phone
Other Phone
Apex Class
Code Sample for Apex Class ctrl_u360
public without sharing class ctrl_u360 {
//In order for this controller to work correctly, the "uPortal360 Credentials" custom setting needs to be set up first.
public Contact contact {get;set;}
public string primaryNumber {get;set;}
public string primaryNumberType {get;set;}
public string viewInUportalUrl {get;set;}
public boolean hasErrorMessage {get;set;}
public string accountSummary {get;set;}
public ctrl_u360(ApexPages.StandardController stdController){
ID contactId = System.currentPageReference().getParameters().get('id');
contact = retrieveContact(contactId);
accountSummary = customerSummary();
system.debug('contact = ' + contact);
}
public void addCustomer(){
system.debug('Entered addCustomer');
ID contactId = System.currentPageReference().getParameters().get('id');
contact = retrieveContact(contactId);
system.debug('contact = ' + contact);
list<Contact> contactList = new list<Contact>();
contactList.add(contact);
createCustomer(contactList);
}
public void viewInUportal(){
system.debug('Entered viewInUportal');
ID contactId = System.currentPageReference().getParameters().get('id');
contact = retrieveContact(contactId);
uPortal360_Credentials__c credentials = uPortal360_Credentials__c.getInstance(Userinfo.getUserId());
if(credentials.uPortal360_API_Token__c == null){
hasErrorMessage = true;
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Unable to find credentials for user. Please have a custom setting created for this user.'));
return;
}
viewInUportalUrl = retrieveDomain() + '/viewCustomer?';
viewInUportalUrl += '&key=' + credentials.uPortal360_API_Token__c;
viewInUportalUrl += '&customer=' + contact.UAS_Account_Number__c;
system.debug('viewInUportalUrl == ' + viewInUportalUrl);
}
public String customerSummary(){
system.debug('Entered customerSummary');
ID contactId = System.currentPageReference().getParameters().get('id');
contact = retrieveContact(contactId);
uPortal360_Credentials__c credentials = uPortal360_Credentials__c.getInstance(Userinfo.getUserId());
system.debug(credentials);
if(credentials.uPortal360_API_Token__c == null){
system.debug('here');
hasErrorMessage = true;
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Unable to find credentials for user. Please have a custom setting created for this user.'));
return null;
}
//If an unexpected error occurs, this error will appear on the page. Contact UGA and we will advise where the error is occurring
//and work to resolve.
string retrieveSummaryErrorMessage = 'Error retrieving the customer summary. Contact UGA support.';
string accountSummary;
if(contact.UAS_Account_Number__c == null || contact.UAS_Account_Number__c == ''){
return null;
}
string endPoint = '';
string method = '';
endPoint = retrieveDomain();
endPoint += '/service/rest/v1.0/customers/' + contact.UAS_Account_Number__c;
method = 'GET';
endPoint += '?api_key=' + credentials.uPortal360_API_Token__c;
system.debug('endpoint: ' + endpoint);
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint);
req.setMethod(method);
system.debug('request == ' + req);
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getStatus());
System.debug(res.getStatusCode());
System.debug(res.toString());
System.debug(res.getBody());
JSONParser parser = JSON.createParser(res.getBody());
//If successful, parse out the html returned.
if(res.getStatusCode() == 200){
//All fields that are provided in the html can also be pulled from the loans object found in the response.
while (parser.nextToken() != null) {
if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
String fieldName = parser.getText();
parser.nextToken();
if (fieldName == 'html') {
accountSummary = parser.getText();
}
}
}
}else if(res.getStatusCode() == 400){
hasErrorMessage = true;
while (parser.nextToken() != null) {
if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
String fieldName = parser.getText();
if (fieldName == 'errors') {
//Skip Field name Token
parser.nextToken();
if(parser.getCurrentToken() == JSONToken.START_ARRAY){
//Go through the array and get all errors
while(parser.nextToken() != null){
system.debug(parser.getCurrentToken());
//system.assert(false, parser.getCurrentToken());
if(parser.getCurrentToken() == JSONToken.START_OBJECT){
ErrorObject errorObject = (ErrorObject)parser.readValueAs(ErrorObject.class);
String errorString = 'Field=' + errorObject.field + ', Message=' + errorObject.message
+ ',Rejected Value=' + errorObject.rejectedValue
+ '. ';
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating customer: '+ errorString));
}
}
}
}
}
}
}else{
hasErrorMessage = true;
accountSummary = retrieveSummaryErrorMessage;
}
return accountSummary;
}
public PageReference createCustomer(list<Contact> contactList){
system.debug('Entered createCustomer');
uPortal360_Credentials__c credentials = uPortal360_Credentials__c.getInstance(Userinfo.getUserId());
if(credentials.uPortal360_API_Token__c == null){
hasErrorMessage = true;
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Unable to find credentials for user. Please have a custom setting created for this user.'));
return null;
}
hasErrorMessage = validateContact(contactList[0]);
//If an unexpected error occurs, this error will appear on the page. Contact UGA and we will advise where the error is occurring
//and work to resolve.
string generalErrorMessage = 'Error creating customer. Contact UGA support.';
string endPoint = '';
string method = '';
if(!hasErrorMessage){
endPoint = retrieveDomain();
endPoint += '/service/rest/v1.0/customers';
method = 'POST';
string primaryNumber = retrievePrimaryNumber();
string primaryNumberType= retrievePrimaryNumberType();
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint);
req.setMethod(method);
req.setHeader('Content-Type', 'application/json');
string createCustomerRequestBody =
'{' +
'\"api_key\"' + ':' + '\"' + credentials.uPortal360_API_Token__c + '\"' + ',' +
//Only applicable if location needs to be defaulted. Contact UGA Tech Support if you'd like assistance adding this default value.
//'\"location_id\"' + ':' + '\"' + credentials.uPortal360_Location_Id__c + '\"' + ',' +
'\"first_name\"'+ ':' + '\"' + contact.FirstName + '\"' + ',' +
'\"last_name\"'+ ':' + '\"' + contact.LastName + '\"' + ',' +
'\"street\"'+ ':' + '\"' + contact.MailingStreet + '\"' + ',' +
'\"city\"'+ ':' + '\"' + contact.MailingCity + '\"' + ',' +
'\"state\"'+ ':' + '\"' + contact.MailingState + '\"' + ',' +
'\"zip\"'+ ':' + '\"' + contact.MailingPostalCode + '\"' + ',' +
'\"country\"' + ':' + '\"' + contact.MailingCountry+ '\"' + ',' +
'\"email\"'+ ':' + '\"' + contact.Email + '\"' + ',' +
'\"phone_primary_number\"'+ ':' + '\"' + primaryNumber + '\"' + ',' +
'\"phone_primary_type\"'+ ':' + '\"' + primaryNumberType + '\"' +
'}';
system.debug(createCustomerRequestBody);
req.setBody(createCustomerRequestBody);
system.debug('request body == ' + req.getBody());
system.debug('request == ' + req);
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getStatus());
System.debug(res.getStatusCode());
System.debug(res.toString());
System.debug(res.getBody());
JSONParser parser = JSON.createParser(res.getBody());
system.debug('res.getBody() == ' + res.getBody());
//If successful, update contact.
if(res.getStatusCode() == 200){
while (parser.nextToken() != null) {
if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
String fieldName = parser.getText();
parser.nextToken();
if (fieldName == 'id') {
system.debug('parser.getText == ' + parser.getText());
contact.UAS_Account_Number__c = parser.getText();
}
}
}
database.update(contact, true);
PageReference updatedContactPage = ApexPages.currentPage();
updatedContactPage.setRedirect(true);
return updatedContactPage;
}else if(res.getStatusCode() == 400){
hasErrorMessage = true;
while (parser.nextToken() != null) {
//Start at the array of errors
String fieldName = parser.getText();
if (fieldName == 'errors') {
//Skip Field name Token
parser.nextToken();
if(parser.getCurrentToken() == JSONToken.START_ARRAY){
//Go through the array and get all errors
while(parser.nextToken() != null){
system.debug(parser.getCurrentToken());
//system.assert(false, parser.getCurrentToken());
if(parser.getCurrentToken() == JSONToken.START_OBJECT){
ErrorObject errorObject = (ErrorObject)parser.readValueAs(ErrorObject.class);
String errorString = 'Field=' + errorObject.field + ', Message=' + errorObject.message
+ ',Rejected Value=' + errorObject.rejectedValue
+ '. ';
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating customer: '+ errorString));
}
}
}
}
}
return null;
}else{
hasErrorMessage = true;
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,generalErrorMessage));
return null;
}
}else{
//PageReference ContactPage = ApexPages.currentPage();
return null;
}
}
//These are validations to ensure the contact has all of the information that createCustomer will need in order to create the customer account and contact.
public Boolean validateContact(Contact contact){
hasErrorMessage = false;
uPortal360_Credentials__c credentials = uPortal360_Credentials__c.getInstance(Userinfo.getUserId());
if(credentials.uPortal360_API_Token__c == null){
hasErrorMessage = true;
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Unable to find credentials for user. Please have a custom setting created for this user.'));
return null;
}
primaryNumber = retrievePrimaryNumber();
primaryNumberType= retrievePrimaryNumberType();
string errorMessage = '';
if(credentials.uPortal360_API_Token__c == '' || credentials.uPortal360_API_Token__c == null){
errorMessage += '-Missing uPortal360 API Token.-';
}
/*Only applicable if location needs to be defaulted. Contact UGA Tech Support if you'd like assistance adding this default value.
if(credentials.uPortal360_Location_Id__c == '' || credentials.uPortal360_Location_Id__c == null){
errorMessage += '-Missing uPortal360 Location Id.-';
}
*/
if(contact.FirstName == '' ||contact.FirstName == null){
errorMessage += '-Contact missing first name.-';
}
if(contact.LastName == '' ||contact.LastName == null){
errorMessage += '-Contact missing last name.-';
}
if(contact.MailingStreet == '' ||contact.MailingStreet == null){
errorMessage += '-Contact missing street address.-';
}
if(contact.MailingCity == '' ||contact.MailingCity == null){
errorMessage += '-Contact missing city.-';
}
if(contact.MailingState == '' ||contact.MailingState == null){
errorMessage += '-Contact missing state.-';
}
if(contact.MailingCountry == '' ||contact.MailingCountry == null){
errorMessage += '-Contact missing country.-';
}
if(contact.MailingPostalCode == '' ||contact.MailingPostalCode == null){
errorMessage += '-Contact missing zip.-';
}
if(contact.Email == '' ||contact.Email == null){
errorMessage += '-Contact missing email.-';
}
if(primaryNumber == '' || primaryNumber == null){
errorMessage += '-Contact missing a phone number.-';
}
if(primaryNumberType == '' || primaryNumberType == null){
errorMessage += '-Contact missing a phone number type.-';
}
if(errorMessage != ''){
hasErrorMessage = true;
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,errorMessage));
}
return hasErrorMessage;
}
//Modify this logic so that it retrieves the primary number for a contact
public String retrievePrimaryNumber(){
system.debug('Entered retrievePrimaryNumber');
primaryNumber = null;
if(contact.MobilePhone != null){
primaryNumber = string.valueOf(contact.MobilePhone);
}else if(contact.Phone != null){
primaryNumber = string.valueOf(contact.Phone);
}else if(contact.HomePhone != null){
primaryNumber = string.valueOf(contact.HomePhone);
}else if(contact.OtherPhone != null){
primaryNumber = string.valueOf(contact.OtherPhone);
}
if(primaryNumber != null){
primaryNumber = primaryNumber.replace('(','');
primaryNumber = primaryNumber.replace(')','-');
primaryNumber = primaryNumber.replace(' ','');
}
system.debug('primaryNumber== ' + primaryNumber);
return primaryNumber;
}
//Modify this logic so that it retrieves the primary number for a contact
public String retrievePrimaryNumberType(){
system.debug('Entered retrievePrimaryNumberType');
primaryNumberType = null;
if(contact.MobilePhone != null){
primaryNumberType = 'Mobile';
}else if(contact.Phone != null){
primaryNumberType = 'Mobile';
}else if(contact.HomePhone != null){
primaryNumberType = 'Home';
}else if(contact.OtherPhone != null){
primaryNumberType = 'Mobile';
}
return primaryNumberType;
}
// Determine Org
// IsSandbox True or OrganizationType = 'Developer Edition' then use uPortal360 Staging Environment
public String retrieveDomain() {
Organization org = [SELECT Id, IsSandbox, OrganizationType FROM Organization LIMIT 1];
if(org.IsSandbox || org.OrganizationType == 'Developer Edition'){
return 'https://staging.uportal360.com';
} else {
return 'https://uportal360.com';
}
}
public Contact retrieveContact(Id contactId){
return [Select Id, firstName, lastName, email, Phone, MailingStreet, MailingCity, MailingState, MailingPostalCode, MailingCountry, MobilePhone,HomePhone,
OtherPhone, UAS_Account_Number__c
from Contact where Id =: contactId];
}
public class ErrorObject {
public string field;
public string rejectedValue;
public string message;
public ErrorObject(String fieldProvided, String rejectedValueProvided, String messageValue){
field = fieldProvided;
rejectedValue = rejectedValueProvided;
message = messageValue;
}
}
}
Apex Class - Test Class
Code Sample for Apex Class ctrl_u360_test
@isTest
global class ctrl_u360_test {
static testMethod void validData() {
//Good Info
Contact contact = new Contact(
firstName = 'Mike',
lastName = 'Testcase',
Birthdate = system.today().addYears(-38),
UAS_Account_Number__c = 'XXX123',
Email = 'noemail@noemail.com',
Phone = '8888888888',
MailingStreet = '220 Locust Ave',
MailingCity = 'Anthill',
MailingState = 'MO',
MailingPostalCode = '88888'
);
insert contact;
uPortal360_Credentials__c creds = new uPortal360_Credentials__c(
SetupOwnerId = Userinfo.getUserId(),
uPortal360_API_Token__c = 'aBcDeFG1234'
);
insert creds;
test.startTest();
//Create a page per contact
//Contact with no errors
PageReference pageRef = Page.vf_uPortal360;
pageRef.getParameters().put('id', String.valueOf(contact.id));
Test.setCurrentPage(pageRef);
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGeneratorCreateCustomer());
ApexPages.StandardController controller = new ApexPages.StandardController(contact);
ctrl_u360 ctrl = new ctrl_u360(controller);
ctrl.addCustomer();
ctrl.viewInUportal();
ctrl.validateContact(contact);
ctrl.retrievePrimaryNumber();
ctrl.retrievePrimaryNumberType();
ctrl.retrieveDomain();
test.stopTest();
}
static testMethod void responseError() {
//Good Info
Contact contact = new Contact(
firstName = 'Mike',
lastName = 'Testcase',
Birthdate = system.today().addYears(-38),
UAS_Account_Number__c = 'XXX123',
Email = 'noemail@noemail.com',
Phone = '8888888888',
MailingStreet = '220 Locust Ave',
MailingCity = 'Anthill',
MailingState = 'MO',
MailingPostalCode = '88888'
);
insert contact;
uPortal360_Credentials__c creds = new uPortal360_Credentials__c(
SetupOwnerId = Userinfo.getUserId(),
uPortal360_API_Token__c = 'aBcDeFG1234'
);
insert creds;
test.startTest();
//Create a page per contact
//Contact with no errors
PageReference pageRef = Page.vf_uPortal360;
pageRef.getParameters().put('id', String.valueOf(contact.id));
Test.setCurrentPage(pageRef);
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGeneratorErrorResponse());
ApexPages.StandardController controller = new ApexPages.StandardController(contact);
ctrl_u360 ctrl = new ctrl_u360(controller);
ctrl.addCustomer();
ctrl.viewInUportal();
ctrl.validateContact(contact);
ctrl.retrievePrimaryNumber();
ctrl.retrievePrimaryNumberType();
ctrl.retrieveDomain();
test.stopTest();
}
static testMethod void noResponse() {
//Good Info
Contact contact = new Contact(
firstName = 'Mike',
lastName = 'Testcase',
Birthdate = system.today().addYears(-38),
UAS_Account_Number__c = 'XXX123',
Email = 'noemail@noemail.com',
Phone = '8888888888',
MailingStreet = '220 Locust Ave',
MailingCity = 'Anthill',
MailingState = 'MO',
MailingPostalCode = '88888'
);
insert contact;
uPortal360_Credentials__c creds = new uPortal360_Credentials__c(
SetupOwnerId = Userinfo.getUserId(),
uPortal360_API_Token__c = 'aBcDeFG1234'
);
insert creds;
test.startTest();
//Create a page per contact
//Contact with no errors
PageReference pageRef = Page.vf_uPortal360;
pageRef.getParameters().put('id', String.valueOf(contact.id));
Test.setCurrentPage(pageRef);
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGeneratorNoResponse());
ApexPages.StandardController controller = new ApexPages.StandardController(contact);
ctrl_u360 ctrl = new ctrl_u360(controller);
ctrl.addCustomer();
ctrl.viewInUportal();
ctrl.validateContact(contact);
ctrl.retrievePrimaryNumber();
ctrl.retrievePrimaryNumberType();
ctrl.retrieveDomain();
test.stopTest();
}
static testMethod void noCredentials() {
//Good Info
Contact contact = new Contact(
firstName = 'Mike',
lastName = 'Testcase',
Birthdate = system.today().addYears(-38),
UAS_Account_Number__c = 'XXX123',
Email = 'noemail@noemail.com',
Phone = '8888888888',
MailingStreet = '220 Locust Ave',
MailingCity = 'Anthill',
MailingState = 'MO',
MailingPostalCode = '88888'
);
insert contact;
test.startTest();
//Create a page per contact
//Contact with no errors
PageReference pageRef = Page.vf_uPortal360;
pageRef.getParameters().put('id', String.valueOf(contact.id));
Test.setCurrentPage(pageRef);
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGeneratorCreateCustomer());
ApexPages.StandardController controller = new ApexPages.StandardController(contact);
ctrl_u360 ctrl = new ctrl_u360(controller);
ctrl.addCustomer();
ctrl.viewInUportal();
ctrl.validateContact(contact);
ctrl.retrievePrimaryNumber();
ctrl.retrievePrimaryNumberType();
ctrl.retrieveDomain();
test.stopTest();
}
static testMethod void contactErrors() {
//Hit all invalid contact errors
Contact contact = new Contact(LastName = 'Testcase3');
Insert contact;
uPortal360_Credentials__c creds = new uPortal360_Credentials__c(
SetupOwnerId = Userinfo.getUserId(),
uPortal360_API_Token__c = 'aBcDeFG1234'
);
insert creds;
test.startTest();
//Create a page per contact
//Contact with no errors
PageReference pageRef = Page.vf_uPortal360;
pageRef.getParameters().put('id', String.valueOf(contact.id));
Test.setCurrentPage(pageRef);
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGeneratorCreateCustomer());
ApexPages.StandardController controller = new ApexPages.StandardController(contact);
ctrl_u360 ctrl = new ctrl_u360(controller);
ctrl.addCustomer();
ctrl.viewInUportal();
ctrl.validateContact(contact);
ctrl.retrievePrimaryNumber();
ctrl.retrievePrimaryNumberType();
ctrl.retrieveDomain();
test.stopTest();
}
global class MockHttpResponseGeneratorCreateCustomer implements HttpCalloutMock {
// Implement this interface method
global HTTPResponse respond(HTTPRequest req) {
HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setStatusCode(200);
res.setBody('{ '
+ '"metadata":{"id":"88888888-0000-1111-2222-333444555666","timestamp":1522855585514,"apiVersion":"1.0","method":"customers.post"}, '
+ '"data":{"id":"XXXXXXX","href":"https://staging.uportal360.com/service/rest/v1.0/customers/XXXXXXX", "html":"samplehtml"}} '
+ '');
return res;
}
}
global class MockHttpResponseGeneratorErrorResponse implements HttpCalloutMock {
// Implement this interface method
global HTTPResponse respond(HTTPRequest req) {
HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setStatusCode(400);
res.setBody('{ '
+ '"metadata":{"id":"88888888-0000-1111-2222-333444555666","timestamp":1522855585514,"apiVersion":"1.0","method":"customers.post"}, '
+ '"data":{"id":"XXXXXXX","href":"https://staging.uportal360.com/service/rest/v1.0/customers/XXXXXXX", "errors":"Error message"}} '
+ '');
return res;
}
}
global class MockHttpResponseGeneratorNoResponse implements HttpCalloutMock {
// Implement this interface method
global HTTPResponse respond(HTTPRequest req) {
HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setStatusCode(999);
res.setBody('{ '
+ '"metadata":{"id":"88888888-0000-1111-2222-333444555666","timestamp":1522855585514,"apiVersion":"1.0","method":"customers.post"}, '
+ '"data":{"id":"XXXXXXX","href":"https://staging.uportal360.com/service/rest/v1.0/customers/XXXXXXX", "errors":"Error message"}} '
+ '');
return res;
}
}
}
Visual Force Page
Code Sample for VisualForce page
<apex:page standardController="Contact" extensions="ctrl_u360" showHeader="false">
<apex:form >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<br/>
<apex:actionStatus id="Status">
<apex:facet name="start">
<img src="/img/loading.gif" style="float: left; margin: 8px;" />
</apex:facet>
<apex:facet name="stop">
<apex:outputPanel id="commandButtons">
<apex:commandButton value="Add Customer" rendered="{!contact.UAS_Account_Number__c == null}" action="{!addCustomer}" rerender="commandButtons,showmsg" oncomplete="refreshContact('{!contact.id}', '{!hasErrorMessage}'); return true;" status="Status" />
</apex:outputPanel>
</apex:facet>
</apex:actionStatus>
<apex:outputPanel rendered="{!accountSummary != null}">
<apex:outputText escape="false" value="{!accountSummary}"/>
</apex:outputPanel>
<apex:commandButton value="View in uPortal360" action="{!viewInUportal}" onComplete="window.open('{!viewInUportalUrl}')" rendered="{!contact.UAS_Account_Number__c != null}" status="Status"/>
</apex:form>
<script type="text/javascript">
function refreshContact(id, hasErrorMessage)
{
if(hasErrorMessage != 'true')
{
window.top.location.href = '/' + id;
}
}
</script>
</apex:page>