> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oristapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

## Preparation before integration testing

* RD needs to provide:
  * clientId & clientSecret (for Merchant identity authentication)
  * RD public key certificate
  * Test environment IP
  * APP for RD test environment
  * SDK
* Customers need to provide:
  * Test environment IP (IP used to call the API, network environment IP for running the test APP)
  * Callback address
  * Merchant public key certificate

## Quick Access Guide (SDK)

### **Business process diagram**

**Create a Sub-wallet**

```mermaid theme={null}
sequenceDiagram
    participant Customer
    participant Platform
    
    rect rgb(242,247,250)
        loop Submit form files
            Customer->>+Platform: 【File Upload】(FileUpload)
            Platform->>Platform: Validate file
            Platform-->>-Customer: Return file key
        end
    end
    
    rect rgb(235,245,255)
        note over Customer,Platform: Company Profile Submission & Review
        Customer->>+Platform: Submit Company Profile(CreateProfileApplication)
        Platform->>Platform: Validate form integrity
        Platform-->>-Customer: Return validation result (Success)
        Platform->>Platform: Review company profile
        Platform->>+Customer: Review Result Notification(callbackRequest)
        Customer-->>-Platform: Confirm receipt
    end

    rect rgb(227,242,253)
        note over Customer,Platform: Sub-Wallet Creation & Query
        Customer->>+Platform: Query Company Profile(QueryCompanyProfile)
        Platform-->>-Customer: Return company details
        Customer->>+Platform: Create Sub-Wallet(CreateSubWallet)
        Platform->>Platform: Process creation request
        Platform-->>-Customer: Return submission success
        Platform->>+Customer: Wallet Activation Result(callbackRequest)
        Customer-->>-Platform: Confirm receipt
        Customer->>+Platform: Query Wallet List(WalletList)
        Platform-->>-Customer: Return wallet list    
    end
```

**Deposit whitelist process**

```mermaid theme={null}
sequenceDiagram
participant Client
participant Platform
participant Blockchain

    rect rgb(242,247,250)
        note over Client,Blockchain: Signature Verification Flow
        Client->>+Platform: Get signature data (GetSignData)
        Platform-->>-Client: Return data to be signed
        Client->>+Platform: Add address to whitelist (AddAddressWhitelist)
        Platform->>Platform: Verify signature
        Platform-->>-Client: Return addition success
    end

    rect rgb(235,245,255)
        note over Client,Blockchain: Small Transfer Flow
        Client->>+Platform: Add address to whitelist (AddAddressWhitelist)
        Platform->>Platform: Generate deposit info
        Platform-->>-Client: Return pending status, deposit address and amount
        Client->>+Blockchain: Transfer (specified amount)
        Blockchain->>+Platform: Transfer result
        Platform->>Platform: Review transfer and deposit
    end

    rect rgb(227,242,253)
        Platform->>+Client: Whitelist added successfully (callbackRequest)
        Client-->>-Platform: Confirm receipt
    end
```

**Deposit process**

```mermaid theme={null}
sequenceDiagram
    participant Customer
    participant Platform
    participant Blockchain
    
    rect rgb(242,247,250)
        note over Customer,Blockchain: Address Query & Order Declaration
        Customer->>+Platform: Receive Address Query(ReceiveAddressQuery)
        Platform-->>-Customer: Return receive address
        Customer->>+Platform: Declare Receive Order(DeclareReceiveOrder)
        Platform-->>-Customer: Return declaration result
    end

    rect rgb(235,245,255)
        note over Customer,Blockchain: Transfer & Result Sync
        Customer->>+Blockchain: Transfer(Amount)
        Blockchain->>+Platform: Transfer Result
    end

    rect rgb(227,242,253)
        note over Customer,Blockchain: Deposit Processing & Notification
        Platform->>Platform: Check address whitelist
        Platform->>Platform: Verify transaction compliance
        Platform->>Platform: Execute fund deposit
        Platform->>+Customer: Deposit Success Result Notification(CallbackRequest)
        Customer-->>-Platform: Confirm receipt
    end
```

**Request Payment process**

```mermaid theme={null}
sequenceDiagram
    participant Customer
    participant Platform
    participant Blockchain
    
    rect rgb(242,247,250)
        note over Customer,Blockchain: Order Declaration & Review
        Customer->>+Platform: Order Declaration(RequestPaymentOrderDeclare)
        Platform->>Platform: Process declaration request
        Platform-->>-Customer: Return submission success
        Platform->>Platform: Review order
        Platform->>+Customer: Result Notification(CallbackRequest)
        Customer-->>-Platform: Confirm receipt
    end

    rect rgb(235,245,255)
        note over Customer,Blockchain: Transfer & Receipt
        Customer->>+Blockchain: Transfer(Specified amount to deposit address)
        Blockchain-->>-Customer: Transfer receipt
        Blockchain->>+Platform: Push transfer result
    end

    rect rgb(227,242,253)
        note over Customer,Blockchain: Deposit Verification & Notification
        Platform->>Platform: Check order material completeness
        Platform->>Platform: Verify transaction compliance
        Platform->>Platform: Execute fund deposit
        Platform->>+Customer: Deposit Success Result Notification(CallbackRequest)
        Customer-->>-Platform: Confirm receipt
    end
```

