Rename config vars. Add widget holder template and endpoint to serve it. Add dockerfile
This commit is contained in:
@@ -26,7 +26,7 @@ type yookassaService struct {
|
||||
func NewYookassaService(conf config.YooKassa) (Service, error) {
|
||||
client := resty.New()
|
||||
client.SetBaseURL(conf.BaseUrl)
|
||||
client.SetBasicAuth(conf.ApiPaymentKey, conf.ApiPaymentSecret)
|
||||
client.SetBasicAuth(conf.ApiPayoutKey, conf.ApiPayoutSecret)
|
||||
client.SetTimeout(conf.Timeout)
|
||||
|
||||
if conf.Retry.Enabled {
|
||||
@@ -110,10 +110,23 @@ func (y *yookassaService) CreatePayout(req models.PayoutReq, userSession *orm.Us
|
||||
|
||||
switch req.PayoutType {
|
||||
case models.TypeSBP:
|
||||
yReq.PayoutDestinationData.Phone = userSession.Phone
|
||||
yReq.PayoutDestinationData.BankID = req.BankID
|
||||
yReq.PayoutDestinationData = PayoutDestination{
|
||||
Phone: userSession.Phone,
|
||||
BankID: req.BankID,
|
||||
}
|
||||
|
||||
case models.TypeYooMoney:
|
||||
yReq.PayoutDestinationData.AccountNumber = req.AccountNumber
|
||||
|
||||
case models.TypeCard:
|
||||
yReq.PayoutDestinationData.Card = Card{
|
||||
Number: req.CardNumber,
|
||||
}
|
||||
|
||||
case models.TypeCardWidget:
|
||||
yReq.PayoutToken = req.PayoutToken
|
||||
yReq.PayoutDestinationData = PayoutDestination{}
|
||||
|
||||
default:
|
||||
return nil, errors.New("unsupported payout type")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user