Skip to content

Commit d139542

Browse files
committed
bump
1 parent 3d28e92 commit d139542

4 files changed

Lines changed: 50 additions & 1 deletion

File tree

OpenFlow/src/Messages/Message.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,11 @@ export class Message {
19591959
}
19601960

19611961
}
1962+
if (object == "invoices_upcoming") {
1963+
if (Util.IsNullEmpty(customerid)) throw new Error("Need customer to work with invoices_upcoming");
1964+
url = "https://api.stripe.com/v1/invoices/upcoming?customer=" + customerid;
1965+
}
1966+
19621967
var auth = "Basic " + new Buffer(Config.stripe_api_secret + ":").toString("base64");
19631968

19641969
var options = {
@@ -2008,10 +2013,11 @@ export class Message {
20082013
// msg.object != "checkout.sessions" && msg.object != "tax_rates"
20092014
// && msg.object != "subscriptions" && msg.object != "subscription_items"
20102015
// && msg.object != "usage_records") throw new Error("Access to " + msg.object + " is not allowed");
2011-
if (msg.object != "plans" && msg.object != "subscription_items") throw new Error("Access to " + msg.object + " is not allowed");
2016+
if (msg.object != "plans" && msg.object != "subscription_items" && msg.object != "invoices_upcoming") throw new Error("Access to " + msg.object + " is not allowed");
20122017

20132018
if (msg.object == "subscription_items" && msg.method != "POST") throw new Error("Access to " + msg.object + " is not allowed");
20142019
if (msg.object == "plans" && msg.method != "GET") throw new Error("Access to " + msg.object + " is not allowed");
2020+
if (msg.object == "invoices_upcoming" && msg.method != "GET") throw new Error("Access to " + msg.object + " is not allowed");
20152021
}
20162022
msg.payload = await this.Stripe(msg.method, msg.object, msg.id, msg.payload, msg.customerid);
20172023
} catch (error) {

OpenFlow/src/public/Controllers.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,6 +3125,7 @@ module openflow {
31253125
public supportplans: stripe_plan[] = [];
31263126
public supporthoursplans: stripe_plan[] = [];
31273127

3128+
public nextbill: string;
31283129

31293130
constructor(
31303131
public $scope: ng.IScope,
@@ -3319,6 +3320,13 @@ module openflow {
33193320
// this.loadData();
33203321
}
33213322
}
3323+
3324+
3325+
// if (this.stripe_customer && this.stripe_customer) {
3326+
// this.nextbill = (await this.api.Stripe<stripe_invoice>("GET", "invoices_upcoming", this.stripe_customer.id, null, null) as any);
3327+
// console.log(this.nextbill);
3328+
// }
3329+
33223330
} catch (error) {
33233331
console.error(error);
33243332
this.cardmessage = error;

OpenFlow/src/public/Message.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,38 @@ module openflow {
485485
public tax_ids: stripe_list<stripe_tax_id>;
486486
public items: stripe_list<stripe_subscription_item>;
487487
}
488+
export class stripe_period {
489+
public end: number;
490+
public start: number;
491+
}
492+
export class stripe_invoice_line extends stripe_base {
493+
public amount: number;
494+
public currency: string;
495+
public description: string;
496+
public discountable: boolean;
497+
public period: stripe_period;
498+
public subplan: stripeplan;
499+
public proration: boolean;
500+
public quantity: number;
501+
public type: string;
502+
public unique_id: string;
503+
}
504+
export class stripe_invoice extends stripe_base {
505+
public account_country: string;
506+
public account_name: string;
507+
public amount_due: number;
508+
public amount_paid: number;
509+
public amount_remaining: number;
510+
public application_fee_amount: number;
511+
public attempt_count: number;
512+
public attempted: boolean;
513+
public billing: string;
514+
public billing_reason: string;
515+
public collection_method: string;
516+
public currency: string;
517+
public customer: string;
518+
public lines: stripe_list<stripe_invoice_line>;
519+
}
488520

489521
export class Message {
490522
public id: string;

OpenFlow/src/public/Payment.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@
376376
Please contact us if you wish to have more users or click <a href
377377
ng-click="ctrl.CancelPlan(ctrl.openflowplan.id)">here to cancel</a> this subscription
378378
</div>
379+
<!-- <div ng-show="(ctrl.supportplan!=null || ctrl.openflowplan!=null) && ctrl.loading==false" class="alert alert-primary">
380+
{{ctrl.nextbill}}
381+
</div> -->
379382
<div ng-show="ctrl.cardmessage != ''"" class=" alert alert-danger" role="alert">{{ctrl.cardmessage}}</div>
380383
<div ng-show="ctrl.errormessage != ''"" class=" alert alert-danger" role="alert">{{ctrl.errormessage}}</div>
381384
<pre ng-show="ctrl.messages!=''" class=" alert alert-primary" role="alert">{{ ctrl.messages }}</pre>

0 commit comments

Comments
 (0)