Module: MangoModel

Defined in:
lib/mangopay/model/model.rb,
lib/mangopay/model/event.rb,
lib/mangopay/model/money.rb,
lib/mangopay/model/address.rb,
lib/mangopay/model/billing.rb,
lib/mangopay/model/e_money.rb,
lib/mangopay/model/shipping.rb,
lib/mangopay/model/birthplace.rb,
lib/mangopay/model/entity/ubo.rb,
lib/mangopay/model/entity/card.rb,
lib/mangopay/model/entity/hook.rb,
lib/mangopay/model/enum/sector.rb,
lib/mangopay/model/broswer_info.rb,
lib/mangopay/model/declared_ubo.rb,
lib/mangopay/model/entity/client.rb,
lib/mangopay/model/entity/refund.rb,
lib/mangopay/model/entity/report.rb,
lib/mangopay/model/entity/wallet.rb,
lib/mangopay/model/refund_reason.rb,
lib/mangopay/model/scope_blocked.rb,
lib/mangopay/model/security_info.rb,
lib/mangopay/model/dispute_reason.rb,
lib/mangopay/model/entity/dispute.rb,
lib/mangopay/model/entity/mandate.rb,
lib/mangopay/model/entity/pay_out.rb,
lib/mangopay/model/enum/card_type.rb,
lib/mangopay/model/enum/kyc_level.rb,
lib/mangopay/model/entity/transfer.rb,
lib/mangopay/model/enum/avs_result.rb,
lib/mangopay/model/enum/event_type.rb,
lib/mangopay/model/enum/funds_type.rb,
lib/mangopay/model/entity/user/user.rb,
lib/mangopay/model/enum/card_status.rb,
lib/mangopay/model/enum/country_iso.rb,
lib/mangopay/model/enum/hook_status.rb,
lib/mangopay/model/enum/person_type.rb,
lib/mangopay/model/enum/report_type.rb,
lib/mangopay/model/enum/secure_mode.rb,
lib/mangopay/model/response_replica.rb,
lib/mangopay/model/enum/account_type.rb,
lib/mangopay/model/enum/culture_code.rb,
lib/mangopay/model/enum/currency_iso.rb,
lib/mangopay/model/enum/deposit_type.rb,
lib/mangopay/model/enum/dispute_type.rb,
lib/mangopay/model/enum/income_range.rb,
lib/mangopay/model/enum/mandate_type.rb,
lib/mangopay/model/entity/entity_base.rb,
lib/mangopay/model/entity/repudiation.rb,
lib/mangopay/model/entity/transaction.rb,
lib/mangopay/model/enum/business_type.rb,
lib/mangopay/model/enum/card_validity.rb,
lib/mangopay/model/enum/hook_validity.rb,
lib/mangopay/model/enum/platform_type.rb,
lib/mangopay/model/enum/report_status.rb,
lib/mangopay/model/entity/kyc_document.rb,
lib/mangopay/model/enum/dispute_status.rb,
lib/mangopay/model/enum/mandate_scheme.rb,
lib/mangopay/model/enum/mandate_status.rb,
lib/mangopay/model/enum/payment_status.rb,
lib/mangopay/model/entity/banking_alias.rb,
lib/mangopay/model/entity/client_wallet.rb,
lib/mangopay/model/entity/pay_in/pay_in.rb,
lib/mangopay/model/enum/document_status.rb,
lib/mangopay/model/enum/download_format.rb,
lib/mangopay/model/document_page_consult.rb,
lib/mangopay/model/enum/transaction_type.rb,
lib/mangopay/model/entity/ubo_declaration.rb,
lib/mangopay/model/entity/user/legal_user.rb,
lib/mangopay/model/enum/direct_debit_type.rb,
lib/mangopay/model/enum/kyc_document_type.rb,
lib/mangopay/model/enum/legal_person_type.rb,
lib/mangopay/model/entity/dispute_document.rb,
lib/mangopay/model/enum/banking_alias_type.rb,
lib/mangopay/model/enum/refund_reason_type.rb,
lib/mangopay/model/enum/transaction_nature.rb,
lib/mangopay/model/enum/transaction_status.rb,
lib/mangopay/model/platform_categorization.rb,
lib/mangopay/model/entity/card_registration.rb,
lib/mangopay/model/entity/pre_authorization.rb,
lib/mangopay/model/entity/user/natural_user.rb,
lib/mangopay/model/entity/user_block_status.rb,
lib/mangopay/model/enum/declared_ubo_status.rb,
lib/mangopay/model/enum/dispute_reason_type.rb,
lib/mangopay/model/enum/pay_in_payment_type.rb,
lib/mangopay/model/pay_in_web_extended_view.rb,
lib/mangopay/model/enum/mandate_culture_code.rb,
lib/mangopay/model/enum/pay_out_payment_type.rb,
lib/mangopay/model/entity/settlement_transfer.rb,
lib/mangopay/model/enum/dispute_document_type.rb,
lib/mangopay/model/enum/natural_user_capacity.rb,
lib/mangopay/model/enum/pay_in_execution_type.rb,
lib/mangopay/model/entity/account/bank_account.rb,
lib/mangopay/model/enum/mandate_execution_type.rb,
lib/mangopay/model/enum/ubo_declaration_status.rb,
lib/mangopay/model/entity/pay_in/card_web_pay_in.rb,
lib/mangopay/model/enum/pre_authorization_status.rb,
lib/mangopay/model/entity/account/ca_bank_account.rb,
lib/mangopay/model/entity/account/gb_bank_account.rb,
lib/mangopay/model/entity/account/us_bank_account.rb,
lib/mangopay/model/entity/pay_in/paypal_web_pay_in.rb,
lib/mangopay/model/entity/account/iban_bank_account.rb,
lib/mangopay/model/entity/pay_in/card_direct_pay_in.rb,
lib/mangopay/model/enum/kyc_doc_refused_reason_type.rb,
lib/mangopay/model/entity/account/other_bank_account.rb,
lib/mangopay/model/entity/account/debited_bank_account.rb,
lib/mangopay/model/enum/dispute_doc_refused_reason_type.rb,
lib/mangopay/model/entity/pay_in/apple_pay_direct_pay_in.rb,
lib/mangopay/model/entity/pay_in/bank_wire_direct_pay_in.rb,
lib/mangopay/model/entity/pay_in/direct_debit_web_pay_in.rb,
lib/mangopay/model/enum/declared_ubo_refused_reason_type.rb,
lib/mangopay/model/enum/pre_authorization_execution_type.rb,
lib/mangopay/model/entity/pay_in/google_pay_direct_pay_in.rb,
lib/mangopay/model/entity/pay_in/card_pre_authorized_pay_in.rb,
lib/mangopay/model/entity/pay_in/direct_debit_direct_pay_in.rb,
lib/mangopay/model/enum/ubo_declaration_refused_reason_type.rb,
lib/mangopay/model/entity/pay_in/bank_wire_external_instruction_pay_in.rb

