Skip to content

Commit

Permalink
Fix: Add CHF ConvergeCharging with OAuth2 Token
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Mar 6, 2024
1 parent 5aab128 commit 0216152
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/sbi/consumer/converged_charging.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package consumer

import (
"context"
"fmt"
"net/http"
"strings"
Expand Down Expand Up @@ -83,17 +82,22 @@ func SendConvergedChargingRequest(smContext *smf_context.SMContext, requestType
var httpResponse *http.Response
var err error

ctx, pd, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NCHF_CONVERGEDCHARGING, models.NfType_CHF)
if err != nil {
return nil, pd, err
}

// select the appropriate converged charging service based on trigger type
switch requestType {
case smf_context.CHARGING_INIT:
rsp, httpResponse, err = smContext.ChargingClient.DefaultApi.ChargingdataPost(context.Background(), *req)
rsp, httpResponse, err = smContext.ChargingClient.DefaultApi.ChargingdataPost(ctx, *req)
chargingDataRef := strings.Split(httpResponse.Header.Get("Location"), "/")
smContext.ChargingDataRef = chargingDataRef[len(chargingDataRef)-1]
case smf_context.CHARGING_UPDATE:
rsp, httpResponse, err = smContext.ChargingClient.DefaultApi.ChargingdataChargingDataRefUpdatePost(
context.Background(), smContext.ChargingDataRef, *req)
ctx, smContext.ChargingDataRef, *req)
case smf_context.CHARGING_RELEASE:
httpResponse, err = smContext.ChargingClient.DefaultApi.ChargingdataChargingDataRefReleasePost(context.Background(),
httpResponse, err = smContext.ChargingClient.DefaultApi.ChargingdataChargingDataRefReleasePost(ctx,
smContext.ChargingDataRef, *req)
}

Expand Down

0 comments on commit 0216152

Please sign in to comment.