diff --git a/APIFolder/api.htm b/APIFolder/api.htm new file mode 100644 index 000000000..7d3e5b872 --- /dev/null +++ b/APIFolder/api.htm @@ -0,0 +1,2071 @@ + + + + + Mifos X API Documentation + + + +
+
+ +
+

Navigation

+
+ +
+ +
+

Full API Docs

+

General

+ +
+ +
+ + + +
+
+
+ + +   +
+
+
+

Mifos X API Documentation

+

+ Much of the presentation ideas here have been taken from the very good API reference (https://stripe.com/docs/api) +

+

+ The Mifox X API is organized around + REST. + Our API is designed to have predictable, resource-oriented + URLs, to use HTTP response codes to indicate API errors, and + to use built-in HTTP features, like HTTP authentication and + HTTP verbs, which can be understood by off-the-shelf HTTP + clients. JSON will be + returned in all responses from the API, including errors. +

+ +
+ +
+

API Endpoint

+ https://thedomainname/ +
Summary of Resource URL Patterns
+
    + + + +
  • /v1/offices
  • +
  • /v1/offices/template
  • +
  • /v1/offices/{OFFICEID}
  • + +
  • /v1/loanproducts
  • +
  • /v1/loanproducts/template
  • +
  • /v1/loanproducts/{PRODUCTID}
  • + +
  • /v1/configurations
  • +
  • /v1/configurations/currency
  • +
+ +
    +
  • /v1/reports
  • +
  • /v1/reports/{REPORTNAME}
  • +
  • /v1/extradata
  • +
  • /v1/extradata/{datasetType}/{datasetName}/{datasetPKValue}
  • + +
+
+
+ +   +
+
+

Authentication

+

+ JPW: Keith, this needs to change to whatever is right after authentication has been added. Don't know if you will go with keys or passwords (I assume passwords)... but can you fix it so we have one user or one user per role that doesn't need a password or always has a password of 'password' so we can let ppl do stuff from the browser and/or REST plugins? We can talk about this. +

+

+ STRIPE content: You authenticate to the Mifos X API by providing one of + your API keys in the request. You can manage your API + keys from your + account. + You can have multiple API keys + active at one time. Your API keys carry many + privileges, so be sure to keep them secret! +

+ +

+ Authentication to the API occurs via + + HTTP Basic Auth. Provide your API key as the basic + auth username. You do not need to provide a password. +

+ +

+ All API requests must be made + over HTTPS. + Calls made over plain HTTP will fail. You must + authenticate for all requests. +

+
+
+ curl https://api.stripe.com/v1/charges \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: + +

+ JPW: We'll update this after... + curl uses the -u flag to pass basic auth +credentials (adding a colon after your API key will prevent + it from asking you for a password). + + + + A sample test API key has been provided in all +the examples on the page, so you can test out any example right away. + + +

+
+
+ +   +
+
+ +

Errors

+

JPW:Need to update this + Stripe uses conventional HTTP response codes to indicate + success or failure of an API request. In general, + codes in the 2xx range indicate success, codes in the + 4xx range indicate an error that resulted from the + provided information (e.g. a required parameter was + missing, a charge failed, etc.), and codes in the 5xx + range indicate an error with Stripe's servers. +

+ +

+ Not all errors map cleanly onto HTTP response codes, + however. When a request is valid but does not complete + successfully (e.g. a card is declined), we return a 402 + error code. +

+ + +

+ All errors return JSON with a type (one of card_error, invalid_request_error, + or api_error) and message describing the particular problem. +

+ +
Attributes
+
+
type
+
+
The type of error returned (card_error, invalid_request_error, api_error) + Card errors are the most common type of error you should expect to handle. + They result when the user enters a card that can't be charged for some reason. + Invalid request errors arise when your request has invalid parameters. API + errors cover any other type of problem (e.g. a temporary problem with Stripe's servers) + and should turn up only very infrequently.
+ +
message
+
+
A user-friendly message describing the error
+ +
code
+
optional
+
For card errors, additional information +about the user-friendly message to display for this error (e.g. "Your +card was declined.")
+ +
param
+
optional
+
The parameter the error relates to if the +error is parameter-specific. You can use this to display a message near + the correct form field, for example.
+
+
+
+
HTTP Status Code Summary
+
    +
  • 200 OK - Everything worked as expected.
  • +
  • 400 Bad Request - Often missing a required parameter.
  • +
  • 401 Unauthorized - No valid API key provided.
  • +
  • 402 Request Failed - Parameters were valid but request failed.
  • +
  • 404 Not Found - The requested item doesn't exist.
  • +
  • 500, 502, 503, 504 Server errors - something went wrong on Stripe's end.
  • +
+
+ +
+
Errors
+ Invalid Request Errors + Type: invalid_request_error + + API Errors + Type: api_error + + Card Errors + Type: card_error + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeDetails
invalid_numberThe card number is invalid
incorrect_numberThe card number is incorrect
invalid_expiry_monthThe card's expiration month is invalid
invalid_expiry_yearThe card's expiration year is invalid
invalid_cvcThe card's security code is invalid
expired_cardThe card has expired
invalid_amountAn invalid amount was entered
incorrect_cvcThe card's security code is incorrect
card_declinedThe card was declined.
missingThere is no card on a customer that is being charged.
duplicate_transactionA transaction with identical amount and credit card information was submitted very recently.
processing_errorAn error occurred while processing the card.
+
+
+ + + + + + + +   +
+
+

Reports

+

+This reports resource allows you to run and receive output from pre-defined Mifos X reports. A "Generic Resultset" containing Column Heading as well as Data information is returned and JSON is the default output format. However, you can export to CSV format by simply adding "&exportCSV=true" to the end of your URI. +

+

+Pentaho reports can also be run from this resource. The Pentaho reports can return HTML, PDF or CSV formats. +

+ +

Add examples showing links to client listing report producing json, then csv, then a pentaho report producing html, pdf, csv

+

+The Mifos X Individual Lending client application uses a JQuery plugin called stretchyreporting which, itself, uses this reports resource to provide a pretty flexible reporting User Interface (UI). Put a link to an example here. +

+ + +
+
+ +
+
+

Parameters

+

Note: the prefix R_ below stands for Reporting

+
+
R_Name
+
mandatory
+
Report Name. One of the standard or user-defined Mifos X reports.
+
R_'parameter names' ...
+
optional, No defaults
+
The number and names of the parameters depend on the specific report and how it has been configured. FR_officeId is an example parameter name.
+
R_parameterType
+
optional, The only valid value is 'true'. If any other value is provided the parameter will be ignored
+
Determines whether the request looks for reports or paraters that have been configured.
+
exportCSV
+
optional, The only valid value is 'true'. If any other value is provided the parameter will be ignored
+
Output will be delivered as a CSV file instead of JSON. Doesn't apply to Pentaho reports.
+
+ +

