export type AppStoreReceipt = {downgradeProductId?: string | undefined, isDowngradeCancellation?: string | undefined, productId?: string | undefined, receiptData?: string | undefined}; export type Province = {isoCode?: string | undefined, name?: string | undefined}; export type Country = {isoCode?: string | undefined, name?: string | undefined, provinces?: Array | undefined, provinceValidated?: string | undefined}; export type AccountAddress = {address1?: string | undefined, address2?: string | undefined, city?: string | undefined, country?: string | undefined, email?: string | undefined, fax?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, phone?: string | undefined, postalCode?: string | undefined, state?: string | undefined, supportedCountries?: Array | undefined}; export type AddressInformation = {address1?: string | undefined, address2?: string | undefined, city?: string | undefined, country?: string | undefined, fax?: string | undefined, phone?: string | undefined, postalCode?: string | undefined, stateOrProvince?: string | undefined, zipPlus4?: string | undefined}; export type CreditCardInformation = {address?: AddressInformation | undefined, cardLastDigits?: string | undefined, cardNumber?: string | undefined, cardType?: string | undefined, cvNumber?: string | undefined, expirationMonth?: string | undefined, expirationYear?: string | undefined, nameOnCard?: string | undefined, tokenizedCard?: string | undefined}; export type DirectDebitProcessorInformation = {bankBranchCode?: string | undefined, bankCheckDigit?: string | undefined, bankCode?: string | undefined, bankName?: string | undefined, bankTransferAccountName?: string | undefined, bankTransferAccountNumber?: string | undefined, bankTransferType?: string | undefined, country?: string | undefined, email?: string | undefined, firstName?: string | undefined, iBAN?: string | undefined, lastName?: string | undefined}; export type PaymentProcessorInformation = {address?: AddressInformation | undefined, billingAgreementId?: string | undefined, email?: string | undefined}; export type AddOn = {active?: string | undefined, addOnId?: string | undefined, id?: string | undefined, name?: string | undefined}; export type CurrencyFeatureSetPrice = {currencyCode?: string | undefined, currencySymbol?: string | undefined, envelopeFee?: string | undefined, fixedFee?: string | undefined, seatFee?: string | undefined}; export type FeatureSet = {currencyFeatureSetPrices?: Array | undefined, envelopeFee?: string | undefined, featureSetId?: string | undefined, fixedFee?: string | undefined, is21CFRPart11?: string | undefined, isActive?: string | undefined, isEnabled?: string | undefined, name?: string | undefined, seatFee?: string | undefined}; export type RecipientDomain = {active?: string | undefined, domainCode?: string | undefined, domainName?: string | undefined, recipientDomainId?: string | undefined}; export type PlanInformation = {addOns?: Array | undefined, currencyCode?: string | undefined, freeTrialDaysOverride?: string | undefined, planFeatureSets?: Array | undefined, planId?: string | undefined, recipientDomains?: Array | undefined}; export type ReferralInformation = {advertisementId?: string | undefined, enableSupport?: string | undefined, externalOrgId?: string | undefined, groupMemberId?: string | undefined, idType?: string | undefined, includedSeats?: string | undefined, industry?: string | undefined, planStartMonth?: string | undefined, promoCode?: string | undefined, publisherId?: string | undefined, referralCode?: string | undefined, referrerName?: string | undefined, saleDiscountAmount?: string | undefined, saleDiscountFixedAmount?: string | undefined, saleDiscountPercent?: string | undefined, saleDiscountPeriods?: string | undefined, saleDiscountSeatPriceOverride?: string | undefined, shopperId?: string | undefined}; export type BillingPlanInformation = {appStoreReceipt?: AppStoreReceipt | undefined, billingAddress?: AccountAddress | undefined, creditCardInformation?: CreditCardInformation | undefined, directDebitProcessorInformation?: DirectDebitProcessorInformation | undefined, downgradeReason?: string | undefined, enablePreAuth?: string | undefined, enableSupport?: string | undefined, includedSeats?: string | undefined, incrementalSeats?: string | undefined, paymentMethod?: string | undefined, paymentProcessor?: string | undefined, paymentProcessorInformation?: PaymentProcessorInformation | undefined, planInformation?: PlanInformation | undefined, processPayment?: string | undefined, referralInformation?: ReferralInformation | undefined, renewalStatus?: string | undefined, saleDiscountAmount?: string | undefined, saleDiscountFixedAmount?: string | undefined, saleDiscountPercent?: string | undefined, saleDiscountPeriods?: string | undefined, saleDiscountSeatPriceOverride?: string | undefined, taxExemptId?: string | undefined}; export type UpdateApiV21AccountsAccountIdBillingPlanArgs = {accountId: string, preview_billing_plan?: string | undefined, body: BillingPlanInformation}; export type UpdateApiV21AccountsAccountIdBillingPlanOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates an account billing plan. * * PUT /v2.1/accounts/{accountId}/billing_plan */ export const updateApiV21AccountsAccountIdBillingPlan = async (args: UpdateApiV21AccountsAccountIdBillingPlanArgs, options?: UpdateApiV21AccountsAccountIdBillingPlanOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.preview_billing_plan != null) query.append("preview_billing_plan", String(args.preview_billing_plan)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/billing_plan${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };