Class: Sellsy::Invoice

Inherits:
Object
  • Object
show all
Defined in:
lib/sellsy/invoices.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



18
19
20
# File 'lib/sellsy/invoices.rb', line 18

def amount
  @amount
end

#client_idObject

Returns the value of attribute client_id.



15
16
17
# File 'lib/sellsy/invoices.rb', line 15

def client_id
  @client_id
end

#corp_nameObject

Returns the value of attribute corp_name.



6
7
8
# File 'lib/sellsy/invoices.rb', line 6

def corp_name
  @corp_name
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/sellsy/invoices.rb', line 5

def id
  @id
end

#identityObject

Returns the value of attribute identity.



9
10
11
# File 'lib/sellsy/invoices.rb', line 9

def identity
  @identity
end

#owner_full_nameObject

Returns the value of attribute owner_full_name.



7
8
9
# File 'lib/sellsy/invoices.rb', line 7

def owner_full_name
  @owner_full_name
end

#packaging_nameObject

Returns the value of attribute packaging_name.



16
17
18
# File 'lib/sellsy/invoices.rb', line 16

def packaging_name
  @packaging_name
end

#shipping_nameObject

Returns the value of attribute shipping_name.



17
18
19
# File 'lib/sellsy/invoices.rb', line 17

def shipping_name
  @shipping_name
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/sellsy/invoices.rb', line 8

def status
  @status
end

#tax_rateObject

Returns the value of attribute tax_rate.



20
21
22
# File 'lib/sellsy/invoices.rb', line 20

def tax_rate
  @tax_rate
end

#taxes_amount_sumObject

Returns the value of attribute taxes_amount_sum.



12
13
14
# File 'lib/sellsy/invoices.rb', line 12

def taxes_amount_sum
  @taxes_amount_sum
end

#total_amountObject

Returns the value of attribute total_amount.



13
14
15
# File 'lib/sellsy/invoices.rb', line 13

def total_amount
  @total_amount
end

#total_amount_taxes_freeObject

Returns the value of attribute total_amount_taxes_free.



11
12
13
# File 'lib/sellsy/invoices.rb', line 11

def total_amount_taxes_free
  @total_amount_taxes_free
end

#unit_amountObject

Returns the value of attribute unit_amount.



19
20
21
# File 'lib/sellsy/invoices.rb', line 19

def unit_amount
  @unit_amount
end

Instance Method Details

#create(invoice) ⇒ Object

