type Stripe = {
token: string;
};
/**
* Post issuing disputes dispute
* Updates the specified Issuing Dispute object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Properties on the evidence object can be unset by passing in an empty string.
*/
export async function main(
auth: Stripe,
dispute: string,
body: {
amount?: number;
evidence?: {
canceled?:
| {
additional_documentation?: string | "";
canceled_at?: number | "";
cancellation_policy_provided?: boolean | "";
cancellation_reason?: string | "";
expected_at?: number | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
return_status?: "" | "merchant_rejected" | "successful";
returned_at?: number | "";
[k: string]: unknown;
}
| "";
duplicate?:
| {
additional_documentation?: string | "";
card_statement?: string | "";
cash_receipt?: string | "";
check_image?: string | "";
explanation?: string | "";
original_transaction?: string;
[k: string]: unknown;
}
| "";
fraudulent?:
| {
additional_documentation?: string | "";
explanation?: string | "";
[k: string]: unknown;
}
| "";
merchandise_not_as_described?:
| {
additional_documentation?: string | "";
explanation?: string | "";
received_at?: number | "";
return_description?: string | "";
return_status?: "" | "merchant_rejected" | "successful";
returned_at?: number | "";
[k: string]: unknown;
}
| "";
not_received?:
| {
additional_documentation?: string | "";
expected_at?: number | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
[k: string]: unknown;
}
| "";
other?:
| {
additional_documentation?: string | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
[k: string]: unknown;
}
| "";
reason?:
| "canceled"
| "duplicate"
| "fraudulent"
| "merchandise_not_as_described"
| "not_received"
| "other"
| "service_not_as_described";
service_not_as_described?:
| {
additional_documentation?: string | "";
canceled_at?: number | "";
cancellation_reason?: string | "";
explanation?: string | "";
received_at?: number | "";
[k: string]: unknown;
}
| "";
[k: string]: unknown;
};
expand?: string[];
metadata?: { [k: string]: string } | "";
}
) {
const url = new URL(`https://api.stripe.com/v1/issuing/disputes/${dispute}`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: encodeParams(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
function encodeParams(o: any) {
function iter(o: any, path: string) {
if (Array.isArray(o)) {
o.forEach(function (a) {
iter(a, path + "[]");
});
return;
}
if (o !== null && typeof o === "object") {
Object.keys(o).forEach(function (k) {
iter(o[k], path + "[" + k + "]");
});
return;
}
data.push(path + "=" + o);
}
const data: string[] = [];
Object.keys(o).forEach(function (k) {
if (o[k] !== undefined) {
iter(o[k], k);
}
});
return new URLSearchParams(data.join("&"));
}
Submitted by hugo697 368 days ago
type Stripe = {
token: string;
};
/**
* Post issuing disputes dispute
* Updates the specified Issuing Dispute object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Properties on the evidence object can be unset by passing in an empty string.
*/
export async function main(
auth: Stripe,
dispute: string,
body: {
amount?: number;
evidence?: {
canceled?:
| {
additional_documentation?: string | "";
canceled_at?: number | "";
cancellation_policy_provided?: boolean | "";
cancellation_reason?: string | "";
expected_at?: number | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
return_status?: "" | "merchant_rejected" | "successful";
returned_at?: number | "";
[k: string]: unknown;
}
| "";
duplicate?:
| {
additional_documentation?: string | "";
card_statement?: string | "";
cash_receipt?: string | "";
check_image?: string | "";
explanation?: string | "";
original_transaction?: string;
[k: string]: unknown;
}
| "";
fraudulent?:
| {
additional_documentation?: string | "";
explanation?: string | "";
[k: string]: unknown;
}
| "";
merchandise_not_as_described?:
| {
additional_documentation?: string | "";
explanation?: string | "";
received_at?: number | "";
return_description?: string | "";
return_status?: "" | "merchant_rejected" | "successful";
returned_at?: number | "";
[k: string]: unknown;
}
| "";
not_received?:
| {
additional_documentation?: string | "";
expected_at?: number | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
[k: string]: unknown;
}
| "";
other?:
| {
additional_documentation?: string | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
[k: string]: unknown;
}
| "";
reason?:
| "canceled"
| "duplicate"
| "fraudulent"
| "merchandise_not_as_described"
| "not_received"
| "other"
| "service_not_as_described";
service_not_as_described?:
| {
additional_documentation?: string | "";
canceled_at?: number | "";
cancellation_reason?: string | "";
explanation?: string | "";
received_at?: number | "";
[k: string]: unknown;
}
| "";
[k: string]: unknown;
};
expand?: string[];
metadata?: { [k: string]: string } | "";
}
) {
const url = new URL(`https://api.stripe.com/v1/issuing/disputes/${dispute}`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: encodeParams(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
function encodeParams(o: any) {
function iter(o: any, path: string) {
if (Array.isArray(o)) {
o.forEach(function (a) {
iter(a, path + "[]");
});
return;
}
if (o !== null && typeof o === "object") {
Object.keys(o).forEach(function (k) {
iter(o[k], path + "[" + k + "]");
});
return;
}
data.push(path + "=" + o);
}
const data: string[] = [];
Object.keys(o).forEach(function (k) {
if (o[k] !== undefined) {
iter(o[k], k);
}
});
return new URLSearchParams(data.join("&"));
}
Submitted by hugo697 795 days ago
type Stripe = {
token: string;
};
/**
* Post issuing disputes dispute
* <p>Updates the specified Issuing <code>Dispute</code> object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Properties on the <code>evidence</code> object can be unset by passing in an empty string.</p>
*/
export async function main(
auth: Stripe,
dispute: string,
body: {
amount?: number;
evidence?: {
canceled?:
| {
additional_documentation?: string | "";
canceled_at?: number | "";
cancellation_policy_provided?: boolean | "";
cancellation_reason?: string | "";
expected_at?: number | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
return_status?: "" | "merchant_rejected" | "successful";
returned_at?: number | "";
[k: string]: unknown;
}
| "";
duplicate?:
| {
additional_documentation?: string | "";
card_statement?: string | "";
cash_receipt?: string | "";
check_image?: string | "";
explanation?: string | "";
original_transaction?: string;
[k: string]: unknown;
}
| "";
fraudulent?:
| {
additional_documentation?: string | "";
explanation?: string | "";
[k: string]: unknown;
}
| "";
merchandise_not_as_described?:
| {
additional_documentation?: string | "";
explanation?: string | "";
received_at?: number | "";
return_description?: string | "";
return_status?: "" | "merchant_rejected" | "successful";
returned_at?: number | "";
[k: string]: unknown;
}
| "";
not_received?:
| {
additional_documentation?: string | "";
expected_at?: number | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
[k: string]: unknown;
}
| "";
other?:
| {
additional_documentation?: string | "";
explanation?: string | "";
product_description?: string | "";
product_type?: "" | "merchandise" | "service";
[k: string]: unknown;
}
| "";
reason?:
| "canceled"
| "duplicate"
| "fraudulent"
| "merchandise_not_as_described"
| "not_received"
| "other"
| "service_not_as_described";
service_not_as_described?:
| {
additional_documentation?: string | "";
canceled_at?: number | "";
cancellation_reason?: string | "";
explanation?: string | "";
received_at?: number | "";
[k: string]: unknown;
}
| "";
[k: string]: unknown;
};
expand?: string[];
metadata?: { [k: string]: string } | "";
}
) {
const url = new URL(`https://api.stripe.com/v1/issuing/disputes/${dispute}`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: encodeParams(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
function encodeParams(o: any) {
function iter(o: any, path: string) {
if (Array.isArray(o)) {
o.forEach(function (a) {
iter(a, path + "[]");
});
return;
}
if (o !== null && typeof o === "object") {
Object.keys(o).forEach(function (k) {
iter(o[k], path + "[" + k + "]");
});
return;
}
data.push(path + "=" + o);
}
const data: string[] = [];
Object.keys(o).forEach(function (k) {
if (o[k] !== undefined) {
iter(o[k], k);
}
});
return new URLSearchParams(data.join("&"));
}
Submitted by hugo697 922 days ago