@arc-publishing/sdk-sales
Version:
JS Sales SDK for working with Arc Subs Sales API
119 lines (118 loc) • 3.63 kB
TypeScript
import { APIErrorResponse } from '@arc-publishing/sdk-subs-core/lib/utils/APIErrorResponse';
export type SubscriptionStatuses = 1 | 2 | 3 | 4 | 5 | 6 | 7;
export interface Subscription {
subscriptionID: number;
sku: string;
nextEventDateUTC: number;
subscriptionType: number;
status: SubscriptionStatuses;
events: Array<SubscriptionEvent>;
salesOrders?: Array<SalesOrder>;
paymentHistory?: Array<Payment>;
productName: string;
priceCode: string;
currentPaymentMethod: PaymentMethod;
clientID: string;
billingAddress: Address;
}
export interface SubscriptionSummary {
subscriptionID: number;
status: SubscriptionStatuses;
paymentMethod?: PaymentMethod | null;
productName?: string | null;
sku?: string | null;
}
export interface SubscriptionSummaryAddress {
subscriptionID: number;
status: SubscriptionStatuses;
paymentMethod?: PaymentMethod | null;
productName?: string | null;
sku?: string | null;
billingAddress?: Address;
}
export interface SubscriptionSummaryAPIResponse {
subscriptionID: number;
statusID: SubscriptionStatuses;
paymentMethod?: PaymentMethod | null;
productName?: string | null;
sku?: string | null;
}
export type Subscriptions = Array<Subscription | SubscriptionSummary>;
export interface CanceledSubscription {
subscriptionID: number;
status: 3;
}
export interface SharingDetails {
numSharesAllowed: number | null;
sharedSubscriptions: Array<AssociateInfo>;
}
export interface AssociateInfo {
email: string;
subscriptionID: number;
}
export interface SubscriptionEvent {
eventType: string;
eventDateUTC: number;
details: string | null;
}
export interface SalesOrder {
id: number;
orderDateUTC: number;
orderNumber: string;
status: number;
tax: number;
shipping: number;
total: number;
}
export interface Payment {
currency: string;
periodFrom: number;
periodTo: number;
sku: string;
tax: number;
total: number;
transactionDate: number;
}
export interface PaymentMethod {
creditCardType: string | null;
firstSix: string | null;
lastFour: string | null;
expiration: string | null;
cardHolderName: string | null;
paymentPartner: string;
paymentMethodID: number;
}
export interface Address {
country?: string | null;
line1?: string | null;
line2?: string | null;
locality?: string | null;
region?: string | null;
postal?: string | null;
}
export interface SubscriptionIDResponse {
subscriptionID: number;
}
export interface ReedemCodeResponse {
redeemCode: string;
}
export declare function isReedemCodeResponse(r: any): r is ReedemCodeResponse;
export declare function isSubscriptionIDResponse(r: any): r is SubscriptionIDResponse;
export declare function isSharingDetails(x: any): x is SharingDetails;
export declare function isSubscription(sub: any): sub is Subscription;
export declare function isSubscriptionSummary(sub: any): sub is SubscriptionSummary;
export declare function isSubscriptionDetail(sub: any): sub is Subscription;
export declare function isAddress(address: any): address is Address;
export interface GiftRecipient {
email: string;
name: string;
note?: string;
sendNotificationOn?: string;
}
export interface SetGiftRecipientResponse {
subscriptionID: number;
redeemCode: string;
name: string;
email: string;
}
export declare function isGiftRecipientResponse(setGiftRecipientResponse: APIErrorResponse | SetGiftRecipientResponse): setGiftRecipientResponse is SetGiftRecipientResponse;