providerapi

io.token.proto.providerapi external/src/main/proto/providerapi/providerapi.proto


syntax = "proto3";
package io.token.proto.providerapi;

import "account.proto";
import "transfer.proto";
import "bankstatus.proto";
import "token.proto";
import "transferinstructions.proto";
import "providerspecific.proto";
import "money.proto";
import "transaction.proto";
import "extensions/field.proto";
import "tsp/bankconfig.proto";
import "v2/common.proto";
import "v2/openbanking/common.proto";
import "v2/openbanking/vrp.proto";
import "v2/openbanking/payment.proto";
import "extensions/method.proto";

message Account {
  string id = 1 [(io.token.proto.extensions.field.redact) = true];
  string name = 2 [(io.token.proto.extensions.field.redact) = true];
  string number = 3 [(io.token.proto.extensions.field.redact) = true];
  string state = 4;
  io.token.proto.common.account.AccountFeatures account_features = 5;
  io.token.proto.common.account.AccountDetails account_details = 6;
}

message Transaction {
  string id = 1;
  string account_id = 2 [(io.token.proto.extensions.field.redact) = true];
  string amount = 3;
  string currency = 4; // ISO4217: 3 letter code such as "USD" or "EUR"
  Type type = 5;
  Status status = 6;
  string account_number = 7 [(io.token.proto.extensions.field.redact) = true]; // Optional account number of the transaction
  string description = 8 [(io.token.proto.extensions.field.redact) = true]; // Optional description of the transaction
  int64 created_at = 9; // Optional timestamp in milliseconds, use booking date if creation date is not available

  map<string, string> metadata = 10 [(io.token.proto.extensions.field.redact) = true]; // Optional additional fields.
  io.token.proto.common.providerspecific.ProviderTransactionDetails provider_transaction_details = 11;
  io.token.proto.common.transferinstructions.TransferEndpoint creditor_endpoint = 12;
  io.token.proto.common.transaction.BankTransactionCode bank_transaction_code = 13;

  string state = 14; // Optional for backwards compatibility only, the new transaction id implementation should always populate it
  string bank_transaction_id = 15; // Optional

  enum Status {
    INVALID = 0;
    SUCCESS = 1;
    INSUFFICIENT_FUNDS = 2;
    FAILURE = 3;
    PENDING = 4 [deprecated = true]; // use PROCESSING instead
    SENT = 5;
    INITIATED = 6;
    PROCESSING = 7;
    PENDING_AUTHORIZATION = 8;
    DECLINED = 9;
    CANCELLED = 10;
    STATUS_NOT_AVAILABLE = 11;
    EXPIRED = 12;
  }

  enum Type {
    INVALID_TYPE = 0;
    DEBIT = 1;
    CREDIT = 2;
  }
}

message CredentialFields {
  repeated io.token.proto.common.providerspecific.CredentialField fields = 1;
}

message StandingOrder {
  string id = 1;
  string account_id = 2 [(io.token.proto.extensions.field.redact) = true];
  string start_date = 3; // ISO 8601: YYYY-MM-DD or	YYYYMMDD
  string end_date = 4;   // Optional. ISO 8601: YYYY-MM-DD or	YYYYMMDD
  string frequency = 5;  // ISO 20022: DAIL, WEEK, TOWK, MNTH, TOMN, QUTR, SEMI, YEAR
  string amount = 6;     // Amount of each individual payment
  string currency = 7;   // ISO 4217, 3 letter currency code such as "USD" or "EUR".
  Status status = 8;
  string description = 9 [(io.token.proto.extensions.field.redact) = true]; // Optional description of the transaction
  int64 created_at = 10; // Optional timestamp in milliseconds, use booking date if creation date is not available

  map<string, string> metadata = 11 [(io.token.proto.extensions.field.redact) = true]; // Optional additional fields.
  io.token.proto.common.providerspecific.ProviderStandingOrderDetails provider_details = 12;
  io.token.proto.common.transferinstructions.TransferEndpoint creditor_endpoint = 13;

  enum Status {
    INVALID = 0;
    ACTIVE = 1;
    INACTIVE = 2;
    PROCESSING = 3;
    FAILED = 4;
    INITIATION_COMPLETE = 5; // Should only be used in GetStandingOrderStatusResponse when
                             // it is not possible to determine ACTIVE/INACTIVE.
    CANCELED = 6;
    INITIATED = 7 [deprecated = true]; // TODO(RD-2723) remove
    PENDING_AUTHORIZATION = 8;
    DECLINED = 9;
  }
}

message Balance {
  string amount = 1;
  string available_amount = 2;
  string currency = 3; // ISO4217: 3 letter code such as "USD" or "EUR"
  int64 updated_at_ms = 4;
  repeated TypedBalance other_balances = 5; // optional

  message TypedBalance {
    string type = 1;
    string amount = 2;
    string currency = 3;
    int64 updated_at_ms = 4;
  }
}

message TransferPayload {
  string amount = 1;
  string currency = 2; // ISO4217: 3 letter code such as "USD" or "EUR"
  string reference_id = 3;
  string description = 4 [(io.token.proto.extensions.field.redact) = true]; // Optional description
  io.token.proto.common.transferinstructions.TransferInstructions.Metadata metadata = 5 [deprecated=true];
  repeated io.token.proto.common.transferinstructions.TransferEndpoint destinations = 6 [deprecated=true];
  repeated io.token.proto.common.transferinstructions.TransferDestination transfer_destinations = 7 [deprecated=true];
  string execution_date = 8; // Optional. ISO 8601: YYYY-MM-DD or YYYYMMDD.
  bool confirm_funds = 9;
  io.token.proto.common.transferinstructions.TransferInstructions transfer_instructions = 10;
  map<string, string> authorization_metadata = 11; // Optional authorization metadata as name-value map
  string remittance_reference = 12 [(io.token.proto.extensions.field.hash) = true];
  string creditor_bank_name = 13; // Optional. provided if IBAN used in payment method
  string creditor_bic = 14; // Optional. provided if IBAN used in payment method
  string certificate_owner_name = 15  [deprecated=true]; // never populated by the platform - certificate owner name is taken from the certificate itself (see PLT-3224)
  bool return_refund_account = 16;  // Returns a refundable account.
  bool disable_future_dated_payment_conversion = 17; // to disable a auto single immediate payment to future dated payment conversion
  string psu_id = 18;     // Optional, This is to help group payments initiated by the same PSU.
}

message StandingOrderPayload {
  string start_date = 1; // ISO 8601: YYYY-MM-DD or	YYYYMMDD
  string end_date = 2;   // Optional. ISO 8601: YYYY-MM-DD or	YYYYMMDD
  string frequency = 3;  // ISO 20022: DAIL, WEEK, TOWK, MNTH, TOMN, QUTR, SEMI, YEAR
  string amount = 4;     // Amount of each individual payment
  string currency = 5;   // ISO 4217, 3 letter currency code such as "USD" or "EUR".
  string reference_id = 6;
  string description = 7 [(io.token.proto.extensions.field.redact) = true]; // Optional description
  repeated io.token.proto.common.transferinstructions.TransferDestination destinations = 8 [deprecated=true];
  io.token.proto.common.transferinstructions.TransferInstructions.Metadata metadata = 9 [deprecated=true];
  io.token.proto.common.transferinstructions.TransferInstructions transfer_instructions = 10;
  map<string, string> authorization_metadata = 11; // Optional authorization metadata as name-value map
  string remittance_reference = 12 [(io.token.proto.extensions.field.hash) = true];
  string creditor_bank_name = 13; // Optional. provided if IBAN used in payment method
  string creditor_bic = 14; // Optional. provided if IBAN used in payment method
  string certificate_owner_name = 15; // The certificate owner's name. "Token" for type 1 members
  bool return_refund_account = 16; // Returns a refundable account.
}

message GetBalanceRequest {
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
}

message GetBalanceResponse {
  Balance balance = 1;
}

message GetTransactionsRequest {
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
  int32 limit = 5;
  string offset = 6;
  // Optional lower bound for a transaction's booking date as returned by the bank, in the format 'YYYY-MM-DD' (e.g. '2016-01-01').
  // If specified, then only transactions whose bank booking date is equal to or later than the given date will be regarded.
  string start_date = 7;
  // Optional upper bound for a transaction's booking date as returned by the bank (= original booking date), in the format 'YYYY-MM-DD' (e.g. '2016-01-01').
  // If specified, then only transactions whose bank booking date is equal to or earlier than the given date will be regarded.
  string end_date = 8;
}

message GetTransactionsResponse {
  repeated Transaction transactions = 1;
  string offset = 2;
}

message GetTransactionRequest {
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
  string transaction_id = 4;
  string state = 5; // Optional
}

message GetTransactionResponse {
  Transaction transaction = 1;
}

message GetStandingOrdersRequest {
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
  int32 limit = 5;
  string offset = 6;
}

message GetStandingOrdersResponse {
  repeated StandingOrder standing_orders = 1;
  string offset = 2;
}

message GetStandingOrderRequest {
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
  string standing_order_id = 4;
}

message GetStandingOrderResponse {
  StandingOrder standing_order = 1;
}

message GetAccountRequest {
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
}

message GetAccountResponse {
  Account account = 1;
}

message GetAccountDetailsRequest {
  option deprecated = true;
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
}

message GetAccountDetailsResponse {
  option deprecated = true;
  io.token.proto.common.account.AccountDetails account_details = 1;
}

message ConfirmFundsRequest {
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
  io.token.proto.common.money.Money money = 4;
}

message ConfirmFundsResponse {
  bool funds_available = 1;
}

message GetLinkingConsentRequest {
  string bank_id = 1;
  string consent_id = 2;
}

message GetLinkingConsentResponse {
  string consent = 1 [(io.token.proto.extensions.field.redact) = true];
}

message ResolveDestinationRequest {
  option deprecated = true; // AccountIdentifier is now populated in Account.AccountDetails - no need to resolve it anymore
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
}

