Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add CHF consumer with OAuth2 Token #96

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading