Skip to content

Commit 60f8bdb

Browse files
Merge pull request #98 from starkbank/feature/mktplace-app-user
Add Marketplace app user type
2 parents 06d1902 + e31f9f6 commit 60f8bdb

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ Given a version number MAJOR.MINOR.PATCH, increment:
1212
- PATCH version when backwards compatible bug **fixes** are implemented.
1313

1414
## [Unreleased]
15+
### Added
16+
- Marketplace app as user type
17+
18+
### Changed
19+
- core version
1520

1621
## [2.18.1] - 2024-09-09
1722
### Fixed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.starkbank;
2+
3+
public final class MarketplaceApp extends User{
4+
static ClassData data = new ClassData(MarketplaceApp.class, "MarketplaceApp");
5+
6+
public final String authorizationId;
7+
8+
/**
9+
* MarketplaceApp object
10+
* <p>
11+
* The MarketplaceApp object is an authentication entity for the SDK that
12+
* represents your entire MarketplaceApp, being able to access any Workspace
13+
* underneath it and even create new Workspaces. Only a legal representative
14+
* of your MarketplaceApp can register or change the MarketplaceApp credentials.
15+
* All requests to the Stark Bank API must be authenticated via an SDK user,
16+
* which must have been previously created at the Stark Bank website
17+
* [https://web.sandbox.starkbank.com] or [https://web.starkbank.com]
18+
* before you can use it in this SDK. MarketplaceApps may be passed as the user parameter on
19+
* each request or may be defined as the default user at the start (See README).
20+
* If you are accessing a specific Workspace using MarketplaceApp credentials, you should
21+
* specify the workspace ID when building the MarketplaceApp object or by request, using
22+
* the MarketplaceApp.set_workspace(workspace_id) method, which creates a copy of the MarketplaceApp
23+
* object with the altered workspace ID. If you are listing or creating new Workspaces, the
24+
* workspace_id should be null.
25+
* <p>
26+
* Parameters (required):
27+
* @param environment [string]: environment where the MarketplaceApp is being used. ex: "sandbox" or "production"
28+
* @param id [string]: unique id required to identify MarketplaceApp. ex: "5656565656565656"
29+
* @param privateKey [EllipticCurve.MarketplaceApp()]: PEM string of the private key linked to the MarketplaceApp. ex: "-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEyTIHK6jYuik6ktM9FIF3yCEYzpLjO5X/\ntqDioGM+R2RyW0QEo+1DG8BrUf4UXHSvCjtQ0yLppygz23z0yPZYfw==\n-----END PUBLIC KEY-----"
30+
* <p>
31+
* Return:
32+
* @throws Exception error in the request
33+
*/
34+
public MarketplaceApp(String environment, String id, String privateKey) throws Exception {
35+
super(environment, id, privateKey);
36+
this.authorizationId = null;
37+
}
38+
39+
/**
40+
* MarketplaceApp object
41+
* <p>
42+
* The MarketplaceApp object is an authentication entity for the SDK that
43+
* represents your entire MarketplaceApp, being able to access any Workspace
44+
* underneath it and even create new Workspaces. Only a legal representative
45+
* of your MarketplaceApp can register or change the MarketplaceApp credentials.
46+
* All requests to the Stark Bank API must be authenticated via an SDK user,
47+
* which must have been previously created at the Stark Bank website
48+
* [https://web.sandbox.starkbank.com] or [https://web.starkbank.com]
49+
* before you can use it in this SDK. MarketplaceApps may be passed as the user parameter on
50+
* each request or may be defined as the default user at the start (See README).
51+
* If you are accessing a specific Workspace using MarketplaceApp credentials, you should
52+
* specify the workspace ID when building the MarketplaceApp object or by request, using
53+
* the MarketplaceApp.set_workspace(workspace_id) method, which creates a copy of the MarketplaceApp
54+
* object with the altered workspace ID. If you are listing or creating new Workspaces, the
55+
* workspace_id should be null.
56+
* <p>
57+
* Parameters (required):
58+
* @param environment [string]: environment where the MarketplaceApp is being used. ex: "sandbox" or "production"
59+
* @param id [string]: unique id required to identify MarketplaceApp. ex: "5656565656565656"
60+
* @param privateKey [EllipticCurve.MarketplaceApp()]: PEM string of the private key linked to the MarketplaceApp. ex: "-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEyTIHK6jYuik6ktM9FIF3yCEYzpLjO5X/\ntqDioGM+R2RyW0QEo+1DG8BrUf4UXHSvCjtQ0yLppygz23z0yPZYfw==\n-----END PUBLIC KEY-----"
61+
* @param authorizationId [string]: unique id of the accessed Workspace, if any. ex: null or "4848484848484848"
62+
* <p>
63+
* Return:
64+
* @throws Exception error in the request
65+
*/
66+
public MarketplaceApp(String environment, String id, String privateKey, String authorizationId) throws Exception {
67+
super(environment, id, privateKey);
68+
this.authorizationId = authorizationId;
69+
}
70+
71+
public String accessId() {
72+
if (this.authorizationId != null)
73+
return "marketplace-app-authorization/" + this.authorizationId;
74+
return "marketplace-app/" + this.id;
75+
}
76+
77+
public static MarketplaceApp replace(MarketplaceApp MarketplaceApp, String authorizationId) throws Exception {
78+
return new MarketplaceApp(
79+
MarketplaceApp.environment,
80+
MarketplaceApp.id,
81+
MarketplaceApp.pem,
82+
authorizationId
83+
);
84+
}
85+
86+
}

0 commit comments

Comments
 (0)