Module: ActiveMerchant::Billing::PaylineWebAPI

Included in:
PaylineGateway
Defined in:
lib/active_merchant/billing/gateways/payline/payline_web_api.rb

Instance Method Summary collapse

Instance Method Details

#create_web_wallet(buyer_data, options = {}) ⇒ Object

Deprecated method: use manage_web_wallet :buyer [Hash] Buyer data, it must contain :wallet_id, :last_name, :first_name :update_personal_details [Boolean] 0 = Updates forbidden (default) ; 1 = Updates allowed Optional parameters: language_code, custom_payment_page_code, security_mode, notification_url, custom_payment_templace_url Optional objects: contract_number,owner, private_data



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/active_merchant/billing/gateways/payline/payline_web_api.rb', line 12

def create_web_wallet(buyer_data, options = {})
  optional_parameters = [
    'languageCode',
    'customPaymentPageCode',
    'securityMode',
    'notificationURL',
    'customPaymentTemplateURL'
  ]

  data = merged_data([
    # Required parameters
    add_buyer(buyer_data),
    add_update_personal_details(options[:update_personal_details]),
    # Optionals parameters
    add_selected_contract_list(options[:contract_number], options[:all_contract_numbers]),
    add_owner(options[:owner]),
    add_private_data(options[:private_data]),
    add_optional_parameters(options, optional_parameters)
  ])

  web_wallet_request :create, data
end

#do_web_payment(amount, options = {}) ⇒ Object Also known as: setup_purchase

:order_ref [String] Order reference (required)- Must contains 1 to 50 chars (required) :currency [String] Default currency code is default_currency :action [String] Default is :purchase (101 (Authorization + Validation)) :mode [String] Default is :direct (“CPT”) Optional parameters: notification_url, language_code, custom_payment_page_code, security_mode, recurring, custom_payment_template_url Optional objects: private_data, buyer, owner



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
# File 'lib/active_merchant/billing/gateways/payline/payline_web_api.rb', line 41

def do_web_payment(amount, options = {})
  optional_parameters = [
    'notificationURL',
    'languageCode',
    'customPaymentPageCode',
    'securityMode', # Required
    'recurring',
    'customPaymentTemplateURL'
  ]

  currency = currency_code(options[:currency])

  data = merged_data([
    # Required parameters
    add_payment(amount, currency, options[:action], options[:mode], options[:payment]),
    add_order(amount, currency, options[:order_ref], options[:order]),
    # Optionals parameters
    add_private_data(options[:private_data]),
    add_buyer(options[:buyer]),
    add_owner(options[:owner]),
    add_selected_contract_list(options[:contract_number], options[:all_contract_numbers]),
    add_optional_parameters(options, optional_parameters)
  ])

  puts data

  web_api_request :do_web_payment, data
end

#get_web_payment_details(token) ⇒ Object

:token [String] Token TODO: Fix



73
74
75
76
77
78
79
# File 'lib/active_merchant/billing/gateways/payline/payline_web_api.rb', line 73

def get_web_payment_details(token)
  data = {
    token: token
  }

  web_api_request :get_web_payment_details, data
end

#get_web_wallet(token) ⇒ Object

:token [String] token TODO: Fix



83
84
85
86
87
# File 'lib/active_merchant/billing/gateways/payline/payline_web_api.rb', line 83

def get_web_wallet(token)
  data = { token: token }

  web_wallet_request :get, data
end

#manage_web_wallet(buyer_data, options = {}) ⇒ Object

Allows user to manage its registered cards through a web page It returns an url where user must be redirected to handle its cards The URL must be “cleaned” (remove weird characters like amp;) Required parameters :buyer [buyer Object] Buyer data must contain :wallet_id, :first_name, :last_name :update_personal_details [Boolean] Default is 0 (false) Optional parameters: language_code, custom_payment_page_code, security_mode, custom_payment_template_url Optional objects: owner, selected_contract_list, private_data, buyer, contract_number_wallet



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/active_merchant/billing/gateways/payline/payline_web_api.rb', line 97

def manage_web_wallet(buyer_data, options = {})
  optional_parameters = [
    'languageCode',
    'customPaymentPageCode',
    'securityMode',
    'notificationURL',
    'customPaymentTemplateURL'
  ]

  data = merged_data([
    # Required parameters
    add_buyer(buyer_data),
    add_update_personal_details(options[:update_personal_details]),
    # Optional parameters
    add_owner(options[:owner]),
    add_private_data(options[:private_data]),
    add_selected_contract_list(options[:contract_number], options[:all_contract_numbers]),
    add_optional_parameters(options, optional_parameters),
    add_contract_number_wallet_list(options[:contract_number_wallet])
  ])

  web_wallet_request :manage, data
end

#update_web_wallet(wallet_id, options = {}) ⇒ Object

Deprecated method: use manage_web_wallet :wallet_id [String] Alpha-numeric 50 chars max (required) :update_payment_details [String] 0 = Updates forbidden ; 1 = Updates allowed :update_personal_details [String] 0 = Updates forbidden ; 1 = Updates allowed :update_owner_details [String] 0 = Updates forbidden ; 1 = Updates allowed Optional parameters: card_ind, languate_code, custom_payment_page_code, security_mode, notification_url, custom_payment_template_url Optional objects: buyer, private_data, contract_number_wallet



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/active_merchant/billing/gateways/payline/payline_web_api.rb', line 128

def update_web_wallet(wallet_id, options = {})
  optional_parameters = [
    'cardInd',
    'languageCode', 'customPaymentPageCode', 'securityMode', 'notificationURL',
    'customPaymentTemplateURL'
  ]

  required_parameters = {
    wallet_id: wallet_id,
    updatePaymentDetails: format_boolean(options[:update_payment_details], true),
    updateOwnerDetails: format_boolean(options[:updateOwnerDetails], true)
  }

  data = merged_data([
    required_parameters,
    add_update_personal_details(options[:update_personal_details]),
    # Optional parameters
    add_buyer(options[:buyer]),
    add_private_data(options[:private_data]),
    add_contract_number_wallet_list(options[:contract_number_wallet]),
    add_optional_parameters(options, optional_parameters)
  ])

  web_wallet_request :update, data
end