ONDC-Official / verification-logs

ONDC Pre-production issue & discussion board
22 stars 306 forks source link

Unable to get ACK on subscribe call to ONDC #3

Open keshav-BFRS01751 opened 2 years ago

keshav-BFRS01751 commented 2 years ago

My Curl request is :

curl -i -XPOST -H'Accept: application/json' -H'Content-Type: application/json' -d' { "context": { "operation": { "ops_no": 2 }, "request_id": "27baa06d-f90a-486c-85e5-cc621b787f04", "timestamp": "2022-07-11T10:24:55.263Z", "entity": { "gst": { "legal_entity_name": "BIGFOOT RETAIL SOLUTIONS PRIVATE LIMITED", "business_address": "Plot B, Khasra No. 360, Sultanpur, M.G. Road, West Delhi, Delhi, 110030", "city_code": [ "std:011" ], "gst_no": "07AAECB7131Q1ZC" }, "pan": { "name_as_per_pan": "BIGFOOT RETAIL SOLUTION PRIVATE LIMITED", "pan_no": "AAECB7131Q", "date_of_incorporation": "28/09/2011" }, "name_of_authorised_signatory": "Gautam Kapoor, Director of the company and Saahil Goel, CEO \u0026 Director of the company", "address_of_authorised Signatory": "Plot No- B, Khasra No- 360, Sultanpur, New Delhi- 110030", "email_id": "gautam.kapoor@shiprocket.com and saahil.goel@shiprocket.com", "mobile_no": "9899555091", "country": "IND", "subscriber_id": "dev-ondc.shiprocket.in", "callback_url": "https://dev-ondc.shiprocket.in", "key_pair": { "signing_public_key": "z6019Zev9Bw6BsIRJfVU278qbgf+1k1ouwZ2IX020j8\u003d", "encryption_public_key": "Y3mJALmsn/wx52mRpmGp9IngimH0x9TY9DCDufbWBWo\u003d", "valid_from": "2022-07-11T10:24:55.283Z", "valid_until": "2023-07-11T04:54:55.000Z" } }, "network_participant": [ { "subscriber_url": "https://dev-ondc.shiprocket.in", "domain": "nic2004:60232", "type": "sellerApp", "msn": false, "city_code": [ "*" ] } ] } }' 'https://preprod.registry.ondc.org/ondc/subscribe'

We are receiving the error {"message":{"ack":{"status":"NACK"}},"error":{"type":"POLICY-ERROR","code":"132","path":null,"message":"Timestamp is invalid"}}

sujeets-protean commented 2 years ago

Please correct your callback_url and subscriber_url.

Example: subscriber_id: abc.ondc.org callback_url: /ondc/ subscriber_url: /sub/

Then ONDC network registry will use "||on_subscribe" and call "https://abc.ondc.org/ondc/on_subscribe" For search, ONDC gateway will use "||search" and call "https://abc.ondc.org/sub/search"

keshav-BFRS01751 commented 2 years ago

We have corrected our url in json still issue is same:

Response:-

{"message":{"ack":{"status":"NACK"}},"error":{"type":"POLICY-ERROR","code":"132","path":null,"message":"Timestamp is invalid"}}

curl Request :-

