forked from bitcoin-sv/dpp-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Secure payment term support (relies on existing go-dpp changes) (bitc…
- Loading branch information
1 parent
bd857da
commit 288db72
Showing
9 changed files
with
199 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,12 @@ package noop | |
|
||
import ( | ||
"context" | ||
"github.com/libsv/go-dpp/modes/hybridmode" | ||
"time" | ||
|
||
"github.com/libsv/go-dpp/modes/hybridmode" | ||
|
||
"github.com/bitcoin-sv/dpp-proxy/log" | ||
"github.com/libsv/go-bk/envelope" | ||
"github.com/libsv/go-bt/v2/bscript" | ||
"github.com/libsv/go-dpp" | ||
"github.com/libsv/go-dpp/nativetypes" | ||
|
@@ -34,7 +36,7 @@ func (n *noop) PaymentCreate(ctx context.Context, args dpp.PaymentCreateArgs, re | |
func (n noop) PaymentTerms(ctx context.Context, args dpp.PaymentTermsArgs) (*dpp.PaymentTerms, error) { | ||
return &dpp.PaymentTerms{ | ||
Network: "noop", | ||
Version: "1.0", | ||
Version: "1.0", | ||
CreationTimestamp: time.Now().Unix(), | ||
ExpirationTimestamp: time.Now().Add(time.Hour).Unix(), | ||
Memo: "noop", | ||
|
@@ -52,24 +54,35 @@ func (n noop) PaymentTerms(ctx context.Context, args dpp.PaymentTermsArgs) (*dpp | |
"choiceID0": { | ||
"transactions": { | ||
hybridmode.TransactionTerms{ | ||
Outputs: hybridmode.Outputs{ NativeOutputs: []nativetypes.NativeOutput{ | ||
Outputs: hybridmode.Outputs{NativeOutputs: []nativetypes.NativeOutput{ | ||
{ | ||
Amount: 1000, | ||
Amount: 1000, | ||
LockingScript: func() *bscript.Script { | ||
ls, _ := bscript.NewFromHexString( | ||
"76a91493d0d43918a5df78f08cfe22a4e022846b6736c288ac") | ||
return ls | ||
}(), | ||
Description: "noop description", | ||
Description: "noop description", | ||
}, | ||
} }, | ||
Inputs: hybridmode.Inputs{}, | ||
}}, | ||
Inputs: hybridmode.Inputs{}, | ||
Policies: &hybridmode.Policies{}, | ||
}, | ||
}, | ||
}, | ||
|
||
}, | ||
}, | ||
}, nil | ||
} | ||
|
||
func (n noop) PaymentTermsSecure(ctx context.Context, args dpp.PaymentTermsArgs) (*envelope.JSONEnvelope, error) { | ||
var signature string = "3044022004cf2c5711f34f0de11fd316074c44ce0f63a525840aae0cf61d9dee04b317b102201a56049354449ddce3d8b059403b2d866662b6d1f9d0064365d420406d8d992d" | ||
var publicKey string = "03d546057437f3279f66d6ae91a03ffe1120ef3a79b8f186d9b6a8f1e0582ccf78" | ||
return &envelope.JSONEnvelope{ | ||
Payload: "{\"network\":\"mainnet\",\"creationTimestamp\":{},\"expirationTimestamp\":{},\"url\":\"https://localhost:3443/api/v1/payment/123456\",\"memo\":\"string\",\"beneficiary\":{\"name\":\"beneficiary 1\",\"avatar\":\"http://url.com\",\"extensions\":{\"email\":\"[email protected]\",\"address\":\"1 the street, the town, B1 1AA\",\"additionalProp1\":{}}},\"outputs\":[{\"amount\":100000,\"script\":\"76a91455b61be43392125d127f1780fb038437cd67ef9c88ac\",\"description\":\"paymentReference 123456\"}],\"fees\":{\"data\":{\"satoshis\":0,\"bytes\":0},\"standard\":{\"satoshis\":0,\"bytes\":0}},\"ancestry\":{\"format\":\"binary\",\"minDepth\":0}}", | ||
Signature: &signature, | ||
PublicKey: &publicKey, | ||
Encoding: "UTF-8", | ||
MimeType: "application/json", | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 64 additions & 12 deletions
76
vendor/github.com/libsv/go-dpp/mocks/payment_request_service.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.