message ResolveDestinationResponse {
  option deprecated = true; // AccountIdentifier is now populated in Account.AccountDetails - no need to resolve it anymore
  repeated io.token.proto.common.account.BankAccount destinations = 1 [deprecated=true];
  repeated io.token.proto.common.transferinstructions.TransferEndpoint endpoints = 2 [deprecated = true];
  repeated io.token.proto.common.transferinstructions.TransferDestination transfer_destinations = 3;
}

message TransferRequest {
  string bank_id = 1;
  string account_id = 2; // Optional, empty for appless flow
  string payment_state = 3 [(io.token.proto.extensions.field.redact) = true];
  TransferPayload payload = 4;
}

message TransferResponse {
  Transaction transaction = 1;
  string payment_id = 2;
  io.token.proto.common.transferinstructions.TransferEndpoint source = 3;
  io.token.proto.common.providerspecific.ProviderTransferDetails provider_details = 4;
  string status_reason_information = 5; // Optional: provides detailed information on the status reason
  io.token.proto.common.account.AccountIdentifier refund_account = 6 [deprecated=true];    // will be removed after PLT-2140
  io.token.proto.common.account.Refund refund = 7;    // Optional: a refund object will be returned
  bool continue_polling = 8; // force status polling despite the status.
  io.token.proto.common.transfer.Transfer.ScaStatus sca_status = 9; // Optional: a sca status object will be returned
}

message InitiatePaymentRequest {
  string bank_id = 1;
  string account_id = 2; // Optional, empty in appless flow
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];// Optional, empty in appless flow
  string oauth_state = 4;
  string member_state = 5; // Optional
  TransferPayload payload = 6;
  string callback_uri = 7;
  string initiation_state = 8; // Optional, only used when multiple initiations/redirects are needed
  map<string, string> credentials = 9 [(io.token.proto.extensions.field.redact) = true]; // Optional user credentialsmap<string, string> credentials
  bool use_credential_flow = 10; // to use Credential Flow explicitly with empty credentials
  string request_state = 11; //A state only adapter can recognize. Platform will persist it and share with adapters if it is present
}

message InitiatePaymentResponse {
  string member_state = 1;
  // encodedPaymentId, example: paymentIdFromBank&sepa-credit-transfers&uuid10chars
  string payment_id = 3;   // Optional; only required for OneStepPaymentService
  string request_state = 4; // state to be passed back to provider on callback
  string consent_id = 5;
  string payment_state = 6 [(io.token.proto.extensions.field.redact) = true];// Optional; only applicable to the one-step flow
  bool converted_to_future_dated_payment = 9; // whether payment is from a auto single immediate payment to future dated payment conversion
  string raw_payment_id = 10;  // paymentId returned by the bank

  oneof result {
    string redirect_url = 2; // URL for bank authorization
    io.token.proto.common.providerspecific.ScaStatus status = 7; // if SCA process has finished, whether it succeeded or not
    CredentialFields fields = 8; // if additional credentials are required
  }
}

message PaymentCallbackRequest {
  string bank_id = 1;
  map<string, string> parameters = 2 [(io.token.proto.extensions.field.redact) = true];
  string request_state = 3;
}

message PaymentCallbackResponse {
  string payment_state = 2 [(io.token.proto.extensions.field.redact) = true];
  bool funds_available = 4;
  Transaction.Status payment_status = 5;
  string status_reason_information = 6;
}

message CancelPaymentRequest {
  string bank_id = 1;
  string payment_state = 2 [(io.token.proto.extensions.field.redact) = true];
  string account_id = 3 [deprecated = true]; // Optional; empty in appless flow
}

message CancelPaymentResponse {
}

message GetPaymentConsentRequest {
  string bank_id = 1;
  string consent_id = 2;
}

message GetPaymentConsentResponse {
  string consent = 1 [(io.token.proto.extensions.field.redact) = true];
}

message GetPaymentStatusRequest {
  string bank_id = 1;
  string payment_id = 2;
  string payment_state = 3 [(io.token.proto.extensions.field.redact) = true];
  string payment_status = 4; // Optional, current raw status returned from the bank e.g. RCVD
}

message GetPaymentStatusResponse {
  Transaction.Status status = 1;
  string raw_status = 2;
  string status_reason_information = 3; // Optional: provides detailed information on the status reason
  bool continue_polling = 4; // force status polling despite the status.
}

message RefreshPaymentStateRequest {
  string bank_id = 1;
  string payment_state = 2 [(io.token.proto.extensions.field.redact) = true];
  string payment_id = 3;
}

message RefreshPaymentStateResponse {
  string payment_state = 1 [(io.token.proto.extensions.field.redact) = true];
}

message OneStepPaymentCallbackRequest {
  string bank_id = 1;
  map<string, string> parameters = 2 [(io.token.proto.extensions.field.redact) = true];
  string request_state = 3;
  bool return_refund_account = 4;  // Returns a refundable account.
}

