-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ANCHOR-355] Implement SEP-6 deposit (#1035)
This implements the SEP-6 `GET /deposit` endpoint _mostly_ according to the sequence diagram from the PR. Where the implementation deviates is how `CUSTOMER_UPDATED` anchor events are structured. This implementation sends out 1 event whenever a SEP-12 customer is updated instead of fanning them out a `TRANSACTION_STATUS_CHANGED` event for each ongoing transaction submitted by the customer. This was done to keep the scope of this change small, but we can consider whether to move this into the platform later.
- Loading branch information
Showing
55 changed files
with
1,532 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
api-schema/src/main/java/org/stellar/anchor/api/platform/CustomerUpdatedResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
api-schema/src/main/java/org/stellar/anchor/api/sep/sep6/GetDepositRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.stellar.anchor.api.sep.sep6; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NonNull; | ||
|
||
/** | ||
* The request body of the GET /deposit endpoint. | ||
* | ||
* @see <a href="">GET /deposit</a> | ||
*/ | ||
@Builder | ||
@Data | ||
public class GetDepositRequest { | ||
/** The asset code of the asset to deposit. */ | ||
@NonNull | ||
@SerializedName("asset_code") | ||
String assetCode; | ||
|
||
/** The Stellar account ID of the user to deposit to. */ | ||
@NonNull String account; | ||
|
||
/** The memo type to use for the deposit. */ | ||
@SerializedName("memo_type") | ||
String memoType; | ||
|
||
/** The memo to use for the deposit. */ | ||
String memo; | ||
|
||
/** Email address of depositor. Currently, ignored. */ | ||
@SerializedName("email_address") | ||
String emailAddress; | ||
|
||
/** Type of deposit. */ | ||
@NonNull String type; | ||
|
||
/** Name of wallet to deposit to. Currently, ignored. */ | ||
@SerializedName("wallet_name") | ||
String walletName; | ||
|
||
/** | ||
* Anchor should link to this when notifying the user that the transaction has completed. | ||
* Currently, ignored | ||
*/ | ||
@SerializedName("wallet_url") | ||
String walletUrl; | ||
|
||
/** | ||
* Defaults to en if not specified or if the specified language is not supported. Currently, | ||
* ignored. | ||
*/ | ||
String lang; | ||
|
||
/** The amount to deposit. */ | ||
@NonNull String amount; | ||
|
||
/** The ISO 3166-1 alpha-3 code of the user's current address. */ | ||
@SerializedName("country_code") | ||
String countryCode; | ||
|
||
/** | ||
* Whether the client supports receiving deposit transactions as a claimable balance. Currently, | ||
* unsupported. | ||
*/ | ||
@SerializedName("claimable_balances_supported") | ||
Boolean claimableBalancesSupported; | ||
} |
26 changes: 26 additions & 0 deletions
26
api-schema/src/main/java/org/stellar/anchor/api/sep/sep6/GetDepositResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.stellar.anchor.api.sep.sep6; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
/** | ||
* The response to the GET /deposit endpoint. | ||
* | ||
* @see <a | ||
* href="https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0006.md#response">GET | ||
* /deposit response</a> | ||
*/ | ||
@Builder | ||
@Data | ||
public class GetDepositResponse { | ||
/** | ||
* Terse but complete instructions for how to deposit the asset. | ||
* | ||
* <p>Anchor Platform does not support synchronous deposit flows, so this field will never contain | ||
* real instructions. | ||
*/ | ||
String how; | ||
|
||
/** The anchor's ID for this deposit. */ | ||
String id; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
api-schema/src/main/java/org/stellar/anchor/api/shared/InstructionField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.stellar.anchor.api.shared; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class InstructionField { | ||
String value; | ||
String description; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.