pay 3.0.7 → 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pay might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/config/locales/en.yml +7 -0
- data/lib/pay/receipts.rb +24 -13
- data/lib/pay/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bbba4f642300e1894ca803cc17d0f14a59b864fa0d055497ab107f8c37ab6d
|
4
|
+
data.tar.gz: 28bfdb01793bfdc8dfbcdbd1a266c0c4dca82479273ae2af1ed5316f7b79474c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65e202f12303786496f3d21c630030d8a548f8a122615e832ebf9d7870e2dbd4fe58bac90a98f66809701c7ab154d725852a63bc1cdac44cf61233127104efb3
|
7
|
+
data.tar.gz: 7dc6eff7449c28fe8322d2a507e080a45e4f960ccf43020de73f75fdd818a7fbf477bac834c1ea815662e4f47a5a055a8adbf2427aaddd8f0d89a926f088511d
|
data/config/locales/en.yml
CHANGED
@@ -25,6 +25,13 @@ en:
|
|
25
25
|
additional_info: Additional Info
|
26
26
|
refunded: Refunded
|
27
27
|
paid: Paid
|
28
|
+
invoice:
|
29
|
+
amount: "Amount"
|
30
|
+
product: "Product"
|
31
|
+
quantity: "Quantity"
|
32
|
+
subtotal: "Subtotal"
|
33
|
+
total: "Total"
|
34
|
+
unit_price: "Unit Price"
|
28
35
|
errors:
|
29
36
|
action_required: "This payment attempt failed because additional action is required before it can be completed."
|
30
37
|
invalid_payment: "This payment attempt failed because of an invalid payment method."
|
data/lib/pay/receipts.rb
CHANGED
@@ -16,6 +16,16 @@ module Pay
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def receipt_pdf(**options)
|
19
|
+
line_items = [
|
20
|
+
[I18n.t("pay.receipt.date"), I18n.l(created_at, format: :long)],
|
21
|
+
[I18n.t("pay.receipt.account_billed"), "#{customer.customer_name} (#{customer.email})"],
|
22
|
+
[I18n.t("pay.receipt.product"), product],
|
23
|
+
[I18n.t("pay.receipt.amount"), number_to_currency(amount / 100.0)],
|
24
|
+
[I18n.t("pay.receipt.charged_to"), charged_to]
|
25
|
+
]
|
26
|
+
line_items << [I18n.t("pay.receipt.additional_info"), customer.owner.extra_billing_info] if customer.owner.extra_billing_info?
|
27
|
+
line_items << [I18n.t("pay.receipt.refunded"), number_to_currency(amount_refunded / 100.0)] if refunded?
|
28
|
+
|
19
29
|
defaults = {
|
20
30
|
id: id,
|
21
31
|
product: product,
|
@@ -40,15 +50,25 @@ module Pay
|
|
40
50
|
end
|
41
51
|
|
42
52
|
def invoice_pdf(**options)
|
53
|
+
bill_to = [owner.name]
|
54
|
+
bill_to += [owner.extra_billing_info] if owner.extra_billing_info?
|
55
|
+
bill_to += [nil, owner.email]
|
56
|
+
|
57
|
+
total = ActionController::Base.helpers.number_to_currency(amount / 100.0)
|
58
|
+
|
59
|
+
line_items = [
|
60
|
+
["<b>#{I18n.t("pay.invoice.product")}</b>", nil, "<b>#{I18n.t("pay.invoice.amount")}</b>"],
|
61
|
+
[product, nil, total],
|
62
|
+
[nil, I18n.t("pay.invoice.subtotal"), total],
|
63
|
+
[nil, I18n.t("pay.invoice.total"), total]
|
64
|
+
]
|
65
|
+
|
43
66
|
defaults = {
|
44
67
|
id: id,
|
45
68
|
issue_date: I18n.l(created_at, format: :long),
|
46
69
|
due_date: I18n.l(created_at, format: :long),
|
47
70
|
status: "<b><color rgb='#5eba7d'>#{I18n.t("pay.receipt.paid").upcase}</color></b>",
|
48
|
-
bill_to:
|
49
|
-
customer.customer_name,
|
50
|
-
customer.email
|
51
|
-
].compact,
|
71
|
+
bill_to: bill_to,
|
52
72
|
product: product,
|
53
73
|
company: {
|
54
74
|
name: Pay.business_name,
|
@@ -63,15 +83,6 @@ module Pay
|
|
63
83
|
end
|
64
84
|
|
65
85
|
def line_items
|
66
|
-
line_items = [
|
67
|
-
[I18n.t("pay.receipt.date"), I18n.l(created_at, format: :long)],
|
68
|
-
[I18n.t("pay.receipt.account_billed"), "#{customer.customer_name} (#{customer.email})"],
|
69
|
-
[I18n.t("pay.receipt.product"), product],
|
70
|
-
[I18n.t("pay.receipt.amount"), number_to_currency(amount / 100.0)],
|
71
|
-
[I18n.t("pay.receipt.charged_to"), charged_to]
|
72
|
-
]
|
73
|
-
line_items << [I18n.t("pay.receipt.additional_info"), customer.owner.extra_billing_info] if customer.owner.extra_billing_info?
|
74
|
-
line_items << [I18n.t("pay.receipt.refunded"), number_to_currency(amount_refunded / 100.0)] if refunded?
|
75
86
|
line_items
|
76
87
|
end
|
77
88
|
end
|
data/lib/pay/version.rb
CHANGED