**Sub-wallet Aggregation Process**

```mermaid theme={null}
sequenceDiagram
    participant Customer
    participant Platform
    
    rect rgb(235,245,255)
        note over Customer,Platform: Wallet Transfer Process
        Customer->>+Platform: Wallet Transfer(WalletTransfer)
        Platform-->>-Customer: Return Success
    end

    rect rgb(227,242,253)
        Platform->>+Customer: Transfer Successful Result Notification(CallbackRequest)
        Customer-->>-Platform: Confirm Receipt
    end
```

 **Payout process**

```mermaid theme={null}
sequenceDiagram
    participant Customer
    participant Platform
    
    rect rgb(242,247,250)
        note over Customer,Platform: Asset Transfer Process
        Customer->>+Platform: Internal Transfer(InternalTransfer)
        Platform-->>-Customer: Return Success
        Platform->>+Customer: Order Completed 【Result Notification】(CallbackRequest)
        Customer-->>-Platform: Confirm Receipt
    end

    rect rgb(235,245,255)
        note over Customer,Platform: Add Bank Account Process
        Customer->>+Platform: Add Bank Account(AddBankAccount)
        Platform->>Platform: Review Account
        Platform-->>-Customer: Return Review Result
        Platform->>+Customer: Addition Completed 【Result Notification】(CallbackRequest)
        Customer-->>-Platform: Confirm Receipt
    end

    rect rgb(227,242,253)
        note over Customer,Platform: Quote, Order & Exception Handling Process
        Customer->>+Platform: Payout Quote(PayoutQuote)
        Platform-->>-Customer: Return Quote
        Customer->>+Platform: Payout Book(PayoutBook)
        Platform-->>-Customer: Return Order Result
        Platform->>Platform: Process Order
        Platform->>+Customer: Processing Completed 【Result Notification】(CallbackRequest)
        Customer-->>-Platform: Confirm Receipt
        Customer->>+Platform: Re-settle(payoutReSettle)
        Platform->>Platform: Process Re-settlement
        Platform-->>-Customer: Return Processing Result
        Platform->>+Customer: Re-settlement 【Result Notification】(CallbackRequest)
        Customer-->>-Platform: Confirm Receipt
    end
```

### **Java SDK Integration Guide**

**Importing Dependencies**

```xml theme={null}
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>group.rd.digitalasset</groupId>
    <artifactId>digitalasset-toolkit-example</artifactId>
    <version>0.1.0</version>
    <packaging>jar</packaging>
    <name>Digitalasset :: Toolkit :: Example</name>
    <url>https://developer.rd.group</url>
    <properties>
        <project.build.encoding>UTF-8</project.build.encoding>
    </properties>
    <dependencies>
        <dependency>
          <groupId>group.rd.digitalasset</groupId>
          <artifactId>digitalasset-toolkit</artifactId>
          <version>0.1.25</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.4.12</version>
        </dependency>
    </dependencies>
</project>
```

**Configuring environment variables**

Please set RD\_MODE to UAT|PRO in the environment variable

**Configure the location of the business party private key and RD public key file**

Refer to the following sample code. The business party needs to pgpPathstore the following content in the specified directory:

1. The private key currently used by the business party:/clientFingerprint/private.key
2. The RD public key currently used by the business party：/serverFingerprint/public.key

**Integration Example**

```java theme={null}
package group.rd.digitalasset.example;
import group.rd.digitalasset.toolkit.Profile;
import group.rd.digitalasset.toolkit.RDToolkit;
import group.rd.digitalasset.toolkit.api.v1.*;
import org.junit.jupiter.api.Test;
import java.io.FileInputStream;
import java.io.IOException;
public class Demo {
    private final static Logger log = LoggerFactory.getLogger(Demo.class);
    public static void main(String[] args) {
        String appId = "rdClient";
        String clientId = "01JGB38S8Y5MZTSGDF9Q12123C";
        String clientSecret = "XvuJ2ruKpzy8jiL2PRHvholxrvUYdH54";
        String clientFingerprint = "468defed2a1c5e571c181fdb878990b54c24ccdb0da";
        String serverFingerprint = "ee5ec5bf94af5f8sdsdad61355e1e397ce0536";
        String privateKeyPwd = "test_password";
        String path = this.getClass().getClassLoader().getResource("").getPath() + "pgp";
        path = path.replaceFirst("/", "");
        System.out.println("  path:" + path);
        //Configure the global certificate root path
        Profile profile = Profile.of(appId, clientFingerprint, serverFingerprint);
        RDToolkit rdToolkit = RDToolkit.of(path, profile)
                .addAuthority(clientId, clientSecret)
                .addSecret(clientFingerprint, privateKeyPwd);
        WalletListResp walletListResp = rdToolkit.walletList();
    }
}
```
