Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data CustomerAPI route
- newCustomer :: Text -> Text -> NewCustomer
- createCustomer :: CustomerAPI route -> route :- ("customers" :> (ReqBody '[JSON] NewCustomer :> Post '[HalJSON] Customer))
- getCustomer :: CustomerAPI route -> route :- ("customers" :> (Capture "id" CustomerId :> Get '[HalJSON] Customer))
- getCustomers :: CustomerAPI route -> route :- ("customers" :> Get '[HalJSON] (List Customer))
- getCustomersPaginated :: CustomerAPI route -> route :- ("customers" :> (QueryParam "limit" Int :> (QueryParam "from" CustomerId :> Get '[HalJSON] (List Customer))))
- createCustomerPayment :: CustomerAPI route -> route :- ("customers" :> (Capture "id" CustomerId :> ("payments" :> (ReqBody '[JSON] NewPayment :> Post '[HalJSON] Payment))))
- getCustomerPayments :: CustomerAPI route -> route :- ("customers" :> (Capture "id" CustomerId :> ("payments" :> Get '[HalJSON] (List Payment))))
- getCustomerPaymentsPaginated :: CustomerAPI route -> route :- ("customers" :> (Capture "id" CustomerId :> ("payments" :> (QueryParam "limit" Int :> (QueryParam "from" PaymentId :> Get '[HalJSON] (List Payment))))))
Documentation
data CustomerAPI route Source #
Instances
:: Text | _name |
-> Text | _email |
-> NewCustomer |
Helper to create a minimal new customer.
createCustomer :: CustomerAPI route -> route :- ("customers" :> (ReqBody '[JSON] NewCustomer :> Post '[HalJSON] Customer)) Source #
Handler to create a new customer. See https://docs.mollie.com/reference/v2/customers-api/create-customer
getCustomer :: CustomerAPI route -> route :- ("customers" :> (Capture "id" CustomerId :> Get '[HalJSON] Customer)) Source #
Handler to get a customer by its identifier. See https://docs.mollie.com/reference/v2/customers-api/get-customer
getCustomers :: CustomerAPI route -> route :- ("customers" :> Get '[HalJSON] (List Customer)) Source #
Handler to get a paginated list of customers. Applies default pagination for newest 250 customers. See https://docs.mollie.com/reference/v2/customers-api/list-customers
getCustomersPaginated :: CustomerAPI route -> route :- ("customers" :> (QueryParam "limit" Int :> (QueryParam "from" CustomerId :> Get '[HalJSON] (List Customer)))) 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://docs.mollie.com/reference/v2/customers-api/list-customers
Example for fetching the last customer:
import Mollie.API import Mollie.API.Customers env <- createEnv "test_mollieapikeyexample" let customersResult = runMollie env (getCustomersPaginated customerClient (Just 1) Nothing)
createCustomerPayment :: CustomerAPI route -> route :- ("customers" :> (Capture "id" CustomerId :> ("payments" :> (ReqBody '[JSON] NewPayment :> Post '[HalJSON] Payment)))) Source #
Handler to create a new payment for a specific customer. See https://docs.mollie.com/reference/v2/customers-api/create-customer-payment
getCustomerPayments :: CustomerAPI route -> route :- ("customers" :> (Capture "id" CustomerId :> ("payments" :> Get '[HalJSON] (List Payment)))) Source #
Handler to get a paginated list of payments for a specific customer. Applies default pagination for newest 250 payments. See https://docs.mollie.com/reference/v2/customers-api/list-customer-payments
getCustomerPaymentsPaginated :: CustomerAPI route -> route :- ("customers" :> (Capture "id" CustomerId :> ("payments" :> (QueryParam "limit" Int :> (QueryParam "from" PaymentId :> Get '[HalJSON] (List Payment)))))) Source #
Handler to get a paginated list of payments for a specific customer. Offset the results by passing the last payment ID in the from
query param. The payment with this ID is included in the result set as well. See https://docs.mollie.com/reference/v2/customers-api/list-customers-payments
Example for fetching the last payment for a customer:
import Mollie.API import Mollie.API.Customers env <- createEnv "test_mollieapikeyexample" let customerPaymentsResult = runMollie env (getCustomerPaymentsPaginated customerClient "cst_exampleid" (Just 1) Nothing)