1.7 KiB
1.7 KiB
Withdraw: Coin
Sprint: 7
Outcome:
Users can do coin withdrawal from any wallet to favorite address
Implementation description:
Endpoints:
POST {$domain}/api/v2/peatio/account/withdraws
File destination:
{$Dena_Path}/app/api/v2/account/withdraws.rb
Commits:
016303d1
cc565d9e
12322261
What did we implement:
we add controlling step before withdraw creation, so at first check 2fa (if was enabled),
the check auth code that was sent to the email
sequenceDiagram
Title: Withdraw Coin
User->>Ranj:select favorite beneficiary
Ranj->>User:Ask OTP code for confirming
User-->>Ranj:if OTP code not received, try for resend after 120 seconds
Ranj-->>Dena: Ask for sending OTP code again
Dena-->>User:2xx send otp to his or her email
note over User,Ranj:note parameter is optioanl
User->>Ranj:otp, beneficiary_id, currency, amount, **note**
Ranj->>Dena:POST: after client side checking
Dena->>Ranj:4xx if lose any required parameters
Dena->>Ranj:4xx if the config variable: **ENABLE_ACCOUNT_WITHDRAWAL_API** is FALSE
Dena->>Ranj:4xx if enter 2fa code wrong (will be check if 2fa is activated before)
Dena->>Ranj:4xx if OTP code expired
Dena->>Ranj:4xx if beneficiary is not active
Dena->>Ranj:4xx if withdrawal is disabled for the currency
note over Dena,Blockchain:The Blockchain service has own documentation
note over Dena,Blockchain:The Blockchain service trigged by hook method in withdraw model
Dena->>Blockchain:coin withdraw record created and balance locked
Dena->>Ranj:2xx coin withdraw created
Ranj->>User: notify user that new withdraw created