contact”,“corpaddressid”:“36047”,“thirdaddressid”:“36048”,“shipaddressid”:“36049”,“rowsAmount”:“0.000000000”,“discountPercent”:“0.000000000”,“discountAmount”:“0.000000000”,“rowsAmountDiscounted”:“0.000000000”,“offerAmount”:“0.000000000”,“rowsAmountAllInc”:“0.000000000”,“packagingsAmount”:“49.900000000”,“shippingsAmount”:“60.000000000”,“totalAmountTaxesFree”:“109.900000000”,“taxesAmountSum”:“21.540400000”,“taxesAmountDetails”:“a:1:{s:12:"19.600000000";s:12:"21.540400000";”,“totalAmount”:“131.440400000”,“payDateText”:“”,“payDateCustom”:“0000-00-00”,“payMediumsText”:“a:1:i:0;s:7:"chu00e8que";”,“payCheckOrderText”:“”,“payBankAccountText”:“”,“shippingNbParcels”:“0”,“shippingWeight”:“0.000000000”,“shippingWeightUnit”:“g”,“shippingVolume”:“0.000000000”,“shippingTrackingNumber”:“”,“shippingTrackingUrl”:“”,“saveThirdPrefs”:“N”,“displayShipAddress”:“N”,“corpid”:“2”,“ownerid”:“2”,“linkedtype”:“invoice”,“linkedid”:“9512”,“created”:“2012-03-21 14:30:32”,“prefsid”:“14679”,“parentid”:“0”,“docmapid”:“11599”,“hasVat”:“Y”,“doctypeid”:“9512”,“step”:“draft”,“isDeposit”:“N”,“dueAmount”:“131.440400000”,“currencyid”:“1”,“currencyposition”:“right”,“numberformat”:“fr”,“numberdecimals”:“,”,“numberthousands”:“”,“numberprecision”:“2”,“formatted_dueAmount”:“131,44 u20ac”,“step_color”:“pink”,“step_hex”:“#C033DA”,“step_label”:“Non envoyu00e9e”,“step_css”:“colorDraft”,“step_banner”:“draft_f”,“step_id”:“draft”,“displayed_payMediumsText”:“chu00e8que”,“formatted_totalAmount”:“131,44 u20ac”,“formatted_totalAmountTaxesFree”:“109,90 u20ac”,“formatted_displayedDate”:“04/04/2012”,“formatted_payDateCustom”:“04/04/2012”,“noedit”:“N”}



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
# File 'lib/sellsy/invoices.rb', line 24

def create(invoice)
  command = {
      'method' => 'Document.create',
      'params' => {
          'document' => {
              'doctype' => 'invoice',
              # 'parentId' => 'parentId',
              'thirdid' => invoice.client_id
              # 'displayedDate' => 'displayedDate',
              # 'subject' => 'document_subject',
              # 'notes' => 'document_notes',
              # 'tags' => 'document_tags',
              # 'displayShipAddress' => 'displayshippaddress_enum',
              # 'rateCategory' => 'rateCategory',
              # 'globalDiscount' => 'globalDiscount',
              # 'globalDiscountUnit' => 'globalDiscountUnit',
              # 'hasDoubleVat' => 'hasDoubleVat',
              # 'currency' => 'currency',
              # 'doclayout' => 'doclayout',
              # 'payMediums' => 'payMediums'
          },
          # 'paydate' => {
          # 'id' => 'paydate_id',
          # 'xdays' => 'paydate_xdays',
          # 'endmonth' => 'paydate_endmonth',
          # 'scaledDetails' => 'paydate_scaledDetails',
          # 'custom' => 'paydate_custom'
          # },
          # 'thirdaddress' => {
          #     'id' => 'thirdaddress_id'
          # },
          # 'shipaddress' => {
          #     'id' => 'shipaddress_id'
          # },
          'row' => {
              '1' => {
                  'row_type' => 'packaging',
                  'row_packaging' => invoice.packaging_name,
                  'row_name' => 'row_name',
                  'row_unitAmount' => invoice.unit_amount,
                  'row_tax' => invoice.tax_rate
                  # 'row_taxid' => 'row_taxid',
                  # 'row_tax2id' => 'row_tax2id',
                  # 'row_qt' => 'row_quantity',
                  # 'row_isOption' => 'row_option',
                  # 'row_discount' => 'row_discount',
                  # 'row_discountUnit' => 'row_discountUnit'
              },
              '2' => {
                  'row_type' => 'shipping',
                  'row_shipping' => invoice.shipping_name,
                  # 'row_name' => 'row_name',
                  'row_unitAmount' => invoice.unit_amount,
                  'row_tax' => invoice.tax_rate,
                  # 'row_taxid' => 'row_taxid',
                  'row_tax2id' => invoice.quantity
                  # 'row_qt' => 'row_quantity',
                  # 'row_isOption' => 'row_option',
                  # 'row_discount' => 'row_discount',
                  # 'row_discountUnit' => 'row_discountUnit'
              }
              # '3' => {
              # 'row_type' => 'item',
              # 'row_linkedid' => 'catalogue_id_link',
              # 'row_declid' => 'catalogue_declid_link',
              # 'row_name' => 'row_name',
              # 'row_notes' => 'row_notes',
              # 'row_unit' => 'row_unit',
              # 'row_unitAmount' => 'row_unit_amount',
              # 'row_tax' => 'row_taxrate',
              # 'row_taxid' => 'row_taxid',
              # 'row_tax2id' => 'row_tax2id',
              # 'row_qt' => 'row_quantity',
              # 'row_isOption' => 'row_option',
              # 'row_purchaseAmount' => 'row_purchaseAmount',
              # 'row_discount' => 'row_discount',
              # 'row_discountUnit' => 'row_discountUnit'
              # },
              # '4' => {
              # 'row_type' => 'once',
              # 'row_name' => 'row_name',
              # 'row_notes' => 'row_notes',
              # 'row_unit' => 'row_unit',
              # 'row_unitAmount' => 'row_unit_amount',
              # 'row_tax' => 'row_taxrate',
              # 'row_taxid' => 'row_taxid',
              # 'row_tax2id' => 'row_tax2id',
              # 'row_qt' => 'row_quantity',
              # 'row_isOption' => 'row_option',
              # 'row_discount' => 'row_discount',
              # 'row_discountUnit' => 'row_discountUnit'
              # }
          }
      }
  }

  Sellsy::Api.request command
end

#updateObject



123
124
125
# File 'lib/sellsy/invoices.rb', line 123

def update

end