curl -i -XPOST -H'Accept: application/json' -H'Content-Type: application/json' -d' { "context": { "operation": { "ops_no": 2 }, "request_id": "27baa06d-f90a-486c-85e5-cc621b787f04", "timestamp": "2022-07-11T11:09:22.990Z", "entity": { "gst": { "legal_entity_name": "BIGFOOT RETAIL SOLUTIONS PRIVATE LIMITED", "business_address": "Plot B, Khasra No. 360, Sultanpur, M.G. Road, West Delhi, Delhi, 110030", "city_code": [ "std:011" ], "gst_no": "07AAECB7131Q1ZC" }, "pan": { "name_as_per_pan": "BIGFOOT RETAIL SOLUTION PRIVATE LIMITED", "pan_no": "AAECB7131Q", "date_of_incorporation": "28/09/2011" }, "name_of_authorised_signatory": "Gautam Kapoor, Director of the company and Saahil Goel, CEO \u0026 Director of the company", "address_of_authorised Signatory": "Plot No- B, Khasra No- 360, Sultanpur, New Delhi- 110030", "email_id": "gautam.kapoor@shiprocket.com and saahil.goel@shiprocket.com", "mobile_no": "7259028885", "country": "IND", "subscriber_id": "dev-ondc.shiprocket.in", "callback_url": "/", "key_pair": { "signing_public_key": "z6019Zev9Bw6BsIRJfVU278qbgf+1k1ouwZ2IX020j8=", "encryption_public_key": "Y3mJALmsn/wx52mRpmGp9IngimH0x9TY9DCDufbWBWo=", "valid_from": "2022-07-11T11:09:23.008Z", "valid_until": "2023-07-11T11:09:23.000Z" } }, "network_participant": [ { "subscriber_url": "/", "domain": "nic2004:60232", "type": "sellerApp", "msn": false, "city_code": [ "*" ] } ] } }' 'https://preprod.registry.ondc.org/ondc/subscribe'

Shriramprotean commented 2 years ago

Please check the time in JSON. The time is validity is of 10 mins. Please change and then send again.

Shriramprotean commented 2 years ago

We have updated 400 Mins but team is checking on time issue with your JSON.

ganeshfosgen commented 2 years ago

Entity object should under "message". "timestamp" and "request_id" is properties of message The correct json is : { "context": { "operation": { "ops_no": 2 } }, "message": { "entity": { "gst": { "legal_entity_name": "BIGFOOT RETAIL SOLUTIONS PRIVATE LIMITED", "business_address": "Plot B, Khasra No. 360, Sultanpur, M.G. Road, West Delhi, Delhi, 110030", "city_code": [ "std:011" ], "gst_no": "07AAECB7131Q1ZC" }, "pan": { "name_as_per_pan": "BIGFOOT RETAIL SOLUTION PRIVATE LIMITED", "pan_no": "AAECB7131Q", "date_of_incorporation": "28/09/2011" }, "name_of_authorised_signatory": "Gautam Kapoor, Director of the company and Saahil Goel, CEO \u0026 Director of the company", "address_of_authorised Signatory": "Plot No- B, Khasra No- 360, Sultanpur, New Delhi- 110030", "email_id": "gautam.kapoor@shiprocket.com and saahil.goel@shiprocket.com", "mobile_no": "7259028885", "country": "IND", "subscriber_id": "dev-ondc.shiprocket.in", "callback_url": "/", "key_pair": { "signing_public_key": "z6019Zev9Bw6BsIRJfVU278qbgf+1k1ouwZ2IX020j8=", "encryption_public_key": "Y3mJALmsn/wx52mRpmGp9IngimH0x9TY9DCDufbWBWo=", "valid_from": "2022-07-11T11:09:23.008Z", "valid_until": "2023-07-11T11:09:23.000Z" } }, "network_participant": [ { "subscriber_url": "/", "domain": "nic2004:60232", "type": "sellerApp", "msn": false, "city_code": [ "*" ] } ], "request_id": "27baa06d-f90a-486c-85e5-cc621b787f04", "timestamp": "2022-07-11T13:33:22.990Z" } }

keshav-BFRS01751 commented 2 years ago

we are setting the timestamp on the fly. I confirm this with Sujeet and Sachin also, and it is perfectly fine.

Please check is there any other issues ?

Shriramprotean commented 2 years ago

Hi Keshav, Please check the format. Your JSON does not have Message and What Ganesh has fwded has Message

NishaJagtap commented 2 years ago

@keshav-BFRS01751 are you still facing the same issue?

tushargoyal-BFRS01856 commented 2 years ago

@NishaJagtap After correcting the JSON, we are getting this error in the response.

