File tree Expand file tree Collapse file tree 5 files changed +75
-3
lines changed
clients/rev1/curl/account_credit Expand file tree Collapse file tree 5 files changed +75
-3
lines changed Original file line number Diff line number Diff line change @@ -60,4 +60,18 @@ Returns a list of all accounts for the specified ``Customer``.
60
60
61
61
.. container :: code-white
62
62
63
- .. dcode :: scenario account_list_customer
63
+ .. dcode :: scenario account_list_customer
64
+
65
+
66
+ Credit an Account
67
+ --------------------
68
+
69
+ Move funds to an account.
70
+
71
+ .. cssclass :: dl-horizontal dl-params
72
+
73
+ .. dcode :: form credits.create
74
+
75
+ .. container :: code-white
76
+
77
+ .. dcode :: scenario account_credit
Original file line number Diff line number Diff line change @@ -84,6 +84,20 @@ Send money to a bank account.
84
84
.. dcode :: scenario credit_order
85
85
86
86
87
+ Create a Credit to an Account
88
+ ------------------------------
89
+
90
+ Move funds to an account.
91
+
92
+ .. cssclass :: dl-horizontal dl-params
93
+
94
+ .. dcode :: form credits.create
95
+
96
+ .. container :: code-white
97
+
98
+ .. dcode :: scenario account_credit
99
+
100
+
87
101
Fetch a Credit
88
102
-----------------
89
103
Original file line number Diff line number Diff line change 9558
9558
"OPTIONS",
9559
9559
"GET"
9560
9560
]
9561
- },
9561
+ },
9562
+ {
9563
+ "path": "/accounts/:account_id/credits",
9564
+ "description": "",
9565
+ "name": "credits.create",
9566
+ "methods": [
9567
+ "POST",
9568
+ "OPTIONS"
9569
+ ]
9570
+ },
9562
9571
{
9563
9572
"path": "/credits/:credit_id/reversals",
9564
9573
"description": "",
11963
11972
"sortable": true,
11964
11973
"description": "String fields.",
11965
11974
"name": "type"
11966
- },
11975
+ }
11967
11976
],
11968
11977
"name": "AccountsIndex"
11969
11978
}
Original file line number Diff line number Diff line change
1
+ <%namespace file =' /_main.mako' name =' main' />
2
+ <% main.curl_create_template(' credits.create' , sel = [' account_id' ]) %>
Original file line number Diff line number Diff line change
1
+ import requests
2
+
3
+ debit = json .loads (
4
+ storage ['debit_order' ]['response' ]
5
+ )
6
+
7
+ order_href = debit ['links' ]['debits.order' ].replace ('{debits.order}' , debit ['debits' ][0 ]['links' ]['order' ])
8
+
9
+ order = requests .get (ctx .storage ['api_location' ] + order_href ,
10
+ headers = {'Accept-Type' : ctx .storage .get ('accept_type' , '*/*' )},
11
+ auth = (ctx .storage ['secret' ], '' )).json ()
12
+
13
+ order_merchant_accounts_href = "/customers/" + order ['orders' ][0 ]['links' ]['merchant' ] \
14
+ + "/accounts?type%5Bcontains%5D=payable"
15
+
16
+ accounts = requests .get (ctx .storage ['api_location' ] + order_merchant_accounts_href ,
17
+ headers = {'Accept-Type' : ctx .storage .get ('accept_type' , '*/*' )},
18
+ auth = (ctx .storage ['secret' ], '' )).json ()
19
+
20
+ account_credits_href = accounts ['links' ]['accounts.credits' ].replace ('{accounts.id}' , accounts ['accounts' ][0 ]['id' ])
21
+
22
+ request = {
23
+ 'uri' : account_credits_href ,
24
+ 'payload' : {
25
+ 'amount' : 1000 ,
26
+ 'description' : 'A simple credit' ,
27
+ 'appears_on_statement_as' : 'ThingsCo' ,
28
+ 'order' : order ['orders' ][0 ]['href' ],
29
+ "meta" : {
30
+ "rating" : 8
31
+ }
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments