-
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.
Validate KYC before initiating transaction
- Loading branch information
Showing
9 changed files
with
154 additions
and
14 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...schema/src/main/java/org/stellar/anchor/api/exception/SepCustomerInfoNeededException.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,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; | ||
} |
12 changes: 12 additions & 0 deletions
12
api-schema/src/main/java/org/stellar/anchor/api/sep/CustomerInfoNeededResponse.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,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; | ||
} |
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
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
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
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 |
---|---|---|
|
@@ -52,7 +52,9 @@ class Sep6End2EndTest(val config: TestConfig, val jwt: String) { | |
val sep6Client = Sep6Client("${config.env["anchor.domain"]}/sep6", token.token) | ||
|
||
// Create a customer before starting the transaction | ||
anchor.customer(token).add(mapOf("first_name" to "John", "last_name" to "Doe")) | ||
anchor | ||
.customer(token) | ||
.add(mapOf("first_name" to "John", "last_name" to "Doe", "email_address" to "[email protected]")) | ||
|
||
val deposit = | ||
sep6Client.deposit( | ||
|
@@ -98,7 +100,9 @@ class Sep6End2EndTest(val config: TestConfig, val jwt: String) { | |
val sep6Client = Sep6Client("${config.env["anchor.domain"]}/sep6", token.token) | ||
|
||
// Create a customer before starting the transaction | ||
anchor.customer(token).add(mapOf("first_name" to "John", "last_name" to "Doe")) | ||
anchor | ||
.customer(token) | ||
.add(mapOf("first_name" to "John", "last_name" to "Doe", "email_address" to "[email protected]")) | ||
|
||
val withdraw = | ||
sep6Client.withdraw( | ||
|
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 |
---|---|---|
|
@@ -2,14 +2,24 @@ package org.stellar.anchor.platform.test | |
|
||
import org.skyscreamer.jsonassert.JSONAssert | ||
import org.skyscreamer.jsonassert.JSONCompareMode | ||
import org.stellar.anchor.api.sep.sep12.Sep12PutCustomerRequest | ||
import org.stellar.anchor.platform.CLIENT_WALLET_ACCOUNT | ||
import org.stellar.anchor.platform.Sep12Client | ||
import org.stellar.anchor.platform.Sep6Client | ||
import org.stellar.anchor.platform.gson | ||
import org.stellar.anchor.util.Log | ||
import org.stellar.anchor.util.Sep1Helper.TomlContent | ||
|
||
class Sep6Tests(val toml: TomlContent, jwt: String) { | ||
private val sep6Client = Sep6Client(toml.getString("TRANSFER_SERVER"), jwt) | ||
private val sep6Client: Sep6Client | ||
private val sep12Client: Sep12Client | ||
|
||
init { | ||
sep6Client = Sep6Client(toml.getString("TRANSFER_SERVER"), jwt) | ||
sep12Client = Sep12Client(toml.getString("KYC_SERVER"), jwt) | ||
// Create a customer before running any tests | ||
putCustomer() | ||
} | ||
|
||
private val expectedSep6Info = | ||
""" | ||
|
@@ -150,6 +160,16 @@ class Sep6Tests(val toml: TomlContent, jwt: String) { | |
) | ||
} | ||
|
||
private fun putCustomer() { | ||
val request = | ||
Sep12PutCustomerRequest.builder() | ||
.firstName("John") | ||
.lastName("Doe") | ||
.emailAddress("[email protected]") | ||
.build() | ||
sep12Client.putCustomer(request) | ||
} | ||
|
||
fun testAll() { | ||
Log.info("Performing SEP6 tests") | ||
`test Sep6 info endpoint`() | ||
|
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
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