Overview

Module for model classes.

Defined Under Namespace

Classes: AccountType, Address, ApplePayPayIn, ApplePayPaymentData, AvsResult, BankAccount, BankWireDirectPayIn, BankWireExternalInstructionPayIn, BankingAlias, BankingAliasType, Billing, Birthplace, BrowserInfo, BusinessType, CaBankAccount, Card, CardDirectPayIn, CardPreAuthorizedPayIn, CardRegistration, CardStatus, CardType, CardValidity, CardWebPayIn, Client, ClientWallet, CountryIso, CultureCode, CurrencyIso, DebitedBankAccount, DeclaredUbo, DeclaredUboRefusedReasonType, DeclaredUboStatus, DepositType, DirectDebitDirectPayIn, DirectDebitType, DirectDebitWebPayIn, Dispute, DisputeDocRefusedReasonType, DisputeDocument, DisputeDocumentType, DisputeReason, DisputeReasonType, DisputeStatus, DisputeType, DocumentPageConsult, DocumentStatus, DownloadFormat, EMoney, EntityBase, Event, EventType, FundsType, GbBankAccount, GooglePayPayIn, GooglePayPaymentData, Hook, HookStatus, HookValidity, IbanBankAccount, IncomeRange, KycDocRefusedReasonType, KycDocument, KycDocumentType, KycLevel, LegalPersonType, LegalUser, Mandate, MandateCultureCode, MandateExecutionType, MandateScheme, MandateStatus, MandateType, Money, NaturalUser, NaturalUserCapacity, OtherBankAccount, PayIn, PayInExecutionType, PayInPaymentType, PayInWebExtendedView, PayOut, PayOutPaymentType, PaymentStatus, PaypalWebPayIn, PersonType, PlatformCategorization, PlatformType, PreAuthorization, PreAuthorizationExecutionType, PreAuthorizationStatus, Refund, RefundReason, RefundReasonType, Report, ReportStatus, ReportType, Repudiation, ResponseReplica, ScopeBlocked, Sector, SecureMode, SecurityInfo, SettlementTransfer, Shipping, Transaction, TransactionNature, TransactionStatus, TransactionType, Transfer, Ubo, UboDeclaration, UboDeclarationRefusedReasonType, UboDeclarationStatus, UsBankAccount, User, UserBlockStatus, Wallet