message OneStepPaymentCallbackResponse {
  string payment_id = 1;
  Transaction.Status payment_status = 2;
  string initiation_state = 4; // Optional, only used when multiple initiations/redirects are needed
  io.token.proto.common.providerspecific.ProviderTransferDetails provider_details = 5;
  string status_reason_information = 6; // Optional: provides detailed information on the status reason
  io.token.proto.common.account.Refund refund = 8;    // Optional: a refund object will be returned
  bool continue_polling = 9; // force status polling despite the status.
  CredentialFields fields = 10; // if additional credentials are required
  io.token.proto.common.transfer.Transfer.ScaStatus sca_status = 11; // Optional: sca status object will be returned
  string payment_state = 12 [(io.token.proto.extensions.field.redact) = true]; //optional payment state
  //A state only adapter can recognize. If not provided by adapter (empty or unset)
  //and Platform has non-empty one in the DB already, Platform will not update it
  string request_state = 13;
}

message GetOneStepPaymentStatusRequest {
  string bank_id = 1;
  string payment_id = 2;
  string payment_state = 3 [(io.token.proto.extensions.field.redact) = true];
  string payment_status = 4; // Optional, current raw status returned from the bank e.g. RCVD
  io.token.proto.common.transfer.Transfer.ScaStatus sca_status = 5;
  string request_state = 6; //A state only adapter can recognize. Platform will persist it and share with adapters if it is present
}

message GetOneStepPaymentStatusResponse {
  Transaction.Status status = 1;
  string raw_status = 2;
  string status_reason_information = 3; // Optional: provides detailed information on the status reason
  bool continue_polling = 4; // force status polling despite the status.
  io.token.proto.common.transfer.Transfer.ScaStatus sca_status = 5;
  string request_state = 6; //A state only adapter can recognize. Platform will persist it and share with adapters if it is present
}

message CancelOneStepPaymentRequest {
  string bank_id = 1;
  string payment_id = 2;
  string payment_state = 3 [(io.token.proto.extensions.field.redact) = true];
}

message CancelOneStepPaymentResponse {
}

message InitiateStandingOrderRequest {
  string bank_id = 1;
  string account_id = 2; // Optional, empty in appless flow
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true]; // Optional, empty in appless flow
  string oauth_state = 4;
  string member_state = 5; // Optional
  StandingOrderPayload payload = 6;
  string callback_uri = 7;
  map<string, string> credentials = 9 [(io.token.proto.extensions.field.redact) = true]; // Optional user credentials
  bool use_credential_flow = 10; // to use Credential Flow explicitly with empty credentials
}

message InitiateStandingOrderResponse {
  string member_state = 1;
  string payment_id = 3; // Optional; only required in the one-step flow
  string request_state = 4; // state to be passed back to provider on callback
  string consent_id = 5;

  oneof result {
    string redirect_url = 2; // URL for bank authorization
    io.token.proto.common.providerspecific.ScaStatus status = 6; // if SCA process has finished, whether it succeeded or not
    CredentialFields fields = 7; // if additional credentials are required
  }
}

message StandingOrderCallbackRequest {
  string bank_id = 1;
  map<string, string> parameters = 2 [(io.token.proto.extensions.field.redact) = true];
  string request_state = 3;
}

message StandingOrderCallbackResponse {
  string payment_state = 1 [(io.token.proto.extensions.field.redact) = true];
}

message SubmitStandingOrderRequest {
  string bank_id = 1;
  string account_id = 2; // Optional, empty for appless flow
  string payment_state = 3 [(io.token.proto.extensions.field.redact) = true];
  StandingOrderPayload payload = 4;
}

message SubmitStandingOrderResponse {
  StandingOrder standing_order = 1;
  string payment_id = 2;  // Used to look up standing order status if no standing order ID is present
  io.token.proto.common.providerspecific.ProviderStandingOrderSubmissionDetails provider_details = 3;
  string status_reason_information = 4; // Optional: provides detailed information on the status reason
  io.token.proto.common.account.Refund refund = 6;    // Optional: a refund object will be returned
}

message GetStandingOrderStatusRequest {
  string bank_id = 1;
  string payment_id = 2;
  string payment_state = 3 [(io.token.proto.extensions.field.redact) = true];
}

message GetStandingOrderStatusResponse {
  StandingOrder.Status status = 1;
  string raw_status = 2;
  string status_reason_information = 3; // Optional: provides detailed information on the status reason
}

message OneStepStandingOrderCallbackRequest {
  string bank_id = 1;
  map<string, string> parameters = 2 [(io.token.proto.extensions.field.redact) = true];
  string request_state = 3;
  bool return_refund_account = 4;  // Returns a refundable account.
}

message OneStepStandingOrderCallbackResponse {
  string payment_id = 1;
  StandingOrder.Status status = 2;
  io.token.proto.common.providerspecific.ProviderStandingOrderSubmissionDetails provider_details = 3;
  string status_reason_information = 4; // Optional: provides detailed information on the status reason
  io.token.proto.common.account.Refund refund = 6;    // Optional: a refund object will be returned
}

message GetOneStepStandingOrderStatusRequest {
  string bank_id = 1;
  string payment_id = 2;
}

