Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "processout.js",
"version": "1.6.7",
"version": "1.7.0",
"description": "ProcessOut.js is a JavaScript library for ProcessOut's payment processing API.",
"scripts": {
"build:processout": "tsc -p src/processout && uglifyjs --compress --keep-fnames --ie8 dist/processout.js -o dist/processout.js",
Expand Down
41 changes: 41 additions & 0 deletions src/processout/processout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ interface CardInformation {
type: string
}

interface InstallmentPlan {
id: string
name: string
description: string
number_of_installments: number
}

interface FetchInstallmentPlansResponse {
installment_plans: InstallmentPlan[]
success: boolean
}

/**
* ProcessOut module/namespace
*/
Expand Down Expand Up @@ -1669,6 +1681,34 @@ module ProcessOut {
)
}

/**
* Fetch active installment plans for the project
* @param {callback} success
* @param {callback} error
* @return {void}
*/
public fetchActiveInstallmentPlans(
success: (data: FetchInstallmentPlansResponse) => void,
error: (err: Exception) => void,
): void {
this.apiRequest(
"GET",
"installment-plans/active",
{},
function (data: any, req: XMLHttpRequest, e: Event): void {
if (!data.success) {
error(new Exception(data.error_type, data.message))
return
}

success(data)
},
function (req: XMLHttpRequest, e: Event, errorCode: ApiRequestError): void {
error(new Exception(errorCode))
},
)
}

protected handleCardActions(
method: string,
endpoint: string,
Expand Down Expand Up @@ -1720,6 +1760,7 @@ module ProcessOut {
preferred_scheme: options.preferred_scheme,
preferred_card_type: options.preferred_card_type,
split_allocations: options.split_allocations,
installment_plan_id: options.installment_plan_id,
}
payload = this.injectDeviceData(payload)

Expand Down