Class Method Summary collapse

Class Method Details

.bank_account_type(hash) ⇒ Class

Asserts the type of bank account represented by a hash.

Parameters:

  • +hash+ (Hash)

    source hash

Returns:

  • (Class)

    type of bank account represented by the hash



187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/mangopay/model/model.rb', line 187

def (hash)
  case hash['Type']
    when AccountType::IBAN.to_s
      IbanBankAccount
    when AccountType::US.to_s
      UsBankAccount
    when AccountType::CA.to_s
      CaBankAccount
    when AccountType::GB.to_s
      GbBankAccount
    else
      OtherBankAccount
  end
end

.fields_of_type(type) ⇒ Object

Returns an array containing all declared field names of a certain type

noinspection RubyResolve



144
145
146
# File 'lib/mangopay/model/model.rb', line 144

def fields_of_type(type)
  @fields_by_type[type]
end

.pay_in_type(hash) ⇒ Class

Asserts the type of pay-in represented by a hash

Parameters:

  • +hash+ (Hash)

    source hash

Returns:

  • (Class)

    type of pay-in represented by the hash



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/mangopay/model/model.rb', line 152

def pay_in_type(hash)
  if hash['PaymentType'] == PayInPaymentType::CARD.to_s\
    && hash['ExecutionType'] == PayInExecutionType::WEB.to_s
    CardWebPayIn
  elsif hash['PaymentType'] == PayInPaymentType::CARD.to_s\
    && hash['ExecutionType'] == PayInExecutionType::DIRECT.to_s
    CardDirectPayIn
  elsif hash['PaymentType'] == PayInPaymentType::PREAUTHORIZED.to_s\
    && hash['ExecutionType'] == PayInExecutionType::DIRECT.to_s
    CardPreAuthorizedPayIn
  elsif hash['PaymentType'] == PayInPaymentType::BANK_WIRE.to_s\
     && hash['ExecutionType'] == PayInExecutionType::DIRECT.to_s
    BankWireDirectPayIn
  elsif hash['PaymentType'] == PayInPaymentType::BANK_WIRE.to_s\
     && hash['ExecutionType'] == PayInExecutionType::EXTERNAL_INSTRUCTION.to_s
    BankWireExternalInstructionPayIn
  elsif hash['PaymentType'] == PayInPaymentType::DIRECT_DEBIT.to_s\
     && hash['ExecutionType'] == PayInExecutionType::WEB.to_s
    DirectDebitWebPayIn
  elsif hash['PaymentType'] == PayInPaymentType::DIRECT_DEBIT.to_s\
     && hash['ExecutionType'] == PayInExecutionType::DIRECT.to_s
    DirectDebitDirectPayIn
  elsif hash['PaymentType'] == PayInPaymentType::PAYPAL.to_s\
     && hash['ExecutionType'] == PayInExecutionType::WEB.to_s
    PaypalWebPayIn
  elsif hash['PaymentType'] == PayInPaymentType::APPLEPAY.to_s\
     && hash['ExecutionType'] == PayInExecutionType::DIRECT.to_s
    ApplePayPayIn
  end
end

.user_type(hash) ⇒ Class

Asserts the type of user represented by a hash.

Parameters:

  • +hash+ (Hash)

    source hash

Returns:

  • (Class)

    type of user represented by the hash



206
207
208
209
210
211
212
213
# File 'lib/mangopay/model/model.rb', line 206

def user_type(hash)
  case hash['PersonType']
    when PersonType::NATURAL.to_s
      NaturalUser
    else
      LegalUser
  end
end