{"message":{"ack":{"status":"NACK"}},"error":{"type":"POLICY-ERROR","code":"144","path":null,"message":"The Subscriber id is not whitelisted in our database"}}

Shriramprotean commented 2 years ago

For whitelist get in touch with Neeraj

tushargoyal-BFRS01856 commented 2 years ago

@jainneerajnj Please look into this.

keshav-BFRS01751 commented 2 years ago
Screenshot 2022-07-11 at 6 29 29 PM

subscriber Id is already updated in the https://docs.google.com/spreadsheets/d/1j-hB1sxtR3DL9Wot4IIqruShJPbKO4CMnJ60ystrSWc/edit#gid=0

keshav-BFRS01751 commented 2 years ago

@jainneerajnj Please look into the issue. Is there any other place also we have to make any updation.

keshav-BFRS01751 commented 2 years ago

Now we are receiving new error

Response :

{"message":{"ack":{"status":"NACK"}},"error":{"type":"DOMAIN-ERROR","code":"130","path":null,"message":"https://dev-ondc.shiprocket.in : Domain verification file (ondc-site-verification.html) is not found "}}

Curl Request :

curl -i -XPOST -H'Accept: application/json' -H'Content-Type: application/json' -d'{"context":{"operation":{"ops_no":2}},"message":{"request_id":"27baa06d-f90a-486c-85e5-cc621b787f04","timestamp":"2022-07-12T06:52:46.850Z","entity":{"gst":{"legal_entity_name":"BIGFOOT RETAIL SOLUTIONS PRIVATE LIMITED","business_address":"Plot B, Khasra No. 360, Sultanpur, M.G. Road, West Delhi, Delhi, 110030","city_code":["std:011"],"gst_no":"07AAECB7131Q1ZC"},"pan":{"name_as_per_pan":"BIGFOOT RETAIL SOLUTION PRIVATE LIMITED","pan_no":"AAECB7131Q","date_of_incorporation":"28/09/2011"},"name_of_authorised_signatory":"Gautam Kapoor, Director of the company and Saahil Goel, CEO \u0026 Director of the company","address_of_authorised Signatory":"Plot No- B, Khasra No- 360, Sultanpur, New Delhi- 110030","email_id":"gautam.kapoor@shiprocket.com and saahil.goel@shiprocket.com","mobile_no":"7259028885","country":"IND","subscriber_id":"dev-ondc.shiprocket.in","callback_url":"/","key_pair":{"signing_public_key":"z6019Zev9Bw6BsIRJfVU278qbgf+1k1ouwZ2IX020j8\u003d","encryption_public_key":"Y3mJALmsn/wx52mRpmGp9IngimH0x9TY9DCDufbWBWo\u003d","valid_from":"2022-07-12T06:52:46.854Z","valid_until":"2023-07-12T06:52:46.000Z"}},"network_participant":[{"subscriber_url":"/","domain":"nic2004:60232","type":"sellerApp","msn":false,"city_code":["*"]}]}}' 'https://preprod.registry.ondc.org/ondc/subscribe'

keshav-BFRS01751 commented 2 years ago

html file present in our application folder. What is the role of this file path in request json for "subscribe" request.

Shriramprotean commented 2 years ago

you need to put file with signature in subscriber_id/ondc-site-verification.html

ganeshfosgen commented 2 years ago

Error code 130 is find the signature in ondc-site-verification.htm file.

you can generate signature using signing private key and signing message will be your request id.

For generate signature refer following site https://ed25519.herokuapp.com/ eg: Signing Private key : 8pPXr0Y4iwG590D9h2XJ+LAk2vXiOAVS0If7ep1FAqd9AK2I1RKLvAju6cr4g2HLfkU9yee/AAsXX1/UmsuScg== signing Public key: fQCtiNUSi7wI7unK+INhy35FPcnnvwALF19f1JrLknI= Message : 27baa06d-f90a-486c-85e5-cc621b787f04 Signature : BcJeNC7OWGvLKsmdSKmn43O1WNrmT4zDsH3nkAsRTCEs6C7RQ9FVEEqC+dmhUYlCiRsjGKkybQ6N5j7O0mPkBw==

