You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.8 KiB
80 lines
1.8 KiB
|
2 weeks ago
|
/*
|
||
|
|
* Copyright 2024. Huawei Technologies Co., Ltd. All rights reserved.
|
||
|
|
*
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
package notification
|
||
|
|
|
||
|
|
import (
|
||
|
|
"encoding/json"
|
||
|
|
)
|
||
|
|
|
||
|
|
type AppServer struct{}
|
||
|
|
|
||
|
|
// DealNotificationV3 Deal notification information V3.
|
||
|
|
// Params:
|
||
|
|
//
|
||
|
|
// notificationPayloadStr: Notification content, which is the payload decoded by jwsNotification.
|
||
|
|
//
|
||
|
|
// Return:
|
||
|
|
//
|
||
|
|
// nil
|
||
|
|
//
|
||
|
|
// Exception:
|
||
|
|
//
|
||
|
|
// error
|
||
|
|
func (a *AppServer) DealNotificationV3(notificationPayloadStr string) error {
|
||
|
|
var notificationPayload = NotificationPayload{}
|
||
|
|
if err := json.Unmarshal([]byte(notificationPayloadStr), ¬ificationPayload); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
// TODO: Need to replace it with the actual business logic.
|
||
|
|
notificationSubtype := notificationPayload.NotificationSubtype
|
||
|
|
switch notificationSubtype {
|
||
|
|
case INITIAL_BUY:
|
||
|
|
break
|
||
|
|
case DID_RENEW:
|
||
|
|
break
|
||
|
|
case RESTORE:
|
||
|
|
break
|
||
|
|
case AUTO_RENEW_ENABLED:
|
||
|
|
break
|
||
|
|
case AUTO_RENEW_DISABLED:
|
||
|
|
break
|
||
|
|
case DOWNGRADE:
|
||
|
|
break
|
||
|
|
case UPGRADE:
|
||
|
|
break
|
||
|
|
case REFUND_TRANSACTION:
|
||
|
|
break
|
||
|
|
case BILLING_RETRY:
|
||
|
|
break
|
||
|
|
case PRICE_INCREASE:
|
||
|
|
break
|
||
|
|
case BILLING_RECOVERY:
|
||
|
|
break
|
||
|
|
case PRODUCT_NOT_FOR_SALE:
|
||
|
|
break
|
||
|
|
case APPLICATION_DELETE_SUBSCRIPTION_HOSTING:
|
||
|
|
break
|
||
|
|
case RENEWAL_EXTENDED:
|
||
|
|
break
|
||
|
|
default:
|
||
|
|
break
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|