lib/processout/invoice.rb in processout-2.27.1 vs lib/processout/invoice.rb in processout-2.28.0

- old
+ new

@@ -20,10 +20,11 @@ attr_reader :token attr_reader :token_id attr_reader :details attr_reader :url attr_reader :name + attr_reader :order_id attr_reader :amount attr_reader :currency attr_reader :merchant_initiator_type attr_reader :statement_descriptor attr_reader :statement_descriptor_phone @@ -51,10 +52,11 @@ attr_reader :native_apm attr_reader :initiation_type attr_reader :payment_intent attr_reader :billing attr_reader :unsupported_feature_bypass + attr_reader :verification def id=(val) @id = val end @@ -185,10 +187,14 @@ def name=(val) @name = val end + def order_id=(val) + @order_id = val + end + def amount=(val) @amount = val end def currency=(val) @@ -405,10 +411,14 @@ @unsupported_feature_bypass = obj end end + def verification=(val) + @verification = val + end + # Initializes the Invoice object # Params: # +client+:: +ProcessOut+ client instance # +data+:: data that can be used to fill the object @@ -427,10 +437,11 @@ self.token = data.fetch(:token, nil) self.token_id = data.fetch(:token_id, nil) self.details = data.fetch(:details, nil) self.url = data.fetch(:url, nil) self.name = data.fetch(:name, nil) + self.order_id = data.fetch(:order_id, nil) self.amount = data.fetch(:amount, nil) self.currency = data.fetch(:currency, nil) self.merchant_initiator_type = data.fetch(:merchant_initiator_type, nil) self.statement_descriptor = data.fetch(:statement_descriptor, nil) self.statement_descriptor_phone = data.fetch(:statement_descriptor_phone, nil) @@ -458,10 +469,11 @@ self.native_apm = data.fetch(:native_apm, nil) self.initiation_type = data.fetch(:initiation_type, nil) self.payment_intent = data.fetch(:payment_intent, nil) self.billing = data.fetch(:billing, nil) self.unsupported_feature_bypass = data.fetch(:unsupported_feature_bypass, nil) + self.verification = data.fetch(:verification, nil) end # Create a new Invoice using the current client def new(data = {}) @@ -483,10 +495,11 @@ "token": self.token, "token_id": self.token_id, "details": self.details, "url": self.url, "name": self.name, + "order_id": self.order_id, "amount": self.amount, "currency": self.currency, "merchant_initiator_type": self.merchant_initiator_type, "statement_descriptor": self.statement_descriptor, "statement_descriptor_phone": self.statement_descriptor_phone, @@ -514,10 +527,11 @@ "native_apm": self.native_apm, "initiation_type": self.initiation_type, "payment_intent": self.payment_intent, "billing": self.billing, "unsupported_feature_bypass": self.unsupported_feature_bypass, + "verification": self.verification, }.to_json end # Fills the object with data coming from the API # Params: @@ -566,10 +580,13 @@ self.url = data["url"] end if data.include? "name" self.name = data["name"] end + if data.include? "order_id" + self.order_id = data["order_id"] + end if data.include? "amount" self.amount = data["amount"] end if data.include? "currency" self.currency = data["currency"] @@ -659,10 +676,13 @@ self.billing = data["billing"] end if data.include? "unsupported_feature_bypass" self.unsupported_feature_bypass = data["unsupported_feature_bypass"] end + if data.include? "verification" + self.verification = data["verification"] + end self end # Prefills the object with the data passed as parameters @@ -684,10 +704,11 @@ self.token = data.fetch(:token, self.token) self.token_id = data.fetch(:token_id, self.token_id) self.details = data.fetch(:details, self.details) self.url = data.fetch(:url, self.url) self.name = data.fetch(:name, self.name) + self.order_id = data.fetch(:order_id, self.order_id) self.amount = data.fetch(:amount, self.amount) self.currency = data.fetch(:currency, self.currency) self.merchant_initiator_type = data.fetch(:merchant_initiator_type, self.merchant_initiator_type) self.statement_descriptor = data.fetch(:statement_descriptor, self.statement_descriptor) self.statement_descriptor_phone = data.fetch(:statement_descriptor_phone, self.statement_descriptor_phone) @@ -715,10 +736,11 @@ self.native_apm = data.fetch(:native_apm, self.native_apm) self.initiation_type = data.fetch(:initiation_type, self.initiation_type) self.payment_intent = data.fetch(:payment_intent, self.payment_intent) self.billing = data.fetch(:billing, self.billing) self.unsupported_feature_bypass = data.fetch(:unsupported_feature_bypass, self.unsupported_feature_bypass) + self.verification = data.fetch(:verification, self.verification) self end # Create an incremental authorization @@ -1060,10 +1082,11 @@ request = Request.new(@client) path = "/invoices" data = { "customer_id" => @customer_id, "name" => @name, + "order_id" => @order_id, "amount" => @amount, "currency" => @currency, "metadata" => @metadata, "details" => @details, "exemption_reason_3ds2" => @exemption_reason_3ds2, @@ -1087,10 +1110,11 @@ "require_backend_capture" => @require_backend_capture, "external_fraud_tools" => @external_fraud_tools, "tax" => @tax, "payment_type" => @payment_type, "billing" => @billing, - "unsupported_feature_bypass" => @unsupported_feature_bypass + "unsupported_feature_bypass" => @unsupported_feature_bypass, + "verification" => @verification } response = Response.new(request.post(path, data, options)) return_values = Array.new