ondc-site-verification.html file format is:


<html><head><meta
name='ondc-siteverification'
content='BcJeNC7OWGvLKsmdSKmn43O1WNrmT4zDsH3nkAsRTCEs6C7RQ9FVEEqC+dmhUYlCiRsjGKkybQ6N5j7O0mPkBw==' /></head>
<body>ONDC Site Verification
Page </body> </html>
sujeets-protean commented 2 years ago

Error code 130 is find the signature in ondc-site-verification.htm file.

you can generate signature using signing private key and signing message will be your request id.

For generate signature refer following site https://ed25519.herokuapp.com/ eg: Signing Private key : 8pPXr0Y4iwG590D9h2XJ+LAk2vXiOAVS0If7ep1FAqd9AK2I1RKLvAju6cr4g2HLfkU9yee/AAsXX1/UmsuScg== signing Public key: fQCtiNUSi7wI7unK+INhy35FPcnnvwALF19f1JrLknI= Message : 27baa06d-f90a-486c-85e5-cc621b787f04 Signature : BcJeNC7OWGvLKsmdSKmn43O1WNrmT4zDsH3nkAsRTCEs6C7RQ9FVEEqC+dmhUYlCiRsjGKkybQ6N5j7O0mPkBw==

ondc-site-verification.html file format is:


<html><head><meta
name='ondc-siteverification'
content='BcJeNC7OWGvLKsmdSKmn43O1WNrmT4zDsH3nkAsRTCEs6C7RQ9FVEEqC+dmhUYlCiRsjGKkybQ6N5j7O0mPkBw==' /></head>
<body>ONDC Site Verification
Page </body> </html>

@keshav-BFRS01751 please update if you have tried this ?

sujeets-protean commented 2 years ago

@BLR-0118 Can we please close this as it was resolved ?

vjku commented 2 years ago

For generate signature refer following site https://ed25519.herokuapp.com/ eg: Signing Private key : 8pPXr0Y4iwG590D9h2XJ+LAk2vXiOAVS0If7ep1FAqd9AK2I1RKLvAju6cr4g2HLfkU9yee/AAsXX1/UmsuScg== signing Public key: fQCtiNUSi7wI7unK+INhy35FPcnnvwALF19f1JrLknI= Message : 27baa06d-f90a-486c-85e5-cc621b787f04 Signature : BcJeNC7OWGvLKsmdSKmn43O1WNrmT4zDsH3nkAsRTCEs6C7RQ9FVEEqC+dmhUYlCiRsjGKkybQ6N5j7O0mPkBw==

@ganeshfosgen: Thank you for sharing this example. It really helped to validate my signing code while waiting for access to be granted to ONDC staging registry/slack/GH sample code.

BTW https://ed25519.herokuapp.com is no longer working.

Sharing this snippet here so other PHP developers do not miss the ed25519 algorithm scheme mentioned in Signing Beckn APIs in HTTP docs and end up wasting time by using sodium_crypto_sign() instead of sodium_crypto_sign_detached() like I initially did.

`<?php echo sodium_bin2base64(sodium_crypto_sign_detached('27baa06d-f90a-486c-85e5-cc621b787f04', sodium_base642bin("8pPXr0Y4iwG590D9h2XJ+LAk2vXiOAVS0If7ep1FAqd9AK2I1RKLvAju6cr4g2HLfkU9yee/AAsXX1/UmsuScg==",SODIUM_BASE64_VARIANT_ORIGINAL)),SODIUM_BASE64_VARIANT_ORIGINAL);

BcJeNC7OWGvLKsmdSKmn43O1WNrmT4zDsH3nkAsRTCEs6C7RQ9FVEEqC+dmhUYlCiRsjGKkybQ6N5j7O0mPkBw==`

sodium_crypto_sign() generated signatures are incorrect for this use-case and only match the first 85 characters of the expected signature shared in this example.