Module: ContactVouchers

Included in:
ContactEcommerce
Defined in:
lib/contact/ecommerce/vouchers.rb

Instance Method Summary collapse

Instance Method Details

#apply_voucher(order_id, data) ⇒ Object

Apply voucher.Contact

Apply voucher code to the existing order, only applies to sale orders.

Parameters

order_id

(Integer) – Order id.

data

(Hash) – Data to be submitted.

Example

data = { description: 'This is the transaction description', voucher_code: 'XAZWQ12MP' }
@data = @mints_contact.apply_voucher(1, data)


15
16
17
# File 'lib/contact/ecommerce/vouchers.rb', line 15

def apply_voucher(order_id, data)
  @client.raw('post', "/ecommerce/orders/#{order_id}/voucher", nil, data_transform(data), @contact_v1_url)
end