Class: Iyzipay::Model::SubMerchant

Inherits:
IyzipayResource show all
Defined in:
lib/iyzipay/model/sub_merchant.rb

Constant Summary

Constants inherited from IyzipayResource

IyzipayResource::AUTHORIZATION_HEADER_NAME, IyzipayResource::AUTHORIZATION_HEADER_STRING, IyzipayResource::RANDOM_CHARS, IyzipayResource::RANDOM_HEADER_NAME, IyzipayResource::RANDOM_STRING_SIZE

Instance Method Summary collapse

Methods inherited from IyzipayResource

#calculate_hash, #format_header_string, #get_http_header, #get_plain_http_header, #json_decode, #prepare_authorization_string, #random_string, #to_pki_string

Instance Method Details

#create(request = {}, options) ⇒ Object



5
6
7
8
# File 'lib/iyzipay/model/sub_merchant.rb', line 5

def create(request = {}, options)
  pki_string = to_pki_string_create(request)
  HttpClient.post("#{options.base_url}/onboarding/submerchant", get_http_header(pki_string, options), request.to_json)
end

#retrieve(request = {}, options) ⇒ Object



15
16
17
18
# File 'lib/iyzipay/model/sub_merchant.rb', line 15

def retrieve(request = {}, options)
  pki_string = to_pki_string_retrieve(request)
  HttpClient.post("#{options.base_url}/onboarding/submerchant/detail", get_http_header(pki_string, options), request.to_json)
end

#to_pki_string_create(request) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/iyzipay/model/sub_merchant.rb', line 20

def to_pki_string_create(request)
  PkiBuilder.new.
      append(:locale, request[:locale]).
      append(:conversationId, request[:conversationId]).
      append(:name, request[:name]).
      append(:email, request[:email]).
      append(:gsmNumber, request[:gsmNumber]).
      append(:address, request[:address]).
      append(:iban, request[:iban]).
      append(:taxOffice, request[:taxOffice]).
      append(:contactName, request[:contactName]).
      append(:contactSurname, request[:contactSurname]).
      append(:legalCompanyTitle, request[:legalCompanyTitle]).
      append(:swiftCode, request[:swiftCode]).
      append(:currency, request[:currency]).
      append(:subMerchantExternalId, request[:subMerchantExternalId]).
      append(:identityNumber, request[:identityNumber]).
      append(:taxNumber, request[:taxNumber]).
      append(:subMerchantType, request[:subMerchantType]).
      get_request_string
end

#to_pki_string_retrieve(request) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/iyzipay/model/sub_merchant.rb', line 63

def to_pki_string_retrieve(request)
  PkiBuilder.new.
      append(:locale, request[:locale]).
      append(:conversationId, request[:conversationId]).
      append(:subMerchantExternalId, request[:subMerchantExternalId]).
      get_request_string
end

#to_pki_string_update(request) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/iyzipay/model/sub_merchant.rb', line 42

def to_pki_string_update(request)
  PkiBuilder.new.
      append(:locale, request[:locale]).
      append(:conversationId, request[:conversationId]).
      append(:name, request[:name]).
      append(:email, request[:email]).
      append(:gsmNumber, request[:gsmNumber]).
      append(:address, request[:address]).
      append(:iban, request[:iban]).
      append(:taxOffice, request[:taxOffice]).
      append(:contactName, request[:contactName]).
      append(:contactSurname, request[:contactSurname]).
      append(:legalCompanyTitle, request[:legalCompanyTitle]).
      append(:swiftCode, request[:swiftCode]).
      append(:currency, request[:currency]).
      append(:subMerchantKey, request[:subMerchantKey]).
      append(:identityNumber, request[:identityNumber]).
      append(:taxNumber, request[:taxNumber]).
      get_request_string
end

#update(request = {}, options) ⇒ Object



10
11
12
13
# File 'lib/iyzipay/model/sub_merchant.rb', line 10

def update(request = {}, options)
  pki_string = to_pki_string_update(request)
  HttpClient.put("#{options.base_url}/onboarding/submerchant", get_http_header(pki_string, options), request.to_json)
end