Class: Docdata::Order::CreateRequest
- Defined in:
- lib/docdata/order/request.rb
Overview
Create an Order in the Docdata system.
Instance Attribute Summary
Attributes inherited from Request
Instance Method Summary collapse
Methods inherited from Request
Constructor Details
This class inherits a constructor from Docdata::Order::Request
Instance Method Details
#build_request(builder) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/docdata/order/request.rb', line 67 def build_request(builder) # Unique merchant reference to this order. builder.merchantOrderReference(order_reference) # Preferences to use for this payment. builder.paymentPreferences do |preferences| # The profile that is used to select the payment methods that can be used to pay this order. preferences.profile(profile) preferences.numberOfDaysToPay(14) end # Information concerning the shopper who placed the order. builder.shopper(id: shopper_id) do |shopper| # Shopper's full name. shopper.name do |name| # The first given name. name.first(shopper_first_name) # Any subsequent given name or names. May also be used as middle initial. name.middle(shopper_infix) if shopper_infix # The family or inherited name(s). name.last(shopper_last_name) end # Shopper's e-mail address. shopper.email(shopper_email) # Shopper's preferred language. Language code according to ISO 639. shopper.language(code: shopper_language) # Shopper's gender. shopper.gender(shopper_gender) # Ip address of the shopper. Will be used in the future for riskchecks. Can be ipv4 or ipv6. shopper.ipAddress(shopper_ip_address) if shopper_ip_address end # Total order gross amount. The amount in the minor unit for the given currency. # (E.g. for EUR in cents) builder.totalGrossAmount(amount, currency: currency) # Name and address to use for billing. builder.billTo do |bill| bill.name do |name| # The first given name. name.first(shopper_first_name) # Any subsequent given name or names. May also be used as middle initial. name.middle(shopper_infix) if shopper_infix # The family or inherited name(s). name.last(shopper_last_name) end # Address of the destination. bill.address do |address| # Address lines must be filled as specific as possible using the house number # and optionally the house number addition field. address.street(address_street) # The house number. address.houseNumber(address_house_number) address.postalCode(address_postal_code) address.city(address_city) # Country code according to ISO 3166. address.country(code: address_country) end end # The description of the order. builder.description(description) # The description that is used by payment providers on shopper statements. builder.receiptText(receipt_text) end |