Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
B
bunqapi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sybren A. Stüvel
bunqapi
Commits
b81f61ec
Commit
b81f61ec
authored
May 25, 2019
by
Sybren A. Stüvel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added user/{user-id}/monetary-account/{account-id}/payment
parent
638aab16
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
1 deletion
+84
-1
monetary_account.go
monetary_account.go
+11
-0
payment.go
payment.go
+72
-0
request_inquiry.go
request_inquiry.go
+1
-1
No files found.
monetary_account.go
View file @
b81f61ec
...
...
@@ -74,6 +74,17 @@ type MonetaryAccountSetting struct {
RestrictionChat
string
`json:"restriction_chat"`
}
// IBANAlias returns the IBAN alias of the bank account.
func
(
mab
MonetaryAccountBank
)
IBANAlias
()
Alias
{
for
idx
:=
range
mab
.
Alias
{
if
mab
.
Alias
[
idx
]
.
Type
==
"IBAN"
{
return
mab
.
Alias
[
idx
]
}
}
return
Alias
{}
}
// AliasFields returns a log field for each alias of the account.
func
(
mab
MonetaryAccountBank
)
AliasFields
()
logrus
.
Fields
{
fields
:=
logrus
.
Fields
{}
...
...
payment.go
0 → 100644
View file @
b81f61ec
/* (c) 2019 dr. Sybren A. Stüvel
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
bunqapi
import
"fmt"
// Payment is defined by the bunq API.
type
Payment
struct
{
ID
int
`json:"id,omitempty"`
Created
*
Time
`json:"created,omitempty"`
Updated
*
Time
`json:"updated,omitempty"`
Amount
*
Amount
`json:"amount,omitempty"`
CounterpartyAlias
*
LabelMonetaryAccount
`json:"counterparty_alias,omitempty"`
Description
string
`json:"description,omitempty"`
MerchantReference
string
`json:"merchant_reference,omitempty"`
AllowBunqto
bool
`json:"allow_bunqto,omitempty"`
MonetaryAccountID
int
`json:"monetary_account_id,omitempty"`
Alias
*
LabelMonetaryAccount
`json:"alias,omitempty"`
SubType
string
`json:"sub_type,omitempty"`
BunqtoStatus
string
`json:"bunqto_status,omitempty"`
BunqtoSubStatus
string
`json:"bunqto_sub_status,omitempty"`
BunqtoShareURL
string
`json:"bunqto_share_url,omitempty"`
BunqtoExpiry
*
Time
`json:"bunqto_expiry,omitempty"`
BunqtoTimeResponded
*
Time
`json:"bunqto_time_responded,omitempty"`
BatchID
int
`json:"batch_id,omitempty"`
ScheduledID
int
`json:"scheduled_id,omitempty"`
AddressShipping
*
Address
`json:"address_shipping,omitempty"`
AddressBilling
*
Address
`json:"address_billing,omitempty"`
Geolocation
*
Geolocation
`json:"geolocation,omitempty"`
AllowChat
bool
`json:"allow_chat,omitempty"`
BalanceAfterMutation
*
Amount
`json:"balance_after_mutation,omitempty"`
// Not implemented:
// attachment
// request_reference_split_the_bill
}
// CreatePayment performs a payment.
func
(
c
*
Client
)
CreatePayment
(
fromMonetaryAccountID
int
,
payment
Payment
)
int
{
wrappedResponse
:=
wrappedIDResponse
{}
url
:=
fmt
.
Sprintf
(
"user/%d/monetary-account/%d/payment"
,
c
.
session
.
UserPerson
.
ID
,
fromMonetaryAccountID
)
errResp
:=
c
.
DoRequest
(
"POST"
,
url
,
&
payment
,
&
wrappedResponse
)
if
errResp
!=
nil
{
log
.
WithFields
(
errResp
.
LogFields
())
.
Fatal
(
"error performing payment request"
)
}
response
:=
idResponse
{}
MergeStructs
(
wrappedResponse
.
Response
,
&
response
)
log
.
WithField
(
"paymentID"
,
response
.
ID
.
ID
)
.
Info
(
"payment performed"
)
return
response
.
ID
.
ID
}
request_inquiry.go
View file @
b81f61ec
...
...
@@ -62,9 +62,9 @@ type RequestInquiry struct {
type
LabelMonetaryAccount
struct
{
Type
string
`json:"type,omitempty"`
Value
string
`json:"value,omitempty"`
Name
string
`json:"name,omitempty"`
IBAN
string
`json:"iban,omitempty"`
DisplayName
string
`json:"display_name,omitempty"`
Avatar
*
Avatar
`json:"avatar,omitempty"`
LabelUser
*
LabelUser
`json:"label_user,omitempty"`
Country
string
`json:"country,omitempty"`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment