# Phone and Offline Order Tests

If you currently accept orders placed by customers over the phone or have employees who will place retail customer orders through your SFCC OMS and **want decisions for these order types**, please review the [Forter Phone Solution](./../Fraud Management/Checkout/Phone Orders.md) integration options.

Your onboarding team should also be made aware of any designated customer support center IP addresses, email addresses, or wholesale customers so additional analytical adjustments can be made on Forter's side.

## [Review the mapping for Offline Orders](https://docs.forter.com/extensions/phone-and-offline-order-tests#review-the-mapping-for-offline-orders)

All offline orders or orders placed by employees directly through your OMS, should be tagged as orderType"PHONE". Make sure to update the code in your **ForterOrder.ds** file to include logic that will update the OrderType to "PHONE" in the request object.

Below is an example of how the orderType key and connection object should appear for a **PHONE** order:

Java
```java
1{2"orderId":"test_order_6469",3"orderType":"PHONE",4"timeSentToForter":1568128922841,5"checkoutTime":1568128908000,6"connectionInformation":{7"customerIP":"127.0.0.1",8"userAgent":"PCA"9}10}
```

### [Sample forterOrder.ds file with Phone Order](https://docs.forter.com/extensions/phone-and-offline-order-tests#sample-forterorderds-file-with-phone-order)

JS
```javascript
1var ForterLogger =require("int_forter/cartridge/scripts/lib/forter/ForterLogger.ds");2/**
3 * ForterOrder class is the DTO object for request.
4 *
5 * To include this script use:
6 * var ForterOrder = require("int_forter/cartridge/scripts/lib/forter/dto/ForterOrder.ds");
7 */
8function ForterOrder(args){
9var log = new ForterLogger("ForterOrder.ds"),
10 order = args.Order,
11 site = dw.system.Site.getCurrent(),
12 paymentInstruments = order.getPaymentInstruments(),
13 a = null,
14 authResponse = null,
15 shipment = null;
16
17 foreach(var paymentInstrument in paymentInstruments){
18 if(paymentInstrument.paymentMethod =='CREDIT_CARD'){
19 a = paymentInstrument;
20 authResponse = args.CreditCardAuthResponse;
21 }else{
22 a = paymentInstrument;
23 authResponse = {};
24 }
25 }
26
27 forterOrderType = function(){
28 foreach(var type in OrderType){
29 if(orderType.type =='SFCC storeFront web'){
30 return "WEB";
31 }elseif(orderType.type =='PS g direct OMS'|| orderType.type =='customer/ phone order'){
32 return "PHONE";
33 }
34 }
35 };

// General parameters
this.orderId = order.originalOrderNo;// Required
this.orderType = order.forterOrderType;// "WEB" for web orders, "MOBILE" for app orders
this.timeSentToForter = (new Date()).getTime();// Required
this.checkoutTime = new Number((order.creationDate.getTime()/1000).toFixed());// Required //must be seconds, not milliseconds
this.connectionInformation = new ForterConnectionInformation(order);// Required

// Calculate totals
this.totalAmount = {};// Required
this.totalAmount.amountLocalCurrency = order.totalGrossPrice.value.toFixed(2);
this.totalAmount.currency = order.totalGrossPrice.currencyCode;
this.amountUSD = order.totalGrossPrice.value;

... // truncated for brevity

function ForterConnectionInformation(order){
this.customerIP = request.httpRemoteAddress;// Required
this.userAgent = request.httpUserAgent;
for(var i = 0; i < request.httpCookies.cookieCount; i++){
if(request.httpCookies[i].name =="forterToken"){
this.forterTokenCookie = request.httpCookies[i].value;// Required
}
}
}

function ForterCustomer(order){
if(order.customer.profile != null){
this.firstName = order.customer.profile.firstName;
this.lastName = order.customer.profile.lastName;
this.email = order.customer.profile.email;
this.accountId = order.customer.ID;
this.created = new Number((order.customer.profile.getCreationDate().getTime()/1000).toFixed());
}
}

... // truncated for brevity

module.exports = ForterOrder;
```

## [Step 1: Confirm decision enablement for Phone orders](https://docs.forter.com/extensions/phone-and-offline-order-tests#step-1-confirm-decision-enablement-for-phone-order)

By default, Forter's sandbox environment will return a not reviewed decision for phone orders. If you would like Forter to decision Phone orders, make sure that phone order decisions have been enabled for your sandbox environment.

## [Step 2: Testing](https://docs.forter.com/extensions/phone-and-offline-order-tests#step-2-testing)

### [Any email address](https://docs.forter.com/extensions/phone-and-offline-order-tests#any-email-address)

Place a phone order in your sandbox environment using any valid test email address. The transaction should show in the [portal transactions tab](https://portal.forter.com/transactions "portal transactions tab") and include a phone icon next to the order number.

### [Declined by Forter](https://docs.forter.com/extensions/phone-and-offline-order-tests#declined-by-forter)

Place a purchase with email address decline@forter.com using a valid test card credit card or payment method. This email address will always generate a "decline" decision in Forter's sandbox environment and will enable you to test your SFCC cartridge flow for a declined mobile transaction.

### [Approved by Forter](https://docs.forter.com/extensions/phone-and-offline-order-tests#approved-by-forter)

Create an order using approve@forter.com and a valid test card for the transaction. This will generate an "approve" decision and the transaction should show in the [portal transactions tab](https://portal.forter.com/transactions "portal transactions tab") and include a phone icon next to the order number.
