-
Notifications
You must be signed in to change notification settings - Fork 2
/
customer_portal_sessions.go
80 lines (64 loc) · 3.93 KB
/
customer_portal_sessions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Code generated by the Paddle SDK Generator; DO NOT EDIT.
package paddle
import "context"
// CustomerPortalSessionGeneralURLs: Authenticated customer portal deep links that aren't associated with a specific entity.
type CustomerPortalSessionGeneralURLs struct {
// Overview: Link to the overview page in the customer portal.
Overview string `json:"overview,omitempty"`
}
/*
CustomerPortalSessionSubscriptionURLs: List of generated authenticated customer portal deep links for the subscriptions passed in the `subscription_ids` array in the request.
If subscriptions are paused or canceled, links open the overview page for a subscription.
Empty if no subscriptions passed in the request.
*/
type CustomerPortalSessionSubscriptionURLs struct {
// ID: Paddle ID of the subscription that the authenticated customer portal deep links are for.
ID string `json:"id,omitempty"`
// CancelSubscription: Link to the page for this subscription in the customer portal with the subscription cancellation form pre-opened. Use as part of cancel subscription workflows.
CancelSubscription string `json:"cancel_subscription,omitempty"`
/*
UpdateSubscriptionPaymentMethod: Link to the page for this subscription in the customer portal with the payment method update form pre-opened. Use as part of workflows to let customers update their payment details.
If a manually-collected subscription, opens the overview page for this subscription.
*/
UpdateSubscriptionPaymentMethod string `json:"update_subscription_payment_method,omitempty"`
}
// CustomerPortalSessionURLs: Authenticated customer portal deep links. For security, the `token` appended to each link is temporary. You shouldn't store these links.
type CustomerPortalSessionURLs struct {
// General: Authenticated customer portal deep links that aren't associated with a specific entity.
General CustomerPortalSessionGeneralURLs `json:"general,omitempty"`
/*
Subscriptions: List of generated authenticated customer portal deep links for the subscriptions passed in the `subscription_ids` array in the request.
If subscriptions are paused or canceled, links open the overview page for a subscription.
Empty if no subscriptions passed in the request.
*/
Subscriptions []CustomerPortalSessionSubscriptionURLs `json:"subscriptions,omitempty"`
}
// CustomerPortalSession: Represents a customer portal session.
type CustomerPortalSession struct {
// ID: Unique Paddle ID for this customer portal session entity, prefixed with `cpls_`.
ID string `json:"id,omitempty"`
// CustomerID: Paddle ID of the customer that this customer portal sessions is for, prefixed with `ctm_`.
CustomerID string `json:"customer_id,omitempty"`
// URLs: Authenticated customer portal deep links. For security, the `token` appended to each link is temporary. You shouldn't store these links.
URLs CustomerPortalSessionURLs `json:"urls,omitempty"`
// CreatedAt: RFC 3339 datetime string of when this customer portal session was created.
CreatedAt string `json:"created_at,omitempty"`
}
// CustomerPortalSessionsClient is a client for the Customer portal sessions resource.
type CustomerPortalSessionsClient struct {
doer Doer
}
// CreateCustomerPortalSessionRequest is given as an input to CreateCustomerPortalSession.
type CreateCustomerPortalSessionRequest struct {
// URL path parameters.
CustomerID string `in:"path=customer_id" json:"-"`
// SubscriptionIDs: Paddle ID of a subscription related to this customer to create an authenticated customer portal deep link for.
SubscriptionIDs []string `json:"subscription_ids,omitempty"`
}
// CreateCustomerPortalSession performs the POST operation on a Customer portal sessions resource.
func (c *CustomerPortalSessionsClient) CreateCustomerPortalSession(ctx context.Context, req *CreateCustomerPortalSessionRequest) (res *CustomerPortalSession, err error) {
if err := c.doer.Do(ctx, "POST", "/customers/{customer_id}/portal-sessions", req, &res); err != nil {
return nil, err
}
return res, nil
}