message GetOneStepStandingOrderStatusResponse {
  StandingOrder.Status status = 1;
  string raw_status = 2;
  string status_reason_information = 3; // Optional: provides detailed information on the status reason
}

message GetStandingOrderConsentRequest {
  string bank_id = 1;
  string consent_id = 2;
}

message GetStandingOrderConsentResponse {
  string consent = 1 [(io.token.proto.extensions.field.redact) = true];
}

message InitiateLinkingRequest {
  string bank_id = 1;
  string oauth_state = 2;
  string member_state = 3; // Optional
  string callback_uri = 4;
  oneof resource_list {
    io.token.proto.common.token.TokenRequestPayload.AccessBody.ResourceTypeList resource_type_list  = 6;
    io.token.proto.common.token.TokenRequestPayload.AccessBody.AccountResourceList account_resource_list = 7;
  }

  repeated ResourceType resources = 5 [deprecated = true];
  enum ResourceType {
    option deprecated = true;
    INVALID = 0;
    BALANCES = 1;
    TRANSACTIONS = 2;
    TRANSFER_DESTINATIONS = 3;
    FUNDS_CONFIRMATIONS = 4;
  }
  int64 consent_expiration = 8; // Optional
  map<string, string> credentials = 9 [(io.token.proto.extensions.field.redact) = true]; // Optional user credentials
  int32 transaction_history_days = 10; //Optional
  bool use_credential_flow = 11; // to use Credential Flow explicitly with empty credentials
  string psu_id = 12;     // Optional, This is to help group payments initiated by the same PSU.
  string request_state = 13; //A state only adapter can recognize. Platform will persist it and share with adapters if it is present
}

message InitiateLinkingResponse {
  string member_state = 1;
  string request_state = 3; // state to be passed back to provider on callback
  string consent_id = 4;

  oneof result {
    string redirect_url = 2; // URL for bank authorization
    io.token.proto.common.providerspecific.ScaStatus status = 5; // if SCA process has finished, whether it succeeded or not
    CredentialFields fields = 6; // if additional credentials are required
  }
}

message LinkingCallbackRequest {
  string bank_id = 1;
  map<string, string> parameters = 2 [(io.token.proto.extensions.field.redact) = true];
  string request_state = 3;
}

message LinkingCallbackResponse {
  repeated Account accounts = 1;
  CredentialFields fields = 2; // if additional credentials are required
  string consent_id = 3;
  //A state only adapter can recognize. If not provided by adapter (empty or unset)
  //and Platform has non-empty one in the DB already, Platform will not update it
  string request_state = 4;
}

message UnlinkAccountRequest {
  string bank_id = 1;
  string account_id = 2;
  string account_state = 3 [(io.token.proto.extensions.field.redact) = true];
  repeated string payment_states = 4; // outstanding payments associated with the account that should be cancelled
}

message UnlinkAccountResponse {
}

message RefreshAccountStateRequest {
  string bank_id = 1;
  string account_state = 2 [(io.token.proto.extensions.field.redact) = true];
}

message RefreshAccountStateResponse {
  string refreshed_account_state = 1;
}

message DeleteMemberRequest {
  string bank_id = 1;
  string member_state = 2;
  repeated string payment_states = 3; // optional: only used in appless flow
}

message DeleteMemberResponse {
}

message GetBankStatusRequest {
  string bank_id = 1;
}

message GetBankStatusResponse {
  io.token.proto.common.bankstatus.BankStatus status = 1;
}

message RegisterRequest {
  string bank_id = 1;
  io.token.proto.common.tsp.bankconfig.RegistrationPayload payload = 2;
}

