-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65e99da
commit 7f6df67
Showing
5 changed files
with
216 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,71 +8,29 @@ const ondc = new ONDC.default.ONDC({ | |
bppUri: "https://bpp.com/beckn", | ||
country: "IND", | ||
city: "std:080", | ||
ttl: "P1M" | ||
ttl: "P1M", | ||
publicKey: "", | ||
privateKey: "", | ||
uniqueKey: "dev.test.ondc-node.com", | ||
subscriberId: "<Gateway Address>", | ||
}); | ||
|
||
const init = async () => { | ||
console.log(await ondc.init({ | ||
"provider": { | ||
"id": "453678", | ||
"locations": [ | ||
{ | ||
"id": "el" | ||
} | ||
] | ||
}, | ||
"items": [ | ||
{ | ||
"id": "G-0007", | ||
"quantity": { | ||
"count": 1 | ||
} | ||
}, | ||
{ | ||
"id": "G-0007-1", | ||
"quantity": { | ||
"count": 2 | ||
} | ||
console.log(await ondc.search({ | ||
"item": { | ||
"descriptor": { | ||
"name": "ABC Aata" | ||
} | ||
], | ||
"billing": { | ||
"name": "Nirmal", | ||
"phone": "9876543210", | ||
"address": { | ||
"door": "Landmark", | ||
"building": "Test Building", | ||
"street": "Test Address", | ||
"city": "Bengaluru", | ||
"state": "Karnataka", | ||
"country": "IND", | ||
"area_code": "560078" | ||
}, | ||
"email": "[email protected]" | ||
}, | ||
"fulfillment": { | ||
"type": "HOME-DELIVERY", | ||
"tracking": true, | ||
"end": { | ||
"location": { | ||
"gps": "12.9063433,77.5856825", | ||
"address": { | ||
"door": "Landmark", | ||
"building": "Test Building", | ||
"street": "Test Address", | ||
"city": "Bengaluru", | ||
"state": "Karnataka", | ||
"country": "IND", | ||
"area_code": "560078" | ||
} | ||
}, | ||
"contact": { | ||
"phone": "9876543210", | ||
"email": "[email protected]" | ||
"gps": "12.4535445,77.9283792" | ||
} | ||
} | ||
} | ||
})); | ||
console.log(await ondc.search({ | ||
let body = { | ||
"item": { | ||
"descriptor": { | ||
"name": "ABC Aata" | ||
|
@@ -85,7 +43,14 @@ const init = async () => { | |
} | ||
} | ||
} | ||
})); | ||
}; | ||
ondc.apiKey = await ondc.createAuthorizationHeader(body) | ||
console.log(`Header: ${ondc.apiKey}`); | ||
|
||
let output = await ondc.verifyHeader(ondc.apiKey, { | ||
signing_public_key: "" | ||
}, body) | ||
console.log(`output: ${output}`); | ||
}; | ||
|
||
init(); |
Oops, something went wrong.