Skip to content

Commit 0ab7ce4

Browse files
committed
Added refund api
1 parent 127f191 commit 0ab7ce4

File tree

8 files changed

+58
-6
lines changed

8 files changed

+58
-6
lines changed

haxe_libraries/http-status.hxml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# @install: lix --silent download haxelib:http-status#1.2.2 into http-status/1.2.2/haxelib
2-
-D http-status=1.2.2
3-
-cp ${HAXESHIM_LIBCACHE}/http-status/1.2.2/haxelib/src
1+
# @install: lix --silent download "https://github.com/kevinresol/http-status/archive/e1a738c048c47eac396262517e09ad787544ed25.tar.gz" into http-status/1.3.1/github/e1a738c048c47eac396262517e09ad787544ed25
2+
-D http-status=1.3.1
3+
-cp ${HAXESHIM_LIBCACHE}/http-status/1.3.1/github/e1a738c048c47eac396262517e09ad787544ed25/src

src/stripe/api/ChargeApi.hx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ import stripe.types.*;
55
interface ChargeApi {
66

77
@:get('/')
8-
@:consumes('application/x-www-form-urlencoded')
98
public function get():Charge;
109
}

src/stripe/api/RefundApi.hx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package stripe.api;
2+
3+
import stripe.types.*;
4+
5+
interface RefundApi {
6+
7+
@:get('/')
8+
public function get():Refund;
9+
}

src/stripe/api/RefundsApi.hx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package stripe.api;
2+
3+
import stripe.types.*;
4+
5+
interface RefundsApi {
6+
7+
@:sub('/$id')
8+
function ofId(id:String):RefundApi;
9+
10+
@:post('/')
11+
@:consumes('application/x-www-form-urlencoded')
12+
public function create(body:{
13+
charge:String,
14+
?amount:Int,
15+
?reason:String,
16+
?refund_application_fee:Bool,
17+
?reverse_transfer:Bool,
18+
// ?metadata:Metadata, // need support in tink_querystring
19+
}):Refund;
20+
}

src/stripe/api/StripeApi.hx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ interface StripeApi {
88
@:sub('/v1/charges')
99
var charges:ChargesApi;
1010

11+
@:sub('/v1/refund')
12+
var refund:RefundsApi;
13+
1114

1215
}

src/stripe/types/Charge.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import tink.json.Value;
44

55
typedef Charge = {
66
id:String,
7-
object:String,
7+
// object:String,
88
amount:Int,
99
amount_refunded:Int,
1010
?application:String,
1111
?application_fee:String,
1212
balance_transaction:String,
1313
captured:Bool,
1414
created:Timestamp,
15-
currency:String,
15+
currency:Currency,
1616
customer:String,
1717
?description:String,
1818
?destination:String,

src/stripe/types/Object.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ enum Object {
55
@:json({object: 'card'}) Card(card:Card);
66
@:json({object: 'subscription_item'}) SubscriptionItem(subscriptionItem:SubscriptionItem);
77
@:json({object: 'subscription'}) Subscription(subscription:Subscription);
8+
@:json({object: 'refund'}) Refund(refund:Refund);
9+
@:json({object: 'charge'}) Charge(charge:Charge);
810
}

src/stripe/types/Refund.hx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package stripe.types;
2+
3+
import tink.json.Value;
4+
5+
typedef Refund = {
6+
id:String,
7+
// object:String,
8+
amount:Int,
9+
balance_transaction:String,
10+
charge:String,
11+
created:Timestamp,
12+
currency:Currency,
13+
?failure_balance_transaction:String,
14+
?failure_reason:String,
15+
metadata:Metadata,
16+
?reason:String,
17+
?receipt_number:String,
18+
status:String,
19+
}

0 commit comments

Comments
 (0)