-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from klappvisor/payments
Payments
- Loading branch information
Showing
11 changed files
with
615 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE TypeOperators #-} | ||
|
||
module Web.Telegram.API.Bot.API.Payments | ||
( -- * Functions | ||
sendInvoiceM | ||
, answerShippingQueryM | ||
, answerPreCheckoutQueryM | ||
-- * API | ||
, TelegramBotPaymentsAPI | ||
, paymentsApi | ||
-- * Types | ||
) where | ||
|
||
import Data.Proxy | ||
import Servant.API | ||
import Servant.Client | ||
import Web.Telegram.API.Bot.API.Core | ||
import Web.Telegram.API.Bot.Requests | ||
import Web.Telegram.API.Bot.Responses | ||
|
||
type TelegramBotPaymentsAPI = | ||
TelegramToken :> "sendInvoice" | ||
:> ReqBody '[JSON] SendInvoiceRequest | ||
:> Post '[JSON] MessageResponse | ||
:<|> TelegramToken :> "answerShippingQuery" | ||
:> ReqBody '[JSON] AnswerShippingQueryRequest | ||
:> Post '[JSON] AnswerShippingQueryResponse | ||
:<|> TelegramToken :> "answerPreCheckoutQuery" | ||
:> ReqBody '[JSON] AnswerPreCheckoutQueryRequest | ||
:> Post '[JSON] AnswerPreCheckoutQueryResponse | ||
|
||
paymentsApi :: Proxy TelegramBotPaymentsAPI | ||
paymentsApi = Proxy | ||
|
||
sendInvoice_ :: Token -> SendInvoiceRequest -> ClientM MessageResponse | ||
answerShippingQuery_ :: Token -> AnswerShippingQueryRequest -> ClientM AnswerShippingQueryResponse | ||
answerPreCheckoutQuery_ :: Token -> AnswerPreCheckoutQueryRequest -> ClientM AnswerPreCheckoutQueryResponse | ||
sendInvoice_ | ||
:<|> answerShippingQuery_ | ||
:<|> answerPreCheckoutQuery_ | ||
= client paymentsApi | ||
|
||
sendInvoiceM :: SendInvoiceRequest -> TelegramClient MessageResponse | ||
sendInvoiceM = run_ sendInvoice_ | ||
|
||
answerShippingQueryM :: AnswerShippingQueryRequest -> TelegramClient AnswerShippingQueryResponse | ||
answerShippingQueryM = run_ answerShippingQuery_ | ||
|
||
answerPreCheckoutQueryM :: AnswerPreCheckoutQueryRequest -> TelegramClient AnswerPreCheckoutQueryResponse | ||
answerPreCheckoutQueryM = run_ answerPreCheckoutQuery_ |
Oops, something went wrong.