Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data SubscriptionAPI route
- newSubscription :: Double -> Text -> Text -> NewSubscription
- createCustomerSubscription :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (ReqBody '[JSON] NewSubscription :> Post '[HalJSON] Subscription))))
- getCustomerSubscription :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> Get '[HalJSON] Subscription))))
- getCustomerSubscriptions :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> Get '[HalJSON] (List Subscription))))
- getCustomerSubscriptionsPaginated :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (QueryParam "limit" Int :> (QueryParam "from" SubscriptionId :> Get '[HalJSON] (List Subscription))))))
- cancelCustomerSubscription :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> DeleteNoContent '[HalJSON] NoContent))))
- getSubscriptionPayments :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> ("payments" :> Get '[HalJSON] (List Payment))))))
- getSubscriptionPaymentsPaginated :: SubscriptionAPI route -> route :- ("customers" :> (Capture "customerId" CustomerId :> ("subscriptions" :> (Capture "id" SubscriptionId :> ("payments" :> (QueryParam "limit" Int :> (QueryParam "from" PaymentId :> Get '[HalJSON] (List Payment))))))))
Documentation
data SubscriptionAPI route Source #
Servant API definition for Mollie subscriptions API https://www.mollie.com/en/docs/reference/subscriptions/get.
Instances
:: Double | _amount |
-> Text | _interval |
-> Text | _description |
-> NewSubscription |
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)