Example Request: + http://localhost:8080/mifosng-provider/api/v1/reports/Client%20Listing?FR_officeId=1 +

+ +
+ + + + + + +
+ GET https://thedomainname/v1/reports + { + "columnHeaders": [ + { + "columnName": "Office/Branch", + "columnType": "VARCHAR", + "columnLength": null, + "columnDisplayType": null, + "columnValues": [] + }, + { + "columnName": "Name", + "columnType": "VARCHAR", + "columnLength": null, + "columnDisplayType": null, + "columnValues": [] + }, + { + "columnName": "Joining Date", + "columnType": "DATE", + "columnLength": null, + "columnDisplayType": null, + "columnValues": [] + } + ], + "data": [ + { + "row": [ + "Demo MFI Head Office", + "O'Meara, Patrick", + "2009-01-04" + ] + }, + { + "row": [ + "Demo MFI Head Office", + "O'Meara, Dennis", + "2009-01-04" + ] + }, + { + "row": [ + "Demo MFI Head Office", + "Smith, John", + "2009-01-11" + ] + }, +... more "row" entries + ] +} +
+
+ +   +
+
+

Creating a New Customer

+

+ Creates a new customer object. +

+ +
Arguments
+
+
card
+
optional, default is null
+
+ A card to attach to the customer. The card can either be a token, + like the ones returned by our + Stripe.js, + or a dictionary containing a + user's credit card details, with the options described + below. Whenever you attach a card to a customer, Stripe will automatically validate the + card. A customer with a card can be used when creating a charge or put on a recurring + billing plan. + +
+
number
+
required
+
The card number, as a string without any separators.
+ +
exp_month
+
required
+
Two digit number representing the card's expiration month.
+ +
exp_year
+
required
+
Four digit number representing the card's expiration year.
+ +
cvc
+
optional, highly recommended
+
Card security code
+ +
name
+
optional
+
Cardholder's full name.
+ +
address_line1
+
optional
+ +
address_line2
+
optional
+ +
address_zip
+
optional
+ +
address_state
+
optional
+ +
address_country
+
optional
+
+
+ +
coupon
+
optional, default is null
+
+ If you provide a coupon code, the customer will have a + discount applied on all recurring charges. Charges + you create through the API will not have the discount. + You can manage your coupons in the + coupon section of your + account. +
+ +
email
+
optional, default is null
+
+ The customer's email address. It is displayed alongside + the customer in the web interface and can be useful for searching and tracking. +
+ +
description
+
optional, default is null
+
+ An arbitrary string which you can attach to a customer + object. It is displayed alongside the customer in the + web interface. +
+ +
plan
+
optional, default is null
+
+ The identifier of the plan to subscribe the customer + to. If provided, the returned customer object has a + 'subscription' attribute describing the state of the + customer's subscription. +
+ +
trial_end
+
optional, default is null
+
+ UTC integer timestamp representing the end of the trial period + the customer will get before being charged for the first time. + If set, trial_end will override the default trial period of the + plan the customer is being subscribed to. +
+
+ +
Returns
+

+ Returns a customer object if the call succeeded. The + returned object will have information about + subscriptions, discount, and cards, if that information + has been provided. If a non-free plan is specified and + a card is not provided (unless the plan has a trial period), the call will return an error. + If a non-existent plan or a non-existent or expired + coupon is provided, the call will return an error. +

+

+ If a card has been attached to the customer, the + returned customer object will have an active_card + attribute containing the card's details. +

+ +
+ +
+ POST https://api.stripe.com/v1/customers + + curl https://api.stripe.com/v1/customers \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: \ + -d "description=Customer for site@stripe.com" \ + -d "card[number]=4242424242424242" \ + -d "card[exp_month]=5" \ + -d "card[exp_year]=2013" + + + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} + + { + "error": { + "type": "invalid_request_error", + "message": "You must supply a valid card" + } +} + +
+
+ +   +
+
+

Retrieving a Customer

+

+ Retrieves the details of an existing customer. You need + only supply the unique customer identifier that was + returned upon customer creation. +

+ +

+ Like with a charge, you can view the retrieved customer + directly in your browser. +

+ +

+ https://vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE@api.stripe.com/v1/customers/ch_I7HoyUbJDACuPe +

+ +
Arguments
+
+
id
+
required
+
+ The identifier of the customer to be retrieved. +
+
+ +
Returns
+

+ Returns a customer object if a valid identifier was provided. + When requesting the ID of a customer that has been deleted, + a subset of the customer's information will be returned, + including a "deleted" property, which will be true. +

+
+ +
+ GET https://api.stripe.com/v1/customers/{CUSTOMER_ID} + + curl https://api.stripe.com/v1/customers/cus_QEvO1l6xtJNbTI \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: + + + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} + + { + "error": { + "type": "invalid_request_error", + "message": "No such customer: cus_QEvO1l6xtJNbTI" + } +} + +
+
+ +   +
+
+

Updating a Customer

+

+ Updates the specified customer by setting the values of + the parameters passed. Any parameters not provided will + be left unchanged. For example, if you pass + the card parameter, that becomes the + customer's active card which will be used for all + charges in future. +

+ +

+ This request accepts mostly the same arguments as the + customer creation call. However, subscription-related + arguments (plan and + trial_end) are not accepted. To + change those, one must + update the customer's subscription directly. +

+ +
Arguments
+

+

+
card
+
optional, default is null
+
+ A new card to attach to the customer. The card can either be a token, + like the ones returned by our + Stripe.js, + or a dictionary containing a + user's credit card details, with the options described + below. A customer with a card can be used when + creating a charge or put on a recurring billing + plan. Although not all information is required, the + extra info helps prevent fraud. + +
+
number
+
required
+
The card number, as a string without any separators.
+ +
exp_month
+
required
+
Two digit number representing the card's expiration month.
+ +
exp_year
+
required
+
Four digit number representing the card's expiration year.
+ +
cvc
+
optional, highly recommended
+
Card security code
+ +
name
+
optional
+
Cardholder's full name.
+ +
address_line1
+
optional
+ +
address_line2
+
optional
+ +
address_zip
+
optional
+ +
address_state
+
optional
+ +
address_country
+
optional
+
+
+ +
coupon
+
optional, default is null
+
+ If you provide a coupon code, the customer will have a + discount applied on all recurring charges. Charges + you create through the API will not have the discount. + You can manage your coupons in the + coupon section of your + account. +
+ +
description
+
optional, default is null
+
+ An arbitrary string which you can attach to a customer + object. It is displayed alongside the charge in the + web interface. It's often a good idea to use an + email address as a description for tracking later. +
+ +
email
+
optional
+
+ The customer's email address. It is displayed alongside + the customer in the web interface and can be useful for searching and tracking. +
+

