Selling Investment Orders
Description
This web Service sells an investment order. An investment order (IO) can be sold to a single or multiple investors. However, an IO cannot be sold on the same date when it is created.
Denomination is defined on a loan account by the Note Type object associated with it. Number of shares for an investor can be identified by formula (Investment Amount/Denomination on Loan Account) and also can be seen on the investment order with field “Number Of Shares”.
Definition
GET https://<domain>/services/apexrest/peer/v1/investmentOrders/sell/<investmentOrderId>
Request Parameters
The table given below provides details of the request parameters used by this web service:
Field | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
investmentOrderId* | String |
|
||||||||||||||||||
saleTransactions* | Array |
This is an array of objects. A JSON representation of the list of an object, with each object having the following parameters
|
||||||||||||||||||
returnOnlyNewIOs | Boolean | A boolean specifying if the return should contain all the IOs or only newly created IOs in sale transaction. The IO being sold is always returned irrespective of this value. |
Error messages
When you use this web service you can receive the possible error messages as shown in the below table:
Error Code | Error Message | System.Label | Reason | HTTP |
Error |
Row |
---|---|---|---|---|---|---|
INVALID_INPUT | Required |
REQUIRED_PARAME |
One or all mandatory |
400 | 00018 | NA |
INVALID_INPUT | Unable to parse |
UNABLE_PARSE_RE |
Error occurs while |
400 | 00017 | NA |
INVALID_INPUT | Investment |
INVESTMENT_ORDE |
Investment Order Id |
400 | 00018 | NA |
INVALID_INPUT | Investment |
INVESTMENT_ORDE |
No record exists in the |
400 | 00019 | NA |
API_EXCEPTION | <exception_me |
NA | Exception querying |
500 | 00010 | NA |
INVALID_INPUT | Investment |
INVESTMENT_ORDE |
The investment order |
400 | 00011 | NA |
API_EXCEPTION | <exception_me |
NA | Exception querying |
500 | 00012 | NA |
INVALID_INPUT | Loan Account |
LOAN_ACCOUNT_INV |
Either Invalid data is |
400 | 00013 | NA |
INVALID_INPUT | Denomination |
DENOMINATION_NOT |
Note type and in turn |
400 | 00014 | NA |
INVALID_INPUT | Sale date cannot be same |
SALE_DATE_INVALID | Sale Date is same as |
400 | 00016 | NA |
INVALID_INPUT | Price per share is negative for |
PRICE_PER_SHARE_ NEGATIVE |
Price per share is -ve. | 400 | 00001 | Row number |
INVALID_INPUT | Sale |
BUYER_NOT_INVEST |
Buyer is not an |
400 | 00002 | Row |
Buyer cannot |
BUYER_SELLER_SAM |
Buyer and investor of |
400 | 00003 | Row |
|
INVALID_INPUT | Number of |
PRICE_PER_SHARE_ |
Number of shares is |
400 | 00004 | Row |
INVALID_INPUT | Income can |
ADD_INCOME_INVALI |
“addIncomeInPrice” is |
400 | Row |
|
INVALID_INPUT | Investor does |
NUMBER_OF_SHAR |
Buyer does not have |
400 | NA | |
INVALID_INPUT | Total number |
NA | Total Number of |
400 | 00007 | NA |
API_EXCEPTIO |
<exception_me |
NA | If any validation fails |
500 | 00015 | NA |
Sample Request
The sample request to be sent is as shown below:
https://na11.salesforce.com/services/apexrest/v1/investmentOrders/sell/a1zj0000000fH44
Sample Request
{
"saleTransactions" : [
{
"numberOfShares": 10,
"pricePerShare": 90,
"buyer":"001j000000Kn8wM",
"addIncomeInPrice" : true,
"transferIncome" : true
},
{
"numberOfShares": 10,
"pricePerShare": 90,
"buyer":"001j000000Kn8vE"
}
]
}
Sample Response
The sample response is as shown below that contains all the IOs of the loan, or, only the IOs created along with the modified IOs, based on the value of the parameter returnOnlyNewIOs.
{
"status": "SUCCESS",
"rowNumber": null,
"response": [],
"errorNumber": null,
"errorMessage": null,
"errorCode": "NO_ERROR",
"content": [
{
"attributes": {
"type": "loan__Investor_Loan__c",
"url": "/services/data/v33.0/sobjects/loan__Investor_Loan__c/a1zj0000000fH3zAAE"
},
"loan__Unreleased_Interest__c": 0,
"loan__Inv_Interest_Posted_Amt__c": 0,
"loan__Inv_Last_Interest_Accrual_Post_Date__c": "20150314",
"loan__Investor_Start_Date__c": "20150314",
"loan__Share_rounded__c": 100,
"LastModifiedDate": "20150423T19:
25:52.000+0000",
"loan__Unreleased_Principal__c": 0,
"loan__Interest_Rate_On_Loan_Account__c": 10,
"loan__Write_Off_Amount__c": 0,
"loan__Status__c": "Sold",
"loan__Service_Rate__c": 1,
"loan__Account__c": "001j000000Kn8wRAAR",
"loan__Reinvest_Interest__c": false,
"loan__Minimum_Service_Fee__c": 0,
"loan__Interest_Disbursed_To_Investor__c": 0,
"loan__Service_Charge_On_Full_Payment_Amount__c": false,
"loan__Interest_Balance__c": 0,
"Number_of_Shares__c": 50,
"loan__Charged_Off_Interest__c": 0,
"loan__Principal_Amount_Paid__c": 0,
"loan__Inv_Accrued_Interest_Amt__c": 0,
"Purchase_Discount__c": 100,
"CreatedById": "005j000000BhPXNAA3",
"IsDeleted": false,
"Id": "a1zj0000000fH3zAAE",
"loan__Total_Amount_Paid__c": 0,
"loan__Reinvest_Service_Charge__c": 0,
"MarketPlace_Level__c": 1,
"OwnerId": "005j000000BhPXNAA3",
"loan__Original_Loan_Amount__c": 5000,
"loan__Certificate_Rate__c": 10,
"loan__Reinvest_Principal__c": false,
"loan__Loan_Status__c": "Active Good
Standing",
"loan__Principal_Reinvested__c": 0,
"SystemModstamp": "20150423T19:
25:52.000+0000",
"loan__Loan_Principal_Remaining__c": 5000,
"loan__Remaining_Investment_Amount__c": 5000,
"loan__Investor_Loan_ID__c": "ILID0000000346",
"loan__Interest_Reinvested__c": 0,
"loan__Interest_Amount_Paid__c": 0,
"loan__Enabled_Flag__c": false,
"loan__Charged_Off_Principal__c": 0,
"LastModifiedById": "005j000000BhPXNAA3",
"loan__Charged_Off_Fees__c": 0,
"loan__Investor_End_Date__c": "20150316",
"loan__Principal_Disbursed_To_Investor__c": 0,
"loan__Share__c": 100,
"loan__Loan__c": "a2Dj0000000A8YxEAK",
"loan__Income_Reinvested__c": 0,
"Name": "ILID0000000345",
"loan__Late_Fees_Amount_Paid__c": 0,
"CreatedDate": "20150423T19:
23:55.000+0000",
"loan__Loan_Start_Date__c": "20150314",
"loan__Investment_Amount__c": 5000
},
{
"attributes": {
"type": "loan__Investor_Loan__c",
"url": "/services/data/v33.0/sobjects/loan__Investor_Loan__c/a1zj0000000fH44AAE"
},
"loan__Unreleased_Interest__c": 5.56,
"loan__Inv_Interest_Posted_Amt__c": 5.555555555555555,
"loan__Inv_Last_Interest_Accrual_Post_Date__c": "20150318",
"loan__Investor_Start_Date__c": "20150314",
"loan__Share_rounded__c": 100,
"LastModifiedDate": "20150429T21:
02:57.000+0000",
"loan__Unreleased_Principal__c": 994.44,
"loan__Interest_Rate_On_Loan_Account__c": 10,
"loan__Write_Off_Amount__c": 0,
"loan__Status__c": "Sold",
"loan__Service_Rate__c": 1,
"loan__Account__c": "001j000000KpJJNAA3",
"loan__Reinvest_Interest__c": true,
"loan__Minimum_Service_Fee__c": 0,
"loan__Interest_Disbursed_To_Investor__c": 0,
"loan__Service_Charge_On_Full_Payment_Amount__c": false,
"loan__Interest_Balance__c": 0,
"Number_of_Shares__c": 50,
"loan__Charged_Off_Interest__c": 0,
"loan__Principal_Amount_Paid__c": 994.4444444444445,
"loan__Inv_Accrued_Interest_Amt__c": 0,
"Sale_Date__c": "20150316",
"Purchase_Discount__c": 100,
"CreatedById": "005j000000BhPXNAA3",
"IsDeleted": false,
"Id": "a1zj0000000fH44AAE",
"loan__Total_Amount_Paid__c": 1000,
"loan__Reinvest_Service_Charge__c": 0,
"MarketPlace_Level__c": 1,
"OwnerId": "005j000000BhPXNAA3",
"loan__Original_Loan_Amount__c": 5000,
"loan__Certificate_Rate__c": 10,
"loan__Reinvest_Principal__c": true,
"loan__Loan_Status__c": "Active Good
Standing",
"loan__Principal_Reinvested__c": 0,
"SystemModstamp": "20150429T21:
02:57.000+0000",
"loan__Loan_Principal_Remaining__c": 5000,
"loan__Remaining_Investment_Amount__c": 4005.56,
"loan__Investor_Loan_ID__c": "ILID0000000347",
"loan__Interest_Reinvested__c": 0,
"loan__Interest_Amount_Paid__c": 5.555555555555555,
"loan__Enabled_Flag__c": false,
"loan__Charged_Off_Principal__c": 0,
"LastModifiedById": "005j000000BhPXNAA3",
"loan__Charged_Off_Fees__c": 0,
"loan__Investor_End_Date__c": "20150318",
"loan__Principal_Disbursed_To_Investor__c": 0,
"loan__Share__c": 100,
"loan__Loan__c": "a2Dj0000000A8YxEAK",
"loan__Income_Reinvested__c": 0,
"Name": "ILID0000000346",
"loan__Late_Fees_Amount_Paid__c": 0,
"CreatedDate": "20150423T19:
25:52.000+0000",
"loan__Loan_Start_Date__c": "20150314",
"loan__Investment_Amount__c": 5000
},
{
"attributes": {
"type": "loan__Investor_Loan__c",
"url": "/services/data/v33.0/sobjects/loan__Investor_Loan__c/a1zj0000000fL89AAE"
},
"loan__Unreleased_Interest__c": 0,
"loan__Inv_Interest_Posted_Amt__c": 0,
"loan__Inv_Last_Interest_Accrual_Post_Date__c": "20150318",
"loan__Investor_Start_Date__c": "20150318",
"loan__Share_rounded__c": 50.07,
"LastModifiedDate": "20150429T21:
02:56.000+0000",
"loan__Unreleased_Principal__c": 0,
"loan__Interest_Rate_On_Loan_Account__c": 10,
"loan__Write_Off_Amount__c": 0,
"loan__Status__c": "Active",
"loan__Service_Rate__c": 1,
"loan__Account__c": "001j000000KpJJNAA3",
"loan__Reinvest_Interest__c": true,
"loan__Minimum_Service_Fee__c": 0,
"Purchase_Price__c": 2005.5555555555557,
"loan__Interest_Disbursed_To_Investor__c": 0,
"loan__Service_Charge_On_Full_Payment_Amount__c": false,
"loan__Interest_Balance__c": 0,
"Number_of_Shares__c": 20.06,
"loan__Charged_Off_Interest__c": 0,
"loan__Principal_Amount_Paid__c": 0,
"loan__Inv_Accrued_Interest_Amt__c": 0,
"Purchase_Discount__c": 0,
"CreatedById": "005j000000BhPXNAA3",
"IsDeleted": false,
"Id": "a1zj0000000fL89AAE",
"loan__Total_Amount_Paid__c": 0,
"loan__Reinvest_Service_Charge__c": 0,
"MarketPlace_Level__c": 1,
"OwnerId": "005j000000BhPXNAA3",
"loan__Original_Loan_Amount__c": 5000,
"loan__Certificate_Rate__c": 10,
"loan__Reinvest_Principal__c": true,
"loan__Loan_Status__c": "Active Good
Standing",
"loan__Principal_Reinvested__c": 0,
"SystemModstamp": "20150429T21:
02:56.000+0000",
"loan__Loan_Principal_Remaining__c": 4005.5555555555557,
"loan__Remaining_Investment_Amount__c": 2005.56,
"loan__Loan_Delinquent_Days__c": 0,
"loan__Investor_Loan_ID__c": "ILID0000001048",
"loan__Interest_Reinvested__c": 0,
"loan__Interest_Amount_Paid__c": 0,
"loan__Enabled_Flag__c": true,
"loan__Charged_Off_Principal__c": 0,
"LastModifiedById": "005j000000BhPXNAA3",
"loan__Charged_Off_Fees__c": 0,
"loan__Principal_Disbursed_To_Investor__c": 0,
"loan__Share__c": 50.069348127600556,
"loan__Loan__c": "a2Dj0000000A8YxEAK",
"loan__Income_Reinvested__c": 0,
"Name": "ILID0000001047",
"loan__Late_Fees_Amount_Paid__c": 0,
"CreatedDate": "20150429T21:
02:56.000+0000",
"loan__Loan_Start_Date__c": "20150314",
"loan__Investment_Amount__c": 2005.5555555555557
},
{
"attributes": {
"type": "loan__Investor_Loan__c",
"url": "/services/data/v33.0/sobjects/loan__Investor_Loan__c/a1zj0000000fL8AAAU"
},
"loan__Unreleased_Interest__c": 0,
"loan__Inv_Interest_Posted_Amt__c": 0,
"loan__Inv_Last_Interest_Accrual_Post_Date__c": "20150318",
"loan__Investor_Start_Date__c": "20150318",
"loan__Share_rounded__c": 24.97,
"LastModifiedDate": "20150429T21:
02:57.000+0000",
"loan__Unreleased_Principal__c": 0,
"loan__Interest_Rate_On_Loan_Account__c": 10,
"loan__Write_Off_Amount__c": 0,
"loan__Status__c": "Active",
"loan__Service_Rate__c": 1,
"loan__Account__c": "001j000000Kn8wMAAR",
"loan__Reinvest_Interest__c": true,
"loan__Minimum_Service_Fee__c": 0,
"Purchase_Price__c": 900,
"loan__Interest_Disbursed_To_Investor__c": 0,
"loan__Service_Charge_On_Full_Payment_Amount__c": false,
"loan__Interest_Balance__c": 0,
"Number_of_Shares__c": 10,
"loan__Charged_Off_Interest__c": 0,
"loan__Principal_Amount_Paid__c": 0,
"loan__Inv_Accrued_Interest_Amt__c": 0,
"Purchase_Discount__c": 10,
"CreatedById": "005j000000BhPXNAA3",
"IsDeleted": false,
"Id": "a1zj0000000fL8AAAU",
"loan__Total_Amount_Paid__c": 0,
"loan__Reinvest_Service_Charge__c": 0,
"MarketPlace_Level__c": 2,
"OwnerId": "005j000000BhPXNAA3",
"loan__Original_Loan_Amount__c": 5000,
"loan__Certificate_Rate__c": 10,
"loan__Reinvest_Principal__c": true,
"loan__Loan_Status__c": "Active Good
Standing",
"loan__Principal_Reinvested__c": 0,
"SystemModstamp": "20150429T21:
02:57.000+0000",
"loan__Loan_Principal_Remaining__c": 4005.5555555555557,
"loan__Remaining_Investment_Amount__c": 1000,
"loan__Loan_Delinquent_Days__c": 0,
"loan__Investor_Loan_ID__c": "ILID0000001049",
"loan__Interest_Reinvested__c": 0,
"loan__Interest_Amount_Paid__c": 0,
"loan__Enabled_Flag__c": true,
"loan__Charged_Off_Principal__c": 0,
"LastModifiedById": "005j000000BhPXNAA3",
"loan__Charged_Off_Fees__c": 0,
"loan__Principal_Disbursed_To_Investor__c": 0,
"loan__Share__c": 24.965325936199722,
"loan__Loan__c": "a2Dj0000000A8YxEAK",
"loan__Income_Reinvested__c": 0,
"Name": "ILID0000001048",
"loan__Late_Fees_Amount_Paid__c": 0,
"CreatedDate": "20150429T21:
02:57.000+0000",
"loan__Loan_Start_Date__c": "20150314",
"loan__Investment_Amount__c": 1000
},
{
"attributes": {
"type": "loan__Investor_Loan__c",
"url": "/services/data/v33.0/sobjects/loan__Investor_Loan__c/a1zj0000000fL8BAAU"
},
"loan__Unreleased_Interest__c": 0,
"loan__Inv_Interest_Posted_Amt__c": 0,
"loan__Inv_Last_Interest_Accrual_Post_Date__c": "20150318",
"loan__Investor_Start_Date__c": "20150318",
"loan__Share_rounded__c": 24.97,
"LastModifiedDate": "20150429T21:
02:57.000+0000",
"loan__Unreleased_Principal__c": 0,
"loan__Interest_Rate_On_Loan_Account__c": 10,
"loan__Write_Off_Amount__c": 0,
"loan__Status__c": "Active",
"loan__Service_Rate__c": 1,
"loan__Account__c": "001j000000Kn8vEAAR",
"loan__Reinvest_Interest__c": true,
"loan__Minimum_Service_Fee__c": 0,
"Purchase_Price__c": 900,
"loan__Interest_Disbursed_To_Investor__c": 0,
"loan__Service_Charge_On_Full_Payment_Amount__c": false,
"loan__Interest_Balance__c": 0,
"Number_of_Shares__c": 10,
"loan__Charged_Off_Interest__c": 0,
"loan__Principal_Amount_Paid__c": 0,
"loan__Inv_Accrued_Interest_Amt__c": 0,
"Purchase_Discount__c": 10,
"CreatedById": "005j000000BhPXNAA3",
"IsDeleted": false,
"Id": "a1zj0000000fL8BAAU",
"loan__Total_Amount_Paid__c": 0,
"loan__Reinvest_Service_Charge__c": 0,
"MarketPlace_Level__c": 2,
"OwnerId": "005j000000BhPXNAA3",
"loan__Original_Loan_Amount__c": 5000,
"loan__Certificate_Rate__c": 10,
"loan__Reinvest_Principal__c": true,
"loan__Loan_Status__c": "Active Good
Standing",
"loan__Principal_Reinvested__c": 0,
"SystemModstamp": "20150429T21:
02:57.000+0000",
"loan__Loan_Principal_Remaining__c": 4005.5555555555557,
"loan__Remaining_Investment_Amount__c": 1000,
"loan__Loan_Delinquent_Days__c": 0,
"loan__Investor_Loan_ID__c": "ILID0000001050",
"loan__Interest_Reinvested__c": 0,
"loan__Interest_Amount_Paid__c": 0,
"loan__Enabled_Flag__c": true,
"loan__Charged_Off_Principal__c": 0,
"LastModifiedById": "005j000000BhPXNAA3",
"loan__Charged_Off_Fees__c": 0,
"loan__Principal_Disbursed_To_Investor__c": 0,
"loan__Share__c": 24.965325936199722,
"loan__Loan__c": "a2Dj0000000A8YxEAK",
"loan__Income_Reinvested__c": 0,
"Name": "ILID0000001049",
"loan__Late_Fees_Amount_Paid__c": 0,
"CreatedDate": "20150429T21:
02:57.000+0000",
"loan__Loan_Start_Date__c": "20150314",
"loan__Investment_Amount__c": 1000
}
]
}