export interface AutomaticReloadPaymentSummaryItem { label: string; amount: number; thresholdAmount: number; } export interface AutomaticReloadPaymentRequest { paymentDescription: string; automaticReloadBilling: AutomaticReloadPaymentSummaryItem; billingAgreement?: string; managementURL: string; tokenNotificationURL?: string; } export function automaticReloadPaymentSummaryItemFromJson( json: { [key: string]: any } ): AutomaticReloadPaymentSummaryItem { return { label: json.label, amount: json.amount, thresholdAmount: json.threshold_amount, }; } export function automaticReloadPaymentSummaryItemToJson( item: AutomaticReloadPaymentSummaryItem ): { [key: string]: any } { return { label: item.label, amount: item.amount, threshold_amount: item.thresholdAmount, }; } export function automaticReloadPaymentRequestFromJson( json: { [key: string]: any } ): AutomaticReloadPaymentRequest { return { paymentDescription: json.payment_description, automaticReloadBilling: automaticReloadPaymentSummaryItemFromJson(json.automatic_reload_billing), managementURL: json.management_url, billingAgreement: json.billing_agreement, tokenNotificationURL: json.token_notification_url, }; } export function automaticReloadPaymentRequestToJson( request: AutomaticReloadPaymentRequest ): { [key: string]: any } { return { payment_description: request.paymentDescription, automatic_reload_billing: automaticReloadPaymentSummaryItemToJson( request.automaticReloadBilling ), management_url: request.managementURL, billing_agreement: request.billingAgreement, token_notification_url: request.tokenNotificationURL, }; }