Support emailing quotes
This commit is contained in:
parent
b8447b28fe
commit
552e3d3cd8
|
|
@ -74,20 +74,28 @@ class CreditRepository {
|
||||||
return creditResponse.data;
|
return creditResponse.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> emailCredit(Credentials credentials, InvoiceEntity credit,
|
Future<InvoiceEntity> emailCredit(
|
||||||
EmailTemplate template, String subject, String body) async {
|
Credentials credentials,
|
||||||
|
InvoiceEntity credit,
|
||||||
|
EmailTemplate template,
|
||||||
|
String subject,
|
||||||
|
String body) async {
|
||||||
final data = {
|
final data = {
|
||||||
//'reminder': template == EmailTemplate.initial ? '' : template.toString(),
|
'entity': '${credit.entityType}',
|
||||||
'template': {
|
'entity_id': credit.id,
|
||||||
|
'template': 'email_template_$template',
|
||||||
'body': body,
|
'body': body,
|
||||||
'subject': subject,
|
'subject': subject,
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await webClient.post(
|
final dynamic response = await webClient.post(
|
||||||
credentials.url + '/email_invoice?invoice_id=${credit.id}',
|
credentials.url + '/emails', credentials.token,
|
||||||
credentials.token,
|
|
||||||
data: json.encode(data));
|
data: json.encode(data));
|
||||||
|
|
||||||
|
final InvoiceItemResponse invoiceResponse =
|
||||||
|
serializers.deserializeWith(InvoiceItemResponse.serializer, response);
|
||||||
|
|
||||||
|
return invoiceResponse.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<InvoiceEntity> uploadDocument(
|
Future<InvoiceEntity> uploadDocument(
|
||||||
|
|
|
||||||
|
|
@ -75,20 +75,24 @@ class QuoteRepository {
|
||||||
return quoteResponse.data;
|
return quoteResponse.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> emailQuote(Credentials credentials, InvoiceEntity quote,
|
Future<InvoiceEntity> emailQuote(Credentials credentials, InvoiceEntity quote,
|
||||||
EmailTemplate template, String subject, String body) async {
|
EmailTemplate template, String subject, String body) async {
|
||||||
final data = {
|
final data = {
|
||||||
//'reminder': template == EmailTemplate.initial ? '' : template.toString(),
|
'entity': '${quote.entityType}',
|
||||||
'template': {
|
'entity_id': quote.id,
|
||||||
|
'template': 'email_template_$template',
|
||||||
'body': body,
|
'body': body,
|
||||||
'subject': subject,
|
'subject': subject,
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await webClient.post(
|
final dynamic response = await webClient.post(
|
||||||
credentials.url + '/email_invoice?invoice_id=${quote.id}',
|
credentials.url + '/emails', credentials.token,
|
||||||
credentials.token,
|
|
||||||
data: json.encode(data));
|
data: json.encode(data));
|
||||||
|
|
||||||
|
final InvoiceItemResponse invoiceResponse =
|
||||||
|
serializers.deserializeWith(InvoiceItemResponse.serializer, response);
|
||||||
|
|
||||||
|
return invoiceResponse.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<InvoiceEntity> uploadDocument(
|
Future<InvoiceEntity> uploadDocument(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue