Class: Iyzipay::Model::Basket

Inherits:
Object
  • Object
show all
Defined in:
lib/iyzipay/model/basket.rb

Class Method Summary collapse

Class Method Details

.to_pki_string(request) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/iyzipay/model/basket.rb', line 4

def self.to_pki_string(request)
  unless request.nil?
    basket_items = Array.new
    request.each do |item|
      item_pki = PkiBuilder.new.
          append(:id, item[:id]).
          append_price(:price, item[:price]).
          append(:name, item[:name]).
          append(:category1, item[:category1]).
          append(:category2, item[:category2]).
          append(:itemType, item[:itemType]).
          append(:subMerchantKey, item[:subMerchantKey]).
          append_price(:subMerchantPrice, item[:subMerchantPrice]).
          append(:ip, item[:ip]).
          get_request_string
      basket_items << item_pki
    end
    basket_items
  end
end