Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Merge sep-6 into develop #1151

Merged
merged 57 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
678b9e8
[ANCHOR-355] Implement SEP-6 deposit (#1035)
philipliu Sep 8, 2023
e6f8d4f
Remove active transaction store
philipliu Sep 12, 2023
1fd02f8
Merge branch 'develop' into sep-6
philipliu Sep 13, 2023
067a41f
Merge `develop` into `sep-6` (#1107)
philipliu Sep 13, 2023
435ef48
Merge branch 'sep-6' into fix/anchor-439-cleanup
philipliu Sep 13, 2023
5b090f4
[ANCHOR-439] Remove transaction store from reference server (#1105)
philipliu Sep 14, 2023
1b52bfc
Implement withdraw flow
philipliu Sep 10, 2023
7ea5cc9
Cleanup
philipliu Sep 18, 2023
2abd79e
Refactor asset name helper
philipliu Sep 18, 2023
ba021ae
Fix asset name helper
philipliu Sep 18, 2023
242f492
Fix unit test
philipliu Sep 18, 2023
ef4ce69
PR comments
philipliu Sep 19, 2023
d35dede
[ANCHOR-356] SEP-6: Implement withdraw (#1113)
philipliu Sep 19, 2023
dd21e9f
Add withdraw diagram
philipliu Sep 20, 2023
c97b154
Remove dotted arrow
philipliu Sep 20, 2023
08aa4d4
PR comments
philipliu Sep 20, 2023
b3b027d
SEP-6: Add withdraw diagram (#1117)
philipliu Sep 20, 2023
9548e0b
SEP-6: Add deposit diagram (#1116)
philipliu Sep 20, 2023
ebd47bf
[ANCHOR-358] SEP-6: Implement withdraw-exchange (#1124)
philipliu Sep 27, 2023
02a429b
[ANCHOR-353] SEP-6: Fix info response (#1132)
philipliu Sep 27, 2023
8bea964
[ANCHOR-353] SEP-6: Refactor request validation (#1133)
philipliu Sep 29, 2023
aae2c6c
[ANCHOR-357] SEP-6: Implement deposit-exchange (#1125)
philipliu Oct 2, 2023
5dc5c18
[ANCHOR-353] SEP-6: Verify SEP-12 status before deposit/withdraw proc…
philipliu Oct 3, 2023
ae24110
[ANCHOR-464] SEP-6: Enable client status callback (#1126)
philipliu Oct 3, 2023
ca5abe7
SEP-6: Show min/max amounts in the info response (#1138)
philipliu Oct 3, 2023
2cd9561
SEP-6: Remove to account set by withdraw (#1139)
philipliu Oct 4, 2023
309f483
[ANCHOR-353] SEP-6: Enable validation tests (#1137)
philipliu Oct 5, 2023
b6ddd78
[Fix] SEP-6: Only patch transaction if request field is not null (#1141)
philipliu Oct 5, 2023
005922d
[Fix] SEP-6: Verify KYC of authenticated account (#1146)
philipliu Oct 10, 2023
0e9af76
Merge branch 'develop' into sep-6-10-11-merge
philipliu Oct 11, 2023
61c16d4
Fix tests
philipliu Oct 11, 2023
981030b
[Chore] Merge `develop` into `sep-6` (#1154)
philipliu Oct 11, 2023
339ceb2
Revert "[Chore] Merge `develop` into `sep-6` (#1154)"
philipliu Oct 11, 2023
90398f4
Revert "[Chore] Merge `develop` into `sep-6`" (#1156)
philipliu Oct 11, 2023
e3df5d7
Merge branch 'sep-6' into sep-6-10-11-copy
philipliu Oct 11, 2023
8d5c17a
[Chore] Merge `develop` into `sep-6` (#1157)
philipliu Oct 11, 2023
eeadcd2
[Fix] SEP-6: Set customers field in platform transaction (#1158)
philipliu Oct 13, 2023
625d868
Merge branch 'develop' into sep-6-10-19-merge
philipliu Oct 19, 2023
3aef754
Fix test errors
philipliu Oct 19, 2023
db7ab03
[ANCHOR-362] SEP-6: Update reference server to set required_customer_…
philipliu Oct 19, 2023
4bd030b
[ANCHOR-444] SEP-6: Set `client_id` in fee request (#1163)
philipliu Oct 19, 2023
d987461
Merge branch 'sep-6' into sep-6-10-19-merge
philipliu Oct 19, 2023
f29e9c9
[Chore] Merge `develop` into `sep-6` (#1168)
philipliu Oct 19, 2023
1457819
Add type to SEP-6 platform transaction
philipliu Oct 24, 2023
0b06827
[Fix] SEP-6: Add `type` to platform transaction (#1171)
philipliu Oct 24, 2023
ae043c7
[Fix] Fix test failures due to static mock race (#1175)
philipliu Oct 25, 2023
7e42b5c
[ANCHOR-515] SEP-6: Remove KYC verification (#1177)
philipliu Oct 26, 2023
b42448f
Merge branch 'develop' into sep-6-10-30-merge
philipliu Oct 30, 2023
86d95d4
[ANCHOR-388] SEP-6: Implement RPC actions (#1166)
philipliu Oct 31, 2023
57b7b6b
Merge branch 'sep-6' into sep-6-10-30-merge
philipliu Nov 1, 2023
3165ae2
[Fix] SEP-6: Shutdown the event consumer cleanly (#1182)
philipliu Nov 1, 2023
71ef3aa
Merge branch 'sep-6' into sep-6-10-30-merge
philipliu Nov 1, 2023
bfa145f
Fork JVM for every integration test
philipliu Nov 1, 2023
e436286
[Chore] Merge `develop` into `sep-6` (#1181)
philipliu Nov 1, 2023
a758fa7
[ANCHOR-508] SEP-6: Custody integration (#1179)
philipliu Nov 2, 2023
ab155b5
Merge branch 'develop' into sep-6-final-merge
philipliu Nov 2, 2023
7e2f8f9
[Chore] Merge `develop` into `sep-6` (#1186)
philipliu Nov 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/sub_gradle_test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# Prepare Stellar Validation Tests
- name: Pull Stellar Validation Tests Docker Image
run: docker pull stellar/anchor-tests:v0.6.5 &
run: docker pull stellar/anchor-tests:v0.6.9 &

# Set up JDK 11
- name: Set up JDK 11
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:

- name: Run Stellar validation tool
run: |
docker run --network host -v ${GITHUB_WORKSPACE}/platform/src/test/resources://config stellar/anchor-tests:v0.6.5 --home-domain http://host.docker.internal:8080 --seps 1 10 12 24 31 38 --sep-config //config/stellar-anchor-tests-sep-config.json --verbose
docker run --network host -v ${GITHUB_WORKSPACE}/platform/src/test/resources://config stellar/anchor-tests:v0.6.9 --home-domain http://host.docker.internal:8080 --seps 1 6 10 12 24 31 38 --sep-config //config/stellar-anchor-tests-sep-config.json --verbose

- name: Upload Artifacts
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import org.stellar.anchor.api.event.AnchorEvent;
import org.stellar.anchor.api.platform.CustomerUpdatedResponse;
import org.stellar.anchor.api.platform.GetQuoteResponse;
import org.stellar.anchor.api.platform.GetTransactionResponse;

Expand All @@ -13,6 +14,7 @@
public class SendEventRequestPayload {
GetTransactionResponse transaction;
GetQuoteResponse quote;
CustomerUpdatedResponse customer;

/**
* Creates a SendEventRequestPayload from an AnchorEvent.
Expand All @@ -23,6 +25,8 @@ public class SendEventRequestPayload {
public static SendEventRequestPayload from(AnchorEvent event) {
SendEventRequestPayload payload = new SendEventRequestPayload();
switch (event.getType()) {
case CUSTOMER_UPDATED:
payload.setCustomer(event.getCustomer());
case QUOTE_CREATED:
payload.setQuote(event.getQuote());
case TRANSACTION_CREATED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.gson.annotations.SerializedName;
import lombok.*;
import org.stellar.anchor.api.platform.CustomerUpdatedResponse;
import org.stellar.anchor.api.platform.GetQuoteResponse;
import org.stellar.anchor.api.platform.GetTransactionResponse;

Expand All @@ -13,8 +14,7 @@
* Schema</a>
*/
@Builder
@Getter
@Setter
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AnchorEvent {
Expand All @@ -23,6 +23,7 @@ public class AnchorEvent {
String sep;
GetTransactionResponse transaction;
GetQuoteResponse quote;
CustomerUpdatedResponse customer;

public enum Type {
@SerializedName("transaction_created")
Expand All @@ -32,7 +33,9 @@ public enum Type {
@SerializedName("transaction_error")
TRANSACTION_ERROR("transaction_error"),
@SerializedName("quote_created")
QUOTE_CREATED("quote_created");
QUOTE_CREATED("quote_created"),
@SerializedName("customer_updated")
CUSTOMER_UPDATED("customer_updated");

public final String type;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.stellar.anchor.api.exception;

import java.util.List;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/** Thrown when a customer's info is needed to complete a request. */
@RequiredArgsConstructor
@Getter
public class SepCustomerInfoNeededException extends AnchorException {
private final List<String> fields;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.stellar.anchor.api.platform;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CustomerUpdatedResponse {
String id;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.stellar.anchor.api.platform;

import com.google.gson.annotations.SerializedName;
import java.util.List;
import lombok.Builder;
import lombok.Data;
import lombok.NonNull;
import org.stellar.anchor.api.sep.SepTransactionStatus;

/**
* The request body of the GET /transactions endpoint of the Platform API.
*
* @see <a
* href="https://github.com/stellar/stellar-docs/blob/main/openapi/anchor-platform/Platform%20API.yml">Platform
* API</a>
*/
@Data
@Builder
public class GetTransactionsRequest {
@NonNull private TransactionsSeps sep;

@SerializedName("order_by")
private TransactionsOrderBy orderBy;

private TransactionsOrder order;

private List<SepTransactionStatus> statuses;

@SerializedName("page_size")
private Integer pageSize;

@SerializedName("page_number")
private Integer pageNumber;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.gson.annotations.SerializedName;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -29,6 +30,8 @@ public class PlatformTransactionData {
Kind kind;
SepTransactionStatus status;

String type;

@SerializedName("amount_expected")
Amount amountExpected;

Expand Down Expand Up @@ -89,7 +92,23 @@ public class PlatformTransactionData {
Customers customers;
StellarId creator;

@SerializedName("required_info_message")
String requiredInfoMessage;

@SerializedName("required_info_updates")
List<String> requiredInfoUpdates;

@SerializedName("required_customer_info_message")
String requiredCustomerInfoMessage;

@SerializedName("required_customer_info_updates")
List<String> requiredCustomerInfoUpdates;

Map<String, InstructionField> instructions;

public enum Sep {
@SerializedName("6")
SEP_6(6),
@SuppressWarnings("unused")
@SerializedName("24")
SEP_24(24),
Expand Down Expand Up @@ -127,8 +146,13 @@ public enum Kind {
RECEIVE("receive"),
@SerializedName("deposit")
DEPOSIT("deposit"),
@SerializedName("deposit-exchange")
DEPOSIT_EXCHANGE("deposit-exchange"),
@SerializedName("withdrawal")
WITHDRAWAL("withdrawal");
WITHDRAWAL("withdrawal"),

@SerializedName("withdrawal-exchange")
WITHDRAWAL_EXCHANGE("withdrawal-exchange");

public final String kind;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.stellar.anchor.api.platform;

import com.google.gson.annotations.SerializedName;

public enum TransactionsOrder {
@SerializedName("asc")
ASC,
@SerializedName("desc")
DESC
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.stellar.anchor.apiclient;
package org.stellar.anchor.api.platform;

public enum TransactionsOrderBy {
CREATED_AT("started_at"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.stellar.anchor.apiclient;
package org.stellar.anchor.api.platform;

import com.google.gson.annotations.SerializedName;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.stellar.anchor.api.rpc.method;

import com.google.gson.annotations.SerializedName;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -9,4 +11,11 @@
@SuperBuilder
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class RequestCustomerInfoUpdateRequest extends RpcMethodParamsRequest {}
public class RequestCustomerInfoUpdateRequest extends RpcMethodParamsRequest {

@SerializedName("required_customer_info_message")
private String requiredCustomerInfoMessage;

@SerializedName("required_customer_info_updates")
private List<String> requiredCustomerInfoUpdates;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.stellar.anchor.api.rpc.method;

import com.google.gson.annotations.SerializedName;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
import org.stellar.anchor.api.shared.InstructionField;

@Data
@SuperBuilder
Expand All @@ -23,4 +25,7 @@ public class RequestOffchainFundsRequest extends RpcMethodParamsRequest {

@SerializedName("amount_expected")
private AmountRequest amountExpected;

@SerializedName("instructions")
Map<String, InstructionField> instructions;
}
27 changes: 23 additions & 4 deletions api-schema/src/main/java/org/stellar/anchor/api/sep/AssetInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,30 @@ public class AssetInfo {
String code;
String issuer;

public String getAssetName() {
if (issuer != null) {
return schema + ":" + code + ":" + issuer;
/**
* Returns the SEP-38 asset name, which is the SEP-11 asset name prefixed with the schema.
*
* @return The SEP-38 asset name.
*/
public String getSep38AssetName() {
return schema + ":" + makeSep11AssetName(code, issuer);
}

/**
* Returns the SEP-11 asset name for the given asset code and issuer.
*
* @param assetCode The asset code.
* @param assetIssuer The asset issuer.
* @return The SEP-11 asset name.
*/
public static String makeSep11AssetName(String assetCode, String assetIssuer) {
if (AssetInfo.NATIVE_ASSET_CODE.equals(assetCode)) {
return AssetInfo.NATIVE_ASSET_CODE;
} else if (assetIssuer != null) {
return assetCode + ":" + assetIssuer;
} else {
return assetCode;
}
return schema + ":" + code;
}

@SerializedName("distribution_account")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.stellar.anchor.api.sep;

import java.util.List;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Data
public class CustomerInfoNeededResponse {
private final String type = "non_interactive_customer_info_needed";
private final List<String> fields;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.stellar.anchor.api.sep.sep12;

import com.google.gson.annotations.SerializedName;
import java.time.Instant;
import lombok.Builder;
import lombok.Data;

Expand Down Expand Up @@ -108,10 +109,10 @@ public class Sep12PutCustomerRequest implements Sep12CustomerRequestBase {
String idCountryCode;

@SerializedName("id_issue_date")
String idIssueDate;
Instant idIssueDate;

@SerializedName("id_expiration_date")
String idExpirationDate;
Instant idExpirationDate;

@SerializedName("id_number")
String idNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ public enum Sep12Status {
PROCESSING("PROCESSING"),

@SerializedName("REJECTED")
REJECTED("REJECTED"),

@SerializedName("VERIFICATION_REQUIRED")
VERIFICATION_REQUIRED("VERIFICATION_REQUIRED");
REJECTED("REJECTED");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
@Data
@AllArgsConstructor
public class GetTransactionResponse {
Sep6Transaction transaction;
Sep6TransactionResponse transaction;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
@Data
@AllArgsConstructor
public class GetTransactionsResponse {
List<Sep6Transaction> transactions;
List<Sep6TransactionResponse> transactions;
}
Loading
Loading