Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spv-827) switch contacts capability from brfc temporary pike to brfc pike.invite #616

19 changes: 14 additions & 5 deletions engine/contact_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,15 @@ func (p *paymailTestMock) setup(t *testing.T, domain string, supportPike bool) {
}

if supportPike {
wellKnownBody.Capabilities[paymail.BRFCPike] = fmt.Sprintf("%s/pike/{alias}@{domain.tld}", serverURL)
wellKnownBody.Capabilities[paymail.BRFCPike] = map[string]string{
paymail.BRFCPikeInvite: fmt.Sprintf("%s/contact/invite/{alias}@{domain.tld}", serverURL),
paymail.BRFCPikeOutputs: fmt.Sprintf("%s/pike/outputs/{alias}@{domain.tld}", serverURL),
}
}

wellKnownReponse, _ := json.Marshal(wellKnownBody)
wellKnonwResponder := httpmock.NewStringResponder(http.StatusOK, string(wellKnownReponse))
httpmock.RegisterResponder(http.MethodGet, wellKnownUrl, wellKnonwResponder)
wellKnownResponse, _ := json.Marshal(wellKnownBody)
wellKnownResponder := httpmock.NewStringResponder(http.StatusOK, string(wellKnownResponse))
httpmock.RegisterResponder(http.MethodGet, wellKnownUrl, wellKnownResponder)

p.serverUrl = serverURL
p.paymailClient = newTestPaymailClient(t, []string{domain})
Expand All @@ -341,7 +344,13 @@ func (p *paymailTestMock) mockPki(paymail, pubkey string) {
}

func (p *paymailTestMock) mockPike(paymail string) {
httpmock.RegisterResponder(http.MethodPost, fmt.Sprintf("%s/pike/%s", p.serverUrl, paymail),
httpmock.RegisterResponder(http.MethodPost, fmt.Sprintf("%s/contact/invite/%s", p.serverUrl, paymail),
httpmock.NewStringResponder(
200,
"{}",
),
)
httpmock.RegisterResponder(http.MethodPost, fmt.Sprintf("%s/pike/outputs%s", p.serverUrl, paymail),
httpmock.NewStringResponder(
200,
"{}",
Expand Down
12 changes: 6 additions & 6 deletions engine/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions engine/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion engine/paymail_servant.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *PaymailServant) AddContactRequest(ctx context.Context, receiverPaymail
return nil, ErrCapabilitiesPikeUnsupported
}

url := capabilities.GetString(paymail.BRFCPike, "")
url := capabilities.ExtractPikeInviteURL()
response, err := s.pc.AddContactRequest(url, receiverPaymail.Alias, receiverPaymail.Domain, contactData)
if err != nil {
return nil, fmt.Errorf("error during requesting new contact: %w", err)
Expand Down
12 changes: 6 additions & 6 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading