diff --git a/codegen/pkg/generator/generator.go b/codegen/pkg/generator/generator.go index 4122fbb..6d3b2e1 100644 --- a/codegen/pkg/generator/generator.go +++ b/codegen/pkg/generator/generator.go @@ -321,6 +321,13 @@ func (g *Generator) displayTagName(tagKey string) string { return sanitizeTagName(tagKey) } +func (g *Generator) tagDescription(tagKey string) string { + if tag, ok := g.tagLookup[tagKey]; ok && tag != nil { + return strings.TrimSpace(tag.Description) + } + return "" +} + func (g *Generator) namespaceForTag(tagKey string) string { if tagKey == sharedTagKey { return sharedTagNamespace diff --git a/codegen/pkg/generator/services.go b/codegen/pkg/generator/services.go index 2123f80..cdc955a 100644 --- a/codegen/pkg/generator/services.go +++ b/codegen/pkg/generator/services.go @@ -88,7 +88,21 @@ func (g *Generator) buildServiceBlock(tagKey string, operations []*operation) st buf.WriteString("\n") } - fmt.Fprintf(&buf, "/**\n * Class %s\n *\n * @package SumUp\\Services\n */\n", className) + fmt.Fprintf(&buf, "/**\n * Class %s\n", className) + if description := g.tagDescription(tagKey); description != "" { + buf.WriteString(" *\n") + for _, line := range strings.Split(description, "\n") { + line = strings.TrimSpace(line) + if line == "" { + buf.WriteString(" *\n") + continue + } + buf.WriteString(" * ") + buf.WriteString(line) + buf.WriteString("\n") + } + } + buf.WriteString(" *\n * @package SumUp\\Services\n */\n") fmt.Fprintf(&buf, "class %s implements SumUpService\n{\n", className) buf.WriteString(" /**\n") buf.WriteString(" * The client for the http communication.\n") diff --git a/codegen/pkg/generator/sumup.go b/codegen/pkg/generator/sumup.go index 9e6cedd..897a0b9 100644 --- a/codegen/pkg/generator/sumup.go +++ b/codegen/pkg/generator/sumup.go @@ -153,6 +153,13 @@ class SumUp for _, service := range services { method := strcase.ToLowerCamel(service) + buf.WriteString(" /**\n") + fmt.Fprintf(&buf, " * Access the %s API endpoints.\n", service) + buf.WriteString(" *\n") + fmt.Fprintf(&buf, " * @return %s\n", service) + buf.WriteString(" *\n") + buf.WriteString(" * @throws ConfigurationException\n") + buf.WriteString(" */\n") fmt.Fprintf(&buf, " public function %s()\n", method) buf.WriteString(" {\n") buf.WriteString(" if (empty($this->accessToken)) {\n") diff --git a/src/Checkouts/Checkouts.php b/src/Checkouts/Checkouts.php index f3a9486..00aee7e 100644 --- a/src/Checkouts/Checkouts.php +++ b/src/Checkouts/Checkouts.php @@ -75,6 +75,12 @@ class CheckoutsListAvailablePaymentMethodsParams /** * Class Checkouts * + * Accept payments from your end users by adding the Checkouts model to your platform. + * SumUp supports standard and single payment 3DS checkout flows. + * + * The Checkout model allows creating, listing, retrieving, processing and deactivating checkouts. + * A payment is completed by creating a checkout and then processing the checkout. + * * @package SumUp\Services */ class Checkouts implements SumUpService diff --git a/src/Customers/Customers.php b/src/Customers/Customers.php index b32be46..ec744b9 100644 --- a/src/Customers/Customers.php +++ b/src/Customers/Customers.php @@ -38,6 +38,11 @@ public function __construct(array $data = []) /** * Class Customers * + * Allow your regular customers to save their information with the Customers model. + * This will prevent re-entering payment instrument information for recurring payments on your platform. + * + * Depending on the needs you can allow, creating, listing or deactivating payment instruments & creating, retrieving and updating customers. + * * @package SumUp\Services */ class Customers implements SumUpService diff --git a/src/Members/Members.php b/src/Members/Members.php index 377759e..050ea00 100644 --- a/src/Members/Members.php +++ b/src/Members/Members.php @@ -218,6 +218,8 @@ class MembersListParams /** * Class Members * + * Endpoints to manage account members. Members are users that have membership within merchant accounts. + * * @package SumUp\Services */ class Members implements SumUpService diff --git a/src/Memberships/Memberships.php b/src/Memberships/Memberships.php index 1e386eb..88aed18 100644 --- a/src/Memberships/Memberships.php +++ b/src/Memberships/Memberships.php @@ -111,6 +111,8 @@ class MembershipsListParams /** * Class Memberships * + * Endpoints to manage user's memberships. Memberships are used to connect the user to merchant accounts and to grant them access to the merchant's resources via roles. + * * @package SumUp\Services */ class Memberships implements SumUpService diff --git a/src/Merchants/Merchants.php b/src/Merchants/Merchants.php index 2fce411..e4f4269 100644 --- a/src/Merchants/Merchants.php +++ b/src/Merchants/Merchants.php @@ -62,6 +62,8 @@ class MerchantsListPersonsParams /** * Class Merchants * + * Merchant account represents a single business entity at SumUp. + * * @package SumUp\Services */ class Merchants implements SumUpService diff --git a/src/Payouts/Payouts.php b/src/Payouts/Payouts.php index 035615f..a3631ad 100644 --- a/src/Payouts/Payouts.php +++ b/src/Payouts/Payouts.php @@ -96,6 +96,9 @@ class PayoutsListDeprecatedParams /** * Class Payouts * + * The Payouts model will allow you to track funds you’ve received from SumUp. + * You can receive a detailed payouts list with information like dates, fees, references and statuses, using the `List payouts` endpoint. + * * @package SumUp\Services */ class Payouts implements SumUpService diff --git a/src/Readers/Readers.php b/src/Readers/Readers.php index 8817cf7..f6d49c6 100644 --- a/src/Readers/Readers.php +++ b/src/Readers/Readers.php @@ -101,6 +101,8 @@ class ReadersListResponse /** * Class Readers * + * A reader represents a device that accepts payments. You can use the SumUp Solo to accept in-person payments. + * * @package SumUp\Services */ class Readers implements SumUpService diff --git a/src/Receipts/Receipts.php b/src/Receipts/Receipts.php index 3d59b8d..d317b97 100644 --- a/src/Receipts/Receipts.php +++ b/src/Receipts/Receipts.php @@ -37,6 +37,8 @@ class ReceiptsGetParams /** * Class Receipts * + * The Receipts model obtains receipt-like details for specific transactions. + * * @package SumUp\Services */ class Receipts implements SumUpService diff --git a/src/Roles/Roles.php b/src/Roles/Roles.php index d5279b4..7bd03f4 100644 --- a/src/Roles/Roles.php +++ b/src/Roles/Roles.php @@ -106,6 +106,8 @@ class RolesListResponse /** * Class Roles * + * Endpoints to manage custom roles. Custom roles allow you to tailor roles from individual permissions to match your needs. Once created, you can assign your custom roles to your merchant account members using the memberships. + * * @package SumUp\Services */ class Roles implements SumUpService diff --git a/src/Subaccounts/Subaccounts.php b/src/Subaccounts/Subaccounts.php index 83da5c5..4cfa8c4 100644 --- a/src/Subaccounts/Subaccounts.php +++ b/src/Subaccounts/Subaccounts.php @@ -182,6 +182,8 @@ class SubaccountsListSubAccountsParams /** * Class Subaccounts * + * Endpoints for managing merchant sub-accounts (operators). + * * @package SumUp\Services */ class Subaccounts implements SumUpService diff --git a/src/SumUp.php b/src/SumUp.php index 283170b..08ddcc7 100644 --- a/src/SumUp.php +++ b/src/SumUp.php @@ -156,56 +156,111 @@ private function normalizeConfig(array $config): array return $config; } + /** + * Access the Checkouts API endpoints. + * + * @return Checkouts + */ public function checkouts(): Checkouts { return new Checkouts($this->client, $this->resolveAccessToken()); } + /** + * Access the Customers API endpoints. + * + * @return Customers + */ public function customers(): Customers { return new Customers($this->client, $this->resolveAccessToken()); } + /** + * Access the Members API endpoints. + * + * @return Members + */ public function members(): Members { return new Members($this->client, $this->resolveAccessToken()); } + /** + * Access the Memberships API endpoints. + * + * @return Memberships + */ public function memberships(): Memberships { return new Memberships($this->client, $this->resolveAccessToken()); } + /** + * Access the Merchants API endpoints. + * + * @return Merchants + */ public function merchants(): Merchants { return new Merchants($this->client, $this->resolveAccessToken()); } + /** + * Access the Payouts API endpoints. + * + * @return Payouts + */ public function payouts(): Payouts { return new Payouts($this->client, $this->resolveAccessToken()); } + /** + * Access the Readers API endpoints. + * + * @return Readers + */ public function readers(): Readers { return new Readers($this->client, $this->resolveAccessToken()); } + /** + * Access the Receipts API endpoints. + * + * @return Receipts + */ public function receipts(): Receipts { return new Receipts($this->client, $this->resolveAccessToken()); } + /** + * Access the Roles API endpoints. + * + * @return Roles + */ public function roles(): Roles { return new Roles($this->client, $this->resolveAccessToken()); } + /** + * Access the Subaccounts API endpoints. + * + * @return Subaccounts + */ public function subaccounts(): Subaccounts { return new Subaccounts($this->client, $this->resolveAccessToken()); } + /** + * Access the Transactions API endpoints. + * + * @return Transactions + */ public function transactions(): Transactions { return new Transactions($this->client, $this->resolveAccessToken()); diff --git a/src/Transactions/Transactions.php b/src/Transactions/Transactions.php index 8ac547e..f3d3c71 100644 --- a/src/Transactions/Transactions.php +++ b/src/Transactions/Transactions.php @@ -340,6 +340,9 @@ class TransactionsListDeprecatedParams /** * Class Transactions * + * Retrieve details for a specific transaction by it’s `id` + * or any other required query parameter, or list all transactions related to the merchant account. + * * @package SumUp\Services */ class Transactions implements SumUpService