forked from uncloud/uncloud
Test Full cycle and fix some issues
This commit is contained in:
parent
1aeb757e22
commit
2e05ebbf67
19 changed files with 131 additions and 98 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
from uncloud_pay.models import Product, Order, ProductToRecurringPeriod
|
||||
from uncloud_pay.models import Product, Order, ProductToRecurringPeriod, Bill, Payment
|
||||
from .models import VMInstance
|
||||
|
||||
|
||||
def finalize_order(request, customer, billing_address,
|
||||
|
|
@ -17,4 +18,12 @@ def finalize_order(request, customer, billing_address,
|
|||
product = product,
|
||||
config=json.dumps(specs)
|
||||
)
|
||||
return order
|
||||
if order:
|
||||
bill = Bill.create_next_bill_for_order(order, ending_date=order.next_cancel_or_downgrade_date(order.starting_date))
|
||||
payment= Payment.withdraw(owner=request.user, amount=one_time_price, notes=f"BILL #{bill.id}")
|
||||
if payment:
|
||||
#Close the bill as the payment has been added
|
||||
VMInstance.create_instance(order)
|
||||
bill.close()
|
||||
|
||||
return order, bill
|
||||
Loading…
Add table
Add a link
Reference in a new issue