message RegisterResponse {
  io.token.proto.common.tsp.bankconfig.BankConfig config = 1;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
// VRP messages
//
message VrpUpdate {
  // the list of fields should be kept in sync with io.token.proto.common.v2.openbanking.vrp.Vrp fields
  string bank_vrp_id = 1;
  Status provider_status = 2; // this field deliberately called different from what we have in Vrp
  string bank_vrp_status = 3;
  string status_reason_information = 4;
  io.token.proto.common.v2.common.RefundAccount refund_account = 5;
  enum Status {
    // the list of statuses should be kept in sync with io.token.proto.common.v2.openbanking.vrp.Vrp.Status values
    STATUS_UNCHANGED = 0; // adaptor does not want to update the status
    INITIATION_PROCESSING = 1; // The initiation is processing on the bank side
    INITIATION_COMPLETED = 2; // The initiation is successful on the bank side
    INITIATION_REJECTED = 3; // The initiation is rejected on the bank side
  }
}

message VrpConsentUpdate {
  // the list of fields should be kept in sync with io.token.proto.common.v2.openbanking.vrp.VrpConsent fields
  string bank_vrp_consent_id = 1;
  Status provider_status = 2; // this field deliberately called different from what we have in VrpConsent
  string bank_vrp_consent_status = 3;
  string status_reason_information = 4;
  // Required authentication operation to proceed with the consent, should be populated as part of the
  // CreateVrpConsent call and removed when the consent becomes authorized or rejected (ProcessConsentCallback call)
  io.token.proto.common.v2.openbanking.common.Authentication authentication = 5;
  enum Status {
    // the list of statuses should be kept in sync with io.token.proto.common.v2.openbanking.vrp.VrpConsent.Status values
    STATUS_UNCHANGED = 0; // adaptor does not want to update the status
    AUTHORIZED = 1; // the VRP consent has been successfully authorized on the bank side
    REJECTED = 2; // the VRP consent has been rejected on the bank side
    REVOKED = 3; // the VRP consent has been revoked by the PSU on the bank side
  }
}

// The list of fields should be kept in sync with io.token.proto.common.v2.openbanking.vrp.VrpConsentMetadata fields:
// fields that has to be updated by the provider should be listed in the update message
message VrpConsentMetadataUpdate {
  // A state only adapter can understand. Platform will persist it and share with adapters.
  string bank_state = 1;
  // When the bank state should be refreshed. Platform will call the refresh endpoint first.
  string bank_state_refresh_date_time = 2;
}

// The list of fields should be kept in sync with io.token.proto.common.v2.openbanking.vrp.VrpMetadata fields:
// fields that has to be updated by the provider should be listed in the update message
message VrpMetadataUpdate {
}

// request to create or update the consent or its metadata
message VrpConsentRequest {
  io.token.proto.common.v2.openbanking.vrp.VrpConsent consent = 1;
  io.token.proto.common.v2.openbanking.vrp.VrpConsentMetadata consent_metadata = 2;
  io.token.proto.common.tsp.bankconfig.BankConfig bankConfig = 3;
}
// response with the updated consent and or metadata
message VrpConsentResponse {
  VrpConsentUpdate consent_update = 1;
  VrpConsentMetadataUpdate consent_metadata_update = 2;
}

message ProcessVrpConsentCallbackRequest {
  map<string, string> parameters = 1 [(io.token.proto.extensions.field.redact) = true];
  io.token.proto.common.v2.openbanking.vrp.VrpConsent consent = 2;
  io.token.proto.common.v2.openbanking.vrp.VrpConsentMetadata consent_metadata = 3;
  io.token.proto.common.tsp.bankconfig.BankConfig bankConfig = 4;
}

// request to create or update VRP or its metadata (or get info on it)
message VrpRequest {
  io.token.proto.common.v2.openbanking.vrp.Vrp vrp = 1;
  io.token.proto.common.v2.openbanking.vrp.VrpMetadata vrp_metadata = 2;
  io.token.proto.common.v2.openbanking.vrp.VrpConsent consent = 3;
  io.token.proto.common.v2.openbanking.vrp.VrpConsentMetadata consent_metadata = 4;
  io.token.proto.common.tsp.bankconfig.BankConfig bankConfig = 5;
}

message ConfirmFundsVrpRequest {
  string amount = 1; // This amount will be utilized on the adapter side for the Instructed Amount.
  io.token.proto.common.v2.openbanking.vrp.VrpConsent vrp_consent = 2;
  io.token.proto.common.v2.openbanking.vrp.VrpConsentMetadata vrp_consent_metadata = 3;
  io.token.proto.common.tsp.bankconfig.BankConfig bank_config = 4;
}

// response with updated vrp and/or metadata
message VrpResponse {
  VrpUpdate vrp_update = 1;
  VrpMetadataUpdate vrp_metadata_update = 2;
}

message ConfirmFundsVrpResponse {
  bool funds_available = 1;
  VrpMetadataUpdate vrp_metadata_update = 2;
}

message RefreshVrpConsentBankStateResponse {
  VrpConsentMetadataUpdate consent_metadata_update = 1;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
// Payment V2 messages
//
message PaymentUpdate {
  // the list of fields should be kept in sync with io.token.proto.common.v2.openbanking.payment.Payment fields
  string bank_payment_id = 1;
  string bank_transaction_id = 2;
  Status provider_status = 3; // this field deliberately called different from what we have in Payment
  string bank_payment_status = 4;
  string status_reason_information = 5;
  // Required authentication operation to proceed with the payment, should be populated as part of the
  // InitiatePayment call and removed when the payment becomes processing or rejected
  io.token.proto.common.v2.openbanking.common.Authentication authentication = 6;
  io.token.proto.common.v2.common.RefundAccount refund_account = 7;
  bool converted_to_future_dated_payment = 8; // whether payment is converted from an auto single.
  string raw_bank_payment_id = 9;
  enum Status {
    // the list of statuses should be kept in sync with io.token.proto.common.v2.openbanking.payment.Status values
    STATUS_UNCHANGED = 0; // adaptor does not want to update the status
    INITIATION_PROCESSING = 1; // The initiation is processing on the bank side
    INITIATION_COMPLETED = 2; // The initiation is successful on the bank side
    INITIATION_REJECTED = 3; // The initiation is rejected on the bank side
    CANCELED = 4; // This happens in scheduled payments only. It might happened after INITIATION_COMPLETED before execution date.
    INITIATION_PENDING_REDIRECT_AUTH = 5;  // waiting for PSU to open the redirect url, redirect url is expected to be present in the authentication
    INITIATION_PENDING_EMBEDDED_AUTH = 6;  // waiting for PSU to provide the requested data, requested fields are expected to be present in the authentication
    INITIATION_PENDING_REDEMPTION = 7; // Token awaits TPP/PSU to redeem the entity.
    INITIATION_PENDING_DECOUPLED_AUTH = 8; // Token is polling status from the bank while PSU authenticates in a decoupled way
    INITIATION_REJECTED_INSUFFICIENT_FUNDS = 9; // The initiation is rejected by the bank due to insufficient funds
    INITIATION_DECLINED = 10; // The initiation is declined by the PSU
  }
}

// The list of fields should be kept in sync with io.token.proto.common.v2.openbanking.payment.Metadata fields:
// fields that has to be updated by the provider should be listed in the update message
message PaymentMetadataUpdate {
  // A state only adapter can understand. Platform will persist it and share with adapters.
  string bank_state = 1;
  // When the bank state should be refreshed. Platform will call the refresh endpoint first.
  string bank_state_refresh_date_time = 2;
  // If the platform should continue the payment update even tho the status is successful.
  bool continue_polling = 3;
  // Bank consent id if any.
  string consent_id = 4;
  // A state only adapter can understand. Platform will persist it and share with adapters.
  string request_state = 5;
  // It is for backwards compatibility purposes and it would not be needed when adaptors switch to the new provider-api
  string provider_payment_id = 6;
}

// request to create or update the payment or its metadata
message PaymentRequest {
  io.token.proto.common.v2.openbanking.payment.Payment payment = 1;
  io.token.proto.common.v2.openbanking.payment.Metadata payment_metadata = 2;
  io.token.proto.common.tsp.bankconfig.BankConfig bankConfig = 3;
}
// response with the updated payment and or metadata
message PaymentResponse {
  PaymentUpdate payment_update = 1;
  PaymentMetadataUpdate payment_metadata_update = 2;
}

message ProcessPaymentCallbackRequest {
  map<string, string> parameters = 1 [(io.token.proto.extensions.field.redact) = true];
  io.token.proto.common.v2.openbanking.payment.Payment payment = 2;
  io.token.proto.common.v2.openbanking.payment.Metadata payment_metadata = 3;
  io.token.proto.common.tsp.bankconfig.BankConfig bankConfig = 4;
}

message ProcessPaymentEmbeddedAuthRequest {
  map<string, string> embedded_auth = 1 [(io.token.proto.extensions.field.redact) = true];
  io.token.proto.common.v2.openbanking.payment.Payment payment = 2;
  io.token.proto.common.v2.openbanking.payment.Metadata payment_metadata = 3;
  io.token.proto.common.tsp.bankconfig.BankConfig bankConfig = 4;
}

message RefreshPaymentBankStateResponse {
  PaymentMetadataUpdate payment_metadata_update = 1;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
// Services
//
service AccountService {
  rpc GetBalance (GetBalanceRequest) returns (GetBalanceResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc GetTransactions (GetTransactionsRequest) returns (GetTransactionsResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc GetTransaction (GetTransactionRequest) returns (GetTransactionResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc GetStandingOrders (GetStandingOrdersRequest) returns (GetStandingOrdersResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc GetStandingOrder (GetStandingOrderRequest) returns (GetStandingOrderResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc ResolveDestination (ResolveDestinationRequest) returns (ResolveDestinationResponse) {
    option deprecated = true; // AccountIdentifier is now populated in Account.AccountDetails - no need to resolve it anymore
  }

  rpc GetAccountDetails(GetAccountDetailsRequest) returns (GetAccountDetailsResponse) {
    option deprecated = true;
  }

  rpc GetAccount(GetAccountRequest) returns (GetAccountResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc ConfirmFunds (ConfirmFundsRequest) returns (ConfirmFundsResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }
}

service TransferService {
  rpc Transfer (TransferRequest) returns (TransferResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc GetPaymentStatus (GetPaymentStatusRequest) returns (GetPaymentStatusResponse) {}

  rpc InitiatePayment (InitiatePaymentRequest) returns (InitiatePaymentResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc PaymentCallback (PaymentCallbackRequest) returns (PaymentCallbackResponse) {}

  rpc CancelPayment (CancelPaymentRequest) returns (CancelPaymentResponse) {}

  rpc GetPaymentConsent (GetPaymentConsentRequest) returns (GetPaymentConsentResponse) {}

  rpc RefreshPaymentState (RefreshPaymentStateRequest) returns (RefreshPaymentStateResponse) {}
}

service OneStepPaymentService {
  rpc InitiatePayment (InitiatePaymentRequest) returns (InitiatePaymentResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc PaymentCallback (OneStepPaymentCallbackRequest) returns (OneStepPaymentCallbackResponse) {}

  rpc GetPaymentStatus (GetOneStepPaymentStatusRequest) returns (GetOneStepPaymentStatusResponse) {}

  rpc CancelPayment (CancelOneStepPaymentRequest) returns (CancelOneStepPaymentResponse) {}

  rpc GetPaymentConsent (GetPaymentConsentRequest) returns (GetPaymentConsentResponse) {}

  rpc RefreshPaymentState (RefreshPaymentStateRequest) returns (RefreshPaymentStateResponse) {}
}

service StandingOrderService {
  rpc InitiateStandingOrder (InitiateStandingOrderRequest) returns (InitiateStandingOrderResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc StandingOrderCallback (StandingOrderCallbackRequest) returns (StandingOrderCallbackResponse) {}

  rpc SubmitStandingOrder (SubmitStandingOrderRequest) returns (SubmitStandingOrderResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc GetStandingOrderStatus (GetStandingOrderStatusRequest) returns (GetStandingOrderStatusResponse) {}

  rpc GetStandingOrderConsent (GetStandingOrderConsentRequest) returns (GetStandingOrderConsentResponse) {};
}

service OneStepStandingOrderService {
  rpc InitiateStandingOrder (InitiateStandingOrderRequest) returns (InitiateStandingOrderResponse) {
    option (io.token.proto.extensions.method.kafka_topic) = "metric_rpc_call";
  }

  rpc StandingOrderCallback (OneStepStandingOrderCallbackRequest) returns (OneStepStandingOrderCallbackResponse) {}

  rpc GetStandingOrderStatus (GetOneStepStandingOrderStatusRequest) returns (GetOneStepStandingOrderStatusResponse) {}

  rpc GetStandingOrderConsent (GetStandingOrderConsentRequest) returns (GetStandingOrderConsentResponse) {}
}

service LinkingService {
  rpc InitiateLinking (InitiateLinkingRequest) returns (InitiateLinkingResponse) {}

  rpc LinkingCallback (LinkingCallbackRequest) returns (LinkingCallbackResponse) {}

  rpc UnlinkAccount (UnlinkAccountRequest) returns (UnlinkAccountResponse) {}

  rpc RefreshAccountState (RefreshAccountStateRequest) returns (RefreshAccountStateResponse) {}

  rpc GetLinkingConsent (GetLinkingConsentRequest) returns (GetLinkingConsentResponse) {}
}

service MemberService {
  rpc DeleteMember (DeleteMemberRequest) returns (DeleteMemberResponse) {}
}

service StatusService {
  rpc GetBankStatus (GetBankStatusRequest) returns (GetBankStatusResponse) {}
}

service VrpService {
  rpc CreateVrpConsent (VrpConsentRequest) returns (VrpConsentResponse) {}

  rpc ProcessVrpConsentCallback (ProcessVrpConsentCallbackRequest) returns (VrpConsentResponse) {}

  rpc ConfirmFunds (VrpRequest) returns (ConfirmFundsVrpResponse) {}

  rpc RevokeVrpConsent (VrpConsentRequest) returns (VrpConsentResponse) {}

  rpc CreateVrp (VrpRequest) returns (VrpResponse) {}

  rpc UpdateVrp (VrpRequest) returns (VrpResponse) {}

  rpc RefreshVrpConsentBankState (VrpConsentRequest) returns (RefreshVrpConsentBankStateResponse) {}

  rpc ConfirmFundsVrp (ConfirmFundsVrpRequest) returns (ConfirmFundsVrpResponse) {}
}

service RegistrationService {
  rpc Register (RegisterRequest) returns (RegisterResponse) {}
}

io.token.proto.providerapi external/src/main/proto/providerapi/providersigning.proto


syntax = "proto3";
package io.token.proto.providerapi;

message SignRequest {
  string payload = 1;
  string tpp_id = 2;
  string bank_id = 3;
}

message SignResponse {
  Signature signature = 1;

  message Signature {
    string signature = 1;
    string signature_algorithm = 2;
  }
}

message SignJwtRequest {
  string jwt_payload = 1; // JSON string
  string tpp_id = 2;
  string bank_id = 3;
  // JSON string of additional headers other than 'alg' and 'kid'
  string additional_jwt_headers = 4;
}

message SignJwtResponse {
  string jws = 1;
}

service ProviderSigningService {
  rpc Sign (SignRequest) returns (SignResponse) {}
  rpc SignJwt (SignJwtRequest) returns (SignJwtResponse) {}
}

io.token.proto.providerapi external/src/main/proto/providerapi/secret.proto


syntax = "proto3";
package io.token.proto.providerapi;

import "extensions/field.proto";

message Payload {
  string id = 1;
  bytes data = 2;
}

message StoreSecretRequest {
  Payload payload = 1 [(io.token.proto.extensions.field.redact) = true];
}

message StoreSecretResponse {
  string secret_id = 1;
}

message GetSecretRequest {
  string secret_id = 1;
}

message GetSecretResponse {
  Payload payload = 1 [(io.token.proto.extensions.field.redact) = true];
}

service SecretService {
  rpc StoreSecret (StoreSecretRequest) returns (StoreSecretResponse) {}
  rpc GetSecret (GetSecretRequest) returns (GetSecretResponse) {}
}