syntax = "proto3";

package wix.payment.api.pay.v2;

import "google/api/annotations.proto";
import "wix/api/validations.proto";
import "wix/api/entity.proto";

option java_package = "com.wix.payment.api.pay.v2";

service ApplePayPaymentMethodService {

    option (wix.api.service_entity).message = "wix.payment.api.pay.v2.PaymentMethod";

    // Validate ApplePay merchant, returns response from Apple
    rpc ValidateMerchant(ValidateMerchantRequest) returns (ValidateMerchantResponse) {
        option (google.api.http) = {
            post: "/api/payments/v2/accounts/{account_id}/apple-pay-validate-merchant"
        };
    };

}

message ValidateMerchantRequest {
    // Account id for which merchant validation requested
    //
    // For Wix TPAs account_id is pair of `appId:instanceId`.
    string account_id                 = 1;

    // Validation url from Apple
    string validation_url             = 2 [(wix.api.format) = WEB_URL, (wix.api.minLength) = 1];

    // Site domain
    string domain                     = 3;
}

message ValidateMerchantResponse {
    // Apple response in base64
    string value = 1;
}
