1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.paymentgateway.issuerswitch.v1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/paymentgateway/issuerswitch/v1/common_fields.proto"; 24import "google/protobuf/empty.proto"; 25 26option csharp_namespace = "Google.Cloud.PaymentGateway.IssuerSwitch.V1"; 27option go_package = "cloud.google.com/go/paymentgateway/issuerswitch/apiv1/issuerswitchpb;issuerswitchpb"; 28option java_multiple_files = true; 29option java_outer_classname = "RulesProto"; 30option java_package = "com.google.cloud.paymentgateway.issuerswitch.v1"; 31option php_namespace = "Google\\Cloud\\PaymentGateway\\IssuerSwitch\\V1"; 32option ruby_package = "Google::Cloud::PaymentGateway::IssuerSwitch::V1"; 33 34// Manages rules used by the issuer switch's rules engine. 35service IssuerSwitchRules { 36 option (google.api.default_host) = "issuerswitch.googleapis.com"; 37 option (google.api.oauth_scopes) = 38 "https://www.googleapis.com/auth/cloud-platform"; 39 40 // List all rules that are applied on transactions by the issuer switch. Rules 41 // can be filtered on API type and transaction type. 42 rpc ListRules(ListRulesRequest) returns (ListRulesResponse) { 43 option (google.api.http) = { 44 get: "/v1/{parent=projects/*}/rules" 45 }; 46 option (google.api.method_signature) = "parent"; 47 } 48 49 // List all rule metadata for a given rule identifier. 50 rpc ListRuleMetadata(ListRuleMetadataRequest) 51 returns (ListRuleMetadataResponse) { 52 option (google.api.http) = { 53 get: "/v1/{parent=projects/*/rules/*}/metadata" 54 }; 55 option (google.api.method_signature) = "parent"; 56 } 57 58 // List all metadata values for a rule metadata identifier. 59 rpc ListRuleMetadataValues(ListRuleMetadataValuesRequest) 60 returns (ListRuleMetadataValuesResponse) { 61 option (google.api.http) = { 62 get: "/v1/{parent=projects/*/rules/*/metadata/*}/values" 63 }; 64 option (google.api.method_signature) = "parent"; 65 } 66 67 // Create (add) multiple values to the list of values under the specified rule 68 // metadata resource. 69 rpc BatchCreateRuleMetadataValues(BatchCreateRuleMetadataValuesRequest) 70 returns (BatchCreateRuleMetadataValuesResponse) { 71 option (google.api.http) = { 72 post: "/v1/{parent=projects/*/rules/*/metadata/*}/values:batchCreate" 73 body: "*" 74 }; 75 option (google.api.method_signature) = "parent"; 76 } 77 78 // Delete (remove) multiple values from the list of values under the specified 79 // rules metadata resource. 80 rpc BatchDeleteRuleMetadataValues(BatchDeleteRuleMetadataValuesRequest) 81 returns (google.protobuf.Empty) { 82 option (google.api.http) = { 83 post: "/v1/{parent=projects/*/rules/*/metadata/*}/values:batchDelete" 84 body: "*" 85 }; 86 option (google.api.method_signature) = "parent"; 87 } 88} 89 90// A rule that is executed by the issuer switch while processing an 91// API transaction. 92message Rule { 93 option (google.api.resource) = { 94 type: "issuerswitch.googleapis.com/Rule" 95 pattern: "projects/{project}/rules/{rule}" 96 }; 97 98 // The unique identifier for this resource. 99 // Format: projects/{project}/rules/{rule} 100 string name = 1; 101 102 // The description of the rule. 103 string rule_description = 2; 104 105 // The API Type for which this rule gets executed. A value of 106 // `API_TYPE_UNSPECIFIED` indicates that the rule is executed for all API 107 // transactions. 108 ApiType api_type = 3; 109 110 // The transaction type for which this rule gets executed. A value of 111 // `TRANSACTION_TYPE_UNSPECIFIED` indicates that the rule is executed for 112 // all transaction types. 113 TransactionType transaction_type = 4; 114} 115 116// The metadata associated with a rule. This defines data that are used by the 117// rule during execution. 118message RuleMetadata { 119 option (google.api.resource) = { 120 type: "issuerswitch.googleapis.com/RuleMetadata" 121 pattern: "projects/{project}/rules/{rule}/metadata/{metadata}" 122 }; 123 124 // The type of metadata. 125 enum Type { 126 // Unspecified type. 127 TYPE_UNSPECIFIED = 0; 128 129 // List type. Indicates that the metadata contains a list of values which 130 // the rule requires for execution. 131 LIST = 1; 132 } 133 134 // The unique identifier for this resource. 135 // Format: projects/{project}/rules/{rule}/metadata/{metadata} 136 string name = 1; 137 138 // The description of the rule metadata. 139 string description = 2; 140 141 // Type of rule metadata. 142 Type type = 3; 143} 144 145// Represent a single value in a rule's metadata. 146message RuleMetadataValue { 147 option (google.api.resource) = { 148 type: "issuerswitch.googleapis.com/RuleMetadataValue" 149 pattern: "projects/{project}/rules/{rule}/metadata/{metadata}/values/{value}" 150 }; 151 152 // Output only. The unique identifier for this resource. 153 // Format: projects/{project}/rules/{rule}/metadata/{metadata}/values/{value} 154 string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 155 156 // The value of the resource which could be of type string or 157 // AccountReference. The metadata values for rules 158 // BlockedPayeeAccountReqPayDebitRule, BlockedPayerAccountReqPayDebitRule, 159 // BlockedPayeeAccountReqPayCreditRule and BlockedPayerAccountReqPayCreditRule 160 // should be of type AccountReference. For all other rules, metadata values 161 // should be of type string. 162 // 163 // The length of the `value` field depends on the type of 164 // the value being used for the rule metadata. The following are the minimum 165 // and maximum lengths for the different types of values. 166 // 167 // Value Type | Minimum Length | Maximum Length | 168 // -------- | -------- | -------- | 169 // Bank account IFSC | 11 | 11 | 170 // Bank account number | 1 | 255 | 171 // Device identifier | 1 | 255 | 172 // Mobile number | 12 | 12 | 173 // Virtual private address (VPA) | 3 | 255 | 174 oneof value { 175 // The value for string metadata. 176 string id = 2; 177 178 // The value for account reference metadata. 179 AccountReference account_reference = 3; 180 } 181} 182 183// Request body for the `ListRules` method. 184message ListRulesRequest { 185 // Required. The parent resource must have the format of `projects/{project}`. 186 string parent = 1 [ 187 (google.api.field_behavior) = REQUIRED, 188 (google.api.resource_reference) = { 189 child_type: "issuerswitch.googleapis.com/Rule" 190 } 191 ]; 192 193 // The maximum number of rules to return. The service may return fewer 194 // than this value. If unspecified or if the specified value is less than 50, 195 // at most 50 rules will be returned. The maximum value is 1000; values above 196 // 1000 will be coerced to 1000. 197 int32 page_size = 2; 198 199 // A page token, received from a previous `ListRulesRequest` call. 200 // Specify this parameter to retrieve the next page of rules. 201 string page_token = 3; 202} 203 204// Response body for the `ListRules` method. 205message ListRulesResponse { 206 // List of rules satisfying the specified filter criteria. 207 repeated Rule rules = 1; 208 209 // Pass this token in a subsequent `ListRulesRequest` call to continue to list 210 // results. If all results have been returned, this field is an empty string 211 // or not present in the response. 212 string next_page_token = 2; 213 214 // Total number of rules matching request criteria across all pages. 215 int64 total_size = 3; 216} 217 218// Request body for the `ListRuleMetadata` method. 219message ListRuleMetadataRequest { 220 // Required. The parent resource. The format is 221 // `projects/{project}/rules/{rule}`. 222 string parent = 1 [ 223 (google.api.field_behavior) = REQUIRED, 224 (google.api.resource_reference) = { 225 child_type: "issuerswitch.googleapis.com/RuleMetadata" 226 } 227 ]; 228 229 // The maximum number of rule metadata to return. The service may return fewer 230 // than this value. If unspecified or if the specified value is less than 50, 231 // at most 50 rule metadata will be returned. The maximum value is 1000; 232 // values above 1000 will be coerced to 1000. 233 int32 page_size = 2; 234 235 // A page token, received from a previous `ListRuleMetadataRequest` call. 236 // Specify this parameter to retrieve the next page of rule metadata. 237 string page_token = 3; 238} 239 240// Response body for the `ListRuleMetadata` method. 241message ListRuleMetadataResponse { 242 // List of rule metadata associated with the rule. 243 repeated RuleMetadata rule_metadata = 1; 244 245 // Pass this token in a subsequent `ListRuleMetadataRequest` call to continue 246 // to list results. If all results have been returned, this field is an empty 247 // string or not present in the response. 248 string next_page_token = 2; 249 250 // Total number of rule metadata matching request criteria across all pages. 251 int64 total_size = 3; 252} 253 254// Request body for the `ListRuleMetadataValues` method. 255message ListRuleMetadataValuesRequest { 256 // Required. The parent resource. The format is 257 // `projects/{project}/rules/{rule}/metadata/{metadata}`. 258 string parent = 1 [ 259 (google.api.field_behavior) = REQUIRED, 260 (google.api.resource_reference) = { 261 child_type: "issuerswitch.googleapis.com/RuleMetadataValue" 262 } 263 ]; 264 265 // The maximum number of metadata values to return. The service may return 266 // fewer than this value. If unspecified or if the specified value is less 267 // than 1, at most 50 rule metadata values will be returned. The maximum 268 // value is 1000; values above 1000 will be coerced to 1000. 269 int32 page_size = 2; 270 271 // A page token received from a previous `ListRuleMetadataValuesRequest` 272 // call. Specify this parameter to retrieve the next page of rule metadata 273 // values. 274 string page_token = 3; 275} 276 277// Response body for ListRuleMetadataValues. Contains a List of values for a 278// given rule metadata resource. 279message ListRuleMetadataValuesResponse { 280 // List of values for a given rule metadata resource identifier. 281 repeated RuleMetadataValue rule_metadata_values = 1; 282 283 // Pass this token in a subsequent `ListRuleMetadataValuesRequest` call to 284 // continue to list results. If all results have been returned, this field is 285 // an empty string or not present in the response. 286 string next_page_token = 2; 287} 288 289// Request body for the `BatchCreateRuleMetadataValues` method. 290message BatchCreateRuleMetadataValuesRequest { 291 // The parent resource shared by all ruleMetadataValue being created. The 292 // format is `projects/{project}/rules/{rule}/metadata/{metadata}`. The 293 // [CreateRuleMetadataValueRequest.parent][google.cloud.paymentgateway.issuerswitch.v1.CreateRuleMetadataValueRequest.parent] 294 // field in the 295 // [CreateRuleMetadataValueRequest][google.cloud.paymentgateway.issuerswitch.v1.CreateRuleMetadataValueRequest] 296 // messages contained in this request must match this field. 297 string parent = 1 [(google.api.resource_reference) = { 298 child_type: "issuerswitch.googleapis.com/RuleMetadataValue" 299 }]; 300 301 // Required. The request message specifying the resources to create. 302 // A maximum of 1000 RuleMetadataValues can be created in a batch. 303 repeated CreateRuleMetadataValueRequest requests = 2 304 [(google.api.field_behavior) = REQUIRED]; 305} 306 307// Response body for the `BatchCreateRuleMetadataValues` method. 308message BatchCreateRuleMetadataValuesResponse { 309 // List of RuleMetadataValue created. 310 repeated RuleMetadataValue rule_metadata_value = 1; 311} 312 313// Request for creating a single `RuleMetadataValue`. 314message CreateRuleMetadataValueRequest { 315 // Required. The parent resource where this RuleMetadataValue will be created. 316 // The format is `projects/{project}/rules/{rule}/metadata/{metadata}`. 317 string parent = 1 [ 318 (google.api.field_behavior) = REQUIRED, 319 (google.api.resource_reference) = { 320 child_type: "issuerswitch.googleapis.com/RuleMetadataValue" 321 } 322 ]; 323 324 // Required. The rule metadata value to create or add to a list. 325 RuleMetadataValue rule_metadata_value = 2 326 [(google.api.field_behavior) = REQUIRED]; 327} 328 329// Request body for the `BatchDeleteRuleMetadataValues` method. 330message BatchDeleteRuleMetadataValuesRequest { 331 // The parent resource shared by all RuleMetadataValues being deleted. The 332 // format is `projects/{project}/rules/{rule}/metadata/{metadata}`. If this is 333 // set, the parent of all of the RuleMetadataValues specified in the 334 // list of names must match this field. 335 string parent = 1 [(google.api.resource_reference) = { 336 child_type: "issuerswitch.googleapis.com/RuleMetadataValue" 337 }]; 338 339 // Required. The names of the rule metadata values to delete. 340 // A maximum of 1000 RuleMetadataValue can be deleted in a batch. 341 // Format: projects/{project}/rules/{rule}/metadata/{metadata}/values/{value} 342 repeated string names = 2 [ 343 (google.api.field_behavior) = REQUIRED, 344 (google.api.resource_reference) = { 345 type: "issuerswitch.googleapis.com/RuleMetadataValue" 346 } 347 ]; 348} 349