refactor-location #134
			
				
			
		
		
		
	|  | @ -0,0 +1,39 @@ | |||
| package client | ||||
| 
 | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"errors" | ||||
| 
 | ||||
| 	"git.selly.red/Selly-Modules/natsio" | ||||
| 	"git.selly.red/Selly-Modules/natsio/model" | ||||
| 	"git.selly.red/Selly-Modules/natsio/subject" | ||||
| ) | ||||
| 
 | ||||
| // Withdraw ...
 | ||||
| type Withdraw struct{} | ||||
| 
 | ||||
| // GetWithdraw ...
 | ||||
| func GetWithdraw() Withdraw { | ||||
| 	return Withdraw{} | ||||
| } | ||||
| 
 | ||||
| // GetSupplierCash ...
 | ||||
| func (o Withdraw) GetSupplierCash(p model.WithdrawSupplierCashReq) (*model.WithdrawSupplierCashRes, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Withdraw.GetSupplierCash, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	var ( | ||||
| 		r struct { | ||||
| 			Data  model.WithdrawSupplierCashRes `json:"data"` | ||||
| 			Error string                        `json:"error"` | ||||
| 		} | ||||
| 	) | ||||
| 	if err = json.Unmarshal(msg.Data, &r); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if r.Error != "" { | ||||
| 		return nil, errors.New(r.Error) | ||||
| 	} | ||||
| 	return &r.Data, nil | ||||
| } | ||||
|  | @ -0,0 +1,11 @@ | |||
| package model | ||||
| 
 | ||||
| type CheckBankAndBranchByIDRequest struct { | ||||
| 	BankID   string `json:"bankId"` | ||||
| 	BranchID string `json:"branchId"` | ||||
| } | ||||
| 
 | ||||
| type GetBankInfoRequest struct { | ||||
| 	BankID   string `json:"bankId"` | ||||
| 	BranchID string `json:"branchId"` | ||||
| } | ||||
		Loading…
	
		Reference in New Issue