forked from SeungpilPark/uEngine-bill
-
Notifications
You must be signed in to change notification settings - Fork 7
인보이스 템플릿 다국어화 메뉴얼
Seungpil Park edited this page May 20, 2017
·
1 revision
- 인보이스 노티피케이션 설정을 수행한다. 인보이스, 결제 성공 알림, 결제 실패 알림, 구독 취소 요청 알림, 구독 취소 알림 모두 이메일을 받도록 설정한다.
POST /rest/v1/notification_config
Request Example
curl -X POST
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'Authorization: <token>'
--header 'X-organization-id: c16ba270-2842-4339-ac35-91c225eaf185'
-d '{
"INVOICE": true,
"SUCCESSFUL_PAYMENT": true,
"FAILED_PAYMENT": true,
"SUBSCRIPTION_CANCELLATION_REQUESTED": true,
"SUBSCRIPTION_CANCELLATION_EFFECTIVE": true,
"PAYMENT_REFUND": true
}'
'http://localhost:18080/rest/v1/notification_config'
Reponse Example
201 Created
- 기본 저장되어있는 다국어 템플릿의 목록을 조회한다. 기본 저장은 en_US 언어이다.
GET /rest/v1/template
Request Example
curl -X GET
--header 'Accept: application/json'
--header 'Authorization: <token>'
--header 'X-organization-id: c16ba270-2842-4339-ac35-91c225eaf185'
'http://localhost:18080/rest/v1/template'
Reponse Example
{
"FAILED_PAYMENT": [
{
"record_id": 11,
"organization_id": "c16ba270-2842-4339-ac35-91c225eaf185",
"tenant_id": "5da34e77-c429-46f3-8678-e2c638455df4",
"tenant_record_id": 29,
"notification_type": "FAILED_PAYMENT",
"locale": "en_US",
"is_default": "Y",
"subject": "Failed Payment from {{organization.company_name}}",
"body": "<div>Oops, your most recent subscription payment was declined by your bank.</div>\n<div><br></div>\n<div>Here are the details of your declined payment:</div>\n<div><br></div>\n<div>invoiceNumber: {{invoice.invoiceNumber}}</div>\n<div>paymentDate: {{invoice.invoiceDate}}</div>\n<div><br></div>\n<div>{{#invoice.invoiceItems}}</div>\n<div>{{startDate}} {{planName}} : {{formattedAmount}}</div>\n<div>{{/invoice.invoiceItems}}</div>\n<div><br></div>\n<div>invoiceAmountPaid: {{invoice.formattedPaidAmount}}</div>\n<div>invoiceAmountTotal: {{invoice.formattedBalance}}</div>\n<div><br></div>\n<div><br></div>\n<div>billedTo:</div>\n<div>{{account.companyName}}</div>\n<div>{{account.name}}</div>\n<div>{{account.address1}}</div>\n<div>{{account.city}}, {{account.stateOrProvince}} {{account.postalCode}}</div>\n<div>{{account.country}}</div>\n<div><br></div>\n<div>You can update your payment information here:</div>\n<div>http://your-application/payment-method-update-page</div>\n<div><br></div>\n<div>To ensure continued access to {{organization.company_name}}, please update your billing information within 14 days\n of your last statement.\n</div>\n<div><br></div>\n<div>If you have any questions about your account, please reply to this email or contact {{organization.company_name}}\n Support at: {{organization.phone}}\n</div>",
"reg_dt": "2017-03-16"
}
],
"PAYMENT_REFUND": [
{
"record_id": 14,
"organization_id": "c16ba270-2842-4339-ac35-91c225eaf185",
"tenant_id": "5da34e77-c429-46f3-8678-e2c638455df4",
"tenant_record_id": 29,
"notification_type": "PAYMENT_REFUND",
"locale": "en_US",
"is_default": "Y",
"subject": "Refund Receipt from {{organization.company_name}}",
"body": "<div>*** Your payment has been refunded ***</div><div><br></div><div>We have processed a refund in the amount of {{payment.formattedAmount}}.</div><div><br></div><div>This refund will appear on your next credit card statement in approximately 3-5 business days.</div><div><br></div><div>If you have any questions about your account, please reply to this email or contact {{organization.company_name}} Support at: {{organization.phone}}</div>",
"reg_dt": "2017-03-16"
}
],
"SUBSCRIPTION_CANCELLATION_REQUESTED": [
{
"record_id": 12,
"organization_id": "c16ba270-2842-4339-ac35-91c225eaf185",
"tenant_id": "5da34e77-c429-46f3-8678-e2c638455df4",
"tenant_record_id": 29,
"notification_type": "SUBSCRIPTION_CANCELLATION_REQUESTED",
"locale": "en_US",
"is_default": "Y",
"subject": "Subscription Ended from {{organization.company_name}}",
"body": "<div>This email is to confirm your recent subscription cancellation. Your subscription will remain active until {{subscription.chargedThroughDate}}.</div><div><br></div><div>Here are the details of the subscription you canceled:</div><div><br></div><div>Description: {{subscription.lastActivePlan.name}}</div><div>Expires at: {{subscription.chargedThroughDate}}</div><div><br></div><div>At the end of your subscription, your {{organization.company_name}} account will be disabled and you will not be able to access {{organization.company_name}} on your iPad.</div><div><br></div><div>We're sorry to see you go. If you have any questions or if you have received this message in error, please reply to this email or contact {{organization.company_name}} Support at {{organization.phone}}.</div><div><br></div><div>To reactivate your subscription before it expires, or to view previous invoices, please see your account at: http://your-application.com/invoice-page</div><div><br></div><div>If you have any questions about your account, please reply to this email or contact {{organization.company_name}} Support at: {{organization.phone}}</div>",
"reg_dt": "2017-03-16"
}
],
"SUBSCRIPTION_CANCELLATION_EFFECTIVE": [
{
"record_id": 13,
"organization_id": "c16ba270-2842-4339-ac35-91c225eaf185",
"tenant_id": "5da34e77-c429-46f3-8678-e2c638455df4",
"tenant_record_id": 29,
"notification_type": "SUBSCRIPTION_CANCELLATION_EFFECTIVE",
"locale": "en_US",
"is_default": "Y",
"subject": "Subscription Canceled from {{organization.company_name}}",
"body": "<div>Your Personal subscription to {{organization.company_name}} was canceled earlier and has now ended.</div><div><br></div><div>Your access to {{organization.company_name}} on your iPad will end shortly.</div><div><br></div><div>We're sorry to see you go. To reactivate your {{organization.company_name}} service, contact the Support Team at {{organization.phone}}</div><div><br></div><div>If you have any questions about your account, please reply to this email or contact {{organization.company_name}} Support at: {{organization.phone}}</div>",
"reg_dt": "2017-03-16"
}
],
"SUCCESSFUL_PAYMENT": [
{
"record_id": 10,
"organization_id": "c16ba270-2842-4339-ac35-91c225eaf185",
"tenant_id": "5da34e77-c429-46f3-8678-e2c638455df4",
"tenant_record_id": 29,
"notification_type": "SUCCESSFUL_PAYMENT",
"locale": "en_US",
"is_default": "Y",
"subject": "Payment Confirmation from {{organization.company_name}}",
"body": "<div>This email confirms your recent payment.</div><div><br></div><div>Here are the details of your payment:</div><div><br></div><div>invoiceNumber: {{invoice.invoiceNumber}}</div><div>paymentDate: {{invoice.invoiceDate}}</div><div><br></div><div>{{#invoice.invoiceItems}}</div><div>{{startDate}} {{planName}} : {{formattedAmount}}</div><div>{{/invoice.invoiceItems}}</div><div><br></div><div>invoiceAmountPaid: {{invoice.formattedPaidAmount}}</div><div>invoiceAmountTotal: {{invoice.formattedBalance}}</div><div><br></div><div>billedTo:</div><div>{{account.companyName}}</div><div>{{account.name}}</div><div>{{account.address1}}</div><div>{{account.city}}, {{account.stateOrProvince}} {{account.postalCode}}</div><div>{{account.country}}</div><div><br></div><div>If you have any questions about your account, please reply to this email or contact {{organization.company_name}} Support at: {{organization.phone}}</div>",
"reg_dt": "2017-03-16"
}
],
"INVOICE": [
{
"record_id": 9,
"organization_id": "c16ba270-2842-4339-ac35-91c225eaf185",
"tenant_id": "5da34e77-c429-46f3-8678-e2c638455df4",
"tenant_record_id": 29,
"notification_type": "INVOICE",
"locale": "en_US",
"is_default": "Y",
"subject": "Invoice from {{organization.company_name}} (Invoice#: {{invoice.invoiceNumber}})",
"body": "<html>\n<head>\n <style type=\"text/css\">\n th {\n text-align: left;\n width: 225px;\n border-bottom: solid 2px black;\n }\n </style>\n</head>\n<body>\n<h1>invoiceTitle</h1>\n<table>\n <tr>\n <td rowspan=3 width=350px>Insert image here</td>\n <td width=100px/>\n <td width=225px/>\n <td width=225px/>\n </tr>\n <tr>\n <td/>\n <td align=right>invoiceDate</td>\n <td>{{invoice.formattedInvoiceDate}}</td>\n </tr>\n <tr>\n <td/>\n <td align=right>invoiceNumber</td>\n <td>{{invoice.invoiceNumber}}</td>\n </tr>\n <tr>\n <td>companyName</td>\n <td></td>\n <td align=right>accountOwnerName</td>\n <td>{{account.name}}</td>\n </tr>\n <tr>\n <td>companyAddress</td>\n <td/>\n <td/>\n <td>{{account.email}}</td>\n </tr>\n <tr>\n <td>companyCityProvincePostalCode</td>\n <td/>\n <td/>\n <td>{{account.phone}}</td>\n </tr>\n <tr>\n <td>companyCountry</td>\n <td/>\n <td/>\n <td/>\n </tr>\n</table>\n<br/>\n<br/>\n<br/>\n<table>\n <tr>\n <th>Description\n </td>\n <th>BundleName\n </td>\n <th>ServicePeriod\n </td>\n <th>Amount\n </td>\n </tr>\n {{#invoice.invoiceItems}}\n <tr>\n <td>{{description}}</td>\n <td>{{planName}}</td>\n <td>{{formattedStartDate}}{{#formattedEndDate}} - {{formattedEndDate}}{{/formattedEndDate}}</td>\n <td>{{invoice.currency}} {{amount}}</td>\n </tr>\n {{/invoice.invoiceItems}}\n <tr>\n <td colspan=4/>\n </tr>\n <tr>\n <td colspan=2/>\n <td align=right><strong>invoiceAmount</strong></td>\n <td align=right><strong>{{invoice.chargedAmount}}</strong></td>\n </tr>\n <tr>\n <td colspan=2/>\n <td align=right><strong>invoiceAmountPaid</strong></td>\n <td align=right><strong>{{invoice.paidAmount}}</strong></td>\n </tr>\n <tr>\n <td colspan=2/>\n <td align=right><strong>invoiceBalance</strong></td>\n <td align=right><strong>{{invoice.balance}}</strong></td>\n </tr>\n</table>\n</body>\n</html>",
"reg_dt": "2017-03-16"
}
]
}
- 결제 성공 한국어 이메일 템플릿을 업로드한다.
POST /rest/v1/template/{notificationType}/{locale}
Request Example
curl -X POST
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'Authorization: <token>'
--header 'X-organization-id: c16ba270-2842-4339-ac35-91c225eaf185'
-d '{
"record_id": 18,
"organization_id": "c16ba270-2842-4339-ac35-91c225eaf185",
"tenant_id": "5da34e77-c429-46f3-8678-e2c638455df4",
"tenant_record_id": 29,
"notification_type": "SUCCESSFUL_PAYMENT",
"locale": "ko_KR",
"is_default": "Y",
"subject": "결제 성공 알림 이메일입니다.",
"body": "<div>결제 성공 알림 이메일입니다.</div><div><br></div><div>다음은 송장 세부사항입니다.</div><div><br></div><div>invoiceNumber: {{invoice.invoiceNumber}}</div><div>paymentDate: {{invoice.invoiceDate}}</div><div><br></div><div>{{#invoice.invoiceItems}}</div><div>{{startDate}} {{planName}} : {{formattedAmount}}</div><div>{{/invoice.invoiceItems}}</div><div><br></div><div>invoiceAmountPaid: {{invoice.formattedPaidAmount}}</div><div>invoiceAmountTotal: {{invoice.formattedBalance}}</div><div><br></div><div>billedTo:</div><div>{{account.companyName}}</div><div>{{account.name}}</div><div>{{account.address1}}</div><div>{{account.city}}, {{account.stateOrProvince}} {{account.postalCode}}</div><div>{{account.country}}</div><div><br></div><div>If you have any questions about your account, please reply to this email or contact {{organization.company_name}} Support at: {{organization.phone}}</div><div><br></div><div>감사합니다.</div>",
"reg_dt": "2017-03-26"
}'
'http://localhost:18080/rest/v1/template/SUCCESSFUL_PAYMENT/en_US'
Reponse Example
201 Created
- 구매자 계정을 하나 생성하고, 구매자 계정의 언어를 한국어로 설정하고, 이메일 정보를 설정한다.
- 구매자 계정으로 하여금 임시 송장 결제 메뉴를 통해 결제 처리를 한다.
- 이메일을 통해 템플릿으로 등록된 인보이스가 발송되었는지 확인한다.