Skip to content

Commit

Permalink
Merge pull request #2 from neptune-software/feature/supportABAPSDKfor…
Browse files Browse the repository at this point in the history
…GoogleCloud1.7

Compatibility with ABAP SDK for Google Cloud Version 1.7
  • Loading branch information
thorsten-wolf-neptune authored Jun 12, 2024
2 parents c3fd3b8 + 1de8f2b commit 02c7322
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ This is an additional integration scenario for the amazing Google ABAP SDK Libra
The main purpose of this library is to allow sending Firebase Push Notifications (aka Firebase Cloud Messaging) via the new HTTP v1 API (https://fcm.googleapis.com/v1/projects/*myproject-b5ae1*/messages:send) as the legacy FCM API (https://fcm.googleapis.com/fcm/send) was deprecated on June 20, 2023, and will be removed in June 2024. You find more information about the deprecation and migration steps [here](https://firebase.google.com/docs/cloud-messaging/migrate-v1).
The biggest challenge for the new API is that the authentication takes place through short-lived OAuth access tokens that need to be obtained before sending the actual request. The main ABAP Cloud Library already has all implementation for the correct handling of tokens in place that's why we choose to have the main Google Cloud ABAP SDK as a foundation for this additional functionality.

So please make sure you **FIRST INSTALL AND SETUP THE GOOGLE CLOUD ABAP SDK IN VERSION 1.5** (see [Prerequisites](#Prerequisites)) before using this package because you would get syntax errors otherwise.
So please make sure you **FIRST INSTALL AND SETUP THE GOOGLE CLOUD ABAP SDK** (see [Prerequisites](#Prerequisites)) before using this package because you would get syntax errors otherwise.

## Version Dependency
Depending on the **GOOGLE CLOUD ABAP SDK Version** you need to install different versions of this repository.

If you are using **GOOGLE CLOUD ABAP SDK 1.5** please install Version 1.0 of this Repository (https://github.com/neptune-software/google-abap-sdk/releases/tag/v1.0.0).

If you are using **GOOGLE CLOUD ABAP SDK 1.7** please install Version 2.0 of this Repository (https://github.com/neptune-software/google-abap-sdk/releases/tag/v2.0.0).

If you don't ensure to download the correct version you will get a syntax error that is also easily fixable on your own if you want (see https://github.com/neptune-software/google-abap-sdk/commit/9e1cf05d7b9cc622386a546295f574f5eb93eb25)

## Background
The Neptune DXP allows you to create Mobile Clients both for Android and iOS via the Cordova framework. Our solution offers an easy way to integrate Firebase Cloud Messaging (Push Notifications via Firebase) into your Mobile Clients by configuring a few parameters in our Cockpit. Our Neptune DXP SAP Edition is an ABAP Addon that comes with the Function Module called /NEPTUNE/PUSH_FIREBASE. It allows you to send push notifications to the corresponding Mobile Clients. However, since this function module is using the legacy FCM API, this new repository leveraging the well-established Google Cloud ABAP SDK is the easy-to-use successor of the /NEPTUNE/PUSH_FIREBASE function module.

In addition to the Neptune DXP integration, you can also use this library for general-purpose Firebase Cloud Messaging scenarios outside a Neptune DXP use case.

## Prerequisites
Before using this library you need to install the [Cloud ABAP SDK version 1.5](https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/all-guides). It comes with a very detailed install and setup guide so please follow that upfront. After you install the corresponding transport (at least the "Token" approach is required. The additional OAuth transport can be installed but is not required) you need to set up the general authentication settings that are mentioned in the documentation that will then later be used for this FCM library.
Before using this library you need to install the correct [Cloud ABAP SDK version](https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/all-guides). It comes with a very detailed install and setup guide so please follow that upfront. After you install the corresponding transport (at least the "Token" approach is required. The additional OAuth transport can be installed but is not required) you need to set up the general authentication settings that are mentioned in the documentation that will then later be used for this FCM library.

## Artifacts
This package comes with a class (ZCL_GOOG_FCM_V1) that implements the calling of the new HTTP v1 API via the following public methods.
Expand Down
2 changes: 1 addition & 1 deletion deps/#goog#cl_http_client.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ data GV_PROJECT_ID type string .
methods CLOSE_HTTP_CLIENT .
methods CONSTRUCTOR
importing
!IS_KEY type /GOOG/CLIENT_KEY optional
!IV_KEY type CLIKE optional
!IV_ENDPOINT type STRING optional
!IV_ENDPOINT_SUFFIX type STRING optional
!IV_SERVICE_NAME type /GOOG/SERVICE_NAME optional
Expand Down
11 changes: 6 additions & 5 deletions src/zgoog_client/zcl_goog_fcm_v1.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public section.
end of ty_messages_send_each_for_mc .

constants C_SERVICE_NAME type /GOOG/SERVICE_NAME value 'fcm:v1'. "#EC NOTEXT
constants C_REVISION_DATE type DATUM value 20240321. "#EC NOTEXT "#EC NEEDED
constants C_SUPPORTED_AUTH type /GOOG/SUPP_AUTH value 'IJIJ'. "#EC NOTEXT "#EC NEEDED
constants C_REVISION_DATE type DATUM value 20240321. "#EC NOTEXT "#EC NEEDED
constants C_SUPPORTED_AUTH type /GOOG/SUPP_AUTH value 'IJIJ'. "#EC NOTEXT "#EC NEEDED
constants C_ROOT_URL type STRING value 'https://fcm.googleapis.com'. "#EC NOTEXT
constants C_PATH_PREFIX type STRING value ''. "#EC NOTEXT

Expand Down Expand Up @@ -197,8 +197,8 @@ method close.
endmethod.


method CONSTRUCTOR.
data: lv_err_text type string,
method constructor.
data: lv_err_text type string,
lv_endpoint type string,
lv_endpoint_suffix type string.

Expand All @@ -214,7 +214,8 @@ method CONSTRUCTOR.
lv_endpoint = c_root_url.
lv_endpoint_suffix = c_path_prefix.

super->constructor( is_key = ls_key
super->constructor( "is_key = ls_key "#1
iv_key = iv_key_name "#1
iv_endpoint = lv_endpoint
iv_endpoint_suffix = lv_endpoint_suffix
iv_service_name = c_service_name
Expand Down

0 comments on commit 02c7322

Please sign in to comment.