Module: MangoApi::PayIns

Extended by:
UriProvider
Defined in:
lib/mangopay/api/service/pay_ins.rb

Overview

Provides API method delegates concerning the PayIn entity

Class Method Summary collapse

Methods included from UriProvider

provide_uri

Class Method Details

.create_apple_pay_direct(pay_in, id_key = nil) ⇒ ApplePayPayIn

Creates a new pay-in entity of PaymentType::APPLE_PAY and ExecutionType::DIRECT.

ApplePayPayIn properties:

  • Required

    • author_id

    • credited_wallet_id

    • debited_funds

    • fees

    • transaction_id

    • network

    • token_data

  • Optional

    • tag

    • credited_user_id

    • statement_descriptor

Parameters:

  • +pay_in+ (ApplePayPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (ApplePayPayIn)

    the newly-created pay-in entity object



233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/mangopay/api/service/pay_ins.rb', line 233

def create_apple_pay_direct(pay_in, id_key = nil)
  uri = provide_uri(:create_apple_pay_pay_in)
  json = pay_in.jsonify!
  payment_data = pay_in.payment_data.to_json
  new_json = json[0..json.length - 2] + "," + "\"PaymentData\":" + payment_data + "}"
  response = HttpClient.post_raw(uri) do |request|
    HttpClient.api_headers.each { |k, v| request.add_field(k, v) }
    request.add_field('Idempotency-Key', id_key) if id_key
    request.body = new_json
  end
  parse response
end

.create_bank_wire_direct(pay_in, id_key = nil) ⇒ BankWireDirectPayIn

Creates a new pay-in entity of PaymentType::BANK_WIRE and ExecutionType::DIRECT.

BankWireDirectPayIn properties:

  • Required

    • author_id

    • credited_wallet_id

    • declared_debited_funds

    • declared_fees

  • Optional

    • tag

    • credited_user_id

Parameters:

  • +pay_in+ (BankWireDirectPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (BankWireDirectPayIn)

    the newly-created pay-in entity object



103
104
105
106
107
# File 'lib/mangopay/api/service/pay_ins.rb', line 103

def create_bank_wire_direct(pay_in, id_key = nil)
  uri = provide_uri(:create_bank_wire_direct_pay_in)
  response = HttpClient.post(uri, pay_in, id_key)
  parse response
end

.create_card_direct(pay_in, id_key = nil) ⇒ CardDirectPayIn

Creates a new pay-in entity of PaymentType::CARD and ExecutionType::DIRECT.

CardDirectPayIn properties:

  • Required

    • author_id

    • credited_wallet_id

    • debited_funds

    • fees

    • secure_mode_return_url

    • card_id

  • Optional

    • tag

    • credited_user_id

    • secure_mode

    • statement_descriptor

Parameters:

  • +pay_in+ (CardDirectPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (CardDirectPayIn)

    the newly-created pay-in entity object



58
59
60
61
62
# File 'lib/mangopay/api/service/pay_ins.rb', line 58

def create_card_direct(pay_in, id_key = nil)
  uri = provide_uri(:create_card_direct_pay_in)
  response = HttpClient.post(uri, pay_in, id_key)
  parse response
end

.create_card_pre_authorized(pay_in, id_key = nil) ⇒ CardPreAuthorizedPayIn

Creates a new pay-in entity of PaymentType::PREAUTHORIZED and ExecutionType::DIRECT

CardPreAuthorizedPayIn properties:

  • Required

    • author_id

    • credited_wallet_id

    • debited_funds

    • fees

    • preauthorization_id

  • Optional

    • tag

    • credited_user_id

Parameters:

  • +pay_in+ (CardPreAuthorizedPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (CardPreAuthorizedPayIn)

    the newly-created pay-in entity object



81
82
83
84
85
# File 'lib/mangopay/api/service/pay_ins.rb', line 81

def create_card_pre_authorized(pay_in, id_key = nil)
  uri = provide_uri(:create_card_pre_authorized_pay_in)
  response = HttpClient.post(uri, pay_in, id_key)
  parse response
end

.create_card_web(pay_in, id_key = nil) ⇒ CardWebPayIn

Creates a new pay-in entity of PaymentType::CARD and ExecutionType::WEB.

CardWebPayIn properties:

  • Required

    • author_id

    • debited_funds

    • fees

    • return_url

    • credited_wallet_id

    • card_type

    • culture

  • Optional

    • tag

    • credited_user_id

    • secure_mode

    • template_url_options

    • statement_descriptor

Parameters:

  • +pay_in+ (CardWebPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (CardWebPayIn)

    the newly-created pay-in entity object



32
33
34
35
36
# File 'lib/mangopay/api/service/pay_ins.rb', line 32

def create_card_web(pay_in, id_key = nil)
  uri = provide_uri(:create_card_web_pay_in)
  response = HttpClient.post(uri, pay_in, id_key)
  parse response
end

.create_client_bank_wire_direct(pay_in, id_key = nil) ⇒ Object

Creates a new pay-in entity of PaymentType::BANK_WIRE and ExecutionType::DIRECT. This method can be used to add funds to the environment’s client’s wallets.

BankWireDirectPayIn properties:

  • Required

    • credited_wallet_id

    • declared_debited_funds

    • declared_fees

  • Optional

    • tag

Note: The ID field must contain one of the automatically-generated ClientWallet IDs specific to the current environment’s client (FUNDS_TYPE _ CURRENCY - FEES_EUR, CREDIT_USD etc.)

Parameters:

  • +pay_in+ (BankWireDirectPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication



126
127
128
129
130
# File 'lib/mangopay/api/service/pay_ins.rb', line 126

def create_client_bank_wire_direct(pay_in, id_key = nil)
  uri = provide_uri(:create_client_bank_wire_direct_pay_in)
  response = HttpClient.post(uri, pay_in, id_key)
  parse response
end

.create_direct_debit_direct(pay_in, id_key = nil) ⇒ DirectDebitDirectPayIn

Creates a new pay-in entity of PaymentType::DIRECT_DEBIT and ExecutionType::DIRECT.

DirectDebitDirectPayIn properties:

  • Required

    • author_id

    • credited_wallet_id

    • debited_funds

    • fees

    • mandate_id

  • Optional

    • tag

    • credited_user_id

    • statement_descriptor

Parameters:

  • +pay_in+ (DirectDebitDirectPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (DirectDebitDirectPayIn)

    the newly-created pay-in entity object



177
178
179
180
181
# File 'lib/mangopay/api/service/pay_ins.rb', line 177

def create_direct_debit_direct(pay_in, id_key = nil)
  uri = provide_uri(:create_direct_debit_direct_pay_in)
  response = HttpClient.post(uri, pay_in, id_key)
  parse response
end

.create_direct_debit_web(pay_in, id_key = nil) ⇒ DirectDebitWebPayIn

Creates a new pay-in entity of PaymentType::DIRECT_DEBIT and ExecutionType::WEB.

DirectDebitWebPayIn properties:

  • Required

    • author_id

    • debited_funds

    • fees

    • return_url

    • credited_wallet_id

    • direct_debit_type

    • culture

  • Optional

    • tag

    • credited_user_id

    • secure_mode

    • template_url_options

Parameters:

  • +pay_in+ (DirectDebitWebPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (DirectDebitWebPayIn)

    the newly-created pay-in entity object



153
154
155
156
157
# File 'lib/mangopay/api/service/pay_ins.rb', line 153

def create_direct_debit_web(pay_in, id_key = nil)
  uri = provide_uri(:create_direct_debit_web_pay_in)
  response = HttpClient.post(uri, pay_in, id_key)
  parse response
end

.create_google_pay_direct(pay_in, id_key = nil) ⇒ GooglePayPayIn

Creates a new pay-in entity of PaymentType::GOOGLE_PAY and ExecutionType::DIRECT.

GooglePayPayIn properties:

  • Required

    • author_id

    • credited_wallet_id

    • debited_funds

    • fees

    • transaction_id

    • network

    • token_data

    • billing

  • Optional

    • tag

    • credited_user_id

    • statement_descriptor

Parameters:

  • +pay_in+ (GooglePayPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (GooglePayPayIn)

    the newly-created pay-in entity object



267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/mangopay/api/service/pay_ins.rb', line 267

def create_google_pay_direct(pay_in, id_key = nil)
  uri = provide_uri(:create_google_pay_pay_in)
  json = pay_in.jsonify!
  payment_data = pay_in.payment_data.to_json
  billing = pay_in.billing.to_json
  new_json = json[0..json.length - 2] + "," + "\"PaymentData\":" + payment_data + "\"Billing\":" + billing + "}"
  response = HttpClient.post_raw(uri) do |request|
    HttpClient.api_headers.each { |k, v| request.add_field(k, v) }
    request.add_field('Idempotency-Key', id_key) if id_key
    request.body = new_json
  end
  parse response
end

.create_paypal_web(pay_in, id_key = nil) ⇒ PaypalWebPayIn

Creates a new pay-in entity of PaymentType::PAYPAL and ExecutionType::WEB.

PaypalWebPayIn properties:

  • Required

    • author_id

    • debited_funds

    • fees

    • return_url

    • credited_wallet_id

    • direct_debit_type

    • shipping_address

    • paypal_buyer_account_email

    • culture

  • Optional

    • tag

    • credited_user_id

    • secure_mode

    • template_url_options

Parameters:

  • +pay_in+ (PaypalWebPayIn)

    the pay-in data model object

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (PaypalWebPayIn)

    the newly-created pay-in entity object



207
208
209
210
211
# File 'lib/mangopay/api/service/pay_ins.rb', line 207

def create_paypal_web(pay_in, id_key = nil)
  uri = provide_uri(:create_paypal_web_pay_in)
  response = HttpClient.post(uri, pay_in, id_key)
  parse response
end

.extended_card_view(pay_in_id) ⇒ PayInWebExtendedView

Retrieves a detailed view of details concerning the card used to process a Web payment.

for which to retrieve extended details view details about the card

Parameters:

  • +pay_in_id+ (String)

    ID of the Card Web Pay-In entity

Returns:

  • (PayInWebExtendedView)

    Object containing extended



298
299
300
301
302
# File 'lib/mangopay/api/service/pay_ins.rb', line 298

def extended_card_view(pay_in_id)
  uri = provide_uri(:get_extended_card_view, pay_in_id)
  response = HttpClient.get(uri)
  parse_card_view response
end

.get(id) ⇒ PayIn

Retrieves a pay-in entity.

Parameters:

  • +id+ (String)

    ID of the pay-in to be retrieved

Returns:

  • (PayIn)

    the requested entity object



285
286
287
288
289
# File 'lib/mangopay/api/service/pay_ins.rb', line 285

def get(id)
  uri = provide_uri(:get_pay_in, id)
  response = HttpClient.get(uri)
  parse response
end