> For the complete documentation index, see [llms.txt](https://developer.gotadi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.gotadi.com/english/b2b2c-partner/sdk-method.md).

# SDK method

### **Related Documents**

* Connection information between Gotadi and Partners.
* Test scenarios.
* Sample source code.

***

### **Terminology and Abbreviations**

| Viết tắt | Từ đầy đủ                          | Mô tả                                                                                                                                                      |
| -------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| URL      | Uniform Resource                   | Used to reference resources on the Internet.                                                                                                               |
| SSL      | Secure Sockets Layer               | A cryptographic protocol designed to provide secure communication over the Internet.                                                                       |
| HTTPS    | Hypertext Transfer Protocol Secure | A protocol that combines HTTP with SSL or TLS to enable secure information exchange over the Internet.                                                     |
| 3DES     | Triple DES (3DES hay TDES)         | A symmetric key algorithm that applies the DES encryption algorithm three times to each data block.                                                        |
| RSA      | Rivest–Shamir–Adleman              | A public-key cryptographic algorithm. It is the first algorithm suitable for both digital signature generation and encryption.                             |
| SHA-256  | Secure Hash Algorithm              | An algorithm used to transform a specific data segment into a fixed-length output with a high probability of uniqueness. SHA-256 returns a 256-bit result. |
|          | Chữ ký điện tử                     | Information attached to data (text, images, videos, etc.) to identify the owner of that data.                                                              |
| M        | Mandatory                          | Mandatory when calling the API                                                                                                                             |
| O        | Optional                           | Not required when calling the API; this parameter is optional depending on the use case.                                                                   |
| C        | Condition                          | This field is determined as Mandatory or Optional based on the Condition of another field when calling the API                                             |

### Connection Process <a href="#quy-trinh-ket-noi" id="quy-trinh-ket-noi"></a>

<details>

<summary>Step 1</summary>

The partner provides information for Gotadi to create an agency account in the sandbox environment. The information includes:

* **Company Information:**
  * Company name
  * Company address
  * Website address
* **Administrator Information:**
  * Full name
  * Email address
  * Phone number
* **Connection Information:**
  * Partner's system URLs: Product link, Payment gateway link, etc.
  * Relevant integration documents
  * Partner’s public key (RSA public key with a minimum length of 1024 bits)

</details>

<details>

<summary>Step 2</summary>

Gotadi creates an account based on the information provided by the Partner and sends back the account details, including:

* Account activation link and login access to Gotadi's B2B portal (sent to the administrator's email).
* Gotadi system URL: `<gotadi_api_gateway>`
* Gotadi's Public key (RSA public key with a minimum length of 1024 bits)
* Parameters for request headers:
  * API access key: `<api_key>`
  * Partner access code: `<access_code>`

</details>

<details>

<summary>Step 3</summary>

The partner activates the account and uses the information from Step 2 to establish a connection and perform testing in the sandbox environment.

</details>

<details>

<summary>Step 4</summary>

Sandbox Acceptance and Service Go-Live

</details>

### HTTP Response code <a href="#http-response-code" id="http-response-code"></a>

| Code | Mô tả                 |
| ---- | --------------------- |
| 200  | Success               |
| 400  | Bad Request           |
| 401  | Unauthorized          |
| 402  | Forbidden             |
| 402  | Not Found             |
| 500  | Internal Server Error |
| 503  | Service Unavailable   |

### Error codes <a href="#ma-loi" id="ma-loi"></a>

| Mã lỗi | Mô tả                                                          |
| ------ | -------------------------------------------------------------- |
| 00     | Request processed successfully.                                |
| 01     | Request is being processed.                                    |
| 02     | Request processing failed.                                     |
| 03     | Request rejected due to agency account authentication failure. |
| 04     | Request rejected due to an invalid digital signature.          |
| 05     | Request rejected due to data decryption failure.               |
| 06     | Request rejected due to an invalid access code.                |
| 07     | Request rejected due to incorrect data format.                 |
| 08     | Request rejected as it has already been processed.             |
| 09     | Request not yet provessed.                                     |
| 10     | Account information not found.                                 |
| 99     | Other errors.                                                  |

### Detailed Integration Flows  (**Step 3 - 4)**&#x20;

1. **After searching and booking in GotadiSDK**, a callback is returned containing the `BookingNumber`.
2. **The partner receives the `BookingNumber`** and:
   1. Redirects the user to the **\[Partner's Payment Screen]**.
   2. Calls the `/booking-detail` API to retrieve payment details.
3. **Upon successful or failed payment**, the partner:
   1. Redirects the user to the **\[Partner's Invoice Screen]**.
   2. Calls the `/booking-detail` API to retrieve `bookingInfo`.
4. **On the \[Partner's Invoice Screen]**, if the user selects **\[Manage Tickets]**:
   1. Redirects the user to the **\[GotadiSDK Booking Management Screen]**.
