diff --git a/docs/README.md b/docs/README.md index 46c73dea..e21c9d7a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -379,6 +379,7 @@ type Client struct { Mandates *MandatesService Permissions *PermissionsService Onboarding *OnboardingService + PaymentLinks *PaymentLinksService } ``` @@ -738,6 +739,7 @@ GiftCardIssuer type describes issuers supported by mollie. ```go const ( BloemenCadeuKaart GiftCardIssuer = "bloemencadeaukaart" + BloemPlantGiftCard GiftCardIssuer = "bloemplantgiftcard" Boekenbon GiftCardIssuer = "boekenbon" DecaudeuKaart GiftCardIssuer = "decadeaukaart" DelokaleDecauKaart GiftCardIssuer = "delokalecadeaukaart" @@ -754,6 +756,7 @@ const ( Podiumcadeaukaart GiftCardIssuer = "podiumcadeaukaart" Reiscadeau GiftCardIssuer = "reiscadeau" Restaurantcadeau GiftCardIssuer = "restaurantcadeau" + SodexoSportCulturePass GiftCardIssuer = "sodexosportculturepass" Sportenfitcadeau GiftCardIssuer = "sportenfitcadeau" Sustainablefashion GiftCardIssuer = "sustainablefashion" Travelcheq GiftCardIssuer = "travelcheq" @@ -1977,6 +1980,61 @@ type PaymentDetailsAddress struct { PaymentDetailsAddress identify both the address and the person the payment is shipped to. +#### type PaymentLink + +```go +type PaymentLink struct { + ID string `json:"id,omitempty"` + Resource string `json:"resource,omitempty"` + Description string `json:"description,omitempty"` + ProfileID string `json:"profileId,omitempty"` + RedirectURL string `json:"redirectUrl,omitempty"` + WebhookURL string `json:"webhookUrl,omitempty"` + Mode Mode `json:"mode,omitempty"` + Amount Amount `json:"amount,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + PaidAt *time.Time `json:"paidAt,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + ExpiresAt *time.Time `json:"expiresAt,omitempty"` + Links PaymentLinkLinks `json:"_links,omitempty"` +} +``` + +PaymentLink is a resource that can be shared with your customers and will +redirect them to them the payment page where they can complete the payment. + +See: https://docs.mollie.com/reference/v2/payment-links-api/get-payment-link + +#### type PaymentLinkLinks + +```go +type PaymentLinkLinks struct { + Self *URL `json:"self,omitempty"` + Documentation *URL `json:"documentation,omitempty"` + PaymentLink *URL `json:"paymentLink,omitempty"` + Next *URL `json:"next,omitempty"` + Previous *URL `json:"previous,omitempty"` +} +``` + +PaymentLinkLinks describes all the possible links returned with a payment link +struct. + +See: https://docs.mollie.com/reference/v2/payment-links-api/get-payment-link + +#### type PaymentLinkOptions + +```go +type PaymentLinkOptions struct { + ProfileID string `url:"profileId,omitempty"` + From string `url:"from,omitemtpy"` + Limit int `url:"limit,omitempty"` +} +``` + +PaymentLinkOptions represents query string parameters to modify the payment +links requests. + #### type PaymentLinks ```go @@ -2000,6 +2058,58 @@ type PaymentLinks struct { PaymentLinks describes all the possible links to be returned with a payment object. +#### type PaymentLinksList + +```go +type PaymentLinksList struct { + Count int `json:"count,omitempty"` + Links PaymentLinkLinks `json:"_links,omitempty"` + Embedded struct { + PaymentLinks []*PaymentLink `json:"payment_links,omitempty"` + } `json:"_embedded,omitempty"` +} +``` + +#### type PaymentLinksService + +```go +type PaymentLinksService service +``` + +PaymentLinksService operates over the payment link resource. + +#### func (\*PaymentLinksService) Create + +```go +func (pls *PaymentLinksService) Create(p PaymentLink, opts *PaymentLinkOptions) (np *PaymentLink, err error) +``` + +Create generates payment links that by default, unlike regular payments, do not +expire. + +See: https://docs.mollie.com/reference/v2/payment-links-api/create-payment-link + +#### func (\*PaymentLinksService) Get + +```go +func (pls *PaymentLinksService) Get(id string) (pl *PaymentLink, err error) +``` + +Get retrieves a single payment link object by its id/token. + +See: https://docs.mollie.com/reference/v2/payment-links-api/get-payment-link + +#### func (\*PaymentLinksService) List + +```go +func (pls *PaymentLinksService) List(opts *PaymentLinkOptions) (pl *PaymentLinksList, err error) +``` + +List retrieves all payments links created with the current website profile, +ordered from newest to oldest. + +See: https://docs.mollie.com/reference/v2/payment-links-api/list-payment-links + #### type PaymentList ```go diff --git a/go.mod b/go.mod index 7eb3208a..f6ddfcc4 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.15 require ( github.com/google/go-querystring v1.1.0 - golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 + golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5 ) diff --git a/go.sum b/go.sum index 71816d34..8281cf11 100644 --- a/go.sum +++ b/go.sum @@ -188,6 +188,8 @@ golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5 h1:Ati8dO7+U7mxpkPSxBZQEvzHVUYB/MqCklCN8ig5w/o= +golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/mollie/gift_cards.go b/mollie/gift_cards.go index 0daf6b6e..dfd4ff49 100644 --- a/mollie/gift_cards.go +++ b/mollie/gift_cards.go @@ -10,6 +10,7 @@ type GiftCardIssuer string // Supported gift card issuers const ( BloemenCadeuKaart GiftCardIssuer = "bloemencadeaukaart" + BloemPlantGiftCard GiftCardIssuer = "bloemplantgiftcard" Boekenbon GiftCardIssuer = "boekenbon" DecaudeuKaart GiftCardIssuer = "decadeaukaart" DelokaleDecauKaart GiftCardIssuer = "delokalecadeaukaart" @@ -26,6 +27,7 @@ const ( Podiumcadeaukaart GiftCardIssuer = "podiumcadeaukaart" Reiscadeau GiftCardIssuer = "reiscadeau" Restaurantcadeau GiftCardIssuer = "restaurantcadeau" + SodexoSportCulturePass GiftCardIssuer = "sodexosportculturepass" Sportenfitcadeau GiftCardIssuer = "sportenfitcadeau" Sustainablefashion GiftCardIssuer = "sustainablefashion" Travelcheq GiftCardIssuer = "travelcheq"