mollie-api-haskell-2.0.0.0: Mollie API client for Haskell http://www.mollie.com

Safe HaskellNone
LanguageHaskell2010

Mollie.API.Subscriptions

Synopsis

Documentation

data SubscriptionAPI route Source #

Servant API definition for Mollie subscriptions API https://www.mollie.com/en/docs/reference/subscriptions/get.

Instances
Generic (SubscriptionAPI route) Source # 
Instance details

Defined in Mollie.API.Subscriptions

Associated Types

type Rep (SubscriptionAPI route) :: Type -> Type #

Methods

from :: SubscriptionAPI route -> Rep (SubscriptionAPI route) x #

to :: Rep (SubscriptionAPI route) x -> SubscriptionAPI route #

type Rep (SubscriptionAPI route) Source # 
Instance details

Defined in Mollie.API.Subscriptions

type Rep (SubscriptionAPI route) = D1 (MetaData "SubscriptionAPI" "Mollie.API.Subscriptions" "mollie-api-haskell-2.0.0.0-79op8QUDPdyAagRpBQOely" False) (C1 (MetaCons "SubscriptionAPI" PrefixI True) ((S1 (MetaSel (Just "getCustomerSubscriptionsPaginated") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (QueryParam "limit" Int :> (QueryParam "from" SubscriptionId :> Get (HalJSON ': ([] :: [Type])) (List Subscription)))))))) :*: (S1 (MetaSel (Just "getCustomerSubscriptions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> Get (HalJSON ': ([] :: [Type])) (List Subscription)))))) :*: S1 (MetaSel (Just "createCustomerSubscription") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (ReqBody (JSON ': ([] :: [Type])) NewSubscription :> Post (HalJSON ': ([] :: [Type])) Subscription)))))))) :*: ((S1 (MetaSel (Just "getCustomerSubscription") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> Get (HalJSON ': ([] :: [Type])) Subscription)))))) :*: S1 (MetaSel (Just "cancelCustomerSubscription") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> DeleteNoContent (HalJSON ': ([] :: [Type])) NoContent))))))) :*: (S1 (MetaSel (Just "getSubscriptionPaymentsPaginated") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> ("payments" :> (QueryParam "limit" Int :> (QueryParam "from" PaymentId :> Get (HalJSON ': ([] :: [Type])) (List Payment)))))))))) :*: S1 (MetaSel (Just "getSubscriptionPayments") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> ("payments" :> Get (HalJSON ': ([] :: [Type])) (List Payment))))))))))))

newSubscription Source #

Arguments

:: Double

_amount

-> Text

_interval

-> Text

_description

-> NewSubscription 

Helper to create a minimal new subscription. Defaults to an ongoing subscription.

The interval is in human readable format and support the following values: `1 day/n days`, `1 week/n weeks`, `1 month/n months` where n > 1.

createCustomerSubscription :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (ReqBody '[JSON] NewSubscription :> Post '[HalJSON] Subscription)))) Source #

Handler to create a new subscription for a specific customer. See https://www.mollie.com/en/docs/reference/subscriptions/create

getCustomerSubscription :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> Get '[HalJSON] Subscription)))) Source #

Handler to get a subscription by its identifier from a specific customer. See https://www.mollie.com/en/docs/reference/subscriptions/get

getCustomerSubscriptions :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> Get '[HalJSON] (List Subscription)))) Source #

Handler to get a paginated list of subscriptions for a specific customer. Applies default pagination for newest 250 subscriptions. See https://www.mollie.com/en/docs/reference/subscriptions/list

getCustomerSubscriptionsPaginated :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (QueryParam "limit" Int :> (QueryParam "from" SubscriptionId :> Get '[HalJSON] (List Subscription)))))) Source #

Handler to get a paginated list of customers. Offset the results by passing the last customer ID in the from query param. The customer with this ID is included in the result set as well. See https://www.mollie.com/en/docs/reference/subscriptions/list

Example for fetching the last subscription of customer with id "cst_exampleid":

import Mollie.API
import Mollie.API.Subscriptions

env <- createEnv "test_mollieapikeyexample"
let customerSubscriptionsResult = runMollie env (getCustomerSubscriptionsPaginated subscriptionClient "cst_exampleid" (Just 1) Nothing)

cancelCustomerSubscription :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> DeleteNoContent '[HalJSON] NoContent)))) Source #

Handler to cancel a subscription by its identifier for a specific customer. See https://www.mollie.com/en/docs/reference/subscriptions/delete

getSubscriptionPayments :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> ("payments" :> Get '[HalJSON] (List Payment)))))) Source #

Handler to get a paginated list of payments of a specific subscription. Applies default pagination for newest 250 payments. See https://docs.mollie.com/reference/v2/subscriptions-api/list-subscriptions-payments

getSubscriptionPaymentsPaginated :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> ("payments" :> (QueryParam "limit" Int :> (QueryParam "from" PaymentId :> Get '[HalJSON] (List Payment)))))))) Source #

Handler to get a paginated list of payments of a specific subscription. Offset the result set to the payment with from query param. The payment with this ID is included in the result set as well. See https://docs.mollie.com/reference/v2/subscriptions-api/list-subscriptions-payments

Example for fetching the last 5 payments of a subscription with CustomerId "cst_exampleid" and SubscriptionId "sub_exampleid":

import Mollie.API
import Mollie.API.Subscriptions

env <- createEnv "test_mollieapikeyexample"
let subscriptionPaymentsResult = runMollie env (getSubscriptionPaymentsPaginated subscriptionClient "cst_exampleid" "sub_exampleid" (Just 5) Nothing)