chargebee 2.58.0 → 2.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +314 -0
- data/Gemfile +4 -3
- data/Gemfile.lock +18 -14
- data/Makefile +112 -0
- data/README.md +6 -0
- data/VERSION +1 -0
- data/chargebee.gemspec +17 -3
- data/lib/chargebee/errors.rb +12 -3
- data/lib/chargebee/models/comment.rb +1 -1
- data/lib/chargebee/models/coupon_code.rb +1 -0
- data/lib/chargebee/models/credit_note.rb +25 -24
- data/lib/chargebee/models/credit_note_estimate.rb +10 -10
- data/lib/chargebee/models/currency.rb +2 -2
- data/lib/chargebee/models/customer.rb +4 -1
- data/lib/chargebee/models/discount.rb +1 -1
- data/lib/chargebee/models/einvoice.rb +10 -0
- data/lib/chargebee/models/entitlement_override.rb +2 -2
- data/lib/chargebee/models/gateway_error_detail.rb +1 -1
- data/lib/chargebee/models/gift.rb +1 -0
- data/lib/chargebee/models/hosted_page.rb +1 -0
- data/lib/chargebee/models/impacted_customer.rb +14 -0
- data/lib/chargebee/models/invoice.rb +40 -33
- data/lib/chargebee/models/invoice_estimate.rb +14 -14
- data/lib/chargebee/models/offer_event.rb +16 -0
- data/lib/chargebee/models/offer_fulfillment.rb +36 -0
- data/lib/chargebee/models/omnichannel_one_time_order.rb +25 -0
- data/lib/chargebee/models/omnichannel_one_time_order_item.rb +11 -0
- data/lib/chargebee/models/omnichannel_subscription.rb +9 -4
- data/lib/chargebee/models/omnichannel_subscription_item.rb +2 -2
- data/lib/chargebee/models/omnichannel_subscription_item_offer.rb +12 -0
- data/lib/chargebee/models/omnichannel_transaction.rb +9 -1
- data/lib/chargebee/models/order.rb +2 -1
- data/lib/chargebee/models/payment_intent.rb +6 -2
- data/lib/chargebee/models/personalized_offer.rb +26 -0
- data/lib/chargebee/models/pricing_page_session.rb +2 -0
- data/lib/chargebee/models/promotional_credit.rb +1 -1
- data/lib/chargebee/models/quote.rb +11 -11
- data/lib/chargebee/models/quote_line_group.rb +10 -10
- data/lib/chargebee/models/quoted_charge.rb +5 -1
- data/lib/chargebee/models/quoted_delta_ramp.rb +14 -0
- data/lib/chargebee/models/quoted_ramp.rb +1 -1
- data/lib/chargebee/models/quoted_subscription.rb +2 -2
- data/lib/chargebee/models/ramp.rb +7 -3
- data/lib/chargebee/models/recorded_purchase.rb +5 -1
- data/lib/chargebee/models/subscription.rb +4 -3
- data/lib/chargebee/models/subscription_entitlements_created_detail.rb +10 -0
- data/lib/chargebee/models/subscription_entitlements_updated_detail.rb +10 -0
- data/lib/chargebee/models/subscription_estimate.rb +1 -1
- data/lib/chargebee/models/transaction.rb +3 -1
- data/lib/chargebee/models/usage_file.rb +5 -5
- data/lib/chargebee/models/webhook_endpoint.rb +52 -0
- data/lib/chargebee/{nativeRequest.rb → native_request.rb} +17 -9
- data/lib/chargebee/request.rb +2 -2
- data/lib/chargebee/result.rb +103 -18
- data/lib/chargebee.rb +10 -2
- data/lib/ssl/ca-certs.crt +50 -0
- data/spec/chargebee/native_request_spec.rb +13 -0
- metadata +22 -5
|
@@ -11,8 +11,8 @@ module ChargeBee
|
|
|
11
11
|
|
|
12
12
|
attr_accessor :id, :item_id_at_source, :item_parent_id_at_source, :status, :auto_renew_status,
|
|
13
13
|
:current_term_start, :current_term_end, :expired_at, :expiration_reason, :cancelled_at, :cancellation_reason,
|
|
14
|
-
:grace_period_expires_at, :resumes_at, :has_scheduled_changes, :resource_version, :
|
|
15
|
-
:linked_item
|
|
14
|
+
:grace_period_expires_at, :resumes_at, :has_scheduled_changes, :resource_version, :omnichannel_subscription_item_offers,
|
|
15
|
+
:upcoming_renewal, :linked_item
|
|
16
16
|
|
|
17
17
|
# OPERATIONS
|
|
18
18
|
#-----------
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module ChargeBee
|
|
2
|
+
class OmnichannelSubscriptionItemOffer < Model
|
|
3
|
+
|
|
4
|
+
attr_accessor :id, :offer_id_at_source, :category, :category_at_source, :type, :type_at_source,
|
|
5
|
+
:discount_type, :duration, :percentage, :price_currency, :price_units, :price_nanos, :offer_term_start,
|
|
6
|
+
:offer_term_end, :resource_version
|
|
7
|
+
|
|
8
|
+
# OPERATIONS
|
|
9
|
+
#-----------
|
|
10
|
+
|
|
11
|
+
end # ~OmnichannelSubscriptionItemOffer
|
|
12
|
+
end # ~ChargeBee
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
module ChargeBee
|
|
2
2
|
class OmnichannelTransaction < Model
|
|
3
3
|
|
|
4
|
+
class LinkedOmnichannelSubscription < Model
|
|
5
|
+
attr_accessor :omnichannel_subscription_id
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class LinkedOmnichannelOneTimeOrder < Model
|
|
9
|
+
attr_accessor :omnichannel_one_time_order_id
|
|
10
|
+
end
|
|
11
|
+
|
|
4
12
|
attr_accessor :id, :id_at_source, :app_id, :price_currency, :price_units, :price_nanos, :type,
|
|
5
|
-
:transacted_at, :created_at, :resource_version
|
|
13
|
+
:transacted_at, :created_at, :resource_version, :linked_omnichannel_subscriptions, :linked_omnichannel_one_time_orders
|
|
6
14
|
|
|
7
15
|
# OPERATIONS
|
|
8
16
|
#-----------
|
|
@@ -6,7 +6,7 @@ module ChargeBee
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
class ShippingAddress < Model
|
|
9
|
-
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
|
9
|
+
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
class BillingAddress < Model
|
|
@@ -128,6 +128,7 @@ module ChargeBee
|
|
|
128
128
|
Request.send_list_request('get', uri_path("orders"), params, env, headers,nil, false, jsonKeys, options)
|
|
129
129
|
end
|
|
130
130
|
|
|
131
|
+
# @deprecated This method is deprecated and will be removed in a future version.
|
|
131
132
|
def self.orders_for_invoice(id, params={}, env=nil, headers={})
|
|
132
133
|
jsonKeys = {
|
|
133
134
|
}
|
|
@@ -2,12 +2,16 @@ module ChargeBee
|
|
|
2
2
|
class PaymentIntent < Model
|
|
3
3
|
|
|
4
4
|
class PaymentAttempt < Model
|
|
5
|
-
attr_accessor :id, :status, :payment_method_type, :id_at_gateway, :error_code, :error_text, :created_at, :modified_at, :error_detail
|
|
5
|
+
attr_accessor :id, :status, :payment_method_type, :id_at_gateway, :error_code, :error_text, :checkout_details, :created_at, :modified_at, :error_detail
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class PaymentAttempt < Model
|
|
9
|
+
attr_accessor :id, :status, :payment_method_type, :id_at_gateway, :error_code, :error_text, :checkout_details, :created_at, :modified_at, :error_detail
|
|
6
10
|
end
|
|
7
11
|
|
|
8
12
|
attr_accessor :id, :status, :currency_code, :amount, :gateway_account_id, :expires_at, :reference_id,
|
|
9
13
|
:payment_method_type, :success_url, :failure_url, :created_at, :modified_at, :resource_version,
|
|
10
|
-
:updated_at, :customer_id, :gateway, :active_payment_attempt, :business_entity_id
|
|
14
|
+
:updated_at, :customer_id, :gateway, :active_payment_attempt, :payment_attempts, :business_entity_id
|
|
11
15
|
|
|
12
16
|
# OPERATIONS
|
|
13
17
|
#-----------
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module ChargeBee
|
|
2
|
+
class PersonalizedOffer < Model
|
|
3
|
+
|
|
4
|
+
class Content < Model
|
|
5
|
+
attr_accessor :title, :description
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class Option < Model
|
|
9
|
+
attr_accessor :id, :label, :processing_type, :processing_layout, :redirect_url
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attr_accessor :id, :offer_id, :content, :options
|
|
13
|
+
|
|
14
|
+
# OPERATIONS
|
|
15
|
+
#-----------
|
|
16
|
+
|
|
17
|
+
def self.personalized_offers(params, env=nil, headers={})
|
|
18
|
+
jsonKeys = {
|
|
19
|
+
:custom => 0,
|
|
20
|
+
}
|
|
21
|
+
options = {}
|
|
22
|
+
Request.send('post', uri_path("personalized_offers"), params, env, headers, "grow", true, jsonKeys, options)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end # ~PersonalizedOffer
|
|
26
|
+
end # ~ChargeBee
|
|
@@ -8,6 +8,7 @@ module ChargeBee
|
|
|
8
8
|
|
|
9
9
|
def self.create_for_new_subscription(params, env=nil, headers={})
|
|
10
10
|
jsonKeys = {
|
|
11
|
+
:custom => 0,
|
|
11
12
|
}
|
|
12
13
|
options = {
|
|
13
14
|
:isIdempotent => true
|
|
@@ -17,6 +18,7 @@ module ChargeBee
|
|
|
17
18
|
|
|
18
19
|
def self.create_for_existing_subscription(params, env=nil, headers={})
|
|
19
20
|
jsonKeys = {
|
|
21
|
+
:custom => 0,
|
|
20
22
|
}
|
|
21
23
|
options = {
|
|
22
24
|
:isIdempotent => true
|
|
@@ -2,7 +2,7 @@ module ChargeBee
|
|
|
2
2
|
class PromotionalCredit < Model
|
|
3
3
|
|
|
4
4
|
attr_accessor :id, :customer_id, :type, :amount_in_decimal, :amount, :currency_code, :description,
|
|
5
|
-
:credit_type, :reference, :closing_balance, :done_by, :created_at
|
|
5
|
+
:credit_type, :reference, :closing_balance, :done_by, :created_at, :business_entity_id
|
|
6
6
|
|
|
7
7
|
# OPERATIONS
|
|
8
8
|
#-----------
|
|
@@ -5,28 +5,28 @@ module ChargeBee
|
|
|
5
5
|
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :unit_amount_in_decimal, :quantity_in_decimal, :amount_in_decimal, :discount_amount, :item_level_discount_amount, :metered, :is_percentage_pricing, :reference_line_item_id, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
class
|
|
9
|
-
attr_accessor :
|
|
8
|
+
class LineItemTier < Model
|
|
9
|
+
attr_accessor :line_item_id, :starting_unit, :ending_unit, :quantity_used, :unit_amount, :starting_unit_in_decimal, :ending_unit_in_decimal, :quantity_used_in_decimal, :unit_amount_in_decimal, :pricing_type, :package_size
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
class LineItemDiscount < Model
|
|
13
13
|
attr_accessor :line_item_id, :discount_type, :coupon_id, :entity_id, :discount_amount
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
class Tax < Model
|
|
17
|
-
attr_accessor :name, :amount, :description
|
|
18
|
-
end
|
|
19
|
-
|
|
20
16
|
class LineItemTax < Model
|
|
21
17
|
attr_accessor :line_item_id, :tax_name, :tax_rate, :date_to, :date_from, :prorated_taxable_amount, :is_partial_tax_applied, :is_non_compliance_tax, :taxable_amount, :tax_amount, :tax_juris_type, :tax_juris_name, :tax_juris_code, :tax_amount_in_local_currency, :local_currency_code
|
|
22
18
|
end
|
|
23
19
|
|
|
24
|
-
class
|
|
25
|
-
attr_accessor :
|
|
20
|
+
class Discount < Model
|
|
21
|
+
attr_accessor :amount, :description, :line_item_id, :entity_type, :discount_type, :entity_id, :coupon_set_code
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class Tax < Model
|
|
25
|
+
attr_accessor :name, :amount, :description
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
class ShippingAddress < Model
|
|
29
|
-
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
|
29
|
+
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
class BillingAddress < Model
|
|
@@ -36,8 +36,8 @@ module ChargeBee
|
|
|
36
36
|
attr_accessor :id, :name, :po_number, :customer_id, :subscription_id, :invoice_id, :status,
|
|
37
37
|
:operation_type, :vat_number, :price_type, :valid_till, :date, :total_payable, :charge_on_acceptance,
|
|
38
38
|
:sub_total, :total, :credits_applied, :amount_paid, :amount_due, :version, :resource_version,
|
|
39
|
-
:updated_at, :vat_number_prefix, :line_items, :
|
|
40
|
-
:
|
|
39
|
+
:updated_at, :vat_number_prefix, :line_items, :line_item_tiers, :line_item_discounts, :line_item_taxes,
|
|
40
|
+
:discounts, :taxes, :tax_category, :currency_code, :notes, :shipping_address, :billing_address,
|
|
41
41
|
:contract_term_start, :contract_term_end, :contract_term_termination_fee, :business_entity_id,
|
|
42
42
|
:deleted, :total_contract_value, :total_discount
|
|
43
43
|
|
|
@@ -5,25 +5,25 @@ module ChargeBee
|
|
|
5
5
|
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :unit_amount_in_decimal, :quantity_in_decimal, :amount_in_decimal, :discount_amount, :item_level_discount_amount, :metered, :is_percentage_pricing, :reference_line_item_id, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
class Discount < Model
|
|
9
|
-
attr_accessor :amount, :description, :entity_type, :discount_type, :entity_id, :coupon_set_code
|
|
10
|
-
end
|
|
11
|
-
|
|
12
8
|
class LineItemDiscount < Model
|
|
13
9
|
attr_accessor :line_item_id, :discount_type, :coupon_id, :entity_id, :discount_amount
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
class Tax < Model
|
|
17
|
-
attr_accessor :name, :amount, :description
|
|
18
|
-
end
|
|
19
|
-
|
|
20
12
|
class LineItemTax < Model
|
|
21
13
|
attr_accessor :line_item_id, :tax_name, :tax_rate, :date_to, :date_from, :prorated_taxable_amount, :is_partial_tax_applied, :is_non_compliance_tax, :taxable_amount, :tax_amount, :tax_juris_type, :tax_juris_name, :tax_juris_code, :tax_amount_in_local_currency, :local_currency_code
|
|
22
14
|
end
|
|
23
15
|
|
|
16
|
+
class Discount < Model
|
|
17
|
+
attr_accessor :amount, :description, :line_item_id, :entity_type, :discount_type, :entity_id, :coupon_set_code
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class Tax < Model
|
|
21
|
+
attr_accessor :name, :amount, :description
|
|
22
|
+
end
|
|
23
|
+
|
|
24
24
|
attr_accessor :version, :id, :sub_total, :total, :credits_applied, :amount_paid, :amount_due,
|
|
25
|
-
:charge_event, :billing_cycle_number, :line_items, :
|
|
26
|
-
:
|
|
25
|
+
:charge_event, :billing_cycle_number, :line_items, :line_item_discounts, :line_item_taxes, :discounts,
|
|
26
|
+
:taxes
|
|
27
27
|
|
|
28
28
|
# OPERATIONS
|
|
29
29
|
#-----------
|
|
@@ -21,7 +21,11 @@ module ChargeBee
|
|
|
21
21
|
attr_accessor :coupon_id
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
class CouponApplicabilityMapping < Model
|
|
25
|
+
attr_accessor :coupon_id, :applicable_item_price_ids
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
attr_accessor :charges, :addons, :invoice_items, :item_tiers, :coupons, :coupon_applicability_mappings
|
|
25
29
|
|
|
26
30
|
# OPERATIONS
|
|
27
31
|
#-----------
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module ChargeBee
|
|
2
|
+
class QuotedDeltaRamp < Model
|
|
3
|
+
|
|
4
|
+
class LineItem < Model
|
|
5
|
+
attr_accessor :item_level_discount_per_billing_cycle_in_decimal
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
attr_accessor :line_items
|
|
9
|
+
|
|
10
|
+
# OPERATIONS
|
|
11
|
+
#-----------
|
|
12
|
+
|
|
13
|
+
end # ~QuotedDeltaRamp
|
|
14
|
+
end # ~ChargeBee
|
|
@@ -10,7 +10,7 @@ module ChargeBee
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
class ItemTier < Model
|
|
13
|
-
attr_accessor :item_price_id, :starting_unit, :ending_unit, :price, :starting_unit_in_decimal, :ending_unit_in_decimal, :price_in_decimal, :ramp_tier_id
|
|
13
|
+
attr_accessor :item_price_id, :starting_unit, :ending_unit, :price, :starting_unit_in_decimal, :ending_unit_in_decimal, :price_in_decimal, :ramp_tier_id, :pricing_type, :package_size
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
class CouponApplicabilityMapping < Model
|
|
@@ -28,8 +28,8 @@ module ChargeBee
|
|
|
28
28
|
attr_accessor :id, :plan_id, :plan_quantity, :plan_unit_price, :setup_fee, :billing_period,
|
|
29
29
|
:billing_period_unit, :start_date, :trial_end, :remaining_billing_cycles, :po_number, :auto_collection,
|
|
30
30
|
:plan_quantity_in_decimal, :plan_unit_price_in_decimal, :changes_scheduled_at, :change_option,
|
|
31
|
-
:
|
|
32
|
-
:item_tiers, :quoted_contract_term
|
|
31
|
+
:free_period, :free_period_unit, :contract_term_billing_cycle_on_renewal, :addons, :event_based_addons,
|
|
32
|
+
:coupons, :subscription_items, :item_tiers, :quoted_contract_term
|
|
33
33
|
|
|
34
34
|
# OPERATIONS
|
|
35
35
|
#-----------
|
|
@@ -2,11 +2,11 @@ module ChargeBee
|
|
|
2
2
|
class Ramp < Model
|
|
3
3
|
|
|
4
4
|
class ItemsToAdd < Model
|
|
5
|
-
attr_accessor :item_price_id, :item_type, :quantity, :quantity_in_decimal, :unit_price, :unit_price_in_decimal, :amount, :amount_in_decimal, :free_quantity, :free_quantity_in_decimal, :billing_cycles, :service_period_days, :metered_quantity
|
|
5
|
+
attr_accessor :item_price_id, :item_type, :quantity, :quantity_in_decimal, :unit_price, :unit_price_in_decimal, :amount, :amount_in_decimal, :free_quantity, :free_quantity_in_decimal, :billing_cycles, :service_period_days, :metered_quantity, :charge_once, :charge_on_option, :charge_on_event
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
class ItemsToUpdate < Model
|
|
9
|
-
attr_accessor :item_price_id, :item_type, :quantity, :quantity_in_decimal, :unit_price, :unit_price_in_decimal, :amount, :amount_in_decimal, :free_quantity, :free_quantity_in_decimal, :billing_cycles, :service_period_days, :metered_quantity
|
|
9
|
+
attr_accessor :item_price_id, :item_type, :quantity, :quantity_in_decimal, :unit_price, :unit_price_in_decimal, :amount, :amount_in_decimal, :free_quantity, :free_quantity_in_decimal, :billing_cycles, :service_period_days, :metered_quantity, :charge_once, :charge_on_option, :charge_on_event
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
class CouponsToAdd < Model
|
|
@@ -21,13 +21,17 @@ module ChargeBee
|
|
|
21
21
|
attr_accessor :item_price_id, :starting_unit, :ending_unit, :price, :starting_unit_in_decimal, :ending_unit_in_decimal, :price_in_decimal, :pricing_type, :package_size, :index
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
class ContractTerm < Model
|
|
25
|
+
attr_accessor :cancellation_cutoff_period, :renewal_billing_cycles, :action_at_term_end
|
|
26
|
+
end
|
|
27
|
+
|
|
24
28
|
class StatusTransitionReason < Model
|
|
25
29
|
attr_accessor :code, :message
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
attr_accessor :id, :description, :subscription_id, :effective_from, :status, :created_at, :resource_version,
|
|
29
33
|
:updated_at, :items_to_add, :items_to_update, :coupons_to_add, :discounts_to_add, :item_tiers,
|
|
30
|
-
:items_to_remove, :coupons_to_remove, :discounts_to_remove, :deleted, :status_transition_reason
|
|
34
|
+
:items_to_remove, :coupons_to_remove, :discounts_to_remove, :contract_term, :deleted, :status_transition_reason
|
|
31
35
|
|
|
32
36
|
# OPERATIONS
|
|
33
37
|
#-----------
|
|
@@ -5,12 +5,16 @@ module ChargeBee
|
|
|
5
5
|
attr_accessor :omnichannel_subscription_id
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
+
class LinkedOmnichannelOneTimeOrder < Model
|
|
9
|
+
attr_accessor :omnichannel_one_time_order_id
|
|
10
|
+
end
|
|
11
|
+
|
|
8
12
|
class ErrorDetail < Model
|
|
9
13
|
attr_accessor :error_message
|
|
10
14
|
end
|
|
11
15
|
|
|
12
16
|
attr_accessor :id, :customer_id, :app_id, :source, :status, :omnichannel_transaction_id, :created_at,
|
|
13
|
-
:resource_version, :linked_omnichannel_subscriptions, :error_detail
|
|
17
|
+
:resource_version, :linked_omnichannel_subscriptions, :linked_omnichannel_one_time_orders, :error_detail
|
|
14
18
|
|
|
15
19
|
# OPERATIONS
|
|
16
20
|
#-----------
|
|
@@ -30,7 +30,7 @@ module ChargeBee
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
class ShippingAddress < Model
|
|
33
|
-
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
|
33
|
+
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
class ReferralInfo < Model
|
|
@@ -46,7 +46,7 @@ module ChargeBee
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
class Discount < Model
|
|
49
|
-
attr_accessor :id, :invoice_name, :type, :percentage, :amount, :currency_code, :duration_type, :period, :period_unit, :included_in_mrr, :apply_on, :item_price_id, :created_at, :apply_till, :applied_count, :coupon_id, :index
|
|
49
|
+
attr_accessor :id, :invoice_name, :type, :percentage, :amount, :quantity, :currency_code, :duration_type, :period, :period_unit, :included_in_mrr, :apply_on, :item_price_id, :created_at, :apply_till, :applied_count, :coupon_id, :index
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
attr_accessor :id, :currency_code, :plan_id, :plan_quantity, :plan_unit_price, :setup_fee, :billing_period,
|
|
@@ -62,7 +62,7 @@ module ChargeBee
|
|
|
62
62
|
:addons, :event_based_addons, :charged_event_based_addons, :coupon, :coupons, :shipping_address,
|
|
63
63
|
:referral_info, :billing_override, :invoice_notes, :meta_data, :deleted, :changes_scheduled_at,
|
|
64
64
|
:contract_term, :cancel_reason_code, :free_period, :free_period_unit, :create_pending_invoices,
|
|
65
|
-
:auto_close_invoices, :discounts, :business_entity_id, :metadata
|
|
65
|
+
:auto_close_invoices, :discounts, :business_entity_id, :decommissioned, :metadata
|
|
66
66
|
def metadata
|
|
67
67
|
warn "[DEPRECATION] `metadata` is deprecated please use meta_data instead."
|
|
68
68
|
@metadata
|
|
@@ -113,6 +113,7 @@ module ChargeBee
|
|
|
113
113
|
Request.send_list_request('get', uri_path("subscriptions"), params, env, headers,nil, false, jsonKeys, options)
|
|
114
114
|
end
|
|
115
115
|
|
|
116
|
+
# @deprecated This method is deprecated and will be removed in a future version.
|
|
116
117
|
def self.subscriptions_for_customer(id, params={}, env=nil, headers={})
|
|
117
118
|
jsonKeys = {
|
|
118
119
|
}
|
|
@@ -2,7 +2,7 @@ module ChargeBee
|
|
|
2
2
|
class SubscriptionEstimate < Model
|
|
3
3
|
|
|
4
4
|
class ShippingAddress < Model
|
|
5
|
-
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
|
5
|
+
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
class ContractTerm < Model
|
|
@@ -18,7 +18,7 @@ module ChargeBee
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
class GatewayErrorDetail < Model
|
|
21
|
-
attr_accessor :request_id, :error_category, :error_code, :error_message, :decline_code, :decline_message, :network_error_code, :network_error_message, :error_field, :recommendation_code, :recommendation_message, :processor_error_code, :processor_error_message, :error_cause_id
|
|
21
|
+
attr_accessor :request_id, :error_category, :error_code, :error_message, :decline_code, :decline_message, :network_error_code, :network_error_message, :error_field, :recommendation_code, :recommendation_message, :processor_error_code, :processor_error_message, :error_cause_id, :processor_advice_code
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
attr_accessor :id, :customer_id, :subscription_id, :gateway_account_id, :payment_source_id,
|
|
@@ -85,6 +85,7 @@ module ChargeBee
|
|
|
85
85
|
Request.send_list_request('get', uri_path("transactions"), params, env, headers,nil, false, jsonKeys, options)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
# @deprecated This method is deprecated and will be removed in a future version.
|
|
88
89
|
def self.transactions_for_customer(id, params={}, env=nil, headers={})
|
|
89
90
|
jsonKeys = {
|
|
90
91
|
}
|
|
@@ -92,6 +93,7 @@ module ChargeBee
|
|
|
92
93
|
Request.send('get', uri_path("customers",id.to_s,"transactions"), params, env, headers,nil, false, jsonKeys, options)
|
|
93
94
|
end
|
|
94
95
|
|
|
96
|
+
# @deprecated This method is deprecated and will be removed in a future version.
|
|
95
97
|
def self.transactions_for_subscription(id, params={}, env=nil, headers={})
|
|
96
98
|
jsonKeys = {
|
|
97
99
|
}
|
|
@@ -7,23 +7,23 @@ module ChargeBee
|
|
|
7
7
|
|
|
8
8
|
attr_accessor :id, :name, :mime_type, :error_code, :error_reason, :status, :total_records_count,
|
|
9
9
|
:processed_records_count, :failed_records_count, :file_size_in_bytes, :processing_started_at,
|
|
10
|
-
:processing_completed_at, :uploaded_by, :uploaded_at, :upload_details
|
|
10
|
+
:processing_completed_at, :uploaded_by, :uploaded_at, :error_file_path, :error_file_url, :upload_details
|
|
11
11
|
|
|
12
12
|
# OPERATIONS
|
|
13
13
|
#-----------
|
|
14
14
|
|
|
15
|
-
def self.
|
|
15
|
+
def self.upload_url(params, env=nil, headers={})
|
|
16
16
|
jsonKeys = {
|
|
17
17
|
}
|
|
18
18
|
options = {}
|
|
19
|
-
Request.send('post', uri_path("usage_files","
|
|
19
|
+
Request.send('post', uri_path("usage_files","upload_url"), params, env, headers, "file-ingest", false, jsonKeys, options)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def self.
|
|
22
|
+
def self.processing_status(id, env=nil, headers={})
|
|
23
23
|
jsonKeys = {
|
|
24
24
|
}
|
|
25
25
|
options = {}
|
|
26
|
-
Request.send('get', uri_path("usage_files",id.to_s,"
|
|
26
|
+
Request.send('get', uri_path("usage_files",id.to_s,"processing_status"), {}, env, headers, "file-ingest", false, jsonKeys, options)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
end # ~UsageFile
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module ChargeBee
|
|
2
|
+
class WebhookEndpoint < Model
|
|
3
|
+
|
|
4
|
+
attr_accessor :id, :name, :url, :send_card_resource, :disabled, :primary_url, :api_version,
|
|
5
|
+
:chargebee_response_schema_type, :enabled_events
|
|
6
|
+
|
|
7
|
+
# OPERATIONS
|
|
8
|
+
#-----------
|
|
9
|
+
|
|
10
|
+
def self.create(params, env=nil, headers={})
|
|
11
|
+
jsonKeys = {
|
|
12
|
+
}
|
|
13
|
+
options = {
|
|
14
|
+
:isIdempotent => true
|
|
15
|
+
}
|
|
16
|
+
Request.send('post', uri_path("webhook_endpoints"), params, env, headers,nil, false, jsonKeys, options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.update(id, params={}, env=nil, headers={})
|
|
20
|
+
jsonKeys = {
|
|
21
|
+
}
|
|
22
|
+
options = {
|
|
23
|
+
:isIdempotent => true
|
|
24
|
+
}
|
|
25
|
+
Request.send('post', uri_path("webhook_endpoints",id.to_s), params, env, headers,nil, false, jsonKeys, options)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.retrieve(id, env=nil, headers={})
|
|
29
|
+
jsonKeys = {
|
|
30
|
+
}
|
|
31
|
+
options = {}
|
|
32
|
+
Request.send('get', uri_path("webhook_endpoints",id.to_s), {}, env, headers,nil, false, jsonKeys, options)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.delete(id, env=nil, headers={})
|
|
36
|
+
jsonKeys = {
|
|
37
|
+
}
|
|
38
|
+
options = {
|
|
39
|
+
:isIdempotent => true
|
|
40
|
+
}
|
|
41
|
+
Request.send('post', uri_path("webhook_endpoints",id.to_s,"delete"), {}, env, headers,nil, false, jsonKeys, options)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.list(params={}, env=nil, headers={})
|
|
45
|
+
jsonKeys = {
|
|
46
|
+
}
|
|
47
|
+
options = {}
|
|
48
|
+
Request.send_list_request('get', uri_path("webhook_endpoints"), params, env, headers,nil, false, jsonKeys, options)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end # ~WebhookEndpoint
|
|
52
|
+
end # ~ChargeBee
|
|
@@ -17,7 +17,6 @@ module ChargeBee
|
|
|
17
17
|
request = build_http_request(method, uri, headers, isJsonRequest)
|
|
18
18
|
request.body = payload if payload
|
|
19
19
|
request.basic_auth(api_key, nil)
|
|
20
|
-
|
|
21
20
|
http = configure_http_client(uri, env)
|
|
22
21
|
|
|
23
22
|
retry_config = env.retry_config || {}
|
|
@@ -139,7 +138,7 @@ module ChargeBee
|
|
|
139
138
|
|
|
140
139
|
if rcode >= 200 && rcode < 300
|
|
141
140
|
begin
|
|
142
|
-
resp = JSON.parse(rbody)
|
|
141
|
+
resp = rcode == 204 ? rbody : JSON.parse(rbody)
|
|
143
142
|
rescue JSON::ParserError => e
|
|
144
143
|
raise handle_json_error(rbody, e)
|
|
145
144
|
end
|
|
@@ -168,24 +167,33 @@ module ChargeBee
|
|
|
168
167
|
end
|
|
169
168
|
end
|
|
170
169
|
|
|
170
|
+
# Handle errors returned by the ChargeBee API.
|
|
171
|
+
#
|
|
172
|
+
# @param rcode [Integer] HTTP status code.
|
|
173
|
+
# @param rbody [String] HTTP response body.
|
|
174
|
+
#
|
|
175
|
+
# @return [ChargeBee::Error] Appropriate ChargeBee error object.
|
|
171
176
|
def self.handle_for_error(rcode, rbody)
|
|
172
177
|
return Error.new("No response returned by ChargeBee API. HTTP status code: #{rcode}") if rcode == 204
|
|
178
|
+
return ForbiddenError.new("Access forbidden. You do not have permission to access this resource.") if rcode == 403
|
|
173
179
|
begin
|
|
174
180
|
error_obj = JSON.parse(rbody)
|
|
175
181
|
error_obj = Util.symbolize_keys(error_obj)
|
|
176
182
|
rescue Exception => e
|
|
177
|
-
|
|
183
|
+
return Error.new("Error response not in JSON format. The http status code is #{rcode} \n #{rbody.inspect}", e)
|
|
178
184
|
end
|
|
179
|
-
|
|
180
|
-
case type
|
|
185
|
+
|
|
186
|
+
case error_obj[:type]
|
|
181
187
|
when "payment"
|
|
182
|
-
|
|
188
|
+
PaymentError.new(rcode, error_obj)
|
|
183
189
|
when "operation_failed"
|
|
184
|
-
|
|
190
|
+
OperationFailedError.new(rcode, error_obj)
|
|
185
191
|
when "invalid_request"
|
|
186
|
-
|
|
192
|
+
InvalidRequestError.new(rcode, error_obj)
|
|
193
|
+
when "ubb_batch_ingestion_invalid_request"
|
|
194
|
+
UbbBatchIngestionInvalidRequestError.new(rcode, error_obj)
|
|
187
195
|
else
|
|
188
|
-
|
|
196
|
+
APIError.new(rcode, error_obj)
|
|
189
197
|
end
|
|
190
198
|
end
|
|
191
199
|
|
data/lib/chargebee/request.rb
CHANGED
|
@@ -14,9 +14,9 @@ module ChargeBee
|
|
|
14
14
|
|
|
15
15
|
def self.send(method, url, params={}, env=nil, headers={}, sub_domain=nil, isJsonRequest=nil, jsonKeys={}, options={})
|
|
16
16
|
env ||= ChargeBee.default_env
|
|
17
|
-
ser_params = isJsonRequest ? params
|
|
17
|
+
ser_params = isJsonRequest ? params : Util.serialize(params, nil, nil, jsonKeys)
|
|
18
18
|
resp, rheaders, rcode = NativeRequest.request(method, url, env, ser_params||={}, headers, sub_domain, isJsonRequest, options)
|
|
19
|
-
if resp
|
|
19
|
+
if resp&.has_key?(:list)
|
|
20
20
|
ListResult.new(resp[:list], resp[:next_offset], rheaders, rcode)
|
|
21
21
|
else
|
|
22
22
|
Result.new(resp, rheaders, rcode)
|