diff --git a/go.mod b/go.mod index 7ea3206..f050463 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module beckn-onix +module github.com/beckn/beckn-onix go 1.23.4 diff --git a/pkg/plugin/definition/validator.go b/pkg/plugin/definition/validator.go new file mode 100644 index 0000000..dc69ca5 --- /dev/null +++ b/pkg/plugin/definition/validator.go @@ -0,0 +1,16 @@ +package definition + +import ( + "context" + "net/url" +) + +// SchemaValidator interface for schema validation. +type SchemaValidator interface { + Validate(ctx context.Context, url *url.URL, payload []byte) error +} + +// SchemaValidatorProvider interface for creating validators. +type SchemaValidatorProvider interface { + New(ctx context.Context, config map[string]string) (SchemaValidator, func() error, error) +} diff --git a/shared/plugin/implementations/validator.so b/pkg/plugin/implementation/schemaValidator.so similarity index 56% rename from shared/plugin/implementations/validator.so rename to pkg/plugin/implementation/schemaValidator.so index ebd63b3..d90e575 100644 Binary files a/shared/plugin/implementations/validator.so and b/pkg/plugin/implementation/schemaValidator.so differ diff --git a/pkg/plugin/implementation/schemaValidator/cmd/plugin.go b/pkg/plugin/implementation/schemaValidator/cmd/plugin.go new file mode 100644 index 0000000..6882ce4 --- /dev/null +++ b/pkg/plugin/implementation/schemaValidator/cmd/plugin.go @@ -0,0 +1,33 @@ +package main + +import ( + "context" + "errors" + + definition "github.com/beckn/beckn-onix/pkg/plugin/definition" + schemaValidator "github.com/beckn/beckn-onix/pkg/plugin/implementation/schemaValidator" +) + +// schemaValidatorProvider provides instances of schemaValidator. +type schemaValidatorProvider struct{} + +// New initializes a new Verifier instance. +func (vp schemaValidatorProvider) New(ctx context.Context, config map[string]string) (definition.SchemaValidator, func() error, error) { + if ctx == nil { + return nil, nil, errors.New("context cannot be nil") + } + + // Extract schema_dir from the config map + schemaDir, ok := config["schema_dir"] + if !ok || schemaDir == "" { + return nil, nil, errors.New("config must contain 'schema_dir'") + } + + // Create a new schemaValidator instance with the provided configuration + return schemaValidator.New(ctx, &schemaValidator.Config{ + SchemaDir: schemaDir, + }) +} + +// Provider is the exported symbol that the plugin manager will look for. +var Provider definition.SchemaValidatorProvider = schemaValidatorProvider{} diff --git a/pkg/plugin/implementation/schemaValidator/cmd/plugin_test.go b/pkg/plugin/implementation/schemaValidator/cmd/plugin_test.go new file mode 100644 index 0000000..7e06b55 --- /dev/null +++ b/pkg/plugin/implementation/schemaValidator/cmd/plugin_test.go @@ -0,0 +1,160 @@ +package main + +import ( + "context" + "os" + "path/filepath" + "strings" + "testing" +) + +// setupTestSchema creates a temporary directory and writes a sample schema file. +func setupTestSchema(t *testing.T) string { + t.Helper() + + // Create a temporary directory for the schema + schemaDir, err := os.MkdirTemp("", "schemas") + if err != nil { + t.Fatalf("Failed to create temp directory: %v", err) + } + + // Create the directory structure for the schema file + schemaFilePath := filepath.Join(schemaDir, "example", "1.0", "test_schema.json") + if err := os.MkdirAll(filepath.Dir(schemaFilePath), 0755); err != nil { + t.Fatalf("Failed to create schema directory structure: %v", err) + } + + // Define a sample schema + schemaContent := `{ + "type": "object", + "properties": { + "context": { + "type": "object", + "properties": { + "domain": {"type": "string"}, + "version": {"type": "string"} + }, + "required": ["domain", "version"] + } + }, + "required": ["context"] + }` + + // Write the schema to the file + if err := os.WriteFile(schemaFilePath, []byte(schemaContent), 0644); err != nil { + t.Fatalf("Failed to write schema file: %v", err) + } + + return schemaDir +} + +// TestValidatorProviderSuccess tests successful ValidatorProvider implementation. +func TestValidatorProviderSuccess(t *testing.T) { + schemaDir := setupTestSchema(t) + defer os.RemoveAll(schemaDir) + + // Define test cases. + tests := []struct { + name string + ctx context.Context + config map[string]string + expectedError string + }{ + { + name: "Valid schema directory", + ctx: context.Background(), // Valid context + config: map[string]string{"schema_dir": schemaDir}, + expectedError: "", + }, + } + + // Test using table-driven tests + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + vp := schemaValidatorProvider{} + schemaValidator, close, err := vp.New(tt.ctx, tt.config) + + // Ensure no error occurred + if err != nil { + t.Errorf("unexpected error: %v", err) + return + } + + // Ensure the schemaValidator is not nil + if schemaValidator == nil { + t.Error("expected a non-nil schemaValidator, got nil") + } + + // Ensure the close function is not nil + if close == nil { + t.Error("expected a non-nil close function, got nil") + } + + // Test the close function + if err := close(); err != nil { + t.Errorf("close function returned an error: %v", err) + } + }) + } +} + +// TestValidatorProviderSuccess tests cases where ValidatorProvider creation should fail. +func TestValidatorProviderFailure(t *testing.T) { + schemaDir := setupTestSchema(t) + defer os.RemoveAll(schemaDir) + + // Define test cases. + tests := []struct { + name string + ctx context.Context + config map[string]string + expectedError string + }{ + { + name: "Config is empty", + ctx: context.Background(), + config: map[string]string{}, + expectedError: "config must contain 'schema_dir'", + }, + { + name: "schema_dir is empty", + ctx: context.Background(), + config: map[string]string{"schema_dir": ""}, + expectedError: "config must contain 'schema_dir'", + }, + { + name: "Invalid schema directory", + ctx: context.Background(), // Valid context + config: map[string]string{"schema_dir": "/invalid/dir"}, + expectedError: "failed to initialise schemaValidator: schema directory does not exist: /invalid/dir", + }, + { + name: "Nil context", + ctx: nil, // Nil context + config: map[string]string{"schema_dir": schemaDir}, + expectedError: "context cannot be nil", + }, + } + + // Test using table-driven tests + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + vp := schemaValidatorProvider{} + _, _, err := vp.New(tt.ctx, tt.config) + + // Check for expected error + if tt.expectedError != "" { + if err == nil || !strings.Contains(err.Error(), tt.expectedError) { + t.Errorf("expected error %q, got %v", tt.expectedError, err) + } + return + } + + // Ensure no error occurred + if err != nil { + t.Errorf("unexpected error: %v", err) + return + } + }) + } +} diff --git a/pkg/plugin/implementation/schemaValidator/schemaValidator.go b/pkg/plugin/implementation/schemaValidator/schemaValidator.go new file mode 100644 index 0000000..6670642 --- /dev/null +++ b/pkg/plugin/implementation/schemaValidator/schemaValidator.go @@ -0,0 +1,273 @@ +package schemavalidator + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "os" + "path" + "path/filepath" + "strings" + + response "github.com/beckn/beckn-onix/pkg/response" + + "github.com/santhosh-tekuri/jsonschema/v6" +) + +// Payload represents the structure of the data payload with context information. +type payload struct { + Context struct { + Domain string `json:"domain"` + Version string `json:"version"` + Action string `json:"action"` + BapID string `json:"bap_id"` + BapURI string `json:"bap_uri"` + BppID string `json:"bpp_id"` + BppURI string `json:"bpp_uri"` + MessageID string `json:"message_id"` + TransactionID string `json:"transaction_id"` + Timestamp string `json:"timestamp"` + TTL string `json:"ttl"` + Location Location `json:"location"` + } `json:"context"` +} + +// Location represent the structure of the location in context +type Location struct { + Country struct { + Code string `json:"code"` + } `json:"country"` + City struct { + Code string `json:"code"` + } `json:"city"` +} + +// SchemaValidator implements the Validator interface. +type SchemaValidator struct { + config *Config + schemaCache map[string]*jsonschema.Schema +} + +// Config struct for SchemaValidator. +type Config struct { + SchemaDir string +} + +// New creates a new ValidatorProvider instance. +func New(ctx context.Context, config *Config) (*SchemaValidator, func() error, error) { + // Check if config is nil + if config == nil { + return nil, nil, fmt.Errorf("config cannot be nil") + } + v := &SchemaValidator{ + config: config, + schemaCache: make(map[string]*jsonschema.Schema), + } + + // Call Initialise function to load schemas and get validators + if err := v.initialise(); err != nil { + return nil, nil, fmt.Errorf("failed to initialise schemaValidator: %v", err) + } + return v, v.Close, nil +} + +// Validate validates the given data against the schema. +func (v *SchemaValidator) Validate(ctx context.Context, url *url.URL, data []byte) error { + fmt.Println("inside validate function....") + var payloadData payload + err := json.Unmarshal(data, &payloadData) + if err != nil { + return fmt.Errorf("failed to parse JSON payload: %v", err) + } + + if err := validateContext(payloadData); err != nil { + return err + } + + // Extract domain, version, and endpoint from the payload and uri. + cxtDomain := payloadData.Context.Domain + version := payloadData.Context.Version + version = fmt.Sprintf("v%s", version) + + endpoint := path.Base(url.String()) + // ToDo Add debug log here + fmt.Println("Handling request for endpoint:", endpoint) + domain := strings.ToLower(cxtDomain) + domain = strings.ReplaceAll(domain, ":", "_") + + // Construct the schema file name. + schemaFileName := fmt.Sprintf("%s_%s_%s", domain, version, endpoint) + + // Retrieve the schema from the cache. + schema, exists := v.schemaCache[schemaFileName] + if !exists { + return fmt.Errorf("schema not found for domain: %s", schemaFileName) + } + + var jsonData any + if err := json.Unmarshal(data, &jsonData); err != nil { + return fmt.Errorf("failed to parse JSON data: %v", err) + } + err = schema.Validate(jsonData) + if err != nil { + // Handle schema validation errors + if validationErr, ok := err.(*jsonschema.ValidationError); ok { + // Convert validation errors into an array of SchemaValError + var schemaErrors []response.Error + for _, cause := range validationErr.Causes { + // Extract the path and message from the validation error + path := strings.Join(cause.InstanceLocation, ".") // JSON path to the invalid field + message := cause.Error() // Validation error message + + // Append the error to the schemaErrors array + schemaErrors = append(schemaErrors, response.Error{ + Paths: path, + Message: message, + }) + } + // Return the array of schema validation errors + return &response.SchemaValidationErr{Errors: schemaErrors} + } + // Return a generic error for non-validation errors + return fmt.Errorf("validation failed: %v", err) + } + + // Return nil if validation succeeds + return nil +} + +func validateContext(p payload) error { + // Validate the payload context fields FIRST + if p.Context.Domain == "" { + return fmt.Errorf("missing field Domain in context") + } + if p.Context.Version == "" { + return fmt.Errorf("missing field Version in context") + } + if p.Context.Action == "" { + return fmt.Errorf("missing field action in context") + } + if p.Context.BapID == "" { + return fmt.Errorf("missing field bpp_id in context") + } + if p.Context.BapURI == "" { + return fmt.Errorf("missing field bpp_uri in context") + } + if p.Context.BppID == "" { + return fmt.Errorf("missing field bpp_id in context") + } + + if p.Context.BppURI == "" { + return fmt.Errorf("missing field bpp_uri in context") + } + if p.Context.MessageID == "" { + return fmt.Errorf("missing field message_id in context") + } + if p.Context.TransactionID == "" { + return fmt.Errorf("missing field transaction_id in context") + } + if p.Context.Timestamp == "" { + return fmt.Errorf("missing field timestamp in context") + } + if p.Context.TTL == "" { + return fmt.Errorf("missing field ttl in context") + } + if p.Context.Location.Country.Code == "" { + return fmt.Errorf("missing Location.Country.Code in context") + } + if p.Context.Location.City.Code == "" { + return fmt.Errorf("missing field Location.City.Code in context") + } + return nil + +} + +// ValidatorProvider provides instances of Validator. +type ValidatorProvider struct{} + +// Initialise initialises the validator provider by compiling all the JSON schema files +// from the specified directory and storing them in a cache indexed by their schema filenames. +func (v *SchemaValidator) initialise() error { + schemaDir := v.config.SchemaDir + // Check if the directory exists and is accessible. + info, err := os.Stat(schemaDir) + if err != nil { + if os.IsNotExist(err) { + return fmt.Errorf("schema directory does not exist: %s", schemaDir) + } + return fmt.Errorf("failed to access schema directory: %v", err) + } + if !info.IsDir() { + return fmt.Errorf("provided schema path is not a directory: %s", schemaDir) + } + + compiler := jsonschema.NewCompiler() + + // Helper function to process directories recursively. + var processDir func(dir string) error + processDir = func(dir string) error { + entries, err := os.ReadDir(dir) + if err != nil { + return fmt.Errorf("failed to read directory: %v", err) + } + + for _, entry := range entries { + path := filepath.Join(dir, entry.Name()) + if entry.IsDir() { + // Recursively process subdirectories. + if err := processDir(path); err != nil { + return err + } + } else if filepath.Ext(entry.Name()) == ".json" { + // Process JSON files. + compiledSchema, err := compiler.Compile(path) + if err != nil { + return fmt.Errorf("failed to compile JSON schema from file %s: %v", entry.Name(), err) + } + + // Use relative path from schemaDir to avoid absolute paths and make schema keys domain/version specific. + relativePath, err := filepath.Rel(schemaDir, path) + if err != nil { + return fmt.Errorf("failed to get relative path for file %s: %v", entry.Name(), err) + } + // Split the relative path to get domain, version, and schema. + parts := strings.Split(relativePath, string(os.PathSeparator)) + + // Ensure that the file path has at least 3 parts: domain, version, and schema file. + if len(parts) < 3 { + return fmt.Errorf("invalid schema file structure, expected domain/version/schema.json but got: %s", relativePath) + } + + // Extract domain, version, and schema filename from the parts. + // Validate that the extracted parts are non-empty. + domain := strings.TrimSpace(parts[0]) + version := strings.TrimSpace(parts[1]) + schemaFileName := strings.TrimSpace(parts[2]) + schemaFileName = strings.TrimSuffix(schemaFileName, ".json") + + if domain == "" || version == "" || schemaFileName == "" { + return fmt.Errorf("invalid schema file structure, one or more components are empty. Relative path: %s", relativePath) + } + + // Construct a unique key combining domain, version, and schema name (e.g., ondc_trv10_v2.0.0_schema). + uniqueKey := fmt.Sprintf("%s_%s_%s", domain, version, schemaFileName) + // Store the compiled schema in the SchemaCache using the unique key. + v.schemaCache[uniqueKey] = compiledSchema + } + } + return nil + } + + // Start processing from the root schema directory. + if err := processDir(schemaDir); err != nil { + return fmt.Errorf("failed to read schema directory: %v", err) + } + + return nil +} + +// Close releases resources (mock implementation returning nil). +func (v *SchemaValidator) Close() error { + return nil +} diff --git a/pkg/plugin/implementation/schemaValidator/schemaValidator_test.go b/pkg/plugin/implementation/schemaValidator/schemaValidator_test.go new file mode 100644 index 0000000..58084ca --- /dev/null +++ b/pkg/plugin/implementation/schemaValidator/schemaValidator_test.go @@ -0,0 +1,369 @@ +package schemavalidator + +import ( + "context" + "net/url" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/santhosh-tekuri/jsonschema/v6" +) + +// setupTestSchema creates a temporary directory and writes a sample schema file. +func setupTestSchema(t *testing.T) string { + t.Helper() + + // Create a temporary directory for the schema + schemaDir, err := os.MkdirTemp("", "schemas") + if err != nil { + t.Fatalf("Failed to create temp directory: %v", err) + } + + // Create the directory structure for the schema file + schemaFilePath := filepath.Join(schemaDir, "example", "v1.0", "endpoint.json") + if err := os.MkdirAll(filepath.Dir(schemaFilePath), 0755); err != nil { + t.Fatalf("Failed to create schema directory structure: %v", err) + } + + // Define a sample schema + schemaContent := `{ + "type": "object", + "properties": { + "context": { + "type": "object", + "properties": { + "domain": {"type": "string"}, + "version": {"type": "string"}, + "action": {"type": "string"} + }, + "required": ["domain", "version", "action"] + } + }, + "required": ["context"] + }` + + // Write the schema to the file + if err := os.WriteFile(schemaFilePath, []byte(schemaContent), 0644); err != nil { + t.Fatalf("Failed to write schema file: %v", err) + } + + return schemaDir +} + +func TestValidator_Validate_Success(t *testing.T) { + tests := []struct { + name string + url string + payload string + wantErr bool + }{ + { + name: "Valid payload", + url: "http://example.com/endpoint", + payload: `{"context": {"domain": "example", "version": "1.0", "action": "endpoint"}}`, + wantErr: false, + }, + } + + // Setup a temporary schema directory for testing + schemaDir := setupTestSchema(t) + defer os.RemoveAll(schemaDir) + + config := &Config{SchemaDir: schemaDir} + v, _, err := New(context.Background(), config) + if err != nil { + t.Fatalf("Failed to create validator: %v", err) + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u, _ := url.Parse(tt.url) + err := v.Validate(context.Background(), u, []byte(tt.payload)) + if err != nil { + t.Errorf("Unexpected error: %v", err) + } else { + t.Logf("Test %s passed with no errors", tt.name) + } + }) + } +} + +func TestValidator_Validate_Failure(t *testing.T) { + tests := []struct { + name string + url string + payload string + wantErr string + }{ + { + name: "Invalid JSON payload", + url: "http://example.com/endpoint", + payload: `{"context": {"domain": "example", "version": "1.0"`, + wantErr: "failed to parse JSON payload", + }, + { + name: "Schema validation failure", + url: "http://example.com/endpoint", + payload: `{"context": {"domain": "example", "version": "1.0"}}`, + wantErr: "context: at '/context': missing property 'action'", + }, + { + name: "Schema not found", + url: "http://example.com/unknown_endpoint", + payload: `{"context": {"domain": "example", "version": "1.0"}}`, + wantErr: "schema not found for domain", + }, + } + + // Setup a temporary schema directory for testing + schemaDir := setupTestSchema(t) + defer os.RemoveAll(schemaDir) + + config := &Config{SchemaDir: schemaDir} + v, _, err := New(context.Background(), config) + if err != nil { + t.Fatalf("Failed to create validator: %v", err) + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u, _ := url.Parse(tt.url) + err := v.Validate(context.Background(), u, []byte(tt.payload)) + if tt.wantErr != "" { + if err == nil { + t.Errorf("Expected error containing '%s', but got nil", tt.wantErr) + } else if !strings.Contains(err.Error(), tt.wantErr) { + t.Errorf("Expected error containing '%s', but got '%v'", tt.wantErr, err) + } else { + t.Logf("Test %s passed with expected error: %v", tt.name, err) + } + } else { + if err != nil { + t.Errorf("Unexpected error: %v", err) + } else { + t.Logf("Test %s passed with no errors", tt.name) + } + } + }) + } +} + +func TestValidator_Initialise(t *testing.T) { + tests := []struct { + name string + setupFunc func(schemaDir string) error + wantErr string + }{ + { + name: "Schema directory does not exist", + setupFunc: func(schemaDir string) error { + // Do not create the schema directory + return nil + + }, + wantErr: "schema directory does not exist", + }, + { + name: "Schema path is not a directory", + setupFunc: func(schemaDir string) error { + // Create a file instead of a directory + return os.WriteFile(schemaDir, []byte{}, 0644) + }, + wantErr: "provided schema path is not a directory", + }, + { + name: "Invalid schema file structure", + setupFunc: func(schemaDir string) error { + // Create an invalid schema file structure + invalidSchemaFile := filepath.Join(schemaDir, "invalid_schema.json") + if err := os.MkdirAll(filepath.Dir(invalidSchemaFile), 0755); err != nil { + t.Fatalf("Failed to create directory: %v", err) + } + return os.WriteFile(invalidSchemaFile, []byte(`{}`), 0644) + }, + wantErr: "invalid schema file structure", + }, + { + name: "Failed to compile JSON schema", + setupFunc: func(schemaDir string) error { + // Create a schema file with invalid JSON + invalidSchemaFile := filepath.Join(schemaDir, "example", "1.0", "endpoint.json") + if err := os.MkdirAll(filepath.Dir(invalidSchemaFile), 0755); err != nil { + t.Fatalf("Failed to create directory: %v", err) + } + return os.WriteFile(invalidSchemaFile, []byte(`{invalid json}`), 0644) + }, + wantErr: "failed to compile JSON schema", + }, + { + name: "Invalid schema file structure with empty components", + setupFunc: func(schemaDir string) error { + // Create a schema file with empty domain, version, or schema name + invalidSchemaFile := filepath.Join(schemaDir, "", "1.0", "endpoint.json") + if err := os.MkdirAll(filepath.Dir(invalidSchemaFile), 0755); err != nil { + t.Fatalf("Failed to create directory: %v", err) + } + return os.WriteFile(invalidSchemaFile, []byte(`{ + "type": "object", + "properties": { + "context": { + "type": "object", + "properties": { + "domain": {"type": "string"}, + "version": {"type": "string"} + }, + "required": ["domain", "version"] + } + }, + "required": ["context"] + }`), 0644) + }, + wantErr: "failed to read schema directory: invalid schema file structure, expected domain/version/schema.json but got: 1.0/endpoint.json", + }, + { + name: "Failed to read directory", + setupFunc: func(schemaDir string) error { + // Create a directory and remove read permissions + if err := os.MkdirAll(schemaDir, 0000); err != nil { + t.Fatalf("Failed to create directory: %v", err) + } + return nil + }, + wantErr: "failed to read directory", + }, + { + name: "Valid schema directory", + setupFunc: func(schemaDir string) error { + // Create a valid schema file + validSchemaFile := filepath.Join(schemaDir, "example", "1.0", "endpoint.json") + if err := os.MkdirAll(filepath.Dir(validSchemaFile), 0755); err != nil { + t.Fatalf("Failed to create directory: %v", err) + } + return os.WriteFile(validSchemaFile, []byte(`{ + "type": "object", + "properties": { + "context": { + "type": "object", + "properties": { + "domain": {"type": "string"}, + "version": {"type": "string"} + }, + "required": ["domain", "version"] + } + }, + "required": ["context"] + }`), 0644) + }, + wantErr: "", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Setup a temporary schema directory for testing + schemaDir := filepath.Join(os.TempDir(), "schemas") + defer os.RemoveAll(schemaDir) + + // Run the setup function to prepare the test case + if err := tt.setupFunc(schemaDir); err != nil { + t.Fatalf("setupFunc() error = %v", err) + } + + config := &Config{SchemaDir: schemaDir} + v := &SchemaValidator{ + config: config, + schemaCache: make(map[string]*jsonschema.Schema), + } + + err := v.initialise() + if (err != nil && !strings.Contains(err.Error(), tt.wantErr)) || (err == nil && tt.wantErr != "") { + t.Errorf("Error: initialise() returned error = %v, expected error = %v", err, tt.wantErr) + } else if err == nil { + t.Logf("Test %s passed: validator initialized successfully", tt.name) + } else { + t.Logf("Test %s passed with expected error: %v", tt.name, err) + } + }) + } +} + +func TestValidator_New_Success(t *testing.T) { + schemaDir := setupTestSchema(t) + defer os.RemoveAll(schemaDir) + + config := &Config{SchemaDir: schemaDir} + _, _, err := New(context.Background(), config) + if err != nil { + t.Errorf("Unexpected error: %v", err) + } +} + +func TestValidator_New_Failure(t *testing.T) { + tests := []struct { + name string + config *Config + setupFunc func(schemaDir string) error + wantErr string + }{ + { + name: "Config is nil", + config: nil, + setupFunc: func(schemaDir string) error { + return nil + }, + wantErr: "config cannot be nil", + }, + // { + // name: "Config is empty", + // config: &Config{}, + // setupFunc: func(schemaDir string) error { + // return nil + // }, + // wantErr: "config must contain 'schema_dir'", + // }, + // { + // name: "schema_dir is empty", + // config: &Config{SchemaDir: ""}, + // setupFunc: func(schemaDir string) error { + // return nil + // }, + // wantErr: "config must contain 'schema_dir'", + // }, + { + name: "Failed to initialise validators", + config: &Config{ + SchemaDir: "/invalid/path", + }, + setupFunc: func(schemaDir string) error { + // Do not create the schema directory + return nil + }, + wantErr: "ailed to initialise schemaValidator: schema directory does not exist: /invalid/path", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Run the setup function if provided + if tt.setupFunc != nil { + schemaDir := "" + if tt.config != nil { + schemaDir = tt.config.SchemaDir + } + if err := tt.setupFunc(schemaDir); err != nil { + t.Fatalf("Setup function failed: %v", err) + } + } + + // Call the New function with the test config + _, _, err := New(context.Background(), tt.config) + if (err != nil && !strings.Contains(err.Error(), tt.wantErr)) || (err == nil && tt.wantErr != "") { + t.Errorf("Error: New() returned error = %v, expected error = %v", err, tt.wantErr) + } else { + t.Logf("Test %s passed with expected error: %v", tt.name, err) + } + }) + } +} diff --git a/shared/plugin/manager.go b/pkg/plugin/manager.go similarity index 50% rename from shared/plugin/manager.go rename to pkg/plugin/manager.go index c257826..2cc76bb 100644 --- a/shared/plugin/manager.go +++ b/pkg/plugin/manager.go @@ -1,7 +1,6 @@ package plugin import ( - "beckn-onix/shared/plugin/definition" "context" "fmt" "os" @@ -9,33 +8,46 @@ import ( "plugin" "strings" + "github.com/beckn/beckn-onix/pkg/plugin/definition" + "gopkg.in/yaml.v2" ) -// ValidationPluginConfig represents configuration details for a plugin. -type ValidationPluginConfig struct { - ID string `yaml:"id"` - Schema SchemaDetails `yaml:"config"` - PluginPath string `yaml:"plugin_path"` +// Config represents the plugin manager configuration. +type Config struct { + Root string `yaml:"root"` + SchemaValidator PluginConfig `yaml:"schema_validator"` } +// PluginConfig represents configuration details for a plugin. +type PluginConfig struct { + ID string `yaml:"id"` + Config map[string]string `yaml:"config"` +} + +// // ValidationPluginConfig represents configuration details for a plugin. +// type ValidationPluginConfig struct { +// ID string `yaml:"id"` +// Schema SchemaDetails `yaml:"config"` +// PluginPath string `yaml:"plugin_path"` +// } + // SchemaDetails contains information about the plugin schema directory. type SchemaDetails struct { SchemaDir string `yaml:"schema_dir"` } -// Config represents the configuration for the application, including plugin configurations. -type Config struct { - Plugins struct { - ValidationPlugin ValidationPluginConfig `yaml:"validation_plugin"` - } `yaml:"plugins"` -} +// // Config represents the configuration for the application, including plugin configurations. +// type Config struct { +// Plugins struct { +// ValidationPlugin ValidationPluginConfig `yaml:"validation_plugin"` +// } `yaml:"plugins"` +// } // Manager handles dynamic plugin loading and management. type Manager struct { - vp definition.ValidatorProvider - validators map[string]definition.Validator - cfg *Config + vp definition.SchemaValidatorProvider + cfg *Config } // NewManager initializes a new Manager with the given configuration file. @@ -44,8 +56,8 @@ func NewManager(ctx context.Context, cfg *Config) (*Manager, error) { return nil, fmt.Errorf("configuration cannot be nil") } - // Load validator plugin - vp, err := provider[definition.ValidatorProvider](cfg.Plugins.ValidationPlugin.PluginPath, cfg.Plugins.ValidationPlugin.ID) + // Load schema validator plugin + vp, err := provider[definition.SchemaValidatorProvider](cfg.Root, cfg.SchemaValidator.ID) if err != nil { return nil, fmt.Errorf("failed to load validator plugin: %w", err) } @@ -53,21 +65,21 @@ func NewManager(ctx context.Context, cfg *Config) (*Manager, error) { return nil, fmt.Errorf("validator provider is nil") } - // Initialize validator - validatorMap, defErr := vp.New(ctx, map[string]string{ - "schema_dir": cfg.Plugins.ValidationPlugin.Schema.SchemaDir, - }) - if defErr != (definition.Error{}) { - return nil, fmt.Errorf("failed to initialize validator: %v", defErr) - } + // // Initialize validator + // validatorMap, defErr := vp.New(ctx, map[string]string{ + // "schema_dir": cfg.Plugins.ValidationPlugin.Schema.SchemaDir, + // }) + // if defErr != nil { + // return nil, fmt.Errorf("failed to initialize validator: %v", defErr) + // } - // Initialize the validators map - validators := make(map[string]definition.Validator) - for key, validator := range validatorMap { - validators[key] = validator - } + // // Initialize the validators map + // validators := make(map[string]definition.Validator) + // for key, validator := range validatorMap { + // validators[key] = validator + // } - return &Manager{vp: vp, validators: validators, cfg: cfg}, nil + return &Manager{vp: vp, cfg: cfg}, nil } // provider loads a plugin dynamically and retrieves its provider instance. @@ -96,27 +108,23 @@ func provider[T any](path string, id string) (T, error) { return *prov, nil } -// pluginPath constructs the path to the plugin shared object file. +// pluginPath constructs the path to the plugin pkg object file. func pluginPath(path, id string) string { return filepath.Join(path, id+".so") } // Validators retrieves the validation plugin instances. -func (m *Manager) Validators(ctx context.Context) (map[string]definition.Validator, definition.Error) { +func (m *Manager) SchemaValidator(ctx context.Context) (definition.SchemaValidator, func() error, error) { if m.vp == nil { - return nil, definition.Error{Message: "validator plugin provider not loaded"} + return nil, nil, fmt.Errorf("schema validator plugin provider not loaded") } - configMap := map[string]string{ - "schema_dir": m.cfg.Plugins.ValidationPlugin.Schema.SchemaDir, - } - _, err := m.vp.New(ctx, configMap) - if err != (definition.Error{}) { + schemaValidator, close, err := m.vp.New(ctx, m.cfg.SchemaValidator.Config) + if err != nil { - return nil, definition.Error{Message: fmt.Sprintf("failed to initialize validator: %v", err)} + return nil, nil, fmt.Errorf("failed to initialize schema validator: %v", err) } - - return m.validators, definition.Error{} + return schemaValidator, close, nil } // LoadConfig loads the configuration from a YAML file. diff --git a/pkg/plugin/plugin.yaml b/pkg/plugin/plugin.yaml new file mode 100644 index 0000000..edae49e --- /dev/null +++ b/pkg/plugin/plugin.yaml @@ -0,0 +1,14 @@ +# plugins: +# validation_plugin: +# id: validator +# config: +# schema_dir: #Directory where the schema files are stored +# plugin_path: shared/plugin/implementations/ + + +root: pkg/plugin/implementation/ +schema_validator: + id: schemaValidator + config: + schema_dir: pkg/plugin/schemas #Directory where the schema files are stored + plugin_path: pkg/plugin/implementation/ \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/cancel.json b/pkg/plugin/schemas/core/v1.1.0/cancel.json new file mode 100644 index 0000000..b09e97a --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/cancel.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "cancel", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "cancel" + ] + } + }, + "required": [ + "action" + ] + } + ] + } + + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/confirm.json b/pkg/plugin/schemas/core/v1.1.0/confirm.json new file mode 100644 index 0000000..d4b4277 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/confirm.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "confirm", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "confirm" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "definitions.json#/$defs/Order" + } + }, + "required": [ + "order" + ] + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/definitions.json b/pkg/plugin/schemas/core/v1.1.0/definitions.json new file mode 100644 index 0000000..ed7eec1 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/definitions.json @@ -0,0 +1,2459 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "definitions.json", + "$defs": { + "Ack": { + "$id": "Ack", + "description": "Describes the acknowledgement sent in response to an API call. If the implementation uses HTTP/S, then Ack must be returned in the same session. Every API call to a BPP must be responded to with an Ack whether the BPP intends to respond with a callback or not. This has one property called `status` that indicates the status of the Acknowledgement.", + "type": "object", + "additionalProperties": false, + "properties": { + "status": { + "type": "string", + "description": "The status of the acknowledgement. If the request passes the validation criteria of the BPP, then this is set to ACK. If a BPP responds with status = `ACK` to a request, it is required to respond with a callback. If the request fails the validation criteria, then this is set to NACK. Additionally, if a BPP does not intend to respond with a callback even after the request meets the validation criteria, it should set this value to `NACK`.", + "enum": [ + "ACK", + "NACK" + ] + }, + "tags": { + "description": "A list of tags containing any additional information sent along with the Acknowledgement.", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "AddOn": { + "$id": "AddOn", + "description": "Describes an additional item offered as a value-addition to a product or service. This does not exist independently in a catalog and is always associated with an item.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "description": "Provider-defined ID of the add-on", + "type": "string" + }, + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "price": { + "$ref": "definitions.json#/$defs/Price" + }, + "quantity": { + "$ref": "definitions.json#/$defs/ItemQuantity" + } + } + }, + "Address": { + "$id": "Address", + "description": "Describes a postal address.", + "type": "string" + }, + "Agent": { + "$id": "Agent", + "description": "Describes the direct performer, driver or executor that fulfills an order. It is usually a person. But in some rare cases, it could be a non-living entity like a drone, or a bot. Some examples of agents are Doctor in the healthcare sector, a driver in the mobility sector, or a delivery person in the logistics sector. This object can be set at any stage of the order lifecycle. This can be set at the discovery stage when the BPP wants to provide details on the agent fulfilling the order, like in healthcare, where the doctor's name appears during search. This object can also used to search for a particular person that the customer wants fulfilling an order. Sometimes, this object gets instantiated after the order is confirmed, like in the case of on-demand taxis, where the driver is assigned after the user confirms the ride.", + "type": "object", + "additionalProperties": false, + "properties": { + "person": { + "$ref": "definitions.json#/$defs/Person" + }, + "contact": { + "$ref": "definitions.json#/$defs/Contact" + }, + "organization": { + "$ref": "definitions.json#/$defs/Organization" + }, + "rating": { + "$ref": "definitions.json#/$defs/Rating/properties/value" + } + } + }, + "Authorization": { + "$id": "Authorization", + "description": "Describes an authorization mechanism used to start or end the fulfillment of an order. For example, in the mobility sector, the driver may require a one-time password to initiate the ride. In the healthcare sector, a patient may need to provide a password to open a video conference link during a teleconsultation.", + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "description": "Type of authorization mechanism used. The allowed values for this field can be published as part of the network policy.", + "type": "string" + }, + "token": { + "description": "Token used for authorization. This is typically generated at the BPP. The BAP can send this value to the user via any channel that it uses to authenticate the user like SMS, Email, Push notification, or in-app rendering.", + "type": "string" + }, + "valid_from": { + "description": "Timestamp in RFC3339 format from which token is valid", + "type": "string", + "format": "date-time" + }, + "valid_to": { + "description": "Timestamp in RFC3339 format until which token is valid", + "type": "string", + "format": "date-time" + }, + "status": { + "description": "Status of the token", + "type": "string" + } + } + }, + "Billing": { + "$id": "Billing", + "description": "Describes the billing details of an entity.
This has properties like name,organization,address,email,phone,time,tax_number, created_at,updated_at", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "description": "Name of the billable entity", + "type": "string" + }, + "organization": { + "description": "Details of the organization being billed.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Organization" + } + ] + }, + "address": { + "description": "The address of the billable entity", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Address" + } + ] + }, + "state": { + "description": "The state where the billable entity resides. This is important for state-level tax calculation", + "allOf": [ + { + "$ref": "definitions.json#/$defs/State" + } + ] + }, + "city": { + "description": "The city where the billable entity resides.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/City" + } + ] + }, + "email": { + "description": "Email address where the bill is sent to", + "type": "string", + "format": "email" + }, + "phone": { + "description": "Phone number of the billable entity", + "type": "string" + }, + "time": { + "description": "Details regarding the billing period", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Time" + } + ] + }, + "tax_id": { + "description": "ID of the billable entity as recognized by the taxation authority", + "type": "string" + } + } + }, + "Cancellation": { + "$id": "Cancellation", + "description": "Describes a cancellation event", + "type": "object", + "additionalProperties": false, + "properties": { + "time": { + "description": "Date-time when the order was cancelled by the buyer", + "type": "string", + "format": "date-time" + }, + "cancelled_by": { + "type": "string", + "enum": [ + "CONSUMER", + "PROVIDER" + ] + }, + "reason": { + "description": "The reason for cancellation", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Option" + } + ] + }, + "additional_description": { + "description": "Any additional information regarding the nature of cancellation", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Descriptor" + } + ] + } + } + }, + "CancellationTerm": { + "$id": "CancellationTerm", + "description": "Describes the cancellation terms of an item or an order. This can be referenced at an item or order level. Item-level cancellation terms can override the terms at the order level.", + "type": "object", + "additionalProperties": false, + "properties": { + "fulfillment_state": { + "description": "The state of fulfillment during which this term is applicable.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/FulfillmentState" + } + ] + }, + "reason_required": { + "description": "Indicates whether a reason is required to cancel the order", + "type": "boolean" + }, + "cancel_by": { + "description": "Information related to the time of cancellation.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Time" + } + ] + }, + "cancellation_fee": { + "$ref": "definitions.json#/$defs/Fee" + }, + "xinput": { + "$ref": "definitions.json#/$defs/XInput" + }, + "external_ref": { + "$ref": "definitions.json#/$defs/MediaFile" + } + } + }, + "Catalog": { + "$id": "Catalog", + "description": "Describes the products or services offered by a BPP. This is typically sent as the response to a search intent from a BAP. The payment terms, offers and terms of fulfillment supported by the BPP can also be included here. The BPP can show hierarchical nature of products/services in its catalog using the parent_category_id in categories. The BPP can also send a ttl (time to live) in the context which is the duration for which a BAP can cache the catalog and use the cached catalog.
This has properties like bbp/descriptor,bbp/categories,bbp/fulfillments,bbp/payments,bbp/offers,bbp/providers and exp
This is used in the following situations.
", + "type": "object", + "additionalProperties": false, + "properties": { + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "fulfillments": { + "description": "Fulfillment modes offered at the BPP level. This is used when a BPP itself offers fulfillments on behalf of the providers it has onboarded.", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Fulfillment" + } + }, + "payments": { + "description": "Payment terms offered by the BPP for all transactions. This can be overriden at the provider level.", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Payment" + } + }, + "offers": { + "description": "Offers at the BPP-level. This is common across all providers onboarded by the BPP.", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Offer" + } + }, + "providers": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Provider" + } + }, + "exp": { + "description": "Timestamp after which catalog will expire", + "type": "string", + "format": "date-time" + }, + "ttl": { + "description": "Duration in seconds after which this catalog will expire", + "type": "string" + } + } + }, + "Category": { + "$id": "Category", + "description": "A label under which a collection of items can be grouped.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "description": "ID of the category", + "type": "string" + }, + "parent_category_id": { + "$ref": "definitions.json#/$defs/Category/properties/id" + }, + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "time": { + "$ref": "definitions.json#/$defs/Time" + }, + "ttl": { + "description": "Time to live for an instance of this schema" + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "Circle": { + "$id": "Circle", + "description": "Describes a circular region of a specified radius centered at a specified GPS coordinate.", + "type": "object", + "additionalProperties": false, + "properties": { + "gps": { + "$ref": "definitions.json#/$defs/Gps" + }, + "radius": { + "$ref": "definitions.json#/$defs/Scalar" + } + } + }, + "City": { + "$id": "City", + "description": "Describes a city", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "description": "Name of the city", + "type": "string" + }, + "code": { + "description": "City code", + "type": "string" + } + } + }, + "Contact": { + "$id": "Contact", + "description": "Describes the contact information of an entity", + "type": "object", + "additionalProperties": false, + "properties": { + "phone": { + "type": "string" + }, + "email": { + "type": "string" + }, + "jcard": { + "type": "object", + "additionalProperties": false, + "description": "A Jcard object as per draft-ietf-jcardcal-jcard-03 specification" + } + } + }, + "Context": { + "$id": "Context", + "description": "Every API call in beckn protocol has a context. It provides a high-level overview to the receiver about the nature of the intended transaction. Typically, it is the BAP that sets the transaction context based on the consumer's location and action on their UI. But sometimes, during unsolicited callbacks, the BPP also sets the transaction context but it is usually the same as the context of a previous full-cycle, request-callback interaction between the BAP and the BPP. The context object contains four types of fields.
  1. Demographic information about the transaction using fields like `domain`, `country`, and `region`.
  2. Addressing details like the sending and receiving platform's ID and API URL.
  3. Interoperability information like the protocol version that implemented by the sender and,
  4. Transaction details like the method being called at the receiver's endpoint, the transaction_id that represents an end-to-end user session at the BAP, a message ID to pair requests with callbacks, a timestamp to capture sending times, a ttl to specifiy the validity of the request, and a key to encrypt information if necessary.
This object must be passed in every interaction between a BAP and a BPP. In HTTP/S implementations, it is not necessary to send the context during the synchronous response. However, in asynchronous protocols, the context must be sent during all interactions,", + "type": "object", + "additionalProperties": false, + "properties": { + "domain": { + "description": "Domain code that is relevant to this transaction context", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Domain/properties/code", + "type": "string" + } + ] + }, + "location": { + "description": "The location where the transaction is intended to be fulfilled.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Location" + } + ] + }, + "action": { + "description": "The Beckn protocol method being called by the sender and executed at the receiver.", + "type": "string" + }, + "version": { + "type": "string", + "description": "Version of transaction protocol being used by the sender." + }, + "bap_id": { + "description": "Subscriber ID of the BAP", + "allOf": [ + { + "description": "A globally unique identifier of the platform, Typically it is the fully qualified domain name (FQDN) of the platform.", + "type": "string" + } + ] + }, + "bap_uri": { + "description": "Subscriber URL of the BAP for accepting callbacks from BPPs.", + "allOf": [ + { + "description": "The callback URL of the Subscriber. This should necessarily contain the same domain name as set in `subscriber_id``.", + "type": "string", + "format": "uri" + } + ] + }, + "bpp_id": { + "description": "Subscriber ID of the BPP", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Context/properties/bap_id/allOf/0" + } + ] + }, + "bpp_uri": { + "description": "Subscriber URL of the BPP for accepting calls from BAPs.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Context/properties/bap_uri/allOf/0" + } + ] + }, + "transaction_id": { + "description": "This is a unique value which persists across all API calls from `search` through `confirm`. This is done to indicate an active user session across multiple requests. The BPPs can use this value to push personalized recommendations, and dynamic offerings related to an ongoing transaction despite being unaware of the user active on the BAP.", + "type": "string", + "format": "uuid" + }, + "message_id": { + "description": "This is a unique value which persists during a request / callback cycle. Since beckn protocol APIs are asynchronous, BAPs need a common value to match an incoming callback from a BPP to an earlier call. This value can also be used to ignore duplicate messages coming from the BPP. It is recommended to generate a fresh message_id for every new interaction. When sending unsolicited callbacks, BPPs must generate a new message_id.", + "type": "string", + "format": "uuid" + }, + "timestamp": { + "description": "Time of request generation in RFC3339 format", + "type": "string", + "format": "date-time" + }, + "key": { + "description": "The encryption public key of the sender", + "type": "string" + }, + "ttl": { + "description": "The duration in ISO8601 format after timestamp for which this message holds valid", + "type": "string" + } + } + }, + "Country": { + "$id": "Country", + "description": "Describes a country", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "Name of the country" + }, + "code": { + "type": "string", + "description": "Country code as per ISO 3166-1 and ISO 3166-2 format" + } + } + }, + "Credential": { + "$id": "Credential", + "description": "Describes a credential of an entity - Person or Organization", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string", + "default": "VerifiableCredential" + }, + "url": { + "description": "URL of the credential", + "type": "string", + "format": "uri" + } + } + }, + "Customer": { + "$id": "Customer", + "description": "Describes a customer buying/availing a product or a service", + "type": "object", + "additionalProperties": false, + "properties": { + "person": { + "$ref": "definitions.json#/$defs/Person" + }, + "contact": { + "$ref": "definitions.json#/$defs/Contact" + } + } + }, + "DecimalValue": { + "$id": "DecimalValue", + "description": "Describes a numerical value in decimal form", + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + }, + "Descriptor": { + "$id": "Descriptor", + "description": "Physical description of something.", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string" + }, + "short_desc": { + "type": "string" + }, + "long_desc": { + "type": "string" + }, + "additional_desc": { + "type": "object", + "additionalProperties": false, + "properties": { + "url": { + "type": "string" + }, + "content_type": { + "type": "string", + "enum": [ + "text/plain", + "text/html", + "application/json" + ] + } + } + }, + "media": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/MediaFile" + } + }, + "images": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Image" + } + } + } + }, + "Domain": { + "$id": "Domain", + "description": "Described the industry sector or sub-sector. The network policy should contain codes for all the industry sectors supported by the network. Domains can be created in varying levels of granularity. The granularity of a domain can be decided by the participants of the network. Too broad domains will result in irrelevant search broadcast calls to BPPs that don't have services supporting the domain. Too narrow domains will result in a large number of registry entries for each BPP. It is recommended that network facilitators actively collaborate with various working groups and network participants to carefully choose domain codes keeping in mind relevance, performance, and opportunity cost. It is recommended that networks choose broad domains like mobility, logistics, healthcare etc, and progressively granularize them as and when the number of network participants for each domain grows large.", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "description": "Name of the domain", + "type": "string" + }, + "code": { + "description": "Standard code representing the domain. The standard is usually published as part of the network policy. Furthermore, the network facilitator should also provide a mechanism to provide the supported domains of a network." + }, + "additional_info": { + "description": "A url that contains addtional information about that domain.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/MediaFile" + } + ] + } + } + }, + "Duration": { + "$id": "Duration", + "description": "Describes duration as per ISO8601 format", + "type": "string" + }, + "Error": { + "$id": "Error", + "description": "Describes an error object that is returned by a BAP, BPP or BG as a response or callback to an action by another network participant. This object is sent when any request received by a network participant is unacceptable. This object can be sent either during Ack or with the callback.", + "type": "object", + "additionalProperties": false, + "properties": { + "code": { + "type": "string", + "description": "Standard error code. For full list of error codes, refer to docs/protocol-drafts/BECKN-005-ERROR-CODES-DRAFT-01.md of this repo\"" + }, + "paths": { + "type": "string", + "description": "Path to json schema generating the error. Used only during json schema validation errors" + }, + "message": { + "type": "string", + "description": "Human readable message describing the error. Used mainly for logging. Not recommended to be shown to the user." + } + } + }, + "Fee": { + "$id": "Fee", + "description": "A fee applied on a particular entity", + "type": "object", + "additionalProperties": false, + "properties": { + "percentage": { + "description": "Percentage of a value", + "allOf": [ + { + "$ref": "definitions.json#/$defs/DecimalValue" + } + ] + }, + "amount": { + "description": "A fixed value", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Price" + } + ] + } + } + }, + "Form": { + "$id": "Form", + "description": "Describes a form", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "description": "The form identifier.", + "type": "string" + }, + "url": { + "description": "The URL from where the form can be fetched. The content fetched from the url must be processed as per the mime_type specified in this object. Once fetched, the rendering platform can choosed to render the form as-is as an embeddable element; or process it further to blend with the theme of the application. In case the interface is non-visual, the the render can process the form data and reproduce it as per the standard specified in the form.", + "type": "string", + "format": "uri" + }, + "data": { + "description": "The form submission data", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "mime_type": { + "description": "This field indicates the nature and format of the form received by querying the url. MIME types are defined and standardized in IETF's RFC 6838.", + "type": "string", + "enum": [ + "text/html", + "application/html", + "application/xml" + ] + }, + "resubmit": { + "type": "boolean" + }, + "multiple_sumbissions": { + "type": "boolean" + } + } + }, + "Fulfillment": { + "$id": "Fulfillment", + "description": "Describes how a an order will be rendered/fulfilled to the end-customer", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "description": "Unique reference ID to the fulfillment of an order", + "type": "string" + }, + "type": { + "description": "A code that describes the mode of fulfillment. This is typically set when there are multiple ways an order can be fulfilled. For example, a retail order can be fulfilled either via store pickup or a home delivery. Similarly, a medical consultation can be provided either in-person or via tele-consultation. The network policy must publish standard fulfillment type codes for the different modes of fulfillment.", + "type": "string" + }, + "rateable": { + "description": "Whether the fulfillment can be rated or not", + "type": "boolean" + }, + "rating": { + "description": "The rating value of the fulfullment service.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Rating/properties/value" + } + ] + }, + "state": { + "description": "The current state of fulfillment. The BPP must set this value whenever the state of the order fulfillment changes and fire an unsolicited `on_status` call.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/FulfillmentState" + } + ] + }, + "tracking": { + "type": "boolean", + "description": "Indicates whether the fulfillment allows tracking", + "default": false + }, + "customer": { + "description": "The person that will ultimately receive the order", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Customer" + } + ] + }, + "agent": { + "description": "The agent that is currently handling the fulfillment of the order", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Agent" + } + ] + }, + "contact": { + "$ref": "definitions.json#/$defs/Contact" + }, + "vehicle": { + "$ref": "definitions.json#/$defs/Vehicle" + }, + "stops": { + "description": "The list of logical stops encountered during the fulfillment of an order.", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Stop" + } + }, + "path": { + "description": "The physical path taken by the agent that can be rendered on a map. The allowed format of this property can be set by the network.", + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "FulfillmentState": { + "$id": "FulfillmentState", + "description": "Describes the state of fulfillment", + "type": "object", + "additionalProperties": false, + "properties": { + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "updated_by": { + "type": "string", + "description": "ID of entity which changed the state" + } + } + }, + "Gps": { + "$id": "Gps", + "description": "Describes a GPS coordinate", + "type": "string", + "pattern": "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$" + }, + "Image": { + "$id": "Image", + "description": "Describes an image", + "type": "object", + "additionalProperties": false, + "properties": { + "url": { + "description": "URL to the image. This can be a data url or an remote url", + "type": "string", + "format": "uri" + }, + "size_type": { + "description": "The size of the image. The network policy can define the default dimensions of each type", + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg", + "xl", + "custom" + ] + }, + "width": { + "description": "Width of the image in pixels", + "type": "string" + }, + "height": { + "description": "Height of the image in pixels", + "type": "string" + } + } + }, + "Intent": { + "$id": "Intent", + "description": "The intent to buy or avail a product or a service. The BAP can declare the intent of the consumer containing
This has properties like descriptor,provider,fulfillment,payment,category,offer,item,tags
This is typically used by the BAP to send the purpose of the user's search to the BPP. This will be used by the BPP to find products or services it offers that may match the user's intent.
For example, in Mobility, the mobility consumer declares a mobility intent. In this case, the mobility consumer declares information that describes various aspects of their journey like,
For example, in health domain, a consumer declares the intent for a lab booking the describes various aspects of their booking like,", + "type": "object", + "additionalProperties": false, + "properties": { + "descriptor": { + "description": "A raw description of the search intent. Free text search strings, raw audio, etc can be sent in this object.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Descriptor" + } + ] + }, + "provider": { + "description": "The provider from which the customer wants to place to the order from", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Provider" + } + ] + }, + "fulfillment": { + "description": "Details on how the customer wants their order fulfilled", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Fulfillment" + } + ] + }, + "payment": { + "description": "Details on how the customer wants to pay for the order", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Payment" + } + ] + }, + "category": { + "description": "Details on the item category", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Category" + } + ] + }, + "offer": { + "description": "details on the offer the customer wants to avail", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Offer" + } + ] + }, + "item": { + "description": "Details of the item that the consumer wants to order", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Item" + } + ] + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "ItemQuantity": { + "$id": "ItemQuantity", + "description": "Describes the count or amount of an item", + "type": "object", + "additionalProperties": false, + "properties": { + "allocated": { + "description": "This represents the exact quantity allocated for purchase of the item.", + "type": "object", + "additionalProperties": false, + "properties": { + "count": { + "type": "integer", + "minimum": 0 + }, + "measure": { + "$ref": "definitions.json#/$defs/Scalar" + } + } + }, + "available": { + "description": "This represents the exact quantity available for purchase of the item. The buyer can only purchase multiples of this", + "type": "object", + "additionalProperties": false, + "properties": { + "count": { + "type": "integer", + "minimum": 0 + }, + "measure": { + "$ref": "definitions.json#/$defs/Scalar" + } + } + }, + "maximum": { + "description": "This represents the maximum quantity allowed for purchase of the item", + "type": "object", + "additionalProperties": false, + "properties": { + "count": { + "type": "integer", + "minimum": 1 + }, + "measure": { + "$ref": "definitions.json#/$defs/Scalar" + } + } + }, + "minimum": { + "description": "This represents the minimum quantity allowed for purchase of the item", + "type": "object", + "additionalProperties": false, + "properties": { + "count": { + "type": "integer", + "minimum": 0 + }, + "measure": { + "$ref": "definitions.json#/$defs/Scalar" + } + } + }, + "selected": { + "description": "This represents the quantity selected for purchase of the item", + "type": "object", + "additionalProperties": false, + "properties": { + "count": { + "type": "integer", + "minimum": 0 + }, + "measure": { + "$ref": "definitions.json#/$defs/Scalar" + } + } + }, + "unitized": { + "description": "This represents the quantity available in a single unit of the item", + "type": "object", + "additionalProperties": false, + "properties": { + "count": { + "type": "integer", + "minimum": 1, + "maximum": 1 + }, + "measure": { + "$ref": "definitions.json#/$defs/Scalar" + } + } + } + } + }, + "Item": { + "$id": "Item", + "description": "Describes a product or a service offered to the end consumer by the provider. In the mobility sector, it can represent a fare product like one way journey. In the logistics sector, it can represent the delivery service offering. In the retail domain it can represent a product like a grocery item.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "description": "ID of the item.", + "type": "string" + }, + "parent_item_id": { + "description": "ID of the item, this item is a variant of", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Item/properties/id" + } + ] + }, + "parent_item_quantity": { + "description": "The number of units of the parent item this item is a multiple of", + "allOf": [ + { + "$ref": "definitions.json#/$defs/ItemQuantity" + } + ] + }, + "descriptor": { + "description": "Physical description of the item", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Descriptor" + } + ] + }, + "creator": { + "description": "The creator of this item", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Organization" + } + ] + }, + "price": { + "description": "The price of this item, if it has intrinsic value", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Price" + } + ] + }, + "quantity": { + "description": "The selling quantity of the item", + "allOf": [ + { + "$ref": "definitions.json#/$defs/ItemQuantity" + } + ] + }, + "category_ids": { + "description": "Categories this item can be listed under", + "type": "array", + "items": { + "allOf": [ + { + "$ref": "definitions.json#/$defs/Category/properties/id" + } + ] + } + }, + "fulfillment_ids": { + "description": "Modes through which this item can be fulfilled", + "type": "array", + "items": { + "allOf": [ + { + "$ref": "definitions.json#/$defs/Fulfillment/properties/id" + } + ] + } + }, + "location_ids": { + "description": "Provider Locations this item is available in", + "type": "array", + "items": { + "allOf": [ + { + "$ref": "definitions.json#/$defs/Location/properties/id" + } + ] + } + }, + "payment_ids": { + "description": "Payment modalities through which this item can be ordered", + "type": "array", + "items": { + "allOf": [ + { + "$ref": "definitions.json#/$defs/Payment/properties/id" + } + ] + } + }, + "add_ons": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/AddOn" + } + }, + "cancellation_terms": { + "description": "Cancellation terms of this item", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/CancellationTerm" + } + }, + "refund_terms": { + "description": "Refund terms of this item", + "type": "array", + "items": { + "description": "Refund term of an item or an order", + "type": "object", + "additionalProperties": false, + "properties": { + "fulfillment_state": { + "description": "The state of fulfillment during which this term is applicable.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/State" + } + ] + }, + "refund_eligible": { + "description": "Indicates if cancellation will result in a refund", + "type": "boolean" + }, + "refund_within": { + "description": "Time within which refund will be processed after successful cancellation.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Time" + } + ] + }, + "refund_amount": { + "$ref": "definitions.json#/$defs/Price" + } + } + } + }, + "replacement_terms": { + "description": "Terms that are applicable be met when this item is replaced", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/ReplacementTerm" + } + }, + "return_terms": { + "description": "Terms that are applicable when this item is returned", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/ReturnTerm" + } + }, + "xinput": { + "description": "Additional input required from the customer to purchase / avail this item", + "allOf": [ + { + "$ref": "definitions.json#/$defs/XInput" + } + ] + }, + "time": { + "description": "Temporal attributes of this item. This property is used when the item exists on the catalog only for a limited period of time.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Time" + } + ] + }, + "rateable": { + "description": "Whether this item can be rated", + "type": "boolean" + }, + "rating": { + "description": "The rating of the item", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Rating/properties/value" + } + ] + }, + "matched": { + "description": "Whether this item is an exact match of the request", + "type": "boolean" + }, + "related": { + "description": "Whether this item is a related item to the exactly matched item", + "type": "boolean" + }, + "recommended": { + "description": "Whether this item is a recommended item to a response", + "type": "boolean" + }, + "ttl": { + "description": "Time to live in seconds for an instance of this schema", + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "Location": { + "$id": "Location", + "description": "The physical location of something", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "map_url": { + "description": "The url to the map of the location. This can be a globally recognized map url or the one specified by the network policy.", + "type": "string", + "format": "uri" + }, + "gps": { + "description": "The GPS co-ordinates of this location.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Gps" + } + ] + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "address": { + "description": "The address of this location.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Address" + } + ] + }, + "city": { + "description": "The city this location is, or is located within", + "allOf": [ + { + "$ref": "definitions.json#/$defs/City" + } + ] + }, + "district": { + "description": "The state this location is, or is located within", + "type": "string" + }, + "state": { + "description": "The state this location is, or is located within", + "allOf": [ + { + "$ref": "definitions.json#/$defs/State" + } + ] + }, + "country": { + "description": "The country this location is, or is located within", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Country" + } + ] + }, + "area_code": { + "type": "string" + }, + "circle": { + "$ref": "definitions.json#/$defs/Circle" + }, + "polygon": { + "description": "The boundary polygon of this location", + "type": "string" + }, + "3dspace": { + "description": "The three dimensional region describing this location", + "type": "string" + }, + "rating": { + "description": "The rating of this location", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Rating/properties/value" + } + ] + } + } + }, + "MediaFile": { + "$id": "MediaFile", + "description": "This object contains a url to a media file.", + "type": "object", + "additionalProperties": false, + "properties": { + "mimetype": { + "description": "indicates the nature and format of the document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838", + "type": "string" + }, + "url": { + "description": "The URL of the file", + "type": "string", + "format": "uri" + }, + "signature": { + "description": "The digital signature of the file signed by the sender", + "type": "string" + }, + "dsa": { + "description": "The signing algorithm used by the sender", + "type": "string" + } + } + }, + "Offer": { + "$id": "Offer", + "description": "An offer associated with a catalog. This is typically used to promote a particular product and enable more purchases.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "location_ids": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Location/properties/id" + } + }, + "category_ids": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Category/properties/id" + } + }, + "item_ids": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Item/properties/id" + } + }, + "time": { + "$ref": "definitions.json#/$defs/Time" + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "Option": { + "$id": "Option", + "description": "Describes a selectable option", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + } + } + }, + "Order": { + "$id": "Order", + "description": "Describes a legal purchase order. It contains the complete details of the legal contract created between the buyer and the seller.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "Human-readable ID of the order. This is generated at the BPP layer. The BPP can either generate order id within its system or forward the order ID created at the provider level." + }, + "ref_order_ids": { + "description": "A list of order IDs to link this order to previous orders.", + "type": "array", + "items": { + "type": "string", + "description": "ID of a previous order" + } + }, + "status": { + "description": "Status of the order. Allowed values can be defined by the network policy", + "type": "string", + "enum": [ + "ACTIVE", + "COMPLETE", + "CANCELLED", + "COMPLETED", + "SOFT_CANCEL" + ] + }, + "type": { + "description": "This is used to indicate the type of order being created to BPPs. Sometimes orders can be linked to previous orders, like a replacement order in a retail domain. A follow-up consultation in healthcare domain. A single order part of a subscription order. The list of order types can be standardized at the network level.", + "type": "string", + "default": "DEFAULT", + "enum": [ + "DRAFT", + "DEFAULT" + ] + }, + "provider": { + "description": "Details of the provider whose catalog items have been selected.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Provider" + } + ] + }, + "items": { + "description": "The items purchased / availed in this order", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Item" + } + }, + "add_ons": { + "description": "The add-ons purchased / availed in this order", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/AddOn" + } + }, + "offers": { + "description": "The offers applied in this order", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Offer" + } + }, + "billing": { + "description": "The billing details of this order", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Billing" + } + ] + }, + "fulfillments": { + "description": "The fulfillments involved in completing this order", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Fulfillment" + } + }, + "cancellation": { + "description": "The cancellation details of this order", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Cancellation" + } + ] + }, + "cancellation_terms": { + "description": "Cancellation terms of this item", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/CancellationTerm" + } + }, + "documents": { + "type": "array", + "items": { + "description": "Documnents associated to the order", + "type": "object", + "additionalProperties": false, + "properties": { + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "mime_type": { + "description": "This field indicates the nature and format of the form received by querying the url. MIME types are defined and standardized in IETF's RFC 6838.", + "type": "string", + "enum": [ + "text/html", + "application/html", + "application/xml", + "application/pdf" + ] + }, + "url": { + "description": "The URL from where the form can be fetched. The content fetched from the url must be processed as per the mime_type specified in this object.", + "type": "string", + "format": "uri" + } + } + } + }, + "refund_terms": { + "description": "Refund terms of this item", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Item/properties/refund_terms/items" + } + }, + "replacement_terms": { + "description": "Replacement terms of this item", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/ReplacementTerm" + } + }, + "return_terms": { + "description": "Return terms of this item", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/ReturnTerm" + } + }, + "quote": { + "description": "The mutually agreed upon quotation for this order.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Quotation" + } + ] + }, + "payments": { + "description": "The terms of settlement for this order", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Payment" + } + }, + "created_at": { + "description": "The date-time of creation of this order", + "type": "string", + "format": "date-time" + }, + "updated_at": { + "description": "The date-time of updated of this order", + "type": "string", + "format": "date-time" + }, + "xinput": { + "description": "Additional input required from the customer to confirm this order", + "allOf": [ + { + "$ref": "definitions.json#/$defs/XInput" + } + ] + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "Organization": { + "$id": "Organization", + "description": "An organization. Usually a recognized business entity.", + "type": "object", + "additionalProperties": false, + "properties": { + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "address": { + "description": "The postal address of the organization", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Address" + } + ] + }, + "state": { + "description": "The state where the organization's address is registered", + "allOf": [ + { + "$ref": "definitions.json#/$defs/State" + } + ] + }, + "city": { + "description": "The city where the the organization's address is registered", + "allOf": [ + { + "$ref": "definitions.json#/$defs/City" + } + ] + }, + "contact": { + "$ref": "definitions.json#/$defs/Contact" + } + } + }, + "Payment": { + "$id": "Payment", + "description": "Describes the terms of settlement between the BAP and the BPP for a single transaction. When instantiated, this object contains
  1. the amount that has to be settled,
  2. The payment destination destination details
  3. When the settlement should happen, and
  4. A transaction reference ID
. During a transaction, the BPP reserves the right to decide the terms of payment. However, the BAP can send its terms to the BPP first. If the BPP does not agree to those terms, it must overwrite the terms and return them to the BAP. If overridden, the BAP must either agree to the terms sent by the BPP in order to preserve the provider's autonomy, or abort the transaction. In case of such disagreements, the BAP and the BPP can perform offline negotiations on the payment terms. Once an agreement is reached, the BAP and BPP can resume transactions.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "description": "ID of the payment term that can be referred at an item or an order level in a catalog", + "type": "string" + }, + "collected_by": { + "description": "This field indicates who is the collector of payment. The BAP can set this value to 'bap' if it wants to collect the payment first and settle it to the BPP. If the BPP agrees to those terms, the BPP should not send the payment url. Alternatively, the BPP can set this field with the value 'bpp' if it wants the payment to be made directly.", + "type": "string" + }, + "url": { + "type": "string", + "description": "A payment url to be called by the BAP. If empty, then the payment is to be done offline. The details of payment should be present in the params object. If tl_method = http/get, then the payment details will be sent as url params. Two url param values, ```$transaction_id``` and ```$amount``` are mandatory.", + "format": "uri" + }, + "tl_method": { + "type": "string" + }, + "params": { + "type": "object", + "additionalProperties": false, + "properties": { + "transaction_id": { + "type": "string", + "description": "The reference transaction ID associated with a payment activity" + }, + "amount": { + "type": "string" + }, + "currency": { + "type": "string" + }, + "bank_code": { + "type": "string" + }, + "bank_account_number": { + "type": "string" + }, + "virtual_payment_address": { + "type": "string" + }, + "source_bank_code": { + "type": "string" + }, + "source_bank_account_number": { + "type": "string" + }, + "source_virtual_payment_address": { + "type": "string" + } + } + }, + "type": { + "type": "string", + "enum": [ + "PRE-ORDER", + "PRE-FULFILLMENT", + "ON-FULFILLMENT", + "POST-FULFILLMENT", + "ON-ORDER", + "PART-PAYMENT" + ] + }, + "status": { + "type": "string", + "enum": [ + "PAID", + "NOT-PAID" + ] + }, + "time": { + "$ref": "definitions.json#/$defs/Time" + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "Person": { + "$id": "Person", + "description": "Describes a person as any individual", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "Describes the identity of the person" + }, + "url": { + "description": "Profile url of the person", + "type": "string", + "format": "uri" + }, + "name": { + "description": "the name of the person", + "type": "string" + }, + "image": { + "$ref": "definitions.json#/$defs/Image" + }, + "age": { + "description": "Age of the person", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Duration" + } + ] + }, + "dob": { + "description": "Date of birth of the person", + "type": "string", + "format": "date" + }, + "gender": { + "type": "string", + "description": "Gender of something, typically a Person, but possibly also fictional characters, animals, etc. While Male and Female may be used, text strings are also acceptable for people who do not identify as a binary gender.Allowed values for this field can be published in the network policy" + }, + "creds": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Credential" + } + }, + "languages": { + "type": "array", + "items": { + "description": "Describes a language known to the person.", + "type": "object", + "additionalProperties": false, + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + }, + "skills": { + "type": "array", + "items": { + "description": "Describes a skill of the person.", + "type": "object", + "additionalProperties": false, + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "Price": { + "$id": "Price", + "description": "Describes the price of a product or service", + "type": "object", + "additionalProperties": false, + "properties": { + "currency": { + "type": "string" + }, + "value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "estimated_value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "computed_value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "listed_value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "offered_value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "minimum_value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "maximum_value": { + "$ref": "definitions.json#/$defs/DecimalValue" + } + } + }, + "Provider": { + "$id": "Provider", + "description": "Describes the catalog of a business.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "Id of the provider" + }, + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "category_id": { + "type": "string", + "description": "Category Id of the provider at the BPP-level catalog" + }, + "rating": { + "$ref": "definitions.json#/$defs/Rating/properties/value" + }, + "time": { + "$ref": "definitions.json#/$defs/Time" + }, + "categories": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Category" + } + }, + "fulfillments": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Fulfillment" + } + }, + "payments": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Payment" + } + }, + "locations": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Location" + } + }, + "offers": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Offer" + } + }, + "items": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Item" + } + }, + "exp": { + "type": "string", + "description": "Time after which catalog has to be refreshed", + "format": "date-time" + }, + "rateable": { + "description": "Whether this provider can be rated or not", + "type": "boolean" + }, + "ttl": { + "description": "The time-to-live in seconds, for this object. This can be overriden at deeper levels. A value of -1 indicates that this object is not cacheable.", + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/TagGroup" + } + } + } + }, + "Quotation": { + "$id": "Quotation", + "description": "Describes a quote. It is the estimated price of products or services from the BPP.
This has properties like price, breakup, ttl", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "description": "ID of the quote.", + "type": "string", + "format": "uuid" + }, + "price": { + "description": "The total quoted price", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Price" + } + ] + }, + "breakup": { + "description": "the breakup of the total quoted price", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "item": { + "$ref": "definitions.json#/$defs/Item" + }, + "title": { + "type": "string" + }, + "price": { + "$ref": "definitions.json#/$defs/Price" + } + } + } + }, + "ttl": { + "$ref": "definitions.json#/$defs/Duration" + } + } + }, + "Rating": { + "$id": "Rating", + "description": "Describes the rating of an entity", + "type": "object", + "additionalProperties": false, + "properties": { + "rating_category": { + "description": "Category of the entity being rated", + "type": "string", + "enum": [ + "Item", + "Order", + "Fulfillment", + "Provider", + "Agent", + "Support" + ] + }, + "id": { + "description": "Id of the object being rated", + "type": "string" + }, + "value": { + "description": "Rating value given to the object. This can be a single value or can also contain an inequality operator like gt, gte, lt, lte. This can also contain an inequality expression containing logical operators like && and ||.", + "type": "string" + } + } + }, + "Region": { + "$id": "Region", + "description": "Describes an arbitrary region of space. The network policy should contain a published list of supported regions by the network.", + "type": "object", + "additionalProperties": false, + "properties": { + "dimensions": { + "description": "The number of dimensions that are used to describe any point inside that region. The most common dimensionality of a region is 2, that represents an area on a map. There are regions on the map that can be approximated to one-dimensional regions like roads, railway lines, or shipping lines. 3 dimensional regions are rarer, but are gaining popularity as flying drones are being adopted for various fulfillment services.", + "type": "string", + "enum": [ + "1", + "2", + "3" + ] + }, + "type": { + "description": "The type of region. This is used to specify the granularity of the region represented by this object. Various examples of two-dimensional region types are city, country, state, district, and so on. The network policy should contain a list of all possible region types supported by the network.", + "type": "string" + }, + "name": { + "type": "string", + "description": "Name of the region as specified on the map where that region exists." + }, + "code": { + "type": "string", + "description": "A standard code representing the region. This should be interpreted in the same way by all network participants." + }, + "boundary": { + "type": "string", + "description": "A string representing the boundary of the region. One-dimensional regions are represented by polylines. Two-dimensional regions are represented by polygons, and three-dimensional regions can represented by polyhedra." + }, + "map_url": { + "type": "string", + "description": "The url to the map of the region. This can be a globally recognized map or the one specified by the network policy." + } + } + }, + "ReplacementTerm": { + "$id": "ReplacementTerm", + "description": "The replacement policy of an item or an order", + "type": "object", + "additionalProperties": false, + "properties": { + "fulfillment_state": { + "description": "The state of fulfillment during which this term is applicable.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/State" + } + ] + }, + "replace_within": { + "description": "Applicable only for buyer managed returns where the buyer has to replace the item before a certain date-time, failing which they will not be eligible for replacement", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Time" + } + ] + }, + "external_ref": { + "$ref": "definitions.json#/$defs/MediaFile" + } + } + }, + "ReturnTerm": { + "$id": "ReturnTerm", + "description": "Describes the return policy of an item or an order", + "type": "object", + "additionalProperties": false, + "properties": { + "fulfillment_state": { + "description": "The state of fulfillment during which this term IETF''s applicable.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/State" + } + ] + }, + "return_eligible": { + "description": "Indicates whether the item is eligible for return", + "type": "boolean" + }, + "return_time": { + "description": "Applicable only for buyer managed returns where the buyer has to return the item to the origin before a certain date-time, failing which they will not be eligible for refund.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Time" + } + ] + }, + "return_location": { + "description": "The location where the item or order must / will be returned to", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Location" + } + ] + }, + "fulfillment_managed_by": { + "description": "The entity that will perform the return", + "type": "string", + "enum": [ + "CONSUMER", + "PROVIDER" + ] + } + } + }, + "Scalar": { + "$id": "Scalar", + "description": "Describes a scalar", + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "CONSTANT", + "VARIABLE" + ] + }, + "value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "estimated_value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "computed_value": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "range": { + "type": "object", + "additionalProperties": false, + "properties": { + "min": { + "$ref": "definitions.json#/$defs/DecimalValue" + }, + "max": { + "$ref": "definitions.json#/$defs/DecimalValue" + } + } + }, + "unit": { + "type": "string" + } + } + }, + "Schedule": { + "$id": "Schedule", + "description": "Describes schedule as a repeating time period used to describe a regularly recurring event. At a minimum a schedule will specify frequency which describes the interval between occurrences of the event. Additional information can be provided to specify the schedule more precisely. This includes identifying the timestamps(s) of when the event will take place. Schedules may also have holidays to exclude a specific day from the schedule.
This has properties like frequency, holidays, times", + "type": "object", + "additionalProperties": false, + "properties": { + "frequency": { + "$ref": "definitions.json#/$defs/Duration" + }, + "holidays": { + "type": "array", + "items": { + "type": "string", + "format": "date-time" + } + }, + "times": { + "type": "array", + "items": { + "type": "string", + "format": "date-time" + } + } + } + }, + "State": { + "$id": "State", + "description": "A bounded geopolitical region of governance inside a country.", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "Name of the state" + }, + "code": { + "type": "string", + "description": "State code as per country or international standards" + } + } + }, + "Stop": { + "$id": "Stop", + "description": "A logical point in space and time during the fulfillment of an order.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "parent_stop_id": { + "type": "string" + }, + "location": { + "description": "Location of the stop", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Location" + } + ] + }, + "type": { + "description": "The type of stop. Allowed values of this property can be defined by the network policy.", + "type": "string" + }, + "time": { + "description": "Timings applicable at the stop.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Time" + } + ] + }, + "instructions": { + "description": "Instructions that need to be followed at the stop", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Descriptor" + } + ] + }, + "contact": { + "description": "Contact details of the stop", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Contact" + } + ] + }, + "person": { + "description": "The details of the person present at the stop", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Person" + } + ] + }, + "authorization": { + "$ref": "definitions.json#/$defs/Authorization" + } + } + }, + "Support": { + "$id": "Support", + "description": "Details of customer support", + "type": "object", + "additionalProperties": false, + "properties": { + "ref_id": { + "type": "string" + }, + "callback_phone": { + "type": "string", + "format": "phone" + }, + "phone": { + "type": "string", + "format": "phone" + }, + "email": { + "type": "string", + "format": "email" + }, + "url": { + "type": "string", + "format": "uri" + } + } + }, + "Tag": { + "$id": "Tag", + "description": "Describes a tag. This is used to contain extended metadata. This object can be added as a property to any schema to describe extended attributes. For BAPs, tags can be sent during search to optimize and filter search results. BPPs can use tags to index their catalog to allow better search functionality. Tags are sent by the BPP as part of the catalog response in the `on_search` callback. Tags are also meant for display purposes. Upon receiving a tag, BAPs are meant to render them as name-value pairs. This is particularly useful when rendering tabular information about a product or service.", + "type": "object", + "additionalProperties": false, + "properties": { + "descriptor": { + "description": "Description of the Tag, can be used to store detailed information.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Descriptor" + } + ] + }, + "value": { + "description": "The value of the tag. This set by the BPP and rendered as-is by the BAP.", + "type": "string" + }, + "display": { + "description": "This value indicates if the tag is intended for display purposes. If set to `true`, then this tag must be displayed. If it is set to `false`, it should not be displayed. This value can override the group display value.", + "type": "boolean" + } + } + }, + "TagGroup": { + "$id": "TagGroup", + "description": "A collection of tag objects with group level attributes. For detailed documentation on the Tags and Tag Groups schema go to https://github.com/beckn/protocol-specifications/discussions/316", + "type": "object", + "additionalProperties": false, + "properties": { + "display": { + "description": "Indicates the display properties of the tag group. If display is set to false, then the group will not be displayed. If it is set to true, it should be displayed. However, group-level display properties can be overriden by individual tag-level display property. As this schema is purely for catalog display purposes, it is not recommended to send this value during search.", + "type": "boolean", + "default": true + }, + "descriptor": { + "description": "Description of the TagGroup, can be used to store detailed information.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Descriptor" + } + ] + }, + "list": { + "description": "An array of Tag objects listed under this group. This property can be set by BAPs during search to narrow the `search` and achieve more relevant results. When received during `on_search`, BAPs must render this list under the heading described by the `name` property of this schema.", + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Tag" + } + } + } + }, + "Time": { + "$id": "Time", + "description": "Describes time in its various forms. It can be a single point in time; duration; or a structured timetable of operations
This has properties like label, time stamp,duration,range, days, schedule", + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "duration": { + "$ref": "definitions.json#/$defs/Duration" + }, + "range": { + "type": "object", + "additionalProperties": false, + "properties": { + "start": { + "type": "string", + "format": "date-time" + }, + "end": { + "type": "string", + "format": "date-time" + } + } + }, + "days": { + "type": "string", + "description": "comma separated values representing days of the week" + }, + "schedule": { + "$ref": "definitions.json#/$defs/Schedule" + } + } + }, + "Tracking": { + "$id": "Tracking", + "description": "Contains tracking information that can be used by the BAP to track the fulfillment of an order in real-time. which is useful for knowing the location of time sensitive deliveries.", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "description": "A unique tracking reference number", + "type": "string" + }, + "url": { + "description": "A URL to the tracking endpoint. This can be a link to a tracking webpage, a webhook URL created by the BAP where BPP can push the tracking data, or a GET url creaed by the BPP which the BAP can poll to get the tracking data. It can also be a websocket URL where the BPP can push real-time tracking data.", + "type": "string", + "format": "uri" + }, + "location": { + "description": "In case there is no real-time tracking endpoint available, this field will contain the latest location of the entity being tracked. The BPP will update this value everytime the BAP calls the track API.", + "allOf": [ + { + "$ref": "definitions.json#/$defs/Location" + } + ] + }, + "status": { + "description": "This value indicates if the tracking is currently active or not. If this value is `active`, then the BAP can begin tracking the order. If this value is `inactive`, the tracking URL is considered to be expired and the BAP should stop tracking the order.", + "type": "string", + "enum": [ + "active", + "inactive" + ] + } + } + }, + "Vehicle": { + "$id": "Vehicle", + "description": "Describes a vehicle is a device that is designed or used to transport people or cargo over land, water, air, or through space.
This has properties like category, capacity, make, model, size,variant,color,energy_type,registration", + "type": "object", + "additionalProperties": false, + "properties": { + "category": { + "type": "string" + }, + "capacity": { + "type": "integer" + }, + "make": { + "type": "string" + }, + "model": { + "type": "string" + }, + "size": { + "type": "string" + }, + "variant": { + "type": "string" + }, + "color": { + "type": "string" + }, + "energy_type": { + "type": "string" + }, + "registration": { + "type": "string" + }, + "wheels_count": { + "type": "string" + }, + "cargo_volumne": { + "type": "string" + }, + "wheelchair_access": { + "type": "string" + }, + "code": { + "type": "string" + }, + "emission_standard": { + "type": "string" + } + } + }, + "XInput": { + "$id": "XInput", + "description": "Contains any additional or extended inputs required to confirm an order. This is typically a Form Input. Sometimes, selection of catalog elements is not enough for the BPP to confirm an order. For example, to confirm a flight ticket, the airline requires details of the passengers along with information on baggage, identity, in addition to the class of ticket. Similarly, a logistics company may require details on the nature of shipment in order to confirm the shipping. A recruiting firm may require additional details on the applicant in order to confirm a job application. For all such purposes, the BPP can choose to send this object attached to any object in the catalog that is required to be sent while placing the order. This object can typically be sent at an item level or at the order level. The item level XInput will override the Order level XInput as it indicates a special requirement of information for that particular item. Hence the BAP must render a separate form for the Item and another form at the Order level before confirmation.", + "type": "object", + "additionalProperties": false, + "properties": { + "head": { + "description": "Provides the header information for the xinput.", + "type": "object", + "additionalProperties": false, + "properties": { + "descriptor": { + "$ref": "definitions.json#/$defs/Descriptor" + }, + "index": { + "type": "object", + "additionalProperties": false, + "properties": { + "min": { + "type": "integer" + }, + "cur": { + "type": "integer" + }, + "max": { + "type": "integer" + } + } + }, + "headings": { + "type": "array", + "items": { + "type": "string", + "description": "The heading names of the forms" + } + } + } + }, + "form": { + "$ref": "definitions.json#/$defs/Form" + }, + "form_response": { + "description": "Describes the response to a form submission", + "type": "object", + "additionalProperties": false, + "properties": { + "status": { + "description": "Contains the status of form submission.", + "type": "string" + }, + "signature": { + "type": "string" + }, + "submission_id": { + "type": "string" + }, + "errors": { + "type": "array", + "items": { + "$ref": "definitions.json#/$defs/Error" + } + } + } + }, + "required": { + "description": "Indicates whether the form data is mandatorily required by the BPP to confirm the order.", + "type": "boolean" + } + } + } + } + } \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/init.json b/pkg/plugin/schemas/core/v1.1.0/init.json new file mode 100644 index 0000000..fec48db --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/init.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "init", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "init" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "./definitions.json#/$defs/Order" + } + }, + "required": [ + "order" + ] + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_cancel.json b/pkg/plugin/schemas/core/v1.1.0/on_cancel.json new file mode 100644 index 0000000..4abb380 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_cancel.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_cancel", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_cancel" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "./definitions.json#/$defs/Order" + } + }, + "required": [ + "order" + ] + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "context", + "message" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_confirm.json b/pkg/plugin/schemas/core/v1.1.0/on_confirm.json new file mode 100644 index 0000000..4abea80 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_confirm.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_confirm", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_confirm" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "./definitions.json#/$defs/Order" + } + }, + "required": [ + "order" + ] + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_init.json b/pkg/plugin/schemas/core/v1.1.0/on_init.json new file mode 100644 index 0000000..18c44f3 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_init.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_init", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_init" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "./definitions.json#/$defs/Order" + } + }, + "required": [ + "order" + ] + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_rating.json b/pkg/plugin/schemas/core/v1.1.0/on_rating.json new file mode 100644 index 0000000..0b9898b --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_rating.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_rating", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_rating" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "properties": { + "feedback_form": { + "description": "A feedback form to allow the user to provide additional information on the rating provided", + "allOf": [ + { + "$ref": "./definitions.json#/$defs/XInput" + } + ] + } + } + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "context", + "message" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_search.json b/pkg/plugin/schemas/core/v1.1.0/on_search.json new file mode 100644 index 0000000..854c6f9 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_search.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_search", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_search" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "catalog": { + "$ref": "./definitions.json#/$defs/Catalog" + } + }, + "required": [ + "catalog" + ] + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_select.json b/pkg/plugin/schemas/core/v1.1.0/on_select.json new file mode 100644 index 0000000..956c6a8 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_select.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_select", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_select" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "./definitions.json#/$defs/Order" + } + } + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_status.json b/pkg/plugin/schemas/core/v1.1.0/on_status.json new file mode 100644 index 0000000..00167e5 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_status.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_status", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_status" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "./definitions.json#/$defs/Order" + } + }, + "required": [ + "order" + ] + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_support.json b/pkg/plugin/schemas/core/v1.1.0/on_support.json new file mode 100644 index 0000000..7ba94f0 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_support.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_support", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_support" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "properties": { + "support": { + "$ref": "./definitions.json#/$defs/Support" + } + } + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "context", + "message" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_track.json b/pkg/plugin/schemas/core/v1.1.0/on_track.json new file mode 100644 index 0000000..cbaf906 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_track.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_track", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_track" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "tracking": { + "$ref": "./definitions.json#/$defs/Tracking" + } + }, + "required": [ + "tracking" + ] + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "context", + "message" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/on_update.json b/pkg/plugin/schemas/core/v1.1.0/on_update.json new file mode 100644 index 0000000..74de03c --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/on_update.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_update", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "on_update" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "./definitions.json#/$defs/Order" + } + }, + "required": [ + "order" + ] + }, + "error": { + "$ref": "./definitions.json#/$defs/Error" + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/rating.json b/pkg/plugin/schemas/core/v1.1.0/rating.json new file mode 100644 index 0000000..3006d12 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/rating.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "rating", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "rating" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "properties": { + "ratings": { + "type": "array", + "items": { + "$ref": "./definitions.json#/$defs/Rating" + } + } + } + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/response.json b/pkg/plugin/schemas/core/v1.1.0/response.json new file mode 100644 index 0000000..cbd7372 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/response.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "Response", + "type": "object", + "properties": {}, + "required": [] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/search.json b/pkg/plugin/schemas/core/v1.1.0/search.json new file mode 100644 index 0000000..7faae89 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/search.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "search", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + } + ] + }, + "message": { + "properties": { + "intent": { + "$ref": "./definitions.json#/$defs/Intent" + } + }, + "type": "object" + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/select.json b/pkg/plugin/schemas/core/v1.1.0/select.json new file mode 100644 index 0000000..7151fff --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/select.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "select", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "select" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order": { + "$ref": "./definitions.json#/$defs/Order" + } + }, + "required": [ + "order" + ] + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/status.json b/pkg/plugin/schemas/core/v1.1.0/status.json new file mode 100644 index 0000000..871f693 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/status.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "status", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "status" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "ref_id": { + "$ref": "./definitions.json#/$defs/Order" + }, + "order_id": { + "$ref": "./definitions.json#/$defs/Order" + } + } + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/support.json b/pkg/plugin/schemas/core/v1.1.0/support.json new file mode 100644 index 0000000..729b81a --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/support.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "support", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "support" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "properties": { + "support": { + "$ref": "./definitions.json#/$defs/Support" + } + } + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/track.json b/pkg/plugin/schemas/core/v1.1.0/track.json new file mode 100644 index 0000000..ec891b1 --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/track.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "track", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "track" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "order_id": { + "$ref": "./definitions.json#/$defs/Order" + }, + "callback_url": { + "type": "string", + "format": "uri" + } + }, + "required": [ + "order_id" + ] + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/core/v1.1.0/update.json b/pkg/plugin/schemas/core/v1.1.0/update.json new file mode 100644 index 0000000..6a664fa --- /dev/null +++ b/pkg/plugin/schemas/core/v1.1.0/update.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "update", + "type": "object", + "properties": { + "context": { + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Context" + }, + { + "type": "object", + "properties": { + "action": { + "enum": [ + "update" + ] + } + }, + "required": [ + "action" + ] + } + ] + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "update_target": { + "description": "Comma separated values of order objects being updated. For example: ```\"update_target\":\"item,billing,fulfillment\"```", + "type": "string" + }, + "order": { + "description": "Updated order object", + "allOf": [ + { + "$ref": "./definitions.json#/$defs/Order" + } + ] + } + }, + "required": [ + "update_target", + "order" + ] + } + }, + "required": [ + "message", + "context" + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/cancel.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/cancel.json new file mode 100644 index 0000000..b53fedb --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/cancel.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "cancel", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/cancel.json#" + }, + { + "$ref": "init.json#/allOf/2" + }, + { + "properties": { + "message": { + "type": "object", + "properties": { + "order_id": { + "type": "string" + }, + "descriptor": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": ["SOFT_CANCEL", "CONFIRM_CANCEL"] + } + }, + "required": ["code"] + }, + "cancellation_reason_id": { + "type": "string", + "pattern": "^[0-9]+$" + } + }, + "required": ["order_id", "descriptor", "cancellation_reason_id"] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/confirm.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/confirm.json new file mode 100644 index 0000000..25f4e01 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/confirm.json @@ -0,0 +1,463 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "confirm", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/confirm.json#" + }, + { + "$ref": "./init.json#/allOf/1" + }, + { + "$ref": "./init.json#/allOf/2" + }, + { + "allOf": [ + { + "$ref": "./on_select.json#/allOf/5" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "type": "array", + "items": { + "allOf": [ + { + "properties": { + "customer": { + "properties": { + "contact": { + "properties": { + "phone": { + "type": "string", + "pattern": "^\\+?[1-9]\\d{1,14}$" + } + }, + "required": [ + "phone" + ] + }, + "person": { + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + }, + "required": [ + "contact", + "person" + ] + } + }, + "required": [ + "customer" + ] + } + ] + } + } + } + } + } + } + } + } + ] + }, + { + "allOf": [ + { + "$ref": "./init.json#/allOf/7" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "payments": { + "type": "array", + "items": { + "type": "object", + "properties": { + "params": { + "type": "object", + "properties": { + "amount": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + } + }, + "type": { + "type": "string", + "enum": [ + "PRE-ORDER", + "ON-FULFILLMENT", + "POST-FULFILLMENT" + ] + }, + "status": { + "type": "string", + "enum": [ + "PAID", + "NOT-PAID" + ] + }, + "collected_by": { + "type": "string", + "enum": [ + "BAP", + "BPP" + ] + }, + "tags": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "SETTLEMENT_TERMS", + "BUYER_FINDER_FEES" + ] + } + }, + "allOf": [ + { + "if": { + "properties": { + "descriptor": { + "properties": { + "code": { + "const": "SETTLEMENT_TERMS" + } + } + } + } + }, + "then": { + "properties": { + "list": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "STATIC_TERMS" + } + } + }, + "value": { + "type": "string", + "format": "uri" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_BASIS" + } + } + }, + "value": { + "type": "string", + "enum": [ + "DELIVERY" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_WINDOW" + } + } + }, + "value": { + "type": "string" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "DELAY_INTEREST" + } + } + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_TYPE" + } + } + }, + "value": { + "type": "string", + "enum": [ + "upi", + "neft", + "rtgs", + "UPI", + "NEFT", + "RTGS" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_AMOUNT" + } + } + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "MANDATORY_ARBITRATION" + } + } + }, + "value": { + "type": "string", + "enum": [ + "true", + "false" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "COURT_JURISDICTION" + } + } + }, + "value": { + "type": "string" + } + } + } + } + ] + } + } + } + }, + { + "if": { + "properties": { + "descriptor": { + "properties": { + "code": { + "const": "BUYER_FINDER_FEES" + } + } + } + } + }, + "then": { + "properties": { + "list": { + "type": "array", + "items": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "enum": [ + "BUYER_FINDER_FEES_PERCENTAGE" + ] + } + } + }, + "value": { + "type": "string", + "pattern": "^-?\\d+(\\.\\d+)?$" + } + } + } + } + } + } + } + ] + } + }, + "required": [ + "descriptor" + ] + } + } + }, + "required": [ + "type", + "status", + "collected_by", + "tags" + ] + } + } + } + } + } + } + } + } + ] + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "payments": { + "type": "array", + "items": { + "properties": { + "type": { + "type": "string" + }, + "params": { + "type": "object", + "properties": { + "transaction_id": { + "type": "string" + } + } + } + }, + "required": [ + "type" + ], + "allOf": [ + { + "if": { + "properties": { + "type": { + "const": "PRE-ORDER" + } + } + }, + "then": { + "properties": { + "params": { + "required": [ + "transaction_id" + ] + } + } + } + } + ] + } + } + }, + "required": [ + "payments" + ] + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "not": { + "required": [ + "id" + ] + } + } + } + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/init.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/init.json new file mode 100644 index 0000000..395ba67 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/init.json @@ -0,0 +1,550 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "init", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/init.json#" + }, + { + "properties": { + "context": { + "type": "object", + "allOf": [ + { + "$ref": "./search.json#/properties/context/allOf/0" + }, + { + + "required": [ + "bpp_id", + "bpp_uri" + ] + } + ] + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "type": "object", + "properties": { + "provider": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + }, + "required": [ + "provider", + "items" + ] + } + } + } + } + }, + { + "$ref": "./confirm.json#/allOf/4" + }, + { + "$ref": "./on_select.json#/allOf/7" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "required": [ + "fulfillments" + ] + } + } + } + } + }, + { + "properties": { + "message": { + "type": "object", + "properties": { + "order": { + "type": "object", + "properties": { + "payments": { + "type": "array", + "items": { + "type": "object", + "properties": { + "params": { + "type": "object", + "properties": { + "amount": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + } + }, + "type": { + "type": "string", + "enum": [ + "PRE-ORDER", + "ON-FULFILLMENT", + "POST-FULFILLMENT" + ] + }, + "status": { + "type": "string", + "enum": [ + "PAID", + "NOT-PAID" + ] + }, + "collected_by": { + "type": "string", + "enum": [ + "BAP", + "BPP" + ] + }, + "tags": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "SETTLEMENT_TERMS", + "BUYER_FINDER_FEES" + ] + } + } + } + }, + "required": [ + "descriptor" + ] + } + } + }, + "required": [ + "type", + "status", + "collected_by", + "tags" + ], + "allOf": [ + { + "if": { + "allOf": [ + { + "properties": { + "collected_by": { + "const": "BAP" + } + } + }, + { + "properties": { + "type": { + "const": "PRE-ORDER" + } + } + } + ] + }, + "then": { + "properties": { + "tags": { + "items": { + "if": { + "properties": { + "descriptor": { + "properties": { + "code": { + "const": "SETTLEMENT_TERMS" + } + } + } + } + }, + "then": { + "properties": { + "list": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "STATIC_TERMS" + } + } + }, + "value": { + "type": "string", + "format": "uri" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_BASIS" + } + } + }, + "value": { + "type": "string", + "enum": [ + "DELIVERY" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_WINDOW" + } + } + }, + "value": { + "type": "string" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "DELAY_INTEREST" + } + } + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + } + } + } + ] + } + } + } + } + } + } + } + }, + { + "if": { + "allOf": [ + { + "properties": { + "collected_by": { + "const": "BPP" + } + } + }, + { + "properties": { + "type": { + "const": "PRE-ORDER" + } + } + } + ] + }, + "then": { + "properties": { + "tags": { + "items": { + "if": { + "properties": { + "descriptor": { + "properties": { + "code": { + "const": "SETTLEMENT_TERMS" + } + } + } + } + }, + "then": { + "properties": { + "list": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "STATIC_TERMS" + } + } + }, + "value": { + "type": "string", + "format": "uri" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_BASIS" + } + } + }, + "value": { + "type": "string", + "enum": [ + "DELIVERY" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_WINDOW" + } + } + }, + "value": { + "type": "string" + } + } + } + } + ] + } + } + } + } + } + } + } + }, + { + "if": { + "allOf": [ + { + "properties": { + "collected_by": { + "const": "BPP" + } + } + }, + { + "properties": { + "type": { + "const": "ON-FULFILLMENT" + } + } + } + ] + }, + "then": { + "properties": { + "tags": { + "items": { + "if": { + "properties": { + "descriptor": { + "properties": { + "code": { + "const": "SETTLEMENT_TERMS" + } + } + } + } + }, + "then": { + "properties": { + "list": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "STATIC_TERMS" + } + } + }, + "value": { + "type": "string", + "format": "uri" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_BASIS" + } + } + }, + "value": { + "type": "string", + "enum": [ + "DELIVERY" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_WINDOW" + } + } + }, + "value": { + "type": "string" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "DELAY_INTEREST" + } + } + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + } + } + } + ] + } + } + } + } + } + } + } + } + ] + } + } + } + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "billing": { + "required": [ + "name" + ] + } + }, + "required": [ + "billing" + ] + } + } + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_cancel.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_cancel.json new file mode 100644 index 0000000..dbcf8f0 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_cancel.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_cancel", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_cancel.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_confirm.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_confirm.json new file mode 100644 index 0000000..4a0083e --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_confirm.json @@ -0,0 +1,314 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_confirm", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_confirm.json#" + }, + { + "$ref": "./init.json#/allOf/1" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "provider": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": ["id"] + } + }, + "required": ["provider"] + } + } + } + } + }, + { + "$ref": "./confirm.json#/allOf/5" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "items": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "fulfillment_ids": { + "minItems": 1 + }, + "location_ids": { + "minItems": 1 + } + }, + "required": ["fulfillment_ids", "location_ids"] + } + } + } + } + } + } + } + }, + { + "$ref": "./confirm.json#/allOf/4/allOf/1" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["DELIVERY"] + } + }, + "required": ["type"] + } + } + } + } + } + } + } + }, + { + "allOf": [ + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "quote": { + "type": "object", + "properties": { + "price": { + "type": "object", + "properties": { + "currency": { + "type": "string" + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + }, + "required": ["currency", "value"] + }, + "breakup": { + "type": "array", + "items": { + "type": "object", + "properties": { + "price": { + "type": "object", + "properties": { + "currency": { + "type": "string" + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + }, + "required": ["currency", "value"] + }, + "title": { + "type": "string", + "enum": [ + "BASE_FARE", + "DISTANCE_FARE", + "TAX", + "DISCOUNT", + "WAITING_CHARGE" + ] + } + }, + "required": ["price", "title"] + } + } + }, + "required": ["price", "breakup"] + } + }, + "required": ["quote"] + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "quote": { + "properties": { + "breakup": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "title": { + "const": "BASE_FARE" + }, + "price": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + }, + "required": ["value"] + } + }, + "required": ["title", "price"] + } + }, + { + "contains": { + "type": "object", + "properties": { + "title": { + "const": "DISTANCE_FARE" + }, + "price": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + }, + "required": ["value"] + } + }, + "required": ["title", "price"] + } + } + ] + } + } + } + } + } + } + } + } + } + ] + }, + { + "$ref": "./confirm.json#/allOf/6" + }, + { + "allOf": [ + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "cancellation_terms": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fulfillment_state": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "RIDE_ASSIGNED", + "RIDE_ENROUTE_PICKUP", + "RIDE_ARRIVED_PICKUP", + "RIDE_STARTED" + ] + } + }, + "required": ["code"] + } + }, + "required": ["descriptor"] + }, + "cancellation_fee": { + "oneOf": [ + { + "type": "object", + "properties": { + "percentage": { + "type": "string", + "pattern": "^(100(\\.0{1,2})?|([0-9]{1,2})(\\.\\d{1,2})?)$" + } + }, + "required": ["percentage"] + }, + { + "type": "object", + "properties": { + "amount": { + "type": "object", + "properties": { + "value": { + "type": "string", + "pattern": "^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)$" + }, + "currency": { + "type": "string" + } + }, + "required": ["currency", "value"] + } + }, + "required": ["amount"] + } + ] + } + }, + "required": ["fulfillment_state", "cancellation_fee"] + } + } + }, + "required": ["cancellation_terms"] + } + } + } + } + }, + { + "properties": { + "message": { + "type": "object" + } + }, + "required": ["message"] + } + ] + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_init.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_init.json new file mode 100644 index 0000000..fe7105c --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_init.json @@ -0,0 +1,317 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_init", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_init.json#" + }, + { + "$ref": "./init.json#/allOf/1" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "provider": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": ["id"] + } + }, + "required": ["provider"] + } + } + } + } + }, + { + "$ref": "./confirm.json#/allOf/5" + }, + { + "$ref": "./on_select.json#/allOf/6" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "items": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "fulfillment_ids": { + "minItems": 1 + }, + "location_ids": { + "minItems": 1 + } + }, + "required": ["fulfillment_ids", "location_ids"] + } + } + } + } + } + } + } + }, + { + "$ref": "./confirm.json#/allOf/4/allOf/1" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["DELIVERY"] + } + }, + "required": ["type"] + } + } + } + } + } + } + } + }, + { + "allOf": [ + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "quote": { + "type": "object", + "properties": { + "price": { + "type": "object", + "properties": { + "currency": { + "type": "string" + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + }, + "required": ["currency", "value"] + }, + "breakup": { + "type": "array", + "items": { + "type": "object", + "properties": { + "price": { + "type": "object", + "properties": { + "currency": { + "type": "string" + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + }, + "required": ["currency", "value"] + }, + "title": { + "type": "string", + "enum": [ + "BASE_FARE", + "DISTANCE_FARE", + "TAX", + "DISCOUNT", + "WAITING_CHARGE" + ] + } + }, + "required": ["price", "title"] + } + } + }, + "required": ["price", "breakup"] + } + }, + "required": ["quote"] + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "quote": { + "properties": { + "breakup": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "title": { + "const": "BASE_FARE" + }, + "price": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + }, + "required": ["value"] + } + }, + "required": ["title", "price"] + } + }, + { + "contains": { + "type": "object", + "properties": { + "title": { + "const": "DISTANCE_FARE" + }, + "price": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + }, + "required": ["value"] + } + }, + "required": ["title", "price"] + } + } + ] + } + } + } + } + } + } + } + } + } + ] + }, + { + "$ref": "./confirm.json#/allOf/6" + }, + { + "allOf": [ + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "cancellation_terms": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fulfillment_state": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "RIDE_ASSIGNED", + "RIDE_ENROUTE_PICKUP", + "RIDE_ARRIVED_PICKUP", + "RIDE_STARTED" + ] + } + }, + "required": ["code"] + } + }, + "required": ["descriptor"] + }, + "cancellation_fee": { + "oneOf": [ + { + "type": "object", + "properties": { + "percentage": { + "type": "string", + "pattern": "^(100(\\.0{1,2})?|([0-9]{1,2})(\\.\\d{1,2})?)$" + } + }, + "required": ["percentage"] + }, + { + "type": "object", + "properties": { + "amount": { + "type": "object", + "properties": { + "value": { + "type": "string", + "pattern": "^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)$" + }, + "currency": { + "type": "string" + } + }, + "required": ["currency", "value"] + } + }, + "required": ["amount"] + } + ] + } + }, + "required": ["fulfillment_state", "cancellation_fee"] + } + } + }, + "required": ["cancellation_terms"] + } + } + } + } + }, + { + "properties": { + "message": { + "type": "object" + } + }, + "required": ["message"] + } + ] + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_rating.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_rating.json new file mode 100644 index 0000000..684a1c3 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_rating.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_rating", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_rating.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_search.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_search.json new file mode 100644 index 0000000..06d5a8b --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_search.json @@ -0,0 +1,644 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_search", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_search.json#" + }, + { + "$ref": "./init.json#/allOf/1" + }, + { + "properties": { + "message": { + "type": "object", + "properties": { + "catalog": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + }, + "required": [ + "name" + ] + }, + "providers": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "descriptor": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + }, + "required": [ + "name" + ] + }, + "fulfillments": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "vehicle": { + "type": "object", + "properties": { + "category": { + "type": "string", + "enum": [ + "AUTO_RICKSHAW", + "CAB" + ] + } + }, + "required": [ + "category" + ] + }, + "type": { + "type": "string", + "enum": [ + "DELIVERY" + ] + } + }, + "required": [ + "id", + "vehicle", + "type" + ] + } + }, + "items": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string", + "enum": [ + "RIDE" + ] + } + }, + "required": [ + "code" + ] + }, + "price": { + "type": "object", + "properties": { + "value": { + "type": "string", + "pattern": "^-?\\d+(\\.\\d+)?$" + } + }, + "required": [ + "value", + "currency" + ] + }, + "fulfillment_ids": { + "type": "array", + "minItems": 1 + }, + "payment_ids": { + "type": "array", + "minItems": 1 + } + }, + "required": [ + "id", + "descriptor", + "price", + "fulfillment_ids" + ] + } + } + }, + "required": [ + "id", + "items", + "fulfillments" + ] + } + } + }, + "required": [ + "providers" + ] + } + }, + "required": [ + "catalog" + ] + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "payments": { + "type": "array", + "items": { + "type": "object", + "properties": { + "collected_by": { + "type": "string", + "enum": [ + "BAP", + "BPP" + ] + }, + "tags": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "SETTLEMENT_TERMS", + "BUYER_FINDER_FEES" + ] + } + } + } + }, + "required": [ + "descriptor" + ] + } + } + }, + "required": [ + "collected_by", + "tags" + ], + "allOf": [ + { + "if": { + "allOf": [ + { + "properties": { + "collected_by": { + "const": "BAP" + } + } + } + ] + }, + "then": { + "properties": { + "tags": { + "items": { + "if": { + "properties": { + "descriptor": { + "properties": { + "code": { + "const": "SETTLEMENT_TERMS" + } + } + } + } + }, + "then": { + "properties": { + "list": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "STATIC_TERMS" + } + } + }, + "value": { + "type": "string", + "format": "uri" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_TYPE" + } + } + }, + "value": { + "type": "string", + "enum": [ + "upi", + "neft", + "rtgs", + "UPI", + "NEFT", + "RTGS" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "DELAY_INTEREST" + } + } + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "MANDATORY_ARBITRATION" + } + } + }, + "value": { + "type": "string", + "enum": [ + "true", + "false" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "COURT_JURISDICTION" + } + } + }, + "value": { + "type": "string" + } + } + } + } + ] + } + } + } + } + } + } + } + }, + { + "if": { + "allOf": [ + { + "properties": { + "collected_by": { + "const": "BPP" + } + } + } + ] + }, + "then": { + "properties": { + "tags": { + "items": { + "if": { + "properties": { + "descriptor": { + "properties": { + "code": { + "const": "SETTLEMENT_TERMS" + } + } + } + } + }, + "then": { + "properties": { + "list": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "STATIC_TERMS" + } + } + }, + "value": { + "type": "string", + "format": "uri" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_TYPE" + } + } + }, + "value": { + "type": "string", + "enum": [ + "upi", + "neft", + "rtgs", + "UPI", + "NEFT", + "RTGS" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "DELAY_INTEREST" + } + } + }, + "value": { + "type": "string", + "pattern": "^\\d+(\\.\\d{1,2})?$" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "MANDATORY_ARBITRATION" + } + } + }, + "value": { + "type": "string", + "enum": [ + "true", + "false" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "COURT_JURISDICTION" + } + } + }, + "value": { + "type": "string" + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_BASIS" + } + } + }, + "value": { + "type": "string", + "enum": [ + "DELIVERY" + ] + } + } + } + }, + { + "contains": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "const": "SETTLEMENT_WINDOW" + } + } + }, + "value": { + "type": "string" + } + } + } + } + ] + } + } + } + } + } + } + } + } + ] + } + } + }, + "required": [ + "payments" + ] + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "catalog": { + "properties": { + "providers": { + "items": { + "properties": { + "fulfillments": { + "items": { + "properties": { + "stops": { + "allOf": [ + { + "contains": { + "type": "object", + "properties": { + "location": { + "type": "object", + "properties": { + "gps": { + "type": "string" + } + }, + "required": [ + "gps" + ] + }, + "type": { + "const": "START" + } + }, + "required": [ + "location", + "type" + ] + } + }, + { + "contains": { + "type": "object", + "properties": { + "location": { + "type": "object", + "properties": { + "gps": { + "type": "string" + } + }, + "required": [ + "gps" + ] + }, + "type": { + "const": "END" + } + }, + "required": [ + "location", + "type" + ] + } + } + ] + } + }, + "required": [ + "stops" + ] + } + } + } + } + } + } + } + } + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_select.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_select.json new file mode 100644 index 0000000..f942502 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_select.json @@ -0,0 +1,227 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_select", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_select.json#" + }, + { + "$ref": "./init.json#/allOf/1" + }, + { + "$ref": "./on_init.json#/allOf/2" + }, + { + "$ref": "./on_init.json#/allOf/5" + }, + { + "allOf": [ + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "type": "array", + "minItems": 1, + "items": { + "required": ["id"] + } + } + }, + "required": ["fulfillments"] + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "state": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "RIDE_ASSIGNED", + "RIDE_ENROUTE_PICKUP", + "RIDE_ARRIVED_PICKUP", + "RIDE_STARTED", + "RIDE_ENDED", + "RIDE_CANCELLED" + ] + } + }, + "required": ["code"] + } + } + } + } + } + } + } + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "type": "array", + "minItems": 1, + "items": { + "properties": { + "stops": { + "items": { + "properties": { + "authorization": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["OTP"] + }, + "token": { + "type": "string", + "pattern": "^-?\\d+(\\.\\d+)?$" + } + }, + "required": ["type", "token"] + } + } + } + } + } + } + } + } + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "items": { + "properties": { + "stops": { + "type": "array", + "minItems": 2, + "items": { + "type": "object", + "properties": { + "location": { + "type": "object", + "properties": { + "gps": { "type": "string" } + }, + "required": ["gps"] + }, + "type": { + "enum": ["START", "END"] + } + }, + "required": ["location", "type"] + } + } + }, + "required": ["stops"] + } + } + } + } + } + } + } + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "vehicle": { + "properties": { + "category": { + "type": "string", + "enum": ["AUTO_RICKSHAW", "CAB"] + } + }, + "required": ["category"] + } + }, + "required": ["vehicle"] + } + } + }, + "required": ["fulfillments"] + } + } + } + } + } + ] + }, + { + "$ref": "./on_init.json#/allOf/7" + }, + { + "properties": { + "message": { + "properties": { + "order": { + "properties": { + "fulfillments": { + "type": "array", + "items": { + "allOf": [ + { + "not": { + "required": ["agent"] + } + } + ] + } + } + } + } + } + } + } + }, + { + "$ref": "./on_init.json#/allOf/8" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_status.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_status.json new file mode 100644 index 0000000..3ac9a6c --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_status.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_status", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_status.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_support.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_support.json new file mode 100644 index 0000000..5884c85 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_support.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_support", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_support.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_track.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_track.json new file mode 100644 index 0000000..7796a66 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_track.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_track", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_track.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_update.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_update.json new file mode 100644 index 0000000..487def2 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/on_update.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "on_update", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/on_update.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/rating.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/rating.json new file mode 100644 index 0000000..5cfbc74 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/rating.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "rating", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/rating.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/search.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/search.json new file mode 100644 index 0000000..f661f8e --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/search.json @@ -0,0 +1,146 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "search", + "allOf": [ + { "$ref": "../../core/v1.1.0/search.json#" } + ], + "type": "object", + "properties": { + "context": { + "type": "object", + "allOf": [ + { + "properties": { + "action": { + "type": "string" + }, + "location": { + "type": "object", + "properties": { + "city": { + "type": "object", + "properties": { + "code": { "type": "string" } + }, + "required": ["code"] + }, + "country": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": ["IND"] + } + }, + "required": ["code"] + } + }, + "required": ["city", "country"] + }, + "bap_id": { + "type": "string" + }, + "bpp_id": { + "type": "string" + }, + "ttl": { + "type": "string", + "format": "duration" + }, + "timestamp": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "location", + "domain", + "action", + "message_id", + "transaction_id", + "timestamp", + "bap_id", + "bap_uri", + "ttl" + ] + } + ] + }, + "message": { + "type": "object", + "properties": { + "intent": { + "allOf": [ + { + "type": "object", + "properties": { + "payment": { + "type": "object", + "properties": { + "collected_by": { + "type": "string", + "enum": ["BPP", "BAP"] + }, + "tags": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "type": "object", + "properties": { + "descriptor": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": ["SETTLEMENT_TERMS", "BUYER_FINDER_FEES"] + } + } + } + }, + "required": ["descriptor"] + } + } + }, + "required": ["collected_by"] + }, + "fulfillment": { + "type": "object", + "properties": { + "stops": { + "type": "array", + "items": { + "type": "object", + "properties": { + "location": { + "type": "object", + "properties": { + "gps": { "type": "string" } + }, + "required": ["gps"] + }, + "type": { + "type": "string", + "enum": ["START", "END"] + } + }, + "required": ["location", "type"] + }, + "minItems": 2 + } + }, + "required": ["stops"] + } + }, + "required": ["payment", "fulfillment"] + } + ] + } + }, + "required": ["intent"] + } + }, + "required": ["context", "message"] + } + \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/select.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/select.json new file mode 100644 index 0000000..2d22396 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/select.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "select", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/select.json#" + }, + { + "$ref": "./init.json#/allOf/1" + }, + { + "$ref": "./init.json#/allOf/2" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/status.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/status.json new file mode 100644 index 0000000..a9085d2 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/status.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "status", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/status.json#" + }, + { + "$ref": "./init.json#/allOf/1" + }, + { + "properties": { + "message": { + "type": "object", + "properties": { + "order_id": { + "type": "string" + } + }, + "required": ["order_id"] + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/support.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/support.json new file mode 100644 index 0000000..de4dbda --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/support.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "support", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/support.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/track.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/track.json new file mode 100644 index 0000000..242cec1 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/track.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "track", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/track.json#" + }, + { + "$ref": "./init.json#/allOf/1" + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/schemas/ondc_trv10/v2.0.1/update.json b/pkg/plugin/schemas/ondc_trv10/v2.0.1/update.json new file mode 100644 index 0000000..d197cc7 --- /dev/null +++ b/pkg/plugin/schemas/ondc_trv10/v2.0.1/update.json @@ -0,0 +1,35 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "update", + "type": "object", + "allOf": [ + { + "$ref": "../../core/v1.1.0/update.json#" + }, + { + "$ref": "./init.json#/allOf/1" + }, + { + "properties": { + "message": { + "type": "object", + "properties": { + "order": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": ["id"] + }, + "update_target": { + "type": "string", + "pattern": "^[^,]+(,[^,]+)*$" + } + } + } + } + } + ] +} \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/cancel.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/cancel.json new file mode 100644 index 0000000..27820bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/cancel.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", + "timestamp": "2023-03-23T05:15:08Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "cancellation_reason_id": "7", + "descriptor": { + "code": "SOFT_CANCEL", + "name": "Ride Cancellation" + }, + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/confirm.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/confirm.json new file mode 100644 index 0000000..c198095 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/confirm.json @@ -0,0 +1,155 @@ +{ + "context": { + "action": "confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-12-10T04:34:48.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/init.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/init.json new file mode 100644 index 0000000..2b93c6a --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/init.json @@ -0,0 +1,148 @@ +{ + "context": { + "action": "init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:09:31.307Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_cancel.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_cancel.json new file mode 100644 index 0000000..e8c1921 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_cancel.json @@ -0,0 +1,390 @@ +{ + "context": { + "action": "on_cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "version": "2.0.1", + "ttl": "PT30S" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "time": { + "duration": "PT2H" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "CAB Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "156", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BAP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "Delivery" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "2.5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://www.icicibank.com/personal-banking/loans/personal-loan" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "85" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "10" + }, + "title": "CANCELLATION_CHARGES" + }, + { + "price": { + "currency": "INR", + "value": "-146" + }, + "title": "REFUND" + } + ], + "price": { + "currency": "INR", + "value": "10" + }, + "ttl": "P200S" + }, + "status": "SOFT_CANCEL" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_confirm.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_confirm.json new file mode 100644 index 0000000..de4017a --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_confirm.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-10T08:03:34.294Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-10T08:03:34.294Z" + } + } + } + \ No newline at end of file diff --git a/shared/plugin/testData/payloads/select.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_init.json similarity index 96% rename from shared/plugin/testData/payloads/select.json rename to pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_init.json index a391e6e..d591334 100644 --- a/shared/plugin/testData/payloads/select.json +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_init.json @@ -1,6 +1,6 @@ { "context": { - "action": "select", + "action": "on_init", "bap_id": "example-bap.com", "bap_uri": "https://example-bap.com/prod/trv10", "bpp_id": "example-bpp.com", @@ -18,7 +18,7 @@ "timestamp": "2023-12-09T14:11:32.859Z", "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", "ttl": "PT30S", - "version": "2.0.0" + "version": "2.0.1" }, "message": { "order": { @@ -90,7 +90,11 @@ "location": { "gps": "13.008935, 77.644408" }, - "type": "START" + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } }, { "location": { @@ -126,7 +130,8 @@ ], "type": "DELIVERY", "vehicle": { - "category": "AUTO_RICKSHAW" + "category": "AUTO_RICKSHAW", + "variant": "EV" } } ], diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_rating.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_rating.json new file mode 100644 index 0000000..7f6dabe --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_rating.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "on_rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "2a17e268-1dc4-4d1a-98a2-17554a50c7d2", + "timestamp": "2023-03-23T05:41:15Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "feedback_ack": true, + "rating_ack": true + } +} diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_search.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_search.json new file mode 100644 index 0000000..b921b15 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_search.json @@ -0,0 +1,221 @@ +{ + "context": { + "action": "on_search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "21e54d3c-9c3b-47c1-aa3b-b0e7b20818ee", + "timestamp": "2023-12-09T13:41:16.161Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "catalog": { + "descriptor": { + "name": "Mobility Servies BPP" + }, + "providers": [ + { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + }, + { + "id": "F2", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "CAB", + "variant": "SEDAN" + } + } + ], + "id": "P1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + } + }, + { + "descriptor": { + "code": "RIDE", + "name": "CAB Economy Ride" + }, + "fulfillment_ids": [ + "F2" + ], + "id": "I2", + "location_ids": [ + "L2", + "L4" + ], + "price": { + "currency": "INR", + "maximum_value": "236", + "minimum_value": "206", + "value": "206" + } + } + ], + "locations": [ + { + "gps": "12.916468,77.608998", + "id": "L1" + }, + { + "gps": "12.916714,77.609298", + "id": "L2" + }, + { + "gps": "12.916573,77.615216", + "id": "L3" + }, + { + "gps": "12.906857,77.604456", + "id": "L4" + } + ], + "payments": [ + { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ] + } + ] + } + ] + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_select.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_select.json new file mode 100644 index 0000000..1dbac52 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_select.json @@ -0,0 +1,209 @@ +{ + "context": { + "action": "on_select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T13:49:26.132Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "P200s" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_status.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_status.json new file mode 100644 index 0000000..59da10d --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_status.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "5ee2001f-e612-431d-9e07-49574af60e88", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_support.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_support.json new file mode 100644 index 0000000..b0d398c --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_support.json @@ -0,0 +1,30 @@ +{ + "context": { + "action": "on_support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "support": { + "email": "support@nammayatri.in", + "phone": "+918068870525", + "url": "https://support.nammayatri.com/gethelp" + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_track.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_track.json new file mode 100644 index 0000000..066efb4 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_track.json @@ -0,0 +1,33 @@ +{ + "context": { + "action": "on_track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "tracking": { + "status": "active", + "location": { + "gps": "28.620976, 77.046732", + "updated_at": "2023-03-23T05:41:09Z" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_update.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_update.json new file mode 100644 index 0000000..57ee6a5 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/on_update.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-10T08:03:34.294Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "SELF_PICKUP", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-10T08:03:34.294Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/rating.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/rating.json new file mode 100644 index 0000000..300a828 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/rating.json @@ -0,0 +1,28 @@ +{ + "context": { + "action": "rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "b462a835-97d6-4479-bec8-9660a0f8513e", + "timestamp": "2023-03-23T04:46:45Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "id": "b0462745-f6c9-4100-bbe7-4fa3648b6b40", + "rating_category": "DRIVER", + "value": 4 + } +} diff --git a/shared/plugin/testData/payloads/search_missingField.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/search.json similarity index 80% rename from shared/plugin/testData/payloads/search_missingField.json rename to pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/search.json index 792e533..ae3a356 100644 --- a/shared/plugin/testData/payloads/search_missingField.json +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/search.json @@ -16,10 +16,26 @@ "timestamp": "2023-12-09T13:39:56.645Z", "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", "ttl": "PT30S", - "version": "2.0.0" + "version": "2.0.1" }, "message": { "intent": { + "fulfillment": { + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ] + }, "payment": { "collected_by": "BPP", "tags": [ diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/select.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/select.json new file mode 100644 index 0000000..1ac2e28 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/select.json @@ -0,0 +1,36 @@ +{ + "context": { + "action": "select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "432fdfd6-0457-47b6-9fac-80cbe5c0a75b", + "timestamp": "2023-12-09T13:49:01.460Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "P120S", + "version": "2.0.1" + }, + "message": { + "order": { + "items": [ + { + "id": "I1" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/status.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/status.json new file mode 100644 index 0000000..911166d --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/status.json @@ -0,0 +1,25 @@ +{ + "context": { + "action": "status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + } +} diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/support.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/support.json new file mode 100644 index 0000000..5d2e454 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/support.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "7751bd26-3fdc-47ca-9b64-e998dc5abe68" + } +} diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/track.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/track.json new file mode 100644 index 0000000..520ba45 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/track.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/update.json b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/update.json new file mode 100644 index 0000000..826c3d3 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign Driver Assign_Driver_post_OnConfirm(Self-Pickup)/update.json @@ -0,0 +1,38 @@ +{ + "context": { + "action": "update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-03-23T04:41:16Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "update_target": "order", + "order": { + "billing": { + "email": "jane.doe@example.com", + "name": "Jane Doe", + "phone": "+91-9897867564" + }, + "id": "O1", + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/cancel.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/cancel.json new file mode 100644 index 0000000..27820bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/cancel.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", + "timestamp": "2023-03-23T05:15:08Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "cancellation_reason_id": "7", + "descriptor": { + "code": "SOFT_CANCEL", + "name": "Ride Cancellation" + }, + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/confirm.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/confirm.json new file mode 100644 index 0000000..c198095 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/confirm.json @@ -0,0 +1,155 @@ +{ + "context": { + "action": "confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-12-10T04:34:48.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/init.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/init.json new file mode 100644 index 0000000..259b266 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/init.json @@ -0,0 +1,154 @@ +{ + "context": { + "action": "init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:09:31.307Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "AUTO_RICKSHAW", + "energy_type": "CNG" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "144.54" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_cancel.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_cancel.json new file mode 100644 index 0000000..e8c1921 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_cancel.json @@ -0,0 +1,390 @@ +{ + "context": { + "action": "on_cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "version": "2.0.1", + "ttl": "PT30S" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "time": { + "duration": "PT2H" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "CAB Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "156", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BAP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "Delivery" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "2.5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://www.icicibank.com/personal-banking/loans/personal-loan" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "85" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "10" + }, + "title": "CANCELLATION_CHARGES" + }, + { + "price": { + "currency": "INR", + "value": "-146" + }, + "title": "REFUND" + } + ], + "price": { + "currency": "INR", + "value": "10" + }, + "ttl": "P200S" + }, + "status": "SOFT_CANCEL" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_confirm.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_confirm.json new file mode 100644 index 0000000..de4017a --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_confirm.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-10T08:03:34.294Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-10T08:03:34.294Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_init.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_init.json new file mode 100644 index 0000000..38f4ee8 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_init.json @@ -0,0 +1,356 @@ +{ + "context": { + "action": "on_init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:11:32.859Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + } + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_rating.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_rating.json new file mode 100644 index 0000000..7f6dabe --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_rating.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "on_rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "2a17e268-1dc4-4d1a-98a2-17554a50c7d2", + "timestamp": "2023-03-23T05:41:15Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "feedback_ack": true, + "rating_ack": true + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_search.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_search.json new file mode 100644 index 0000000..daaea02 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_search.json @@ -0,0 +1,208 @@ +{ + "context": { + "action": "on_search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "21e54d3c-9c3b-47c1-aa3b-b0e7b20818ee", + "timestamp": "2023-12-09T13:41:16.161Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "catalog": { + "descriptor": { + "name": "Mobility Services BPP" + }, + "providers": [ + { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "AUTO_RICKSHAW" + } + }, + { + "id": "F2", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "CAB", + "variant": "SEDAN" + } + } + ], + "id": "P1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + } + }, + { + "descriptor": { + "code": "RIDE", + "name": "CAB Economy Ride" + }, + "fulfillment_ids": [ + "F2" + ], + "id": "I2", + "location_ids": [ + "L2", + "L4" + ], + "price": { + "currency": "INR", + "maximum_value": "236", + "minimum_value": "206", + "value": "206" + } + } + ], + "locations": [ + { + "gps": "12.916468,77.608998", + "id": "L1" + }, + { + "gps": "12.916714,77.609298", + "id": "L2" + }, + { + "gps": "12.916573,77.615216", + "id": "L3" + }, + { + "gps": "12.906857,77.604456", + "id": "L4" + } + ], + "payments": [ + { + "collected_by": "BAP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ] + } + ] + } + ] + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_select.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_select.json new file mode 100644 index 0000000..0cbe642 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_select.json @@ -0,0 +1,208 @@ +{ + "context": { + "action": "on_select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T13:49:26.132Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "P200s" + } + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_status.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_status.json new file mode 100644 index 0000000..59da10d --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_status.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "5ee2001f-e612-431d-9e07-49574af60e88", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_support.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_support.json new file mode 100644 index 0000000..b0d398c --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_support.json @@ -0,0 +1,30 @@ +{ + "context": { + "action": "on_support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "support": { + "email": "support@nammayatri.in", + "phone": "+918068870525", + "url": "https://support.nammayatri.com/gethelp" + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_track.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_track.json new file mode 100644 index 0000000..d546596 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_track.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "on_track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "tracking": { + "status": "active", + "location": { + "gps": "28.620976, 77.046732", + "updated_at": "2023-03-23T05:41:09Z" + } + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_update.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_update.json new file mode 100644 index 0000000..01e3bc8 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/on_update.json @@ -0,0 +1,361 @@ +{ + "context": { + "action": "on_update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-11T03:54:28.832Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENDED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "CLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-11T03:54:28.832Z" + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/rating.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/rating.json new file mode 100644 index 0000000..300a828 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/rating.json @@ -0,0 +1,28 @@ +{ + "context": { + "action": "rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "b462a835-97d6-4479-bec8-9660a0f8513e", + "timestamp": "2023-03-23T04:46:45Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "id": "b0462745-f6c9-4100-bbe7-4fa3648b6b40", + "rating_category": "DRIVER", + "value": 4 + } +} diff --git a/shared/plugin/testData/payloads/search.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/search.json similarity index 82% rename from shared/plugin/testData/payloads/search.json rename to pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/search.json index 282f81f..21b14a5 100644 --- a/shared/plugin/testData/payloads/search.json +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/search.json @@ -13,10 +13,10 @@ } }, "message_id": "40963dc1-e402-4f4d-ae70-7c5864ca682c", - "timestamp": "2023-12-09T13:39:56.645Z", + "timestamp": "2023-12-09T13:40:21.452Z", "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", "ttl": "PT30S", - "version": "2.0.0" + "version": "2.0.1" }, "message": { "intent": { @@ -37,7 +37,7 @@ ] }, "payment": { - "collected_by": "BPP", + "collected_by": "BAP", "tags": [ { "descriptor": { @@ -61,9 +61,15 @@ "list": [ { "descriptor": { - "code": "DELAY_INTEREST" + "code": "SETTLEMENT_WINDOW" }, - "value": "5" + "value": "PT1D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" }, { "descriptor": { diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/select.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/select.json new file mode 100644 index 0000000..ae53bc2 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/select.json @@ -0,0 +1,35 @@ +{ + "context": { + "action": "select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "432fdfd6-0457-47b6-9fac-80cbe5c0a75b", + "timestamp": "2023-12-09T13:49:01.460Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "P120S", + "version": "2.0.1" + }, + "message": { + "order": { + "items": [ + { + "id": "I1" + } + ], + "provider": { + "id": "P1" + } + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/status.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/status.json new file mode 100644 index 0000000..911166d --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/status.json @@ -0,0 +1,25 @@ +{ + "context": { + "action": "status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/support.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/support.json new file mode 100644 index 0000000..5d2e454 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/support.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "7751bd26-3fdc-47ca-9b64-e998dc5abe68" + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/track.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/track.json new file mode 100644 index 0000000..520ba45 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/track.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/update.json b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/update.json new file mode 100644 index 0000000..826c3d3 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_on_onConfirm/update.json @@ -0,0 +1,38 @@ +{ + "context": { + "action": "update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-03-23T04:41:16Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "update_target": "order", + "order": { + "billing": { + "email": "jane.doe@example.com", + "name": "Jane Doe", + "phone": "+91-9897867564" + }, + "id": "O1", + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/cancel.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/cancel.json new file mode 100644 index 0000000..27820bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/cancel.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", + "timestamp": "2023-03-23T05:15:08Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "cancellation_reason_id": "7", + "descriptor": { + "code": "SOFT_CANCEL", + "name": "Ride Cancellation" + }, + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/confirm.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/confirm.json new file mode 100644 index 0000000..c198095 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/confirm.json @@ -0,0 +1,155 @@ +{ + "context": { + "action": "confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-12-10T04:34:48.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/init.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/init.json new file mode 100644 index 0000000..2b93c6a --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/init.json @@ -0,0 +1,148 @@ +{ + "context": { + "action": "init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:09:31.307Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_cancel.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_cancel.json new file mode 100644 index 0000000..e8c1921 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_cancel.json @@ -0,0 +1,390 @@ +{ + "context": { + "action": "on_cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "version": "2.0.1", + "ttl": "PT30S" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "time": { + "duration": "PT2H" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "CAB Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "156", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BAP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "Delivery" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "2.5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://www.icicibank.com/personal-banking/loans/personal-loan" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "85" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "10" + }, + "title": "CANCELLATION_CHARGES" + }, + { + "price": { + "currency": "INR", + "value": "-146" + }, + "title": "REFUND" + } + ], + "price": { + "currency": "INR", + "value": "10" + }, + "ttl": "P200S" + }, + "status": "SOFT_CANCEL" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_confirm.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_confirm.json new file mode 100644 index 0000000..de4017a --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_confirm.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-10T08:03:34.294Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-10T08:03:34.294Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_init.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_init.json new file mode 100644 index 0000000..d591334 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_init.json @@ -0,0 +1,357 @@ +{ + "context": { + "action": "on_init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:11:32.859Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_rating.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_rating.json new file mode 100644 index 0000000..7f6dabe --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_rating.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "on_rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "2a17e268-1dc4-4d1a-98a2-17554a50c7d2", + "timestamp": "2023-03-23T05:41:15Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "feedback_ack": true, + "rating_ack": true + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_search.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_search.json new file mode 100644 index 0000000..b921b15 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_search.json @@ -0,0 +1,221 @@ +{ + "context": { + "action": "on_search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "21e54d3c-9c3b-47c1-aa3b-b0e7b20818ee", + "timestamp": "2023-12-09T13:41:16.161Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "catalog": { + "descriptor": { + "name": "Mobility Servies BPP" + }, + "providers": [ + { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + }, + { + "id": "F2", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "CAB", + "variant": "SEDAN" + } + } + ], + "id": "P1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + } + }, + { + "descriptor": { + "code": "RIDE", + "name": "CAB Economy Ride" + }, + "fulfillment_ids": [ + "F2" + ], + "id": "I2", + "location_ids": [ + "L2", + "L4" + ], + "price": { + "currency": "INR", + "maximum_value": "236", + "minimum_value": "206", + "value": "206" + } + } + ], + "locations": [ + { + "gps": "12.916468,77.608998", + "id": "L1" + }, + { + "gps": "12.916714,77.609298", + "id": "L2" + }, + { + "gps": "12.916573,77.615216", + "id": "L3" + }, + { + "gps": "12.906857,77.604456", + "id": "L4" + } + ], + "payments": [ + { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ] + } + ] + } + ] + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_select.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_select.json new file mode 100644 index 0000000..1dbac52 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_select.json @@ -0,0 +1,209 @@ +{ + "context": { + "action": "on_select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T13:49:26.132Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "P200s" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_status.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_status.json new file mode 100644 index 0000000..59da10d --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_status.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "5ee2001f-e612-431d-9e07-49574af60e88", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_support.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_support.json new file mode 100644 index 0000000..b0d398c --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_support.json @@ -0,0 +1,30 @@ +{ + "context": { + "action": "on_support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "support": { + "email": "support@nammayatri.in", + "phone": "+918068870525", + "url": "https://support.nammayatri.com/gethelp" + } + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_track.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_track.json new file mode 100644 index 0000000..066efb4 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_track.json @@ -0,0 +1,33 @@ +{ + "context": { + "action": "on_track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "tracking": { + "status": "active", + "location": { + "gps": "28.620976, 77.046732", + "updated_at": "2023-03-23T05:41:09Z" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_update.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_update.json new file mode 100644 index 0000000..b54c8bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/on_update.json @@ -0,0 +1,379 @@ +{ + "context": { + "action": "on_update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/rating.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/rating.json new file mode 100644 index 0000000..300a828 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/rating.json @@ -0,0 +1,28 @@ +{ + "context": { + "action": "rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "b462a835-97d6-4479-bec8-9660a0f8513e", + "timestamp": "2023-03-23T04:46:45Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "id": "b0462745-f6c9-4100-bbe7-4fa3648b6b40", + "rating_category": "DRIVER", + "value": 4 + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/search.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/search.json new file mode 100644 index 0000000..ae3a356 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/search.json @@ -0,0 +1,81 @@ +{ + "context": { + "action": "search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "40963dc1-e402-4f4d-ae70-7c5864ca682c", + "timestamp": "2023-12-09T13:39:56.645Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "intent": { + "fulfillment": { + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ] + }, + "payment": { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + } + ] + } + ] + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/select.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/select.json new file mode 100644 index 0000000..1ac2e28 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/select.json @@ -0,0 +1,36 @@ +{ + "context": { + "action": "select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "432fdfd6-0457-47b6-9fac-80cbe5c0a75b", + "timestamp": "2023-12-09T13:49:01.460Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "P120S", + "version": "2.0.1" + }, + "message": { + "order": { + "items": [ + { + "id": "I1" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/status.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/status.json new file mode 100644 index 0000000..911166d --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/status.json @@ -0,0 +1,25 @@ +{ + "context": { + "action": "status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/support.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/support.json new file mode 100644 index 0000000..5d2e454 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/support.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "7751bd26-3fdc-47ca-9b64-e998dc5abe68" + } +} diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/track.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/track.json new file mode 100644 index 0000000..520ba45 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/track.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/update.json b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/update.json new file mode 100644 index 0000000..826c3d3 --- /dev/null +++ b/pkg/plugin/testData/payloads/Assign_Driver_post_OnConfirm/update.json @@ -0,0 +1,38 @@ +{ + "context": { + "action": "update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-03-23T04:41:16Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "update_target": "order", + "order": { + "billing": { + "email": "jane.doe@example.com", + "name": "Jane Doe", + "phone": "+91-9897867564" + }, + "id": "O1", + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/cancel.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/cancel.json new file mode 100644 index 0000000..90371f5 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/cancel.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", + "timestamp": "2023-03-23T05:15:08Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "cancellation_reason_id": "7", + "descriptor": { + "code": "CONFIRM_CANCEL", + "name": "Ride Cancellation" + }, + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/confirm.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/confirm.json new file mode 100644 index 0000000..71c2c82 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/confirm.json @@ -0,0 +1,156 @@ +{ + "context": { + "action": "confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "9a7be37d-f228-432b-9aa9-65144d48da38", + "timestamp": "2023-12-10T04:34:49.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "transaction_id": "f08966dc-4c7d-4152-9a15-1046798cc39c", + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "144.54" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/init.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/init.json new file mode 100644 index 0000000..c8577b6 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/init.json @@ -0,0 +1,143 @@ +{ + "context": { + "action": "init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BAP", + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT1D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "144.54" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_cancel.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_cancel.json new file mode 100644 index 0000000..47a63eb --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_cancel.json @@ -0,0 +1,403 @@ +{ + "context": { + "action": "on_cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53.253Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "version": "2.0.1", + "ttl": "PT30S" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_CANCELLED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "time": { + "duration": "PT2H" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "AUTO_RICKSHAW", + "energy_type": "CNG", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "CAB Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "156", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BAP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "Delivery" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "2.5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://www.icicibank.com/personal-banking/loans/personal-loan" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "85" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "10" + }, + "title": "CANCELLATION_CHARGES" + }, + { + "price": { + "currency": "INR", + "value": "-146" + }, + "title": "REFUND" + } + ], + "price": { + "currency": "INR", + "value": "10" + }, + "ttl": "P200S" + }, + "status": "CANCELLED", + "cancellation": { + "cancelled_by": "CONSUMER", + "reason": { + "descriptor": { + "code": "001" + } + } + }, + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-03-23T04:48:53.253Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_confirm.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_confirm.json new file mode 100644 index 0000000..44bf1a7 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_confirm.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "9a7be37d-f228-432b-9aa9-65144d48da38", + "timestamp": "2023-12-10T04:34:52.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic", + "transaction_id": "f08966dc-4c7d-4152-9a15-1046798cc39c", + "amount": "146" + }, + "status": "PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "144.54" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T04:34:52.031Z", + "updated_at": "2023-12-10T04:34:52.031Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_init.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_init.json new file mode 100644 index 0000000..ea94991 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_init.json @@ -0,0 +1,357 @@ +{ + "context": { + "action": "on_init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:11:32.859Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BAP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "144.54" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_rating.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_rating.json new file mode 100644 index 0000000..7f6dabe --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_rating.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "on_rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "2a17e268-1dc4-4d1a-98a2-17554a50c7d2", + "timestamp": "2023-03-23T05:41:15Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "feedback_ack": true, + "rating_ack": true + } +} diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_search.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_search.json new file mode 100644 index 0000000..b921b15 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_search.json @@ -0,0 +1,221 @@ +{ + "context": { + "action": "on_search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "21e54d3c-9c3b-47c1-aa3b-b0e7b20818ee", + "timestamp": "2023-12-09T13:41:16.161Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "catalog": { + "descriptor": { + "name": "Mobility Servies BPP" + }, + "providers": [ + { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + }, + { + "id": "F2", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "CAB", + "variant": "SEDAN" + } + } + ], + "id": "P1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + } + }, + { + "descriptor": { + "code": "RIDE", + "name": "CAB Economy Ride" + }, + "fulfillment_ids": [ + "F2" + ], + "id": "I2", + "location_ids": [ + "L2", + "L4" + ], + "price": { + "currency": "INR", + "maximum_value": "236", + "minimum_value": "206", + "value": "206" + } + } + ], + "locations": [ + { + "gps": "12.916468,77.608998", + "id": "L1" + }, + { + "gps": "12.916714,77.609298", + "id": "L2" + }, + { + "gps": "12.916573,77.615216", + "id": "L3" + }, + { + "gps": "12.906857,77.604456", + "id": "L4" + } + ], + "payments": [ + { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ] + } + ] + } + ] + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_select.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_select.json new file mode 100644 index 0000000..1dbac52 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_select.json @@ -0,0 +1,209 @@ +{ + "context": { + "action": "on_select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T13:49:26.132Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "P200s" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_status.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_status.json new file mode 100644 index 0000000..2aa161f --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_status.json @@ -0,0 +1,350 @@ +{ + "context": { + "action": "on_status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "d883e7f9-f6bc-4ddf-b64c-a2bc44e63ae2", + "timestamp": "2023-03-23T04:48:59Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic", + "transaction_id": "f08966dc-4c7d-4152-9a15-1046798cc39c", + "amount": "146" + }, + "status": "PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "144.54" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + } + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_support.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_support.json new file mode 100644 index 0000000..b0d398c --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_support.json @@ -0,0 +1,30 @@ +{ + "context": { + "action": "on_support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "support": { + "email": "support@nammayatri.in", + "phone": "+918068870525", + "url": "https://support.nammayatri.com/gethelp" + } + } +} diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_track.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_track.json new file mode 100644 index 0000000..066efb4 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_track.json @@ -0,0 +1,33 @@ +{ + "context": { + "action": "on_track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "tracking": { + "status": "active", + "location": { + "gps": "28.620976, 77.046732", + "updated_at": "2023-03-23T05:41:09Z" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_update.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_update.json new file mode 100644 index 0000000..f1d22da --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/on_update.json @@ -0,0 +1,362 @@ +{ + "context": { + "action": "on_update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-11T03:54:28.832Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENDED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "CLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "AUTO_RICKSHAW", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-11T03:54:28.832Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/rating.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/rating.json new file mode 100644 index 0000000..300a828 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/rating.json @@ -0,0 +1,28 @@ +{ + "context": { + "action": "rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "b462a835-97d6-4479-bec8-9660a0f8513e", + "timestamp": "2023-03-23T04:46:45Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "id": "b0462745-f6c9-4100-bbe7-4fa3648b6b40", + "rating_category": "DRIVER", + "value": 4 + } +} diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/search.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/search.json new file mode 100644 index 0000000..ae3a356 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/search.json @@ -0,0 +1,81 @@ +{ + "context": { + "action": "search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "40963dc1-e402-4f4d-ae70-7c5864ca682c", + "timestamp": "2023-12-09T13:39:56.645Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "intent": { + "fulfillment": { + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ] + }, + "payment": { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + } + ] + } + ] + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/select.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/select.json new file mode 100644 index 0000000..1ac2e28 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/select.json @@ -0,0 +1,36 @@ +{ + "context": { + "action": "select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "432fdfd6-0457-47b6-9fac-80cbe5c0a75b", + "timestamp": "2023-12-09T13:49:01.460Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "P120S", + "version": "2.0.1" + }, + "message": { + "order": { + "items": [ + { + "id": "I1" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/status.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/status.json new file mode 100644 index 0000000..5e64f83 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/status.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "d883e7f9-f6bc-4ddf-b64c-a2bc44e63ae2", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "870782be-6757-43f1-945c-8eeaf9536259" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/support.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/support.json new file mode 100644 index 0000000..5d2e454 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/support.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "7751bd26-3fdc-47ca-9b64-e998dc5abe68" + } +} diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/track.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/track.json new file mode 100644 index 0000000..520ba45 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/track.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/update.json b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/update.json new file mode 100644 index 0000000..826c3d3 --- /dev/null +++ b/pkg/plugin/testData/payloads/Bpp_Collecting_Payement/update.json @@ -0,0 +1,38 @@ +{ + "context": { + "action": "update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-03-23T04:41:16Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "update_target": "order", + "order": { + "billing": { + "email": "jane.doe@example.com", + "name": "Jane Doe", + "phone": "+91-9897867564" + }, + "id": "O1", + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/cancel.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/cancel.json new file mode 100644 index 0000000..27820bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/cancel.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", + "timestamp": "2023-03-23T05:15:08Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "cancellation_reason_id": "7", + "descriptor": { + "code": "SOFT_CANCEL", + "name": "Ride Cancellation" + }, + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/confirm.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/confirm.json new file mode 100644 index 0000000..c198095 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/confirm.json @@ -0,0 +1,155 @@ +{ + "context": { + "action": "confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-12-10T04:34:48.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/init.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/init.json new file mode 100644 index 0000000..2b93c6a --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/init.json @@ -0,0 +1,148 @@ +{ + "context": { + "action": "init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:09:31.307Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_init.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_init.json new file mode 100644 index 0000000..d591334 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_init.json @@ -0,0 +1,357 @@ +{ + "context": { + "action": "on_init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:11:32.859Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_rating.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_rating.json new file mode 100644 index 0000000..7f6dabe --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_rating.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "on_rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "2a17e268-1dc4-4d1a-98a2-17554a50c7d2", + "timestamp": "2023-03-23T05:41:15Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "feedback_ack": true, + "rating_ack": true + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_search.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_search.json new file mode 100644 index 0000000..b921b15 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_search.json @@ -0,0 +1,221 @@ +{ + "context": { + "action": "on_search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "21e54d3c-9c3b-47c1-aa3b-b0e7b20818ee", + "timestamp": "2023-12-09T13:41:16.161Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "catalog": { + "descriptor": { + "name": "Mobility Servies BPP" + }, + "providers": [ + { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + }, + { + "id": "F2", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "CAB", + "variant": "SEDAN" + } + } + ], + "id": "P1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + } + }, + { + "descriptor": { + "code": "RIDE", + "name": "CAB Economy Ride" + }, + "fulfillment_ids": [ + "F2" + ], + "id": "I2", + "location_ids": [ + "L2", + "L4" + ], + "price": { + "currency": "INR", + "maximum_value": "236", + "minimum_value": "206", + "value": "206" + } + } + ], + "locations": [ + { + "gps": "12.916468,77.608998", + "id": "L1" + }, + { + "gps": "12.916714,77.609298", + "id": "L2" + }, + { + "gps": "12.916573,77.615216", + "id": "L3" + }, + { + "gps": "12.906857,77.604456", + "id": "L4" + } + ], + "payments": [ + { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ] + } + ] + } + ] + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_select.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_select.json new file mode 100644 index 0000000..1dbac52 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_select.json @@ -0,0 +1,209 @@ +{ + "context": { + "action": "on_select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T13:49:26.132Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "P200s" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_status.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_status.json new file mode 100644 index 0000000..59da10d --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_status.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "5ee2001f-e612-431d-9e07-49574af60e88", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_support.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_support.json new file mode 100644 index 0000000..b0d398c --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_support.json @@ -0,0 +1,30 @@ +{ + "context": { + "action": "on_support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "support": { + "email": "support@nammayatri.in", + "phone": "+918068870525", + "url": "https://support.nammayatri.com/gethelp" + } + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_track.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_track.json new file mode 100644 index 0000000..066efb4 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_track.json @@ -0,0 +1,33 @@ +{ + "context": { + "action": "on_track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "tracking": { + "status": "active", + "location": { + "gps": "28.620976, 77.046732", + "updated_at": "2023-03-23T05:41:09Z" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_update.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_update.json new file mode 100644 index 0000000..b54c8bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/on_update.json @@ -0,0 +1,379 @@ +{ + "context": { + "action": "on_update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/rating.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/rating.json new file mode 100644 index 0000000..300a828 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/rating.json @@ -0,0 +1,28 @@ +{ + "context": { + "action": "rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "b462a835-97d6-4479-bec8-9660a0f8513e", + "timestamp": "2023-03-23T04:46:45Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "id": "b0462745-f6c9-4100-bbe7-4fa3648b6b40", + "rating_category": "DRIVER", + "value": 4 + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/search.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/search.json new file mode 100644 index 0000000..ae3a356 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/search.json @@ -0,0 +1,81 @@ +{ + "context": { + "action": "search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "40963dc1-e402-4f4d-ae70-7c5864ca682c", + "timestamp": "2023-12-09T13:39:56.645Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "intent": { + "fulfillment": { + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ] + }, + "payment": { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + } + ] + } + ] + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/select.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/select.json new file mode 100644 index 0000000..1ac2e28 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/select.json @@ -0,0 +1,36 @@ +{ + "context": { + "action": "select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "432fdfd6-0457-47b6-9fac-80cbe5c0a75b", + "timestamp": "2023-12-09T13:49:01.460Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "P120S", + "version": "2.0.1" + }, + "message": { + "order": { + "items": [ + { + "id": "I1" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/status.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/status.json new file mode 100644 index 0000000..911166d --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/status.json @@ -0,0 +1,25 @@ +{ + "context": { + "action": "status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/support.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/support.json new file mode 100644 index 0000000..5d2e454 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/support.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "7751bd26-3fdc-47ca-9b64-e998dc5abe68" + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/track.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/track.json new file mode 100644 index 0000000..520ba45 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/track.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/update.json b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/update.json new file mode 100644 index 0000000..826c3d3 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_On_on_confirm/update.json @@ -0,0 +1,38 @@ +{ + "context": { + "action": "update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-03-23T04:41:16Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "update_target": "order", + "order": { + "billing": { + "email": "jane.doe@example.com", + "name": "Jane Doe", + "phone": "+91-9897867564" + }, + "id": "O1", + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/cancel.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/cancel.json new file mode 100644 index 0000000..27820bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/cancel.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", + "timestamp": "2023-03-23T05:15:08Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "cancellation_reason_id": "7", + "descriptor": { + "code": "SOFT_CANCEL", + "name": "Ride Cancellation" + }, + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/confirm.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/confirm.json new file mode 100644 index 0000000..c198095 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/confirm.json @@ -0,0 +1,155 @@ +{ + "context": { + "action": "confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-12-10T04:34:48.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/init.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/init.json new file mode 100644 index 0000000..2b93c6a --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/init.json @@ -0,0 +1,148 @@ +{ + "context": { + "action": "init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:09:31.307Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_cancel.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_cancel.json new file mode 100644 index 0000000..a43d8fe --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_cancel.json @@ -0,0 +1,374 @@ +{ + "context": { + "action": "on_cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_CANCELLED" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "CANCELLED", + "cancellation": { + "cancelled_by": "PROVIDER", + "reason": { + "descriptor": { + "code": "011" + } + } + }, + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:48:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_confirm.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_confirm.json new file mode 100644 index 0000000..4c3de86 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_confirm.json @@ -0,0 +1,366 @@ +{ + "context": { + "action": "on_confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_CONFIRMED" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:48:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_init.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_init.json new file mode 100644 index 0000000..d591334 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_init.json @@ -0,0 +1,357 @@ +{ + "context": { + "action": "on_init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:11:32.859Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_rating.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_rating.json new file mode 100644 index 0000000..7f6dabe --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_rating.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "on_rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "2a17e268-1dc4-4d1a-98a2-17554a50c7d2", + "timestamp": "2023-03-23T05:41:15Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "feedback_ack": true, + "rating_ack": true + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_search.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_search.json new file mode 100644 index 0000000..b921b15 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_search.json @@ -0,0 +1,221 @@ +{ + "context": { + "action": "on_search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "21e54d3c-9c3b-47c1-aa3b-b0e7b20818ee", + "timestamp": "2023-12-09T13:41:16.161Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "catalog": { + "descriptor": { + "name": "Mobility Servies BPP" + }, + "providers": [ + { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + }, + { + "id": "F2", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "CAB", + "variant": "SEDAN" + } + } + ], + "id": "P1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + } + }, + { + "descriptor": { + "code": "RIDE", + "name": "CAB Economy Ride" + }, + "fulfillment_ids": [ + "F2" + ], + "id": "I2", + "location_ids": [ + "L2", + "L4" + ], + "price": { + "currency": "INR", + "maximum_value": "236", + "minimum_value": "206", + "value": "206" + } + } + ], + "locations": [ + { + "gps": "12.916468,77.608998", + "id": "L1" + }, + { + "gps": "12.916714,77.609298", + "id": "L2" + }, + { + "gps": "12.916573,77.615216", + "id": "L3" + }, + { + "gps": "12.906857,77.604456", + "id": "L4" + } + ], + "payments": [ + { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ] + } + ] + } + ] + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_select.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_select.json new file mode 100644 index 0000000..1dbac52 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_select.json @@ -0,0 +1,209 @@ +{ + "context": { + "action": "on_select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T13:49:26.132Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "P200s" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_status.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_status.json new file mode 100644 index 0000000..59da10d --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_status.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "5ee2001f-e612-431d-9e07-49574af60e88", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_support.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_support.json new file mode 100644 index 0000000..b0d398c --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_support.json @@ -0,0 +1,30 @@ +{ + "context": { + "action": "on_support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "support": { + "email": "support@nammayatri.in", + "phone": "+918068870525", + "url": "https://support.nammayatri.com/gethelp" + } + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_track.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_track.json new file mode 100644 index 0000000..066efb4 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_track.json @@ -0,0 +1,33 @@ +{ + "context": { + "action": "on_track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "tracking": { + "status": "active", + "location": { + "gps": "28.620976, 77.046732", + "updated_at": "2023-03-23T05:41:09Z" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_update.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_update.json new file mode 100644 index 0000000..b54c8bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/on_update.json @@ -0,0 +1,379 @@ +{ + "context": { + "action": "on_update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/rating.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/rating.json new file mode 100644 index 0000000..300a828 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/rating.json @@ -0,0 +1,28 @@ +{ + "context": { + "action": "rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "b462a835-97d6-4479-bec8-9660a0f8513e", + "timestamp": "2023-03-23T04:46:45Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "id": "b0462745-f6c9-4100-bbe7-4fa3648b6b40", + "rating_category": "DRIVER", + "value": 4 + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/search.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/search.json new file mode 100644 index 0000000..ae3a356 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/search.json @@ -0,0 +1,81 @@ +{ + "context": { + "action": "search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "40963dc1-e402-4f4d-ae70-7c5864ca682c", + "timestamp": "2023-12-09T13:39:56.645Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "intent": { + "fulfillment": { + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ] + }, + "payment": { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + } + ] + } + ] + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/select.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/select.json new file mode 100644 index 0000000..1ac2e28 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/select.json @@ -0,0 +1,36 @@ +{ + "context": { + "action": "select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "432fdfd6-0457-47b6-9fac-80cbe5c0a75b", + "timestamp": "2023-12-09T13:49:01.460Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "P120S", + "version": "2.0.1" + }, + "message": { + "order": { + "items": [ + { + "id": "I1" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/status.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/status.json new file mode 100644 index 0000000..911166d --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/status.json @@ -0,0 +1,25 @@ +{ + "context": { + "action": "status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/support.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/support.json new file mode 100644 index 0000000..5d2e454 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/support.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "7751bd26-3fdc-47ca-9b64-e998dc5abe68" + } +} diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/track.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/track.json new file mode 100644 index 0000000..520ba45 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/track.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/update.json b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/update.json new file mode 100644 index 0000000..826c3d3 --- /dev/null +++ b/pkg/plugin/testData/payloads/Driver_not_found_post_on_confirm/update.json @@ -0,0 +1,38 @@ +{ + "context": { + "action": "update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-03-23T04:41:16Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "update_target": "order", + "order": { + "billing": { + "email": "jane.doe@example.com", + "name": "Jane Doe", + "phone": "+91-9897867564" + }, + "id": "O1", + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/cancel.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/cancel.json new file mode 100644 index 0000000..27820bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/cancel.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", + "timestamp": "2023-03-23T05:15:08Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "cancellation_reason_id": "7", + "descriptor": { + "code": "SOFT_CANCEL", + "name": "Ride Cancellation" + }, + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/confirm.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/confirm.json new file mode 100644 index 0000000..c198095 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/confirm.json @@ -0,0 +1,155 @@ +{ + "context": { + "action": "confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-12-10T04:34:48.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/init.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/init.json new file mode 100644 index 0000000..2b93c6a --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/init.json @@ -0,0 +1,148 @@ +{ + "context": { + "action": "init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:09:31.307Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_cancel.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_cancel.json new file mode 100644 index 0000000..f52f9c8 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_cancel.json @@ -0,0 +1,390 @@ +{ + "context": { + "action": "on_cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "version": "2.0.1", + "ttl": "PT30S" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_CANCELLED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "time": { + "duration": "PT2H" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "CAB Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "156", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BAP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "Delivery" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "2.5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://www.icicibank.com/personal-banking/loans/personal-loan" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "85" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "10" + }, + "title": "CANCELLATION_CHARGES" + }, + { + "price": { + "currency": "INR", + "value": "-146" + }, + "title": "REFUND" + } + ], + "price": { + "currency": "INR", + "value": "10" + }, + "ttl": "P200S" + }, + "status": "CANCELLED" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_confirm.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_confirm.json new file mode 100644 index 0000000..de4017a --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_confirm.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-10T08:03:34.294Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-10T08:03:34.294Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_init.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_init.json new file mode 100644 index 0000000..d591334 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_init.json @@ -0,0 +1,357 @@ +{ + "context": { + "action": "on_init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:11:32.859Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_rating.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_rating.json new file mode 100644 index 0000000..7f6dabe --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_rating.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "on_rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "2a17e268-1dc4-4d1a-98a2-17554a50c7d2", + "timestamp": "2023-03-23T05:41:15Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "feedback_ack": true, + "rating_ack": true + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_search.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_search.json new file mode 100644 index 0000000..b921b15 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_search.json @@ -0,0 +1,221 @@ +{ + "context": { + "action": "on_search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "21e54d3c-9c3b-47c1-aa3b-b0e7b20818ee", + "timestamp": "2023-12-09T13:41:16.161Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "catalog": { + "descriptor": { + "name": "Mobility Servies BPP" + }, + "providers": [ + { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + }, + { + "id": "F2", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "CAB", + "variant": "SEDAN" + } + } + ], + "id": "P1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + } + }, + { + "descriptor": { + "code": "RIDE", + "name": "CAB Economy Ride" + }, + "fulfillment_ids": [ + "F2" + ], + "id": "I2", + "location_ids": [ + "L2", + "L4" + ], + "price": { + "currency": "INR", + "maximum_value": "236", + "minimum_value": "206", + "value": "206" + } + } + ], + "locations": [ + { + "gps": "12.916468,77.608998", + "id": "L1" + }, + { + "gps": "12.916714,77.609298", + "id": "L2" + }, + { + "gps": "12.916573,77.615216", + "id": "L3" + }, + { + "gps": "12.906857,77.604456", + "id": "L4" + } + ], + "payments": [ + { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ] + } + ] + } + ] + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_select.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_select.json new file mode 100644 index 0000000..1dbac52 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_select.json @@ -0,0 +1,209 @@ +{ + "context": { + "action": "on_select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T13:49:26.132Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "P200s" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_status.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_status.json new file mode 100644 index 0000000..59da10d --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_status.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "5ee2001f-e612-431d-9e07-49574af60e88", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_support.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_support.json new file mode 100644 index 0000000..b0d398c --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_support.json @@ -0,0 +1,30 @@ +{ + "context": { + "action": "on_support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "support": { + "email": "support@nammayatri.in", + "phone": "+918068870525", + "url": "https://support.nammayatri.com/gethelp" + } + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_track.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_track.json new file mode 100644 index 0000000..d546596 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_track.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "on_track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "tracking": { + "status": "active", + "location": { + "gps": "28.620976, 77.046732", + "updated_at": "2023-03-23T05:41:09Z" + } + } + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_update.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_update.json new file mode 100644 index 0000000..01e3bc8 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/on_update.json @@ -0,0 +1,361 @@ +{ + "context": { + "action": "on_update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-11T03:54:28.832Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENDED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "CLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-11T03:54:28.832Z" + } + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/rating.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/rating.json new file mode 100644 index 0000000..300a828 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/rating.json @@ -0,0 +1,28 @@ +{ + "context": { + "action": "rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "b462a835-97d6-4479-bec8-9660a0f8513e", + "timestamp": "2023-03-23T04:46:45Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "id": "b0462745-f6c9-4100-bbe7-4fa3648b6b40", + "rating_category": "DRIVER", + "value": 4 + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/search.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/search.json new file mode 100644 index 0000000..ae3a356 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/search.json @@ -0,0 +1,81 @@ +{ + "context": { + "action": "search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "40963dc1-e402-4f4d-ae70-7c5864ca682c", + "timestamp": "2023-12-09T13:39:56.645Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "intent": { + "fulfillment": { + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ] + }, + "payment": { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + } + ] + } + ] + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/select.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/select.json new file mode 100644 index 0000000..1ac2e28 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/select.json @@ -0,0 +1,36 @@ +{ + "context": { + "action": "select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "432fdfd6-0457-47b6-9fac-80cbe5c0a75b", + "timestamp": "2023-12-09T13:49:01.460Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "P120S", + "version": "2.0.1" + }, + "message": { + "order": { + "items": [ + { + "id": "I1" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/status.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/status.json new file mode 100644 index 0000000..e1bfeae --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/status.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/support.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/support.json new file mode 100644 index 0000000..5d2e454 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/support.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "7751bd26-3fdc-47ca-9b64-e998dc5abe68" + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/track.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/track.json new file mode 100644 index 0000000..520ba45 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/track.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/update.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/update.json new file mode 100644 index 0000000..826c3d3 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_driver/update.json @@ -0,0 +1,38 @@ +{ + "context": { + "action": "update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-03-23T04:41:16Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "update_target": "order", + "order": { + "billing": { + "email": "jane.doe@example.com", + "name": "Jane Doe", + "phone": "+91-9897867564" + }, + "id": "O1", + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/cancel.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/cancel.json new file mode 100644 index 0000000..27820bc --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/cancel.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", + "timestamp": "2023-03-23T05:15:08Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "cancellation_reason_id": "7", + "descriptor": { + "code": "SOFT_CANCEL", + "name": "Ride Cancellation" + }, + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/confirm.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/confirm.json new file mode 100644 index 0000000..c198095 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/confirm.json @@ -0,0 +1,155 @@ +{ + "context": { + "action": "confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-12-10T04:34:48.031Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/init.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/init.json new file mode 100644 index 0000000..2b93c6a --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/init.json @@ -0,0 +1,148 @@ +{ + "context": { + "action": "init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:09:31.307Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "billing": { + "name": "Joe Adams" + }, + "fulfillments": [ + { + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "id": "I1" + } + ], + "payments": [ + { + "collected_by": "BPP", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_cancel.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_cancel.json new file mode 100644 index 0000000..f52f9c8 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_cancel.json @@ -0,0 +1,390 @@ +{ + "context": { + "action": "on_cancel", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "version": "2.0.1", + "ttl": "PT30S" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_CANCELLED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "time": { + "duration": "PT2H" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "CAB Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "156", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BAP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "Delivery" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "2.5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://www.icicibank.com/personal-banking/loans/personal-loan" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "85" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "10" + }, + "title": "CANCELLATION_CHARGES" + }, + { + "price": { + "currency": "INR", + "value": "-146" + }, + "title": "REFUND" + } + ], + "price": { + "currency": "INR", + "value": "10" + }, + "ttl": "P200S" + }, + "status": "CANCELLED" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_confirm.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_confirm.json new file mode 100644 index 0000000..de4017a --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_confirm.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_confirm", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-10T08:03:34.294Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-10T08:03:34.294Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_init.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_init.json new file mode 100644 index 0000000..d591334 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_init.json @@ -0,0 +1,357 @@ +{ + "context": { + "action": "on_init", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T14:11:32.859Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "id": "F1", + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_rating.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_rating.json new file mode 100644 index 0000000..7f6dabe --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_rating.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "on_rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "2a17e268-1dc4-4d1a-98a2-17554a50c7d2", + "timestamp": "2023-03-23T05:41:15Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "feedback_ack": true, + "rating_ack": true + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_search.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_search.json new file mode 100644 index 0000000..b921b15 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_search.json @@ -0,0 +1,221 @@ +{ + "context": { + "action": "on_search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "21e54d3c-9c3b-47c1-aa3b-b0e7b20818ee", + "timestamp": "2023-12-09T13:41:16.161Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "catalog": { + "descriptor": { + "name": "Mobility Servies BPP" + }, + "providers": [ + { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + }, + { + "id": "F2", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "CAB", + "variant": "SEDAN" + } + } + ], + "id": "P1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + } + }, + { + "descriptor": { + "code": "RIDE", + "name": "CAB Economy Ride" + }, + "fulfillment_ids": [ + "F2" + ], + "id": "I2", + "location_ids": [ + "L2", + "L4" + ], + "price": { + "currency": "INR", + "maximum_value": "236", + "minimum_value": "206", + "value": "206" + } + } + ], + "locations": [ + { + "gps": "12.916468,77.608998", + "id": "L1" + }, + { + "gps": "12.916714,77.609298", + "id": "L2" + }, + { + "gps": "12.916573,77.615216", + "id": "L3" + }, + { + "gps": "12.906857,77.604456", + "id": "L4" + } + ], + "payments": [ + { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT60M" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + } + ] + } + ] + } + ] + } + ] + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_select.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_select.json new file mode 100644 index 0000000..1dbac52 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_select.json @@ -0,0 +1,209 @@ +{ + "context": { + "action": "on_select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-09T13:49:26.132Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "fulfillments": [ + { + "id": "F1", + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV" + } + } + ], + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "P200s" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_status.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_status.json new file mode 100644 index 0000000..59da10d --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_status.json @@ -0,0 +1,383 @@ +{ + "context": { + "action": "on_status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "5ee2001f-e612-431d-9e07-49574af60e88", + "timestamp": "2023-03-23T04:49:34.53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "UNCLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + }, + { + "descriptor": { + "code": "INFO", + "name": "General Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "DISTANCE_TO_NEAREST_DRIVER_METER" + }, + "value": "661" + }, + { + "descriptor": { + "code": "ETA_TO_NEAREST_DRIVER_MIN" + }, + "value": "3" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-03-23T04:48:34.53Z", + "updated_at": "2023-03-23T04:49:34.53Z" + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_support.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_support.json new file mode 100644 index 0000000..b0d398c --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_support.json @@ -0,0 +1,30 @@ +{ + "context": { + "action": "on_support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "support": { + "email": "support@nammayatri.in", + "phone": "+918068870525", + "url": "https://support.nammayatri.com/gethelp" + } + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_track.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_track.json new file mode 100644 index 0000000..d546596 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_track.json @@ -0,0 +1,32 @@ +{ + "context": { + "action": "on_track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "ec3dea8c-c64c-4f06-b2a0-ec1f9584d7ba", + "timestamp": "2023-03-23T05:41:09Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "tracking": { + "status": "active", + "location": { + "gps": "28.620976, 77.046732", + "updated_at": "2023-03-23T05:41:09Z" + } + } + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_update.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_update.json new file mode 100644 index 0000000..01e3bc8 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/on_update.json @@ -0,0 +1,361 @@ +{ + "context": { + "action": "on_update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-12-11T03:54:28.832Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order": { + "cancellation_terms": [ + { + "cancellation_fee": { + "percentage": "0" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ASSIGNED" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "30" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ENROUTE_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "amount": { + "currency": "INR", + "value": "50" + } + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_ARRIVED_PICKUP" + } + }, + "reason_required": true + }, + { + "cancellation_fee": { + "percentage": "100" + }, + "fulfillment_state": { + "descriptor": { + "code": "RIDE_STARTED" + } + }, + "reason_required": true + } + ], + "fulfillments": [ + { + "agent": { + "contact": { + "phone": "9856798567" + }, + "person": { + "name": "Jason Roy" + } + }, + "customer": { + "contact": { + "phone": "9876556789" + }, + "person": { + "name": "Joe Adams" + } + }, + "id": "F1", + "state": { + "descriptor": { + "code": "RIDE_ENDED" + } + }, + "stops": [ + { + "authorization": { + "token": "234234", + "type": "OTP", + "valid_to": "2023-12-10T08:05:34.294Z", + "status": "CLAIMED" + }, + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START", + "instructions": { + "short_desc": "short description of the location", + "long_desc": "long description of the location" + } + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ], + "tags": [ + { + "descriptor": { + "code": "ROUTE_INFO", + "name": "Route Information" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "ENCODED_POLYLINE", + "name": "Path" + }, + "value": "_p~iF~ps|U_ulLnnqC_mqNvxq`@" + }, + { + "descriptor": { + "code": "WAYPOINTS", + "name": "Waypoints" + }, + "value": "[{\"gps\":\"12.909982, 77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982,77.611822\"},{\"gps\":\"12.909982, 77.611822\"}]" + } + ] + } + ], + "type": "DELIVERY", + "vehicle": { + "category": "AUTO_RICKSHAW", + "variant": "EV", + "make": "Bajaj", + "model": "Compact RE", + "registration": "KA-01-AD-9876" + } + } + ], + "id": "O1", + "items": [ + { + "descriptor": { + "code": "RIDE", + "name": "Auto Ride" + }, + "fulfillment_ids": [ + "F1" + ], + "id": "I1", + "location_ids": [ + "L1", + "L3" + ], + "payment_ids": [ + "PA1" + ], + "price": { + "currency": "INR", + "maximum_value": "176", + "minimum_value": "136", + "value": "146" + }, + "tags": [ + { + "descriptor": { + "code": "FARE_POLICY", + "name": "Daytime Charges" + }, + "display": true, + "list": [ + { + "descriptor": { + "code": "MIN_FARE" + }, + "value": "30" + }, + { + "descriptor": { + "code": "MIN_FARE_DISTANCE_KM" + }, + "value": "2" + }, + { + "descriptor": { + "code": "PER_KM_CHARGE" + }, + "value": "15" + }, + { + "descriptor": { + "code": "PICKUP_CHARGE" + }, + "value": "10" + }, + { + "descriptor": { + "code": "WAITING_CHARGE_PER_MIN" + }, + "value": "2" + }, + { + "descriptor": { + "code": "NIGHT_CHARGE_MULTIPLIER" + }, + "value": "1.5" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_START_TIME" + }, + "value": "22:00:00" + }, + { + "descriptor": { + "code": "NIGHT_SHIFT_END_TIME" + }, + "value": "05:00:00" + } + ] + } + ] + } + ], + "payments": [ + { + "collected_by": "BPP", + "id": "PA1", + "params": { + "bank_account_number": "xxxxxxxxxxxxxx", + "bank_code": "XXXXXXXX", + "virtual_payment_address": "9988199772@okicic" + }, + "status": "NOT-PAID", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "SETTLEMENT_TYPE" + }, + "value": "UPI" + }, + { + "descriptor": { + "code": "SETTLEMENT_WINDOW" + }, + "value": "PT2D" + }, + { + "descriptor": { + "code": "SETTLEMENT_BASIS" + }, + "value": "DELIVERY" + }, + { + "descriptor": { + "code": "MANDATORY_ARBITRATION" + }, + "value": "true" + }, + { + "descriptor": { + "code": "COURT_JURISDICTION" + }, + "value": "New Delhi" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bpp.com/static-terms.txt" + }, + { + "descriptor": { + "code": "SETTLEMENT_AMOUNT" + }, + "value": "1.46" + } + ] + } + ], + "type": "ON-FULFILLMENT" + } + ], + "provider": { + "id": "P1" + }, + "quote": { + "breakup": [ + { + "price": { + "currency": "INR", + "value": "30" + }, + "title": "BASE_FARE" + }, + { + "price": { + "currency": "INR", + "value": "116" + }, + "title": "DISTANCE_FARE" + } + ], + "price": { + "currency": "INR", + "value": "146" + }, + "ttl": "PT30S" + }, + "status": "ACTIVE", + "created_at": "2023-12-10T08:03:34.294Z", + "updated_at": "2023-12-11T03:54:28.832Z" + } + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/rating.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/rating.json new file mode 100644 index 0000000..300a828 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/rating.json @@ -0,0 +1,28 @@ +{ + "context": { + "action": "rating", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "b462a835-97d6-4479-bec8-9660a0f8513e", + "timestamp": "2023-03-23T04:46:45Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "id": "b0462745-f6c9-4100-bbe7-4fa3648b6b40", + "rating_category": "DRIVER", + "value": 4 + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/search.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/search.json new file mode 100644 index 0000000..ae3a356 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/search.json @@ -0,0 +1,81 @@ +{ + "context": { + "action": "search", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "40963dc1-e402-4f4d-ae70-7c5864ca682c", + "timestamp": "2023-12-09T13:39:56.645Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "intent": { + "fulfillment": { + "stops": [ + { + "location": { + "gps": "13.008935, 77.644408" + }, + "type": "START" + }, + { + "location": { + "gps": "12.971186, 77.586812" + }, + "type": "END" + } + ] + }, + "payment": { + "collected_by": "BPP", + "tags": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "BUYER_FINDER_FEES_PERCENTAGE" + }, + "value": "1" + } + ] + }, + { + "descriptor": { + "code": "SETTLEMENT_TERMS" + }, + "display": false, + "list": [ + { + "descriptor": { + "code": "DELAY_INTEREST" + }, + "value": "5" + }, + { + "descriptor": { + "code": "STATIC_TERMS" + }, + "value": "https://example-test-bap.com/static-terms.txt" + } + ] + } + ] + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/select.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/select.json new file mode 100644 index 0000000..1ac2e28 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/select.json @@ -0,0 +1,36 @@ +{ + "context": { + "action": "select", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "432fdfd6-0457-47b6-9fac-80cbe5c0a75b", + "timestamp": "2023-12-09T13:49:01.460Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "P120S", + "version": "2.0.1" + }, + "message": { + "order": { + "items": [ + { + "id": "I1" + } + ], + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/status.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/status.json new file mode 100644 index 0000000..e1bfeae --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/status.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "status", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/support.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/support.json new file mode 100644 index 0000000..5d2e454 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/support.json @@ -0,0 +1,26 @@ +{ + "context": { + "action": "support", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "ref_id": "7751bd26-3fdc-47ca-9b64-e998dc5abe68" + } +} diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/track.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/track.json new file mode 100644 index 0000000..520ba45 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/track.json @@ -0,0 +1,27 @@ +{ + "context": { + "action": "track", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/seller", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "8926b747-0362-4fcc-b795-0994a6287700", + "timestamp": "2023-03-23T04:48:53Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "order_id": "O1" + } + } + \ No newline at end of file diff --git a/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/update.json b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/update.json new file mode 100644 index 0000000..826c3d3 --- /dev/null +++ b/pkg/plugin/testData/payloads/Ride_Cancellation_by_rider/update.json @@ -0,0 +1,38 @@ +{ + "context": { + "action": "update", + "bap_id": "example-bap.com", + "bap_uri": "https://example-bap.com/prod/trv10", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://example-bpp.com/prod/trv10", + "domain": "ONDC:TRV10", + "location": { + "city": { + "code": "std:080" + }, + "country": { + "code": "IND" + } + }, + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-03-23T04:41:16Z", + "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", + "ttl": "PT30S", + "version": "2.0.1" + }, + "message": { + "update_target": "order", + "order": { + "billing": { + "email": "jane.doe@example.com", + "name": "Jane Doe", + "phone": "+91-9897867564" + }, + "id": "O1", + "provider": { + "id": "P1" + } + } + } + } + \ No newline at end of file diff --git a/pkg/response/response.go b/pkg/response/response.go new file mode 100644 index 0000000..be87f9f --- /dev/null +++ b/pkg/response/response.go @@ -0,0 +1,152 @@ +package response + +import ( + "context" + "encoding/json" + "fmt" + "strings" +) + +type ErrorType string + +const ( + SchemaValidationErrorType ErrorType = "SCHEMA_VALIDATION_ERROR" + InvalidRequestErrorType ErrorType = "INVALID_REQUEST" +) + +type BecknRequest struct { + Context map[string]interface{} `json:"context,omitempty"` +} +type Error struct { + Code string `json:"code,omitempty"` + Message string `json:"message,omitempty"` + Paths string `json:"paths,omitempty"` +} + +// SchemaValidationErr represents a collection of schema validation failures. +type SchemaValidationErr struct { + Errors []Error +} + +// Error implements the error interface for SchemaValidationErr. +func (e *SchemaValidationErr) Error() string { + var errorMessages []string + for _, err := range e.Errors { + errorMessages = append(errorMessages, fmt.Sprintf("%s: %s", err.Paths, err.Message)) + } + return strings.Join(errorMessages, "; ") +} + +type Message struct { + Ack struct { + Status string `json:"status,omitempty"` + } `json:"ack,omitempty"` + Error *Error `json:"error,omitempty"` +} +type BecknResponse struct { + Context map[string]interface{} `json:"context,omitempty"` + Message Message `json:"message,omitempty"` +} +type ClientFailureBecknResponse struct { + Context map[string]interface{} `json:"context,omitempty"` + Error *Error `json:"error,omitempty"` +} + +var errorMap = map[ErrorType]Error{ + SchemaValidationErrorType: { + Code: "400", + Message: "Schema validation failed", + }, + InvalidRequestErrorType: { + Code: "401", + Message: "Invalid request format", + }, +} +var DefaultError = Error{ + Code: "500", + Message: "Internal server error", +} + +func Nack(ctx context.Context, tp ErrorType, paths string, body []byte) ([]byte, error) { + var req BecknRequest + if err := json.Unmarshal(body, &req); err != nil { + return nil, fmt.Errorf("failed to parse request: %w", err) + } + errorObj, ok := errorMap[tp] + if paths != "" { + errorObj.Paths = paths + } + var response BecknResponse + if !ok { + response = BecknResponse{ + Context: req.Context, + Message: Message{ + Ack: struct { + Status string `json:"status,omitempty"` + }{ + Status: "NACK", + }, + Error: &DefaultError, + }, + } + } else { + response = BecknResponse{ + Context: req.Context, + Message: Message{ + Ack: struct { + Status string `json:"status,omitempty"` + }{ + Status: "NACK", + }, + Error: &errorObj, + }, + } + } + return json.Marshal(response) +} + +// Ack processes the incoming Beckn request, unmarshals the JSON body into a BecknRequest struct, +// and returns a JSON-encoded acknowledgment response with a status of "ACK". +// If the request body cannot be parsed, it returns an error. +func Ack(ctx context.Context, body []byte) ([]byte, error) { + var req BecknRequest + if err := json.Unmarshal(body, &req); err != nil { + return nil, fmt.Errorf("failed to parse request: %w", err) + } + response := BecknResponse{ + Context: req.Context, + Message: Message{ + Ack: struct { + Status string `json:"status,omitempty"` + }{ + Status: "ACK", + }, + }, + } + return json.Marshal(response) +} + +// HandleClientFailure processes a client failure scenario by unmarshaling the provided +// request body, determining the appropriate error response based on the given ErrorType, +// and returning the serialized response. If the ErrorType is not found in the error map, +// a default error is used. +func HandleClientFailure(ctx context.Context, tp ErrorType, body []byte) ([]byte, error) { + var req BecknRequest + if err := json.Unmarshal(body, &req); err != nil { + return nil, fmt.Errorf("failed to parse request: %w", err) + } + errorObj, ok := errorMap[tp] + var response ClientFailureBecknResponse + if !ok { + response = ClientFailureBecknResponse{ + Context: req.Context, + Error: &DefaultError, + } + } else { + response = ClientFailureBecknResponse{ + Context: req.Context, + Error: &errorObj, + } + } + return json.Marshal(response) +} diff --git a/shared/plugin/definition/validator.go b/shared/plugin/definition/validator.go deleted file mode 100644 index 21a1bf8..0000000 --- a/shared/plugin/definition/validator.go +++ /dev/null @@ -1,22 +0,0 @@ -package definition - -import ( - "context" - "net/url" -) - -// Error struct for validation errors -type Error struct { - Path string - Message string -} - -// Validator interface for schema validation -type Validator interface { - Validate(ctx context.Context, url *url.URL, payload []byte) (bool, Error) -} - -// ValidatorProvider interface for creating validators -type ValidatorProvider interface { - New(ctx context.Context, config map[string]string) (map[string]Validator, Error) -} diff --git a/shared/plugin/implementations/validator/cmd/plugin.go b/shared/plugin/implementations/validator/cmd/plugin.go deleted file mode 100644 index 13dab92..0000000 --- a/shared/plugin/implementations/validator/cmd/plugin.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "context" - - "beckn-onix/shared/plugin/definition" - "beckn-onix/shared/plugin/implementations/validator" -) - -// ValidatorProvider provides instances of Validator. -type ValidatorProvider struct{} - -// New initializes a new Verifier instance. -func (vp ValidatorProvider) New(ctx context.Context, config map[string]string) (map[string]definition.Validator, definition.Error) { - // Create a new Validator instance with the provided configuration - validators, err := validator.New(ctx, config) - if err != (definition.Error{}) { - return nil, definition.Error{Path: "", Message: err.Message} - } - - return validators, definition.Error{} -} - -// Provider is the exported symbol that the plugin manager will look for. -var Provider definition.ValidatorProvider = &ValidatorProvider{} diff --git a/shared/plugin/implementations/validator/cmd/plugin_test.go b/shared/plugin/implementations/validator/cmd/plugin_test.go deleted file mode 100644 index 525a761..0000000 --- a/shared/plugin/implementations/validator/cmd/plugin_test.go +++ /dev/null @@ -1,107 +0,0 @@ -package main - -import ( - "context" - "errors" - "fmt" - "io/ioutil" - "net/url" - "os" - "testing" - - "beckn-onix/shared/plugin/definition" -) - -// MockValidator is a mock implementation of the Validator interface for testing. -type MockValidator struct{} - -func (m *MockValidator) Validate(ctx context.Context, u *url.URL, data []byte) (bool, definition.Error) { - return true, definition.Error{} -} - -// Mock New function for testing -func MockNew(ctx context.Context, config map[string]string) (map[string]definition.Validator, error) { - // If the config has the error flag set to "true", return an error - if config["error"] == "true" { - return nil, errors.New("mock error") - } - - // If schema_dir is set, print it out for debugging purposes - if schemaDir, ok := config["schema_dir"]; ok { - // You could add more logic to handle the schema_dir, for now we just print it - fmt.Println("Using schema directory:", schemaDir) - } - - // Return a map of mock validators - return map[string]definition.Validator{ - "validator1": &MockValidator{}, - "validator2": &MockValidator{}, - }, nil -} - -// New method for ValidatorProvider, uses MockNew for creating mock validators -func New(ctx context.Context, config map[string]string) (map[string]definition.Validator, definition.Error) { - validators, err := MockNew(ctx, config) - if err != nil { - return nil, definition.Error{Message: err.Error()} - } - return validators, definition.Error{} -} - -func TestValidatorProvider(t *testing.T) { - // Create a temporary directory for the schema - schemaDir, err := ioutil.TempDir("", "schemas") - if err != nil { - t.Fatalf("Failed to create temp directory: %v", err) - } - defer os.RemoveAll(schemaDir) - - // Create a temporary JSON schema file - schemaFile := fmt.Sprintf("%s/test_schema.json", schemaDir) - schemaContent := `{"type": "object", "properties": {"name": {"type": "string"}}}` - if err := ioutil.WriteFile(schemaFile, []byte(schemaContent), 0644); err != nil { - t.Fatalf("Failed to write schema file: %v", err) - } - - // Define test cases - tests := []struct { - name string - config map[string]string - expectedError string - expectedCount int - }{ - { - name: "Valid schema directory", - config: map[string]string{"schema_dir": schemaDir}, // Use schemaDir instead of tempDir - expectedError: "", - expectedCount: 2, // Expecting 2 mock validators - }, - { - name: "Invalid schema directory", - config: map[string]string{"schema_dir": "/invalid/dir"}, - expectedError: "failed to initialise validators: {/invalid/dir schema directory does not exist}", - expectedCount: 0, - }, - } - - // Test using table-driven tests - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - vp := ValidatorProvider{} - validators, err := vp.New(context.Background(), tt.config) - - // Check for expected error - if tt.expectedError != "" { - if err == (definition.Error{}) || err.Message != tt.expectedError { - t.Errorf("expected error %q, got %v", tt.expectedError, err) - } - return - } - - // Check for expected number of validators - if len(validators) != tt.expectedCount { - t.Errorf("expected %d validators, got %d", tt.expectedCount, len(validators)) - } - }) - } -} diff --git a/shared/plugin/implementations/validator/validator.go b/shared/plugin/implementations/validator/validator.go deleted file mode 100644 index 57cf4bb..0000000 --- a/shared/plugin/implementations/validator/validator.go +++ /dev/null @@ -1,166 +0,0 @@ -package validator - -import ( - "context" - "encoding/json" - "fmt" - "net/url" - "os" - "path" - "path/filepath" - "strings" - - "beckn-onix/shared/plugin/definition" - - "github.com/santhosh-tekuri/jsonschema/v6" -) - -// Payload represents the structure of the data payload with context information. -type Payload struct { - Context struct { - Domain string `json:"domain"` - Version string `json:"version"` - } `json:"context"` -} - -// Validator implements the Validator interface. -type Validator struct { - config map[string]string - schema *jsonschema.Schema - SchemaCache map[string]*jsonschema.Schema -} - -// New creates a new ValidatorProvider instance. -func New(ctx context.Context, config map[string]string) (map[string]definition.Validator, definition.Error) { - v := &Validator{config: config} - // Call Initialise function to load schemas and get validators - validators, err := v.Initialise() - if err != (definition.Error{}) { - return nil, definition.Error{Message: fmt.Sprintf("failed to initialise validators: %v", err)} - } - return validators, definition.Error{} -} - -// Validate validates the given data against the schema. -func (v *Validator) Validate(ctx context.Context, url *url.URL, payload []byte) (bool, definition.Error) { - var payloadData Payload - err := json.Unmarshal(payload, &payloadData) - if err != nil { - return false, definition.Error{Path: "", Message: fmt.Sprintf("failed to parse JSON payload: %v", err)} - } - - // Extract domain, version, and endpoint from the payload and uri - domain := payloadData.Context.Domain - version := payloadData.Context.Version - version = fmt.Sprintf("v%s", version) - - endpoint := path.Base(url.String()) - fmt.Println("Handling request for endpoint:", endpoint) - domain = strings.ToLower(domain) - domain = strings.ReplaceAll(domain, ":", "_") - - var jsonData interface{} - if err := json.Unmarshal(payload, &jsonData); err != nil { - return false, definition.Error{Path: "", Message: err.Error()} - } - err = v.schema.Validate(jsonData) - if err != nil { - // TODO: Integrate with the logging module once it is ready - return false, definition.Error{Path: "", Message: fmt.Sprintf("Validation failed: %v", err)} - } - - return true, definition.Error{} -} - -// ValidatorProvider provides instances of Validator. -type ValidatorProvider struct{} - -// Initialise initialises the validator provider by compiling all the JSON schema files -// from the specified directory and storing them in a cache. It returns a map of validators -// indexed by their schema filenames. -func (v *Validator) Initialise() (map[string]definition.Validator, definition.Error) { - // Initialize SchemaCache as an empty Map if it's nil - if v.SchemaCache == nil { - v.SchemaCache = make(map[string]*jsonschema.Schema) - } - schemaDir := v.config["schema_dir"] - // Check if the directory exists and is accessible - info, err := os.Stat(schemaDir) - if err != nil { - if os.IsNotExist(err) { - return nil, definition.Error{Path: schemaDir, Message: "schema directory does not exist"} - } - return nil, definition.Error{Path: schemaDir, Message: fmt.Sprintf("failed to access schema directory: %v", err)} - } - if !info.IsDir() { - return nil, definition.Error{Path: schemaDir, Message: "provided schema path is not a directory"} - } - - // Initialize the validatorCache map to store the Validator instances associated with each schema. - validatorCache := make(map[string]definition.Validator) - compiler := jsonschema.NewCompiler() - - // Helper function to process directories recursively - var processDir func(dir string) definition.Error - processDir = func(dir string) definition.Error { - entries, err := os.ReadDir(dir) - if err != nil { - return definition.Error{Path: dir, Message: fmt.Sprintf("failed to read directory: %v", err)} - } - - for _, entry := range entries { - path := filepath.Join(dir, entry.Name()) - if entry.IsDir() { - // Recursively process subdirectories - if err := processDir(path); err != (definition.Error{}) { - return err - } - } else if filepath.Ext(entry.Name()) == ".json" { - // Process JSON files - compiledSchema, err := compiler.Compile(path) - if err != nil { - return definition.Error{Path: path, Message: fmt.Sprintf("failed to compile JSON schema from file %s: %v", entry.Name(), err)} - } - - // Use relative path from schemaDir to avoid absolute paths and make schema keys domain/version specific. - relativePath, err := filepath.Rel(schemaDir, path) - if err != nil { - return definition.Error{Path: path, Message: fmt.Sprintf("failed to get relative path for file %s: %v", entry.Name(), err)} - } - // Split the relative path to get domain, version, and schema. - parts := strings.Split(relativePath, string(os.PathSeparator)) - - // Ensure that the file path has at least 3 parts: domain, version, and schema file. - if len(parts) < 3 { - return definition.Error{Path: relativePath, Message: "invalid schema file structure, expected domain/version/schema.json"} - } - - // Extract domain, version, and schema filename from the parts. - // Validate that the extracted parts are non-empty - domain := strings.TrimSpace(parts[0]) - version := strings.TrimSpace(parts[1]) - schemaFileName := strings.TrimSpace(parts[2]) - schemaFileName = strings.TrimSuffix(schemaFileName, ".json") - - if domain == "" || version == "" || schemaFileName == "" { - return definition.Error{Path: relativePath, Message: "invalid schema file structure, one or more components are empty"} - } - - // Construct a unique key combining domain, version, and schema name (e.g., ondc_trv10_v2.0.0_schema). - uniqueKey := fmt.Sprintf("%s_%s_%s", domain, version, schemaFileName) - // Store the compiled schema in the SchemaCache using the unique key. - v.SchemaCache[uniqueKey] = compiledSchema - // Store the corresponding validator in the validatorCache using the same unique key. - validatorCache[uniqueKey] = &Validator{schema: compiledSchema} - } - } - return definition.Error{} - } - - // Start processing from the root schema directory - if err := processDir(schemaDir); err != (definition.Error{}) { - return nil, definition.Error{Path: schemaDir, Message: fmt.Sprintf("failed to read schema directory: %v", err)} - } - - return validatorCache, definition.Error{} -} diff --git a/shared/plugin/implementations/validator/validator_test.go b/shared/plugin/implementations/validator/validator_test.go deleted file mode 100644 index 3a95761..0000000 --- a/shared/plugin/implementations/validator/validator_test.go +++ /dev/null @@ -1,294 +0,0 @@ -package validator - -import ( - "beckn-onix/shared/plugin/definition" - "context" - "fmt" - "net/url" - "os" - "path/filepath" - "strings" - "testing" -) - -func TestValidator_Validate(t *testing.T) { - tests := []struct { - name string - url string - payload string - wantValid bool - wantErr string - }{ - { - name: "Valid payload", - url: "http://example.com/endpoint", - payload: `{"context": {"domain": "example", "version": "1.0"}}`, - wantValid: true, - wantErr: "", - }, - { - name: "Invalid JSON payload", - url: "http://example.com/endpoint", - payload: `{"context": {"domain": "example", "version": "1.0"`, - wantValid: false, - wantErr: "failed to parse JSON payload", - }, - { - name: "Schema validation failure", - url: "http://example.com/endpoint", - payload: `{"context": {"domain": "invalid", "version": "1.0"}}`, - wantValid: false, - wantErr: "Validation failed", - }, - } - - // Setup a temporary schema directory for testing - schemaDir := filepath.Join(os.TempDir(), "schemas") - defer os.RemoveAll(schemaDir) - os.MkdirAll(schemaDir, 0755) - - // Create a sample schema file - schemaContent := `{ - "type": "object", - "properties": { - "context": { - "type": "object", - "properties": { - "domain": {"type": "string"}, - "version": {"type": "string"} - }, - "required": ["domain", "version"] - } - }, - "required": ["context"] - }` - schemaFile := filepath.Join(schemaDir, "example", "1.0", "endpoint.json") - os.MkdirAll(filepath.Dir(schemaFile), 0755) - os.WriteFile(schemaFile, []byte(schemaContent), 0644) - - config := map[string]string{"schema_dir": schemaDir} - v, err := New(context.Background(), config) - if err != (definition.Error{}) { - t.Fatalf("Failed to create validator: %v", err) - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - u, _ := url.Parse(tt.url) - valid, err := v["example_1.0_endpoint"].Validate(context.Background(), u, []byte(tt.payload)) - if (err != (definition.Error{}) && !strings.Contains(err.Message, tt.wantErr)) || (err == (definition.Error{}) && tt.wantErr != "") { - t.Errorf("Error: Validate() returned error = %v, expected error = %v", err, tt.wantErr) - return - } - if valid != tt.wantValid { - t.Errorf("Error: Validate() returned valid = %v, expected valid = %v", valid, tt.wantValid) - } else { - t.Logf("Test %s passed: valid = %v", tt.name, valid) - } - }) - } -} - -func TestValidator_Initialise(t *testing.T) { - tests := []struct { - name string - setupFunc func(schemaDir string) error - wantErr string - }{ - { - name: "Schema directory does not exist", - setupFunc: func(schemaDir string) error { - // Do not create the schema directory - return fmt.Errorf("schema directory does not exist: %s", schemaDir) - - }, - wantErr: "schema directory does not exist", - }, - { - name: "Schema path is not a directory", - setupFunc: func(schemaDir string) error { - // Create a file instead of a directory - return os.WriteFile(schemaDir, []byte{}, 0644) - }, - wantErr: "provided schema path is not a directory", - }, - { - name: "Invalid schema file structure", - setupFunc: func(schemaDir string) error { - // Create an invalid schema file structure - invalidSchemaFile := filepath.Join(schemaDir, "invalid_schema.json") - os.MkdirAll(filepath.Dir(invalidSchemaFile), 0755) - return os.WriteFile(invalidSchemaFile, []byte(`{}`), 0644) - }, - wantErr: "invalid schema file structure", - }, - { - name: "Failed to compile JSON schema", - setupFunc: func(schemaDir string) error { - // Create a schema file with invalid JSON - invalidSchemaFile := filepath.Join(schemaDir, "example", "1.0", "endpoint.json") - os.MkdirAll(filepath.Dir(invalidSchemaFile), 0755) - return os.WriteFile(invalidSchemaFile, []byte(`{invalid json}`), 0644) - }, - wantErr: "failed to compile JSON schema", - }, - { - name: "Invalid schema file structure with empty components", - setupFunc: func(schemaDir string) error { - // Create a schema file with empty domain, version, or schema name - invalidSchemaFile := filepath.Join(schemaDir, "", "1.0", "endpoint.json") - os.MkdirAll(filepath.Dir(invalidSchemaFile), 0755) - return os.WriteFile(invalidSchemaFile, []byte(`{ - "type": "object", - "properties": { - "context": { - "type": "object", - "properties": { - "domain": {"type": "string"}, - "version": {"type": "string"} - }, - "required": ["domain", "version"] - } - }, - "required": ["context"] - }`), 0644) - }, - wantErr: "invalid schema file structure, one or more components are empty", - }, - { - name: "Failed to read directory", - setupFunc: func(schemaDir string) error { - // Create a directory and remove read permissions - os.MkdirAll(schemaDir, 0000) - return nil - }, - wantErr: "failed to read directory", - }, - { - name: "Failed to access schema directory", - setupFunc: func(schemaDir string) error { - // Create a directory and remove access permissions - os.MkdirAll(schemaDir, 0000) - return nil - }, - wantErr: "failed to access schema directory", - }, - { - name: "Valid schema directory", - setupFunc: func(schemaDir string) error { - // Create a valid schema file - validSchemaFile := filepath.Join(schemaDir, "example", "1.0", "endpoint.json") - os.MkdirAll(filepath.Dir(validSchemaFile), 0755) - return os.WriteFile(validSchemaFile, []byte(`{ - "type": "object", - "properties": { - "context": { - "type": "object", - "properties": { - "domain": {"type": "string"}, - "version": {"type": "string"} - }, - "required": ["domain", "version"] - } - }, - "required": ["context"] - }`), 0644) - }, - wantErr: "", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - // Setup a temporary schema directory for testing - schemaDir := filepath.Join(os.TempDir(), "schemas") - defer os.RemoveAll(schemaDir) - - // Run the setup function to prepare the test case - if err := tt.setupFunc(schemaDir); err != nil { - t.Fatalf("setupFunc() error = %v", err) - } - - config := map[string]string{"schema_dir": schemaDir} - v := &Validator{config: config} - - _, err := v.Initialise() - if (err != (definition.Error{}) && !strings.Contains(err.Message, tt.wantErr)) || (err == (definition.Error{}) && tt.wantErr != "") { - t.Errorf("Error: Initialise() returned error = %v, expected error = %v", err, tt.wantErr) - } else if err == (definition.Error{}) { - t.Logf("Test %s passed: validator initialized successfully", tt.name) - } else { - t.Logf("Test %s passed with expected error: %v", tt.name, err) - } - }) - } -} - -func TestValidator_New(t *testing.T) { - tests := []struct { - name string - config map[string]string - setupFunc func(schemaDir string) error - wantErr string - }{ - { - name: "Failed to initialise validators", - config: map[string]string{ - "schema_dir": "/invalid/path", - }, - setupFunc: func(schemaDir string) error { - // Do not create the schema directory - return nil - }, - wantErr: "failed to initialise validators", - }, - { - name: "Valid initialisation", - config: map[string]string{ - "schema_dir": "/valid/path", - }, - setupFunc: func(schemaDir string) error { - // Create a valid schema directory and file - validSchemaFile := filepath.Join(schemaDir, "example", "1.0", "endpoint.json") - os.MkdirAll(filepath.Dir(validSchemaFile), 0755) - return os.WriteFile(validSchemaFile, []byte(`{ - "type": "object", - "properties": { - "context": { - "type": "object", - "properties": { - "domain": {"type": "string"}, - "version": {"type": "string"} - }, - "required": ["domain", "version"] - } - }, - "required": ["context"] - }`), 0644) - }, - wantErr: "", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - // Setup a temporary schema directory for testing - schemaDir := tt.config["schema_dir"] - defer os.RemoveAll(schemaDir) - - // Run the setup function to prepare the test case - if err := tt.setupFunc(schemaDir); err != nil { - t.Fatalf("setupFunc() error = %v", err) - } - - _, err := New(context.Background(), tt.config) - if (err != (definition.Error{}) && !strings.Contains(err.Message, tt.wantErr)) || (err == (definition.Error{}) && tt.wantErr != "") { - t.Errorf("Error: New() returned error = %v, expected error = %v", err, tt.wantErr) - } else if err == (definition.Error{}) { - t.Logf("Test %s passed: validator initialized successfully", tt.name) - } else { - t.Logf("Test %s passed with expected error: %v", tt.name, err) - } - }) - } -} diff --git a/shared/plugin/plugin.yaml b/shared/plugin/plugin.yaml deleted file mode 100644 index 291b0ca..0000000 --- a/shared/plugin/plugin.yaml +++ /dev/null @@ -1,6 +0,0 @@ -plugins: - validation_plugin: - id: validator - config: - schema_dir: #Directory where the schema files are stored - plugin_path: shared/plugin/implementations/ \ No newline at end of file diff --git a/shared/plugin/testData/directory.json b/shared/plugin/testData/directory.json deleted file mode 100644 index e69de29..0000000 diff --git a/shared/plugin/testData/payloads/cancel.json b/shared/plugin/testData/payloads/cancel.json deleted file mode 100644 index 51c66e3..0000000 --- a/shared/plugin/testData/payloads/cancel.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "context": { - "action": "cancel", - "bap_id": "example-bap.com", - "bap_uri": "https://example-bap.com/prod/trv10", - "bpp_id": "api.beckn.juspay.in/dobpp/beckn/7f7896dd-787e-4a0b-8675-e9e6fe93bb8f", - "bpp_uri": "https://example-bpp.com/prod/seller", - "domain": "ONDC:TRV10", - "location": { - "city": { - "code": "std:080" - }, - "country": { - "code": "IND" - } - }, - "message_id": "be6a495a-e941-4fbf-9d59-f1e6166cccc8", - "timestamp": "2023-03-23T05:15:08Z", - "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", - "ttl": "PT30S", - "version": "2.0.0" - }, - "message": { - "cancellation_reason_id": "7", - "descriptor": { - "code": "SOFT_CANCEL", - "name": "Ride Cancellation" - }, - "order_id": "O1" - } -} \ No newline at end of file diff --git a/shared/plugin/testData/payloads/confirm.json b/shared/plugin/testData/payloads/confirm.json deleted file mode 100644 index b5a0e21..0000000 --- a/shared/plugin/testData/payloads/confirm.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "context": { - "action": "confirm", - "bap_id": "example-bap.com", - "bap_uri": "https://example-bap.com/prod/trv10", - "bpp_id": "example-bpp.com", - "bpp_uri": "https://example-bpp.com/prod/seller", - "domain": "ONDC:TRV10", - "location": { - "city": { - "code": "std:080" - }, - "country": { - "code": "IND" - } - }, - "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", - "timestamp": "2023-12-10T04:34:48.031Z", - "transaction_id": "870782be-6757-43f1-945c-8eeaf9536259", - "ttl": "PT30S", - "version": "2.0.0" - }, - "message": { - "order": { - "billing": { - "name": "Joe Adams" - }, - "fulfillments": [ - { - "customer": { - "contact": { - "phone": "9876556789" - }, - "person": { - "name": "Joe Adams" - } - }, - "id": "F1", - "stops": [ - { - "location": { - "gps": "13.008935, 77.644408" - }, - "type": "START" - }, - { - "location": { - "gps": "12.971186, 77.586812" - }, - "type": "END" - } - ], - "vehicle": { - "category": "AUTO_RICKSHAW" - } - } - ], - "items": [ - { - "id": "I1" - } - ], - "payments": [ - { - "collected_by": "BPP", - "id": "PA1", - "params": { - "bank_account_number": "xxxxxxxxxxxxxx", - "bank_code": "XXXXXXXX", - "virtual_payment_address": "9988199772@okicic" - }, - "status": "NOT-PAID", - "tags": [ - { - "descriptor": { - "code": "BUYER_FINDER_FEES" - }, - "display": false, - "list": [ - { - "descriptor": { - "code": "BUYER_FINDER_FEES_PERCENTAGE" - }, - "value": "1" - } - ] - }, - { - "descriptor": { - "code": "SETTLEMENT_TERMS" - }, - "display": false, - "list": [ - { - "descriptor": { - "code": "SETTLEMENT_WINDOW" - }, - "value": "PT60M" - }, - { - "descriptor": { - "code": "SETTLEMENT_BASIS" - }, - "value": "DELIVERY" - }, - { - "descriptor": { - "code": "SETTLEMENT_TYPE" - }, - "value": "UPI" - }, - { - "descriptor": { - "code": "MANDATORY_ARBITRATION" - }, - "value": "true" - }, - { - "descriptor": { - "code": "COURT_JURISDICTION" - }, - "value": "New Delhi" - }, - { - "descriptor": { - "code": "DELAY_INTEREST" - }, - "value": "5" - }, - { - "descriptor": { - "code": "STATIC_TERMS" - }, - "value": "https://example-test-bap.com/static-terms.txt" - }, - { - "descriptor": { - "code": "SETTLEMENT_AMOUNT" - }, - "value": "1.46" - } - ] - } - ], - "type": "ON-FULFILLMENT" - } - ], - "provider": { - "id": "P1" - } - } - } -} \ No newline at end of file diff --git a/shared/plugin/testData/payloads/search_extraField.json b/shared/plugin/testData/payloads/search_extraField.json deleted file mode 100644 index ef8ad94..0000000 --- a/shared/plugin/testData/payloads/search_extraField.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "context": { - "action": "search", - "bap_id": "bap.example.com", - "bap_uri": "https://example-bap.com/prod/trv10", - "domain": "example-domain", - "location": { - "city": { - "code": "PUN" - }, - "country": { - "code": "IND" - } - }, - "message_id": "123e4567-e89b-12d3-a456-426614174000", - "timestamp": "2025-03-06T12:00:00Z", - "transaction_id": "123e4567-e89b-12d3-a456-426614174001", - "ttl": "PT30M", - "version": "1.0.0", - "extra_field": "unexpected_value" - }, - "message": { - "intent": { - "fulfillment": { - "stops": [ - { - "location": { - "gps": "19.0760,72.8777", - "created_at": "unexpected_value" - }, - "type": "START" - }, - { - "location": { - "gps": "18.5204,73.8567" - }, - "type": "END" - } - ] - }, - "payment": { - "collected_by": "BPP", - "tags": [ - { - "descriptor": { - "code": "some-code" - }, - "display": true, - "list": [ - { - "descriptor": { - "code": "list-code" - }, - "value": "list-value" - } - ] - } - ] - } - } - } - } - \ No newline at end of file diff --git a/shared/plugin/testData/schema_valid/ondc_trv10/v2.0.0/search.json b/shared/plugin/testData/schema_valid/ondc_trv10/v2.0.0/search.json deleted file mode 100644 index 82c1720..0000000 --- a/shared/plugin/testData/schema_valid/ondc_trv10/v2.0.0/search.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "$id": "http://example.com/schema/searchSchema", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "context": { - "type": "object", - "properties": { - "action": { "type": "string" }, - "bap_id": { "type": "string" }, - "bap_uri": { "type": "string", "format": "uri" }, - "domain": { "type": "string" }, - "location": { - "type": "object", - "properties": { - "city": { - "type": "object", - "properties": { - "code": { "type": "string" } - }, - "required": ["code"] - }, - "country": { - "type": "object", - "properties": { - "code": { "type": "string" } - }, - "required": ["code"] - } - }, - "required": ["city", "country"] - }, - "message_id": { "type": "string", "format": "uuid" }, - "timestamp": { "type": "string", "format": "date-time" }, - "transaction_id": { "type": "string", "format": "uuid" }, - "ttl": { "type": "string" }, - "version": { "type": "string" } - }, - "required": [ - "action", - "bap_id", - "bap_uri", - "domain", - "location", - "message_id", - "timestamp", - "transaction_id", - "ttl", - "version" - ] - }, - "message": { - "type": "object", - "properties": { - "intent": { - "type": "object", - "properties": { - "fulfillment": { - "type": "object", - "properties": { - "stops": { - "type": "array", - "items": { - "type": "object", - "properties": { - "location": { - "type": "object", - "properties": { - "gps": { "type": "string", "pattern": "^\\d{1,3}\\.\\d+,\\s?\\d{1,3}\\.\\d+$" } - }, - "required": ["gps"] - }, - "type": { "type": "string", "enum": ["START", "END"] } - }, - "required": ["location", "type"] - } - } - }, - "required": ["stops"] - }, - "payment": { - "type": "object", - "properties": { - "collected_by": { "type": "string", "enum": ["BPP", "BAP"] }, - "tags": { - "type": "array", - "items": { - "type": "object", - "properties": { - "descriptor": { - "type": "object", - "properties": { - "code": { "type": "string" } - }, - "required": ["code"] - }, - "display": { "type": "boolean" }, - "list": { - "type": "array", - "items": { - "type": "object", - "properties": { - "descriptor": { - "type": "object", - "properties": { - "code": { "type": "string" } - }, - "required": ["code"] - }, - "value": { "type": "string" } - }, - "required": ["descriptor", "value"] - } - } - }, - "required": ["descriptor", "display", "list"] - } - } - }, - "required": ["collected_by", "tags"] - } - }, - "required": ["fulfillment", "payment"] - } - } - } - }, - "required": ["context", "message"] -} diff --git a/test.go b/test.go index 50932a3..d319abb 100644 --- a/test.go +++ b/test.go @@ -1,77 +1,44 @@ package main import ( - "beckn-onix/shared/plugin" - "beckn-onix/shared/plugin/definition" "context" - "encoding/json" "fmt" - "io/ioutil" + "io" "log" "net/http" "net/url" + + "github.com/beckn/beckn-onix/pkg/plugin/definition" + + "github.com/beckn/beckn-onix/pkg/plugin" ) var ( - manager *plugin.Manager - validators map[string]definition.Validator + manager *plugin.Manager ) -// Payload represents the structure of the payload with context information. -type Payload struct { - Context struct { - Action string `json:"action"` - BapID string `json:"bap_id"` - BapURI string `json:"bap_uri"` - BppID string `json:"bpp_id"` - BppURI string `json:"bpp_uri"` - Domain string `json:"domain"` - Location struct { - City struct { - Code string `json:"code"` - } `json:"city"` - Country struct { - Code string `json:"code"` - } `json:"country"` - } `json:"location"` - MessageID string `json:"message_id"` - Timestamp string `json:"timestamp"` - TransactionID string `json:"transaction_id"` - TTL string `json:"ttl"` - Version string `json:"version"` - } `json:"context"` - Message struct { - CancellationReasonID string `json:"cancellation_reason_id"` - Descriptor struct { - Code string `json:"code"` - Name string `json:"name"` - } `json:"descriptor"` - OrderID string `json:"order_id"` - } `json:"message"` -} - func main() { var err error - // Load the configuration - config, err := plugin.LoadConfig("shared/plugin/plugin.yaml") + // Load the configuration. + config, err := plugin.LoadConfig("pkg/plugin/plugin.yaml") if err != nil { log.Fatalf("Failed to load plugins configuration: %v", err) } - // Initialize the plugin manager + // Initialize the plugin manager. manager, err = plugin.NewManager(context.Background(), config) if err != nil { log.Fatalf("Failed to create PluginManager: %v", err) } - // Get the validators map - validators, defErr := manager.Validators(context.Background()) - if defErr != (definition.Error{}) { + // Get the validator. + validator, _, defErr := manager.SchemaValidator(context.Background()) + if defErr != nil { log.Fatalf("Failed to get validators: %v", defErr) } http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - validateHandler(w, r, validators) + validateHandler(w, r, validator) }) fmt.Println("Starting server on port 8084...") err = http.ListenAndServe(":8084", nil) @@ -80,13 +47,13 @@ func main() { } } -func validateHandler(w http.ResponseWriter, r *http.Request, validators map[string]definition.Validator) { +func validateHandler(w http.ResponseWriter, r *http.Request, validators definition.SchemaValidator) { if r.Method != http.MethodPost { http.Error(w, "Invalid request method", http.StatusMethodNotAllowed) return } - // Extract endpoint from request URL + // Extract endpoint from request URL. requestURL := r.RequestURI u, err := url.ParseRequestURI(requestURL) if err != nil { @@ -94,40 +61,32 @@ func validateHandler(w http.ResponseWriter, r *http.Request, validators map[stri return } - payloadData, err := ioutil.ReadAll(r.Body) + payloadData, err := io.ReadAll(r.Body) if err != nil { http.Error(w, "Failed to read payload data", http.StatusInternalServerError) return } - var payload Payload - err = json.Unmarshal(payloadData, &payload) - if err != nil { - log.Printf("Failed to parse JSON payload: %v", err) - http.Error(w, fmt.Sprintf("Failed to parse JSON payload: %v", err), http.StatusBadRequest) - return - } - - // Validate that the domain and version fields are not empty - if payload.Context.Domain == "" || payload.Context.Version == "" { - http.Error(w, "Invalid payload: domain and version are required fields", http.StatusBadRequest) - return - } - schemaFileName := "ondc_trv10_v2.0.0_cancel" - - validator, exists := validators[schemaFileName] - if !exists { - http.Error(w, fmt.Sprintf("Validator not found for %s", schemaFileName), http.StatusNotFound) - return - } ctx := context.Background() - valid, validationErr := validator.Validate(ctx, u, payloadData) - if validationErr != (definition.Error{}) { - http.Error(w, fmt.Sprintf("Document validation failed: %v", validationErr), http.StatusBadRequest) - } else if !valid { - http.Error(w, "Document validation failed", http.StatusBadRequest) + // validationErr := validators.Validate(ctx, u, payloadData) + // if validationErr != (definition.SchemaValError{}) { + // http.Error(w, fmt.Sprintf("Document validation failed: %v", validationErr), http.StatusBadRequest) + // } else if !valid { + // http.Error(w, "Document validation failed", http.StatusBadRequest) + // } else { + // w.WriteHeader(http.StatusOK) + // if _, err := w.Write([]byte("Document validation succeeded!")); err != nil { + // log.Fatalf("Failed to write response: %v", err) + // } + // } + validationErr := validators.Validate(ctx, u, payloadData) + if validationErr != nil { + // Handle other types of errors + http.Error(w, fmt.Sprintf("Schema validation failed: %v", validationErr), http.StatusBadRequest) } else { w.WriteHeader(http.StatusOK) - w.Write([]byte("Document validation succeeded!")) + if _, err := w.Write([]byte("Schema validation succeeded!")); err != nil { + log.Fatalf("Failed to write response: %v", err) + } } }