The Bidco SDK 'Act' functionality provides your app users with a means to respond to a merchant's call to action.

Some examples of Acts:

  • Book a test drive at a car dealership.
  • Request an information pack from a charity.
  • Enter a competition.

When a merchant creates an 'Act' they specify the information they require from the user which is then stored as a template on the server and linked to an ActWorkflow.
When a user interacts with a Bidco trigger that results in an ActWorkflow, the user needs to be prompted to provide the information required.


The following sections are covered:


Retrieving the Act Details


  1. Get the Act from the workflow:
Act act = workflow.Act;

  1. Get the Act fields to display to the user:
// Get the Act ID
string actId = act.ActId;

// Get the Act name
string actName = act.Name;

// get the Act headline
string headline = act.Headline;

// Get the merchant's message for the Act
string message = act.Message;

// Get the Terms & Conditions to display for this Act
string terms = act.TermsAndConditions;

// Get any images to display
List<Image> images = act.Images;

// Get the merchant's thank you message for displaying after the act has been transmitted
string thankYouMessage = act.ThankYouMessage;

  1. Get the Act data keys:

The data needed to display the custom field to the user is stored in ActDataKey

for (ActDataKey actDataKey : act.getActDataKeys()) {
	// Retrieve the key identifier for this custom value
	string key = actDataKey.Key;

	// Retrieve the display name of the custom value
	string name = actDataKey.Name;

	// Retrieve the data type the must be returned to the SDK. valid types are String, Time, Date, Email, Address, boolean
	ActDataType actDataType = actDataKey.Type;

	// Retrieve the optional options list items and display to the user
	if(actDataType == ActDataType.OptionList){}
		List<String> optionsList = actDataKey.OptionList;
	}
	
	// Retrieve the optional predefined value to display to the user
	string value = actDataKey.PredefinedValue;

	// Retrieve the flag indicating if this is an optional field
	bool optional = actDataKey.IsOptional;
}

Preparing the Act Transaction Details

The user's response must be stored in an ActTransactionDetails so that it can be submitted to the server.

ActTransactionDetails actTransactionDetails = new ActTransactionDetails();

Adding an Act Data Value


Add the values supplied by the user for each ActDataKey:

// Add the user's value as a string
actTransactionDetails.AddActDataValue(actDataKey, userValueString);

Note: At the very least, add the user values for all mandatory keys.


Removing an Act Data Value


  1. To remove a stored user value:
bool valueRemoved = actTransactionDetails.RemoveActDataValue(actDatakey);

Removing All Act Data Values


  1. To clear ActTransactionDetails of all act data values:
actTransactionDetails.ClearActDataValues();

Obtaining All Act Data Values

  1. To obtain all act data values added to ActTransActionDetails:
IReadOnlyDictionary<string, string> actDataValues = actTransactionDetails.ActDataValues;

Submit the Act Transaction Details


Submit the act transaction details to the Bidco server using the ActManager.
An 'ActTransaction' is returned that contains:

  • The transaction Id that can be used to retrieve the transaction details.
  • A set of coupons that the user can redeem on future purchases. The coupons are automatically saved to the user's profile but returned here so they can be displayed to the user.
ActManager actManager = ManagerFactory.GetInstance().ActManager;
ActTransaction actTransaction = await actManager.SubmitTransactionAsync(act, actTransactionDetails);
// Keep the transaction ID
displayTransactionToUser(actTransaction.TransactionId);

// Display returned coupons to user
List<Coupon> coupons = actTransaction.TriggeredCoupons;
if(!coupons.IsNullOrEmpty()){
	displayCouponsToUser();
}