import { Amount } from './offer'; import { Offer } from '../models/offer'; import { SubscriptionHistoryModel, SubscriptionRatePlan } from '../models/subscription'; import { Pricing, Product } from './offer'; export interface UserDataForSubscribe { userId: string; firstName: string; lastName: string; email: string; countryCode: string; state?: string; postcode?: string; } export interface Subscribe { user: UserDataForSubscribe; options: PaymentOptions; deliveryAddress?: DeliveryAddress; } export interface DeliveryAddress { poBox: string; province: string; addressType: string; state: string; company: string; addressLine1: string; addressLine2: string; addressLine3: string; city: string; countryCode: string; county: string; instructions: string; postcode: string; } /** * Types of payment available */ export enum PaymentType { CREDITCARD = 'creditcard', DIRECTDEBIT = 'directdebit', PAYPAL = 'paypal', APPLEPAY = 'applepay' } export interface PaymentOptions { paymentType: PaymentType; paymentMethodId: string; paymentGateway: string; paymentTerm: string; billingCountry: string; billingCity?: string; billingState?: string; billingPostcode?: string; offer: Offer; // Marketing specific options segmentId?: string; // PayPal specific options paypalBAID?: string; paypalEmail?: string; // Delivery specific options startDate?: string; option?: string; // Optional backdatedStartDate backdatedStartDate?: string; // Indicates if the subscription must be a single term singleTermSubscription?: boolean; // Indicates if the payment method should be closed after the subscription creation closePaymentMethod: boolean; // indicates if the welcome / confirmation email should be sent sendConfirmationEmail?: boolean; } export interface MappedPaymentOptions { paymentType: string; paymentMethodId: string; paymentGateway: string; price: string; currencyCode: string; subscriptionTerm: SubscriptionTerm; offerId: string; paypalBAID?: string; paypalEmail?: string; paymentToken?: string; transactionIdentifier?: string; term?: string; trial?: { price: string; term: string; }; startDate?: string; option?: string; segmentId?: string; closePaymentMethod?: boolean; sendConfirmationEmail?: boolean; backdatedStartDate?: string; } export interface PaymentSignature { token: string; pageId: string; tenantId: string; signature: string; paymentGateway: string; userId?: string; } export interface Subscriber { status: Status; billingAccount: BillingAccount; subscriptions: Array; } export interface Status { currentTriallist: boolean; currentSubscriber: boolean; lapsedSubscriber: boolean; subscriptions: Array; } export interface OfferData { offerId: string | null; discount: string | null; } export interface StepUpData { isInStepUp: boolean | null; priceBeforeStepUp?: string | null; priceAfterStepUp?: string | null; } export interface Subscription { status: string; active: boolean; fulfilmentOption: string; productCodes: Array; productName: string; productType: string; reference: string; startDate: string; createdDate: string; renewalDate: string; endDate: string; trialEndDate: string; trialPrice: Amount; price: Amount; term: string; isOutOfTerm: boolean; isSingleTerm: boolean; source: string; offerId: string; offer: OfferData; stepUp: StepUpData; ratePlan: SubscriptionRatePlan futureRatePlan: SubscriptionRatePlan hasFrozenPrice: boolean; availableActions: Array; history: Array<{}>; } export interface SubscriptionDetails { subNumber: string; productName: string; products: Array; price: Amount; term: string; productType?: string; } export interface ExposedSubscriptionHistory { isInStepUp: boolean; hasFrozenPrice: boolean; history: Array; } export interface SubscriptionHistoryItem { user_id: string; event_date: string; event_type: string; event_data: SubscriptionHistoryEventData; event_effective_date: string; event_outcome: string; origin_system: string; origin_user: string; subscription_number: string; } interface SubscriptionHistoryEventData { message: SubscriptionHistoryEventMessage; } interface SubscriptionHistoryEventMessage { subscription?: SubscriptionHistorySubscription; subscriptionBefore?: SubscriptionDetails; subscriptionAfter?: SubscriptionDetails; } export interface SubscriptionHistorySubscription { subscriptionCreationDate: string; subscriptionEffectiveDate: string; paymentMethodId: string; paymentType: string; userId: string; offerId: string; offerName: string; product: Product; subscriptionOption: Pricing; segmentId: string; productRatePlanId: string; subscriptionId: string; subscriptionNumber: string; invoiceId: string; invoiceNumber: string; paymentId: string; deliveryAddress: string; } export interface BillingAccount { currencyCode: string; isDeferredBilling: boolean; isExternal: boolean; paymentMethod: PaymentMethod; } interface CardDetails { expirationMonth: string; expirationYear: string; type: string; maskedNumber: string; } export interface PaymentMethod { type: string; creditCard?: CardDetails; lastTransactionStatus: string; } export interface SubscriptionTerm { iso8601Duration: string; termType: string; autoRenewTerm: boolean; } export interface FetchGatewayConfigOptions { paymentType: string; paymentTerm?: string; // aka: billingFrequency P1M,P1Y,etc countryCode: string; clientIPAddress: string; authorizationAmount: number; appIdOverride?: string; userId: string; ftSession?: string; }