+ +
Returns
+

+ Returns the customer object if the update succeeded. + Errors will be thrown if update parameters are invalid. + For example, specifying an invalid coupon or + an invalid card will return an error. +

+
+ +
+ POST https://api.stripe.com/v1/customers/{CUSTOMER_ID} + + curl https://api.stripe.com/v1/customers/cus_QEvO1l6xtJNbTI \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: \ + -d "description=Customer for site@stripe.com" + + + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": "Customer for site@stripe.com", + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} + + { + "error": { + "type": "invalid_request_error", + "message": "No such customer: cus_QEvO1l6xtJNbTI" + } +} + +
+
+ +   +
+
+

Deleting a Customer

+ +

Permanently deletes a customer. It cannot be undone.

+ +
Arguments
+
+
id
+
required
+
+ The identifier of the customer to be deleted. +
+
+ +
Returns
+

+ Returns an object with a deleted parameter on success. + If the customer ID does not exist, an error is returned. +

+

+ Unlike other objects, deleted customers can still be + retrieved through the API, in order to be able to track + the history of customers while still removing their + credit card details and preventing any further operations + to be performed (such as adding a new subscription). +

+
+ +
+ DELETE https://api.stripe.com/v1/customers/{CUSTOMER_ID} + + curl https://api.stripe.com/v1/customers/cus_QEvO1l6xtJNbTI \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: \ + -X DELETE + + + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} + + { + "error": { + "type": "invalid_request_error", + "message": "No such customer: cus_QEvO1l6xtJNbTI" + } +} + +
+
+ +   +
+
+

List all Customers

+

+ Returns a list of your customers. The customers are + returned sorted by creation date, with the most recently + created customers appearing first. +

+ +

+ Like with an individual customer, you can view the list + of customers directly in your browser. +

+ +

+ https://vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE@api.stripe.com/v1/customers +

+ +
Arguments
+
+
count
+
optional, default is 10
+
+ A limit on the number of customers to be returned. + Count can range between 1 and 100 customers. +
+ +
offset
+
optional, default is 0
+
+ An offset into your customer array. The API will + return the requested number of customers starting at + that offset. +
+
+ +
Returns
+

+ A dictionary with a data + property that contains an array of up to count customers, + starting at index offset. Each entry + in the array is a separate customer object. If no more + customers are available, the resulting array will be + empty. This request should never return an error. +

+
+ +
+ GET https://api.stripe.com/v1/customers + + curl https://api.stripe.com/v1/customers \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: + + + { + data: [ + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 + }, + {...}, + {...} + ] +} + +
+
+ + + + + + + + + + + + + + +   +
+
+

Customers

+

+ Customer objects allow you to perform recurring charges + and track multiple charges that are associated with the + same customer. The API allows you to create, delete, + and update your customers. You can retrieve individual + customers as well as a list of all your customers. +

+
+
+ +   +
+
+

The customer object

+
Attributes
+
+ +
+ id +
+
+ + + string + + + +
+ + +
+ object +
+
+ + string, value is "customer" + + +
+ + +
+ livemode +
+
+ + + boolean + + + +
+ + +
+ created +
+
+ + + timestamp + + + +
+ + +
+ account_balance +
+
+ + + integer + + + or null +
+ +
Current balance, if any, being stored on the customer's +account. If negative, the customer has credit to apply + to the next invoice. If positive, the customer has an amount +owed that will be added to the next invoice. The balance does not + refer to any unpaid invoices; it solely takes into account +amounts that have yet to be successfully applied to any invoice.
+ + +
+ active_card +
+
+ + +
hash
+
+ Hash describing the current card on the customer, if there is one. +
+ +
+ object +
+
+ + + string + + + +
+ + +
+ exp_month +
+
+ + + integer + + + +
+ + +
+ exp_year +
+
+ + + integer + + + +
+ + +
+ fingerprint +
+
+ + + string + + + +
+ +
Uniquely identifies this particular card number. You can use this + attribute to check whether two customers who've signed up with you are using the same card + number, for example.
+ + +
+ last4 +
+
+ + + string + + + +
+ + +
+ type +
+
+ + + string + + + +
+ +
Card brand. Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown
+ + +
+ address_country +
+
+ + + string + + + or null +
+ +
Billing address country, if provided when creating card
+ + +
+ address_line1 +
+
+ + + string + + + or null +
+ + +
+ address_line1_check +
+
+ + + string + + + or null +
+ +
If address_line1 was provided, results of the check: pass, fail, or unchecked
+ + +
+ address_line2 +
+
+ + + string + + + or null +
+ + +
+ address_state +
+
+ + + string + + + or null +
+ + +
+ address_zip +
+
+ + + string + + + or null +
+ + +
+ address_zip_check +
+
+ + + string + + + or null +
+ +
If address_zip was provided, results of the check: pass, fail, or unchecked
+ + +
+ country +
+
+ + + string + + + or null +
+ +
Two-letter ISO code representing the country of the card (as accurately as we can determine it). + You could use this attribute to get a sense of the international breakdown of cards you've collected.
+ + +
+ cvc_check +
+
+ + + string + + + or null +
+ +
If a CVC was provided, results of the check: pass, fail, or unchecked
+ + +
+ name +
+
+ + + string + + + or null +
+ +
Cardholder name
+ + +
+ + + + + or null +
+ + +
+ delinquent +
+
+ + + boolean + + + or null +
+ +
Whether or not the latest charge for the customer's latest invoice has failed
+ + +
+ description +
+
+ + + string + + + or null +
+ + +
+ discount +
+
+ + + hash, discount object + + + or null +
+ +
Describes the current discount active on the customer, if there is one.
+ + +
+ email +
+
+ + + string + + + or null +
+ + +
+ subscription +
+
+ + + hash, subscription object + + + or null +
+ +
Hash describing the current subscription on the customer, if there is one. If the customer has no current subscription, + this will be null.
+ + +
+ + +
+
+ { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} +
+
+ +   +
+
+

Creating a New Customer

+

+ Creates a new customer object. +

