4
4
from general_helpers import datestr_to_python
5
5
from general_helpers import get_last_day_month
7
from openstudio import Invoice, Order, Customer, OSMail
7
from openstudio import Invoice, Order, Customer, CustomerSubscription, OSMail
9
9
from decimal import Decimal, ROUND_HALF_UP
205
205
if valid_mandate:
206
# Do a recurring payment
207
recurring_type = 'recurring'
209
payment = mollie.payments.create({
210
'amount': invoice_amounts.TotalPriceVAT,
211
'customerId': mollie_customer_id,
212
'recurringType': recurring_type, # important
213
'description': description,
215
'invoice_id': invoice.invoice.id,
216
'customers_orders_id': 'invoice' # This lets the webhook function know it's dealing with an invoice
220
redirect(URL('shop', 'complete', vars={'iID':iID}))
221
except Mollie.API.Error as e:
222
return 'API call failed: ' + e.message
206
# Do a normal payment, probably an automatic payment failed somewhere in the process
207
# and customer should pay manually now
208
recurring_type = None
210
# payment = mollie.payments.create({
211
# 'amount': invoice_amounts.TotalPriceVAT,
212
# 'customerId': mollie_customer_id,
213
# 'recurringType': recurring_type, # important
214
# 'description': description,
216
# 'invoice_id': invoice.invoice.id,
217
# 'customers_orders_id': 'invoice' # This lets the webhook function know it's dealing with an invoice
221
# redirect(URL('shop', 'complete', vars={'iID':iID}))
222
# except Mollie.API.Error as e:
223
# return 'API call failed: ' + e.message
224
225
print recurring_type
345
346
payment_methods_id = 100,
349
cs = CustomerSubscription(csID)
350
iID = cs.create_invoice_for_month(TODAY_LOCAL.year, TODAY_LOCAL.month)
348
352
# # create invoice linked to subscription for first subscription term to know the right amount.
349
353
# SubscriptionYear = TODAY_LOCAL.year
350
354
# SubscriptionMonth = TODAY_LOCAL.month