+ +
Arguments
+
+
card
+
optional, default is null
+
+ A card to attach to the customer. The card can either be a token, + like the ones returned by our + Stripe.js, + or a dictionary containing a + user's credit card details, with the options described + below. Whenever you attach a card to a customer, Stripe will automatically validate the + card. A customer with a card can be used when creating a charge or put on a recurring + billing plan. + +
+
number
+
required
+
The card number, as a string without any separators.
+ +
exp_month
+
required
+
Two digit number representing the card's expiration month.
+ +
exp_year
+
required
+
Four digit number representing the card's expiration year.
+ +
cvc
+
optional, highly recommended
+
Card security code
+ +
name
+
optional
+
Cardholder's full name.
+ +
address_line1
+
optional
+ +
address_line2
+
optional
+ +
address_zip
+
optional
+ +
address_state
+
optional
+ +
address_country
+
optional
+
+
+ +
coupon
+
optional, default is null
+
+ If you provide a coupon code, the customer will have a + discount applied on all recurring charges. Charges + you create through the API will not have the discount. + You can manage your coupons in the + coupon section of your + account. +
+ +
email
+
optional, default is null
+
+ The customer's email address. It is displayed alongside + the customer in the web interface and can be useful for searching and tracking. +
+ +
description
+
optional, default is null
+
+ An arbitrary string which you can attach to a customer + object. It is displayed alongside the customer in the + web interface. +
+ +
plan
+
optional, default is null
+
+ The identifier of the plan to subscribe the customer + to. If provided, the returned customer object has a + 'subscription' attribute describing the state of the + customer's subscription. +
+ +
trial_end
+
optional, default is null
+
+ UTC integer timestamp representing the end of the trial period + the customer will get before being charged for the first time. + If set, trial_end will override the default trial period of the + plan the customer is being subscribed to. +
+
+ +
Returns
+

+ Returns a customer object if the call succeeded. The + returned object will have information about + subscriptions, discount, and cards, if that information + has been provided. If a non-free plan is specified and + a card is not provided (unless the plan has a trial period), the call will return an error. + If a non-existent plan or a non-existent or expired + coupon is provided, the call will return an error. +

+

+ If a card has been attached to the customer, the + returned customer object will have an active_card + attribute containing the card's details. +

+ +
+ +
+ POST https://api.stripe.com/v1/customers + + curl https://api.stripe.com/v1/customers \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: \ + -d "description=Customer for site@stripe.com" \ + -d "card[number]=4242424242424242" \ + -d "card[exp_month]=5" \ + -d "card[exp_year]=2013" + + + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} + + { + "error": { + "type": "invalid_request_error", + "message": "You must supply a valid card" + } +} + +
+
+ +   +
+
+

Retrieving a Customer

+

+ Retrieves the details of an existing customer. You need + only supply the unique customer identifier that was + returned upon customer creation. +

+ +

+ Like with a charge, you can view the retrieved customer + directly in your browser. +

+ +

+ https://vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE@api.stripe.com/v1/customers/ch_I7HoyUbJDACuPe +

+ +
Arguments
+
+
id
+
required
+
+ The identifier of the customer to be retrieved. +
+
+ +
Returns
+

+ Returns a customer object if a valid identifier was provided. + When requesting the ID of a customer that has been deleted, + a subset of the customer's information will be returned, + including a "deleted" property, which will be true. +

+
+ +
+ GET https://api.stripe.com/v1/customers/{CUSTOMER_ID} + + curl https://api.stripe.com/v1/customers/cus_QEvO1l6xtJNbTI \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: + + + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} + + { + "error": { + "type": "invalid_request_error", + "message": "No such customer: cus_QEvO1l6xtJNbTI" + } +} + +
+
+ +   +
+
+

Updating a Customer

+

+ Updates the specified customer by setting the values of + the parameters passed. Any parameters not provided will + be left unchanged. For example, if you pass + the card parameter, that becomes the + customer's active card which will be used for all + charges in future. +

+ +

+ This request accepts mostly the same arguments as the + customer creation call. However, subscription-related + arguments (plan and + trial_end) are not accepted. To + change those, one must + update the customer's subscription directly. +

+ +
Arguments
+

+

+
card
+
optional, default is null
+
+ A new card to attach to the customer. The card can either be a token, + like the ones returned by our + Stripe.js, + or a dictionary containing a + user's credit card details, with the options described + below. A customer with a card can be used when + creating a charge or put on a recurring billing + plan. Although not all information is required, the + extra info helps prevent fraud. + +
+
number
+
required
+
The card number, as a string without any separators.
+ +
exp_month
+
required
+
Two digit number representing the card's expiration month.
+ +
exp_year
+
required
+
Four digit number representing the card's expiration year.
+ +
cvc
+
optional, highly recommended
+
Card security code
+ +
name
+
optional
+
Cardholder's full name.
+ +
address_line1
+
optional
+ +
address_line2
+
optional
+ +
address_zip
+
optional
+ +
address_state
+
optional
+ +
address_country
+
optional
+
+
+ +
coupon
+
optional, default is null
+
+ If you provide a coupon code, the customer will have a + discount applied on all recurring charges. Charges + you create through the API will not have the discount. + You can manage your coupons in the + coupon section of your + account. +
+ +
description
+
optional, default is null
+
+ An arbitrary string which you can attach to a customer + object. It is displayed alongside the charge in the + web interface. It's often a good idea to use an + email address as a description for tracking later. +
+ +
email
+
optional
+
+ The customer's email address. It is displayed alongside + the customer in the web interface and can be useful for searching and tracking. +
+

+ +
Returns
+

+ Returns the customer object if the update succeeded. + Errors will be thrown if update parameters are invalid. + For example, specifying an invalid coupon or + an invalid card will return an error. +

+
+ +
+ POST https://api.stripe.com/v1/customers/{CUSTOMER_ID} + + curl https://api.stripe.com/v1/customers/cus_QEvO1l6xtJNbTI \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: \ + -d "description=Customer for site@stripe.com" + + + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": "Customer for site@stripe.com", + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} + + { + "error": { + "type": "invalid_request_error", + "message": "No such customer: cus_QEvO1l6xtJNbTI" + } +} + +
+
+ +   +
+
+

Deleting a Customer

+ +

Permanently deletes a customer. It cannot be undone.

+ +
Arguments
+
+
id
+
required
+
+ The identifier of the customer to be deleted. +
+
+ +
Returns
+

+ Returns an object with a deleted parameter on success. + If the customer ID does not exist, an error is returned. +

+

+ Unlike other objects, deleted customers can still be + retrieved through the API, in order to be able to track + the history of customers while still removing their + credit card details and preventing any further operations + to be performed (such as adding a new subscription). +

+
+ +
+ DELETE https://api.stripe.com/v1/customers/{CUSTOMER_ID} + + curl https://api.stripe.com/v1/customers/cus_QEvO1l6xtJNbTI \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: \ + -X DELETE + + + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 +} + + { + "error": { + "type": "invalid_request_error", + "message": "No such customer: cus_QEvO1l6xtJNbTI" + } +} + +
+
+ +   +
+
+

List all Customers

+

+ Returns a list of your customers. The customers are + returned sorted by creation date, with the most recently + created customers appearing first. +

+ +

+ Like with an individual customer, you can view the list + of customers directly in your browser. +

+ +

+ https://vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE@api.stripe.com/v1/customers +

+ +
Arguments
+
+
count
+
optional, default is 10
+
+ A limit on the number of customers to be returned. + Count can range between 1 and 100 customers. +
+ +
offset
+
optional, default is 0
+
+ An offset into your customer array. The API will + return the requested number of customers starting at + that offset. +
+
+ +
Returns
+

+ A dictionary with a data + property that contains an array of up to count customers, + starting at index offset. Each entry + in the array is a separate customer object. If no more + customers are available, the resulting array will be + empty. This request should never return an error. +

+
+ +
+ GET https://api.stripe.com/v1/customers + + curl https://api.stripe.com/v1/customers \ + -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: + + + { + data: [ + { + "discount": { + "end": 1339507966, + "start": 1336829566, + "object": "discount", + "customer": "cus_QEvO1l6xtJNbTI", + "id": "di_Ogh2mPRH0Y200d", + "coupon": { + "times_redeemed": 1, + "duration_in_months": null, + "livemode": false, + "redeem_by": null, + "object": "coupon", + "duration": "once", + "percent_off": 10, + "id": "JAVA-COUPON-fa8e8918-2f9e-4def-9675-ed19d6f4d41b", + "max_redemptions": null + } + }, + "livemode": false, + "delinquent": false, + "object": "customer", + "email": null, + "subscription": null, + "account_balance": 0, + "description": null, + "id": "cus_QEvO1l6xtJNbTI", + "active_card": null, + "created": 1336829566 + }, + {...}, + {...} + ] +} + +
+
+ + + + + + + + +
+
+ + + \ No newline at end of file diff --git a/APIFolder/apicss/apidocs.css b/APIFolder/apicss/apidocs.css new file mode 100644 index 000000000..41734b37d --- /dev/null +++ b/APIFolder/apicss/apidocs.css @@ -0,0 +1,564 @@ + +html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;} + +a img { outline: none; border: 0; } +h1 { font-size: 180%; font-weight: bold; } +h2 { font-size: 165%; font-weight: bold; } +h3 { font-size: 145%; font-weight: bold; } +h4 { font-size: 120%; font-weight: bold; } +h5 { font-size: 120%; font-weight: bold; } +h6 { font-size: 110%; font-weight: bold; } +h1, h2, h3, h4, h5, h6 { margin: 0 0 0.5em 0; line-height: 1.2em; } +p { margin: 1em 0; } +em {font-style: italic;} + +html { + background-color: rgb(240, 240, 255); +} + +body { + padding: 0; margin: 0; + font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; + font-size: 15px; + line-height: 22px; + min-width: 1000px; + background-color: gray; + border-top: 15px solid black; +} + +#flybar { + font-size: 14px; + line-height: 20px; +} + +.method-example h1, .method-example h2, .method-example h3, .method-example h4, .method-example h5, .method-example h6, #flybar, .footer { + font-family: Helvetica, Arial, sans-serif; +} + +.method-example code { + font-family: Monaco, Consolas, "Lucida Console", monospace; + font-size: 12px; + line-height: 18px; +} + +#flybar { + position: fixed; + z-index: 100; + height: 40px; + min-width: 745px; + left: 0; right: 0; top: 0; + padding-left: 560px; + background: #eee; + background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#dadada)); + background: -moz-linear-gradient(top, #f8f8f8, #dadada); + border-top: 15px solid black; + border-bottom: 1px solid #888; + -webkit-box-shadow: 0 3px 5px rgba(0,0,0,0.1); + -moz-box-shadow: 0 3px 5px rgba(0,0,0,0.1); + box-shadow: 0 3px 5px rgba(0,0,0,0.1); +} + +#nav-logo { + display: block; + height: 30px; + position: absolute; + top: 7px; + left: 10px; +} + +.flybar-button { + text-align: center; + text-transform: uppercase; + font-size: 12px; + padding: 0 1em; + line-height: 40px; + border-right: 1px solid transparent; + border-left: 1px solid transparent; + text-decoration: none; + font-weight: bold; + color: black; +} + +.flybar-nav { + display: block; + float: left; + width: 150px; + position: relative; +} + +.flybar-language { + display: block; + float: left; + position: relative; +} + +.flybar-language .flybar-button { + float: left; + clear: none; + border-right: 1px solid transparent; + border-left: 1px solid transparent; + min-width: 80px; + margin-left: -1px; +} + +.flybar-menu { + display: none; + position: absolute; + top: 41px; + + width: 500px; + background-color: rgba(249, 249, 249, 0.99); + border: 1px solid rgb(187, 187, 187); + border-top: 0; + padding: 1em; + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + -webkit-box-shadow: 0 3px 5px rgba(0,0,0,0.1); + -moz-box-shadow: 0 3px 5px rgba(0,0,0,0.1); + box-shadow: 0 3px 5px rgba(0,0,0,0.1); +} + +#toc-menu { + right: -245px; +} + +#language-menu { + left: -25px; +} + +#language-menu li { + display: inline-block; + margin-right: 25px; +} + +.flybar-menu h3 { + text-transform: uppercase; + font-size: 100%; +} + +.flybar-menu h4 { + text-transform: uppercase; + font-size: 90%; + color: rgb(155, 155, 155); + margin: 0.5em 0 0.5em 0; +} + +.flybar-menu ul { + margin: 0 0 1em 1em; +} + +.flybar-nav:hover .flybar-menu, +.flybar-nav.active .flybar-menu { + display: block; +} + +.flybar-button:hover, +.flybar-button.active, +.flybar-nav:hover .flybar-button, +.flybar-nav.active .flybar-button { + background: #eee; + background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#f8f8f8)); + background: -moz-linear-gradient(top, #eee, #f8f8f8); + border-left: 1px solid rgb(187, 187, 187); + border-right: 1px solid rgb(187, 187, 187); +} + +.flybar-nav:hover .flybar-menu,, +.flybar-button.active { + margin-right: -1px; +} + +.flybar-nav:hover .flybar-button, +.flybar-nav.active .flybar-button { + height: 51px; + color: #000; + background: -webkit-gradient(linear, left top, left bottom, from(#e5e5e5), to(#fff)); + background: -moz-linear-gradient(top, #e5e5e5, #fff); +} + +.toc-column1 { + width: 180px; +} + +.toc-column2 { + width: 205px; +} + +.toc-column1, .toc-column2, .toc-column3, .toc-column4, .toc-column5, .toc-column6 { + float: left; +} + +.toc-section { + width: 235px; + font-size: 90%; +} + +#toc-menu-button { + border-right: 1px solid #bbb; +} + +code { + white-space: pre; + white-space: -o-pre-wrap; + white-space: -moz-pre-wrap; + white-space: pre-wrap; + display: block; + margin: 1em 0; + line-height: 1.5em; +} + +.method-section { + clear: left; + padding: 1em 0; + padding-top: 60px; + margin-left: -580px; +} + +.method-section:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; +} + +.method-description { + width: 540px; + float: left; + padding-right: 20px; + color: black; +} + +.method-description p { +} + +h1 { + text-transform: uppercase; +} + +.method-description h4 { + /*font-family: monospace;*/ +} + +.method-description h5 { + font-size: 110%; + color: rgb(155, 155, 155); + text-transform: uppercase; + clear: both; + padding: 0.5em 0; +} + +.method-example { + margin-left: 560px; + padding-left: 20px; + min-width: 380px; +} + +.method-example code { + white-space: pre; + white-space: -o-pre-wrap; + white-space: -moz-pre-wrap; + white-space: pre-wrap; +} + +.method-example { + color: rgb(105, 105, 125); +} + +.method-example p { + font-style: italic; + color: rgb(105, 105, 105); +} + +.method-error:before { + content: "EXAMPLE ERROR"; + color: rgb(155, 155, 185); + display: block; +} + +.method-declaration:before { + content: "DEFINITION"; + color: rgb(155, 155, 185); + display: block; +} + +.method-request:before { + content: "EXAMPLE REQUEST"; + color: rgb(155, 155, 185); + display: block; +} + +.method-response:before { + content: "EXAMPLE RESPONSE"; + color: rgb(155, 155, 185); + display: block; +} + +.expected-result:before { + content: "RESULT"; + color: rgb(155, 155, 185); + display: block; +} + +.method-response, .method-error { + font-size: 90%; +} + +.method-example li { + font-family: monospace; + color: black; +} + +.method-example ul { + margin: 1em 0; +} + +.method-example table { + font-family: monospace; + color: black; +} + +.method-example td { + padding-right: 20px; + padding-bottom: 5px; + vertical-align: top; +} +.method-example table th { + font-weight: bold; +} + +.method-example code { + color: black; +} + +.prompt:after { + content: '$ '; + color: gray; + display: block; +} + +.prompt.curl:after { content: '$ '; } +.prompt.ruby:after { content: '>> ' } +.prompt.python:after { content: '>>> ' } +.prompt.php:after { content: 'php > ' } +.prompt.java:after { content: '' } + +.method-name { + font-family: monospace; + font-weight: bold; +} + +.notification-request:before { + content: "EXAMPLE NOTIFICATION"; + color: rgb(155, 155, 185); + display: block; +} + +.notification-event:before { + content: "EVENT"; + color: rgb(155, 155, 185); + display: block; +} + + +#page-wrapper { + background-color: white; + color: black; +} + +#main-content-wrapper { + background-color: rgb(240, 240, 255); + + margin-left: 579px; + padding: 0 20px 40px 20px; + border-left: 1px solid rgb(229, 229, 238); +} + +#api-summary-example { + margin-top: 48px; +} + +.argument-list { + font-size: 90%; + line-height: 1.5em; +} + +.argument-list dl { + font-size: 95%; + padding: 1em 0; + line-height: 1.5em; +} + +.argument-list:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; +} + +.argument-list dl:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; +} + +.argument-list dt { + clear:both; + width:34%; + float:left; + text-align:right; + font-weight: bold; + margin-top: 8px; +} + +.event-types.argument-list dt { + width: 48%; +} + +.event-types.argument-list dd { + width: 48%; +} + +.argument-list dt:after { + content: ":"; +} + +.argument-list dd { + float:right; + width: 65%; +} + +.argument-list dl dd { + width: 65%; +} + +.argument-list dt + dd { + margin-top: 8px; + font-weight: bold; +} + +.argument-list dd dl dd dl { + width: 95%; +} + +.argument-list dd dl dd dl dd { + width: 65%; +} +.argument-list dd dl dd dl dt { + width:31%; +} + +.argument-list dd span { + font-style: italic; + font-weight: normal; +} + +.old-syle-anchor {display:block;height:0;width:0;} +strong { font-weight: bold; } + +.footer { + position: fixed; + bottom: 0; + height: 30px; + + border-top: 1px solid #ccc; + background: #eee; + background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#dadada)); + background: -moz-linear-gradient(top, #f8f8f8, #dadada); + + width: 100%; + opacity: 0.95; + font-size: 13px; +} + +.footer input[type="text"] { + height: 14px; + padding: 3px; + border: 1px solid #aaa; + border-radius: 4px; +} + +.suggestion-box { + float: right; + padding-top: 3px; + padding-right: 10px; +} + +.footer input[type="submit"]:hover { + background: -webkit-gradient( + linear, + center top, + center bottom, + from(#fefefe), + to(#dbdbdb), + color-stop(80%, #eeeeee), + color-stop(0%, #eeeeee) + ); + background: -moz-linear-gradient( + top, + #fff, + #fff + ); +} + +.footer input[type="submit"]:active { + background: -webkit-gradient( + linear, + center top, + center bottom, + from(#c0c0c0), + to(#fefefe), + color-stop(0%, #e1e1e1), + color-stop(30%, #eeeeee), + color-stop(80%, #fff) + ); + background: -moz-linear-gradient( + top, + #c0c0c0, + #fefefe + ); + + border: 1px solid #a3a3a3; +} + +.footer input[type="submit"] { + height: 22px; + padding: 3px; + font-size: 13px; + + font-family: "proxima-nova-1","proxima-nova-2", Helvetica, Arial, sans-serif; + color: #454545; + text-shadow: 0px 1px 0px #fff; + text-align: center; + + border: 1px solid #aaa; + background: -webkit-gradient( + linear, + center top, + center bottom, + from(#fefefe), + to(#dbdbdb), + color-stop(50%, #eeeeee) + ); + background: -moz-linear-gradient( + top, + #fefefe, + #dbdbdb + ); + + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -webkit-background-clip: padding-box; + -webkit-backface-visibility: hidden; +} + +.stripe-version { + float: left; +} diff --git a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/stretchyreporting/stretchyreporting-0.967.js b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/stretchyreporting/stretchyreporting-0.968.js similarity index 91% rename from mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/stretchyreporting/stretchyreporting-0.967.js rename to mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/stretchyreporting/stretchyreporting-0.968.js index d1d17152e..56462db0e 100644 --- a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/stretchyreporting/stretchyreporting-0.967.js +++ b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/static/stretchyreporting/stretchyreporting-0.968.js @@ -166,8 +166,8 @@ function initialiseReporting(params) { if (params.reportQuery) reportQuery = params.reportQuery; - var theParams = {Name: reportQuery, Type: 'parameter'}; - getReportData(theParams, setupReportListSuccess) + var theParams = {Type: 'parameter'}; + getReportData(reportQuery, theParams, setupReportListSuccess) } function setCurrentDate() { @@ -435,9 +435,7 @@ function runTheReport() return; } - var theParams; - if ((reportListing[reportListingIndex].type == 'Pentaho')) theParams = {pentahoReportName: reportListing[reportListingIndex].name, Type: 'report'} - else theParams = {Name: reportListing[reportListingIndex].name, Type: 'report'}; + var theParams = {Type: 'report'}; var pValue; var reportParameterName; @@ -471,14 +469,14 @@ function runTheReport() switch(reportListing[reportListingIndex].type) { case "Table": - if (showOption == "XLS") getExportCSV(theParams) + if (showOption == "XLS") getExportCSV(selectedRpt, theParams) else { reportDataSuccess = function(data, textStatus, jqXHR){ createTable(data); showTableReport(); }; - getReportData(theParams, reportDataSuccess); + getReportData(selectedRpt, theParams, reportDataSuccess); } break; case "Chart": @@ -487,10 +485,10 @@ function runTheReport() createChart(data); showChartReport(reportListing[reportListingIndex].subtype); }; - getReportData(theParams, reportDataSuccess); + getReportData(selectedRpt, theParams, reportDataSuccess); break; case "Pentaho": - getPentahoReport(theParams); + getPentahoReport(selectedRpt, theParams); break; default: @@ -581,8 +579,8 @@ var parameterTableHtml = ''; eval(generateSelectSuccessVariable(listOfParameters[i].name, listOfParameters[i].label, selectOne, selectAll)); - var theParams = {Name: listOfParameters[i].name, Type: 'parameter'}; - getReportData(theParams, selectSuccess) + var theParams = {Type: 'parameter'}; + getReportData(listOfParameters[i].name, theParams, selectSuccess) } } @@ -614,8 +612,8 @@ setupParameterListSuccess = function(data, textStatus, jqXHR){ setupReportListSuccess = function(data, textStatus, jqXHR){ showMsgE("In setupReportListSuccess"); - theParams = {Name: 'FullParameterList', Type: 'parameter'}; - getReportData(theParams, setupParameterListSuccess); + theParams = {Type: 'parameter'}; + getReportData('FullParameterList', theParams, setupParameterListSuccess); var prevId = -1; var currId; @@ -672,8 +670,8 @@ setupReportListSuccess = function(data, textStatus, jqXHR){ function copyXLSon() { showMsg("Turning them on"); - $('#ToolTables_FRshowTable_0').css('display', 'inline'); - $('#ToolTables_FRshowTable_1').css('display', 'inline'); + $('#ToolTables_RshowTable_0').css('display', 'inline'); + $('#ToolTables_RshowTable_1').css('display', 'inline'); ttInstances = TableTools.fnGetMasters(); for (i in ttInstances) { ttInstances[i].that.fnResizeButtons(); @@ -684,8 +682,8 @@ function copyXLSon() { function copyXLSoff() { showMsg("Turning them off"); - $('#ToolTables_FRshowTable_0').css('display', 'none'); - $('#ToolTables_FRshowTable_1').css('display', 'none'); + $('#ToolTables_RshowTable_0').css('display', 'none'); + $('#ToolTables_RshowTable_1').css('display', 'none'); filteredCopyXLSon = false; } @@ -768,22 +766,22 @@ return 'var selectSuccess = function(data, textStatus,jqXHR){' + function createChart(theData) { - FRData = new google.visualization.DataTable(); - FRData.addColumn('string', dataTableDef.aoColumns[0].sTitle); - FRData.addColumn('number', dataTableDef.aoColumns[1].sTitle); - FRData.addRows(dataTableDef.aaData.length); + RData = new google.visualization.DataTable(); + RData.addColumn('string', dataTableDef.aoColumns[0].sTitle); + RData.addColumn('number', dataTableDef.aoColumns[1].sTitle); + RData.addRows(dataTableDef.aaData.length); var ii = 0; var numberData; var dblQuotePos; for (var i in dataTableDef.aaData) { - FRData.setValue(ii, 0, dataTableDef.aaData[i][0]); + RData.setValue(ii, 0, dataTableDef.aaData[i][0]); if (dataTableDef.aoColumns[1].sType == "title-numeric" && dataTableDef.aaData[i][1].substr(0, 11) == '
' ); - oTable = $('#FRshowTable').dataTable(dataTableDef); + $('#StretchyReportOutput').html( '
' ); + oTable = $('#RshowTable').dataTable(dataTableDef); oSettings = oTable.fnSettings(); showMsg("1st recs displayed is: " + fnRecordsDisplay()); @@ -901,17 +899,17 @@ function showTableReport() { function showChartReport(rptSubType) { /* * $('#StretchyReportOutput').html( '
' ); - * $('#FRshowTable').dataTable(dataTableDef); + * id=RshowChart>' ); + * $('#RshowTable').dataTable(dataTableDef); */ - $('#StretchyReportOutput').html( '
' ); + $('#StretchyReportOutput').html( '
' ); var options; -var FRchart; +var Rchart; switch(rptSubType) { @@ -922,8 +920,8 @@ var FRchart; // chartArea: {left:0,top:0, width:"100%",height:"100%"} }; - FRchart = new google.visualization.PieChart(document.getElementById('FRshowChart')); - FRchart.draw(FRData, options); + Rchart = new google.visualization.PieChart(document.getElementById('RshowChart')); + Rchart.draw(RData, options); break; case "Bar": options = { @@ -933,8 +931,8 @@ var FRchart; // chartArea: {left:0,top:0, width:"100%",height:"100%"} }; - FRchart = new google.visualization.BarChart(document.getElementById('FRshowChart')); - FRchart.draw(FRData, options); + Rchart = new google.visualization.BarChart(document.getElementById('RshowChart')); + Rchart.draw(RData, options); break; default: alert("System Error: Unknown Chart Type: " + rptSubType); @@ -945,9 +943,9 @@ var FRchart; /* - * var FRchart = new - * google.visualization.PieChart(document.getElementById('FRshowChart')); - * FRchart.draw(FRData, {legend: 'right', is3D: true, width: 400, height: 500, + * var Rchart = new + * google.visualization.PieChart(document.getElementById('RshowChart')); + * Rchart.draw(RData, {legend: 'right', is3D: true, width: 400, height: 500, * chartArea: {left:0,top:0, width:"100%",height:"100%"}}); */ /* @@ -960,7 +958,7 @@ var FRchart; * dataTableDef.aaData[i][1]}); } * * - * var FRchart = new Highcharts.Chart({ chart: { renderTo: 'FRshowChart', + * var Rchart = new Highcharts.Chart({ chart: { renderTo: 'RshowChart', * defaultSeriesType: 'bar' }, title: { text: 'Historic World Population by * Region' }, xAxis: { categories: chartCategories, title: { text: null } }, * yAxis: { min: -5000000, title: { text: 'Population (millions)', align: 'high' } }, @@ -975,17 +973,17 @@ var FRchart; } -function getReportData(inParams, successFunction) { - if (isAuthRequest == true) getReportDataAuth(inParams, successFunction) - else getReportDataNoAuth(inParams, successFunction); +function getReportData(rptName, inParams, successFunction) { + if (isAuthRequest == true) getReportDataAuth(rptName, inParams, successFunction) + else getReportDataNoAuth(rptName, inParams, successFunction); } -function getReportDataAuth(inParams, successFunction) { - +function getReportDataAuth(rptName, inParams, successFunction) { +alert("needs fixing up, dont rely on data") var inQueryParameters = {}; - for (var i in inParams ) inQueryParameters["FR_" + i] = inParams[i]; - if (rptDB > "") inQueryParameters["FR_rptDB"] = rptDB; + for (var i in inParams ) inQueryParameters["R_" + i] = inParams[i]; + if (rptDB > "") inQueryParameters["R_rptDB"] = rptDB; OAuthSimple().reset(); var OAuthProcess = (new OAuthSimple()).sign({ @@ -1029,24 +1027,24 @@ function buildReportParms(inParams) { for (var i in inParams ) { if (paramCount > 1) reportParams += "&" - reportParams += encodeURIComponent("FR_" + i) + "=" + encodeURIComponent(inParams[i]); + reportParams += encodeURIComponent("R_" + i) + "=" + encodeURIComponent(inParams[i]); paramCount = paramCount + 1; } if (rptDB > "") { if (paramCount > 1) reportParams += "&" - reportParams = encodeURIComponent("FR_rptDB") + "=" + encodeURIComponent(rptDB); + reportParams = encodeURIComponent("R_rptDB") + "=" + encodeURIComponent(rptDB); } return reportParams } -function getReportDataNoAuth(inParams, successFunction) { +function getReportDataNoAuth(rptName, inParams, successFunction) { var inQueryParameters = buildReportParms(inParams); showMsgE("getReportDataNoAuth: " + inQueryParameters); $.ajax({ - url: RESTUrl, + url: RESTUrl + "/" + rptName, type:'GET', dataType: 'json', data: inQueryParameters, @@ -1068,10 +1066,13 @@ function getReportDataNoAuth(inParams, successFunction) { } -function getExportCSV(inParams) { +function getExportCSV(rptName, inParams) { var inQueryParameters = buildReportParms(inParams); - var fullExportUrl = RESTUrl + "?" + inQueryParameters + "&exportCSV=true"; + if (inQueryParameters > "") inQueryParameters = "?" + inQueryParameters + "&exportCSV=true" + else inQueryParameters = "?exportCSV=true" + + var fullExportUrl = RESTUrl + "/" + rptName + inQueryParameters; showMsg("full export url: " + fullExportUrl); var loadHTML = ''; @@ -1081,8 +1082,9 @@ function getExportCSV(inParams) { } -function getPentahoReport(inParams) { - +function getPentahoReport(rptName, inParams) { +//todo + var currentReportName = inparams.name; //remember to include this when doing pentaho example var inQueryParameters = "?output-type=" + $('#rptOutputType option:selected').val(); // var paramCount = 1; for (var i in inParams ) diff --git a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/common-head-stretchyreporting.jsp b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/common-head-stretchyreporting.jsp index de3a78e7a..a5c20fe15 100644 --- a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/common-head-stretchyreporting.jsp +++ b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/common-head-stretchyreporting.jsp @@ -16,6 +16,6 @@ - + diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/ReportingApiResource.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/ReportingApiResource.java index 30b17f86e..fe47c06c8 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/ReportingApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/ReportingApiResource.java @@ -7,6 +7,7 @@ import java.util.Set; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; @@ -35,14 +36,14 @@ public class ReportingApiResource { private ReadExtraDataAndReportingService ReadExtraDataAndReportingService; @GET + @Path("{reportName}") @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, "application/x-msdownload" }) - public Response retrieveReport(@Context UriInfo uriInfo) { + public Response retrieveReport(@PathParam("reportName") final String reportName, @Context UriInfo uriInfo) { MultivaluedMap queryParams = uriInfo .getQueryParameters(); - String name = queryParams.getFirst("FR_Name"); - String type = queryParams.getFirst("FR_Type"); + String type = queryParams.getFirst("R_Type"); String exportCSV = queryParams.getFirst("exportCSV"); Map extractedQueryParams = new HashMap(); @@ -52,29 +53,29 @@ public class ReportingApiResource { String pValue; for (String k : keys) { - if (k.startsWith("FR_")) { - pKey = "${" + k.substring(3) + "}"; + if (k.startsWith("R_")) { + pKey = "${" + k.substring(2) + "}"; pValue = queryParams.get(k).get(0); extractedQueryParams.put(pKey, pValue); } } - logger.info("BEGINNING REQUEST FOR: " + name); + logger.info("BEGINNING REQUEST FOR: " + reportName); if ((exportCSV == null) || (!(exportCSV.equalsIgnoreCase("true")))) { GenericResultset result = this.ReadExtraDataAndReportingService - .retrieveGenericResultset(name, type, extractedQueryParams); + .retrieveGenericResultset(reportName, type, extractedQueryParams); return Response.ok().entity(result).build(); } StreamingOutput result = this.ReadExtraDataAndReportingService - .retrieveReportCSV(name, type, extractedQueryParams); + .retrieveReportCSV(reportName, type, extractedQueryParams); return Response .ok() .entity(result) .header("Content-Disposition", - "attachment;filename=" + name.replaceAll(" ", "") + "attachment;filename=" + reportName.replaceAll(" ", "") + ".csv").build(); }