Skip to content

Instantly share code, notes, and snippets.

@stefanoverna
Created December 18, 2013 14:34
Show Gist options
  • Select an option

  • Save stefanoverna/8023308 to your computer and use it in GitHub Desktop.

Select an option

Save stefanoverna/8023308 to your computer and use it in GitHub Desktop.
# Business entity
# Business Name
# Email
# FirstName of the legal representative
# LastName of the legal representative
# Birthday of the legal representative
# Nationality of the legal representative
# Country of residence of the legal representative
# Adress of the legal representative
# IP (for Country of Residence)
# PersonType : LEGAL_PERSONALITY
# Headquarter address (declarative field)
# Certified articles of association
# Proof of registration: Extract from the Company Register issued within the last three months (4)
# Shareholder declaration
# Email: The email of the company or the organization (<255 chars)
# Name: The name of the company or the organization (<255 chars)
# LegalPersonType: 'BUSINESS'
# HeadquartersAddress: The address of the company’s headquarters (<255 chars)
# LegalRepresentativeFirstName*
# LegalRepresentativeLastName*
# LegalRepresentativeAdress
# LegalRepresentativeEmail
# LegalRepresentativeBirthday (Timestamp)
# LegalRepresentativeNationality (IT —— ISO 3166-1 alpha-2 format expected)
# LegalRepresentativeCountryOfResidence (IT)
# Statute (String) The business statute of the company
# ProofOfRegistration (string) The proof of registration of the company
# ShareholderDeclaration (string) The shareholder declaration of the company
# legal_user = MangoPay::LegalUser.create(
# Name: 'Limoney s.r.l.',
# Email: '[email protected]',
# LegalPersonType: 'BUSINESS',
# HeadquartersAddress: 'Via Giacomo Leopardi, 7 - 20123 Milano, Italy',
# LegalRepresentativeFirstName: 'Giuseppe',
# LegalRepresentativeLastName: 'De Martino Norante',
# LegalRepresentativeAdress: 'Via Giacomo Leopardi, 7 - 20123 Milano, Italy',
# LegalRepresentativeEmail: '[email protected]',
# LegalRepresentativeBirthday: Date.new(1985, 9, 25).to_time.to_i,
# LegalRepresentativeNationality: 'IT',
# LegalRepresentativeCountryOfResidence: 'IT',
# Statute: '',
# ProofOfRegistration: '',
# ShareholderDeclaration: ''
# )
# {
# "Name" => "Limoney s.r.l.",
# "LegalPersonType" => "BUSINESS",
# "HeadquartersAddress" => "Via Giacomo Leopardi, 7 - 20123 Milano, Italy",
# "LegalRepresentativeFirstName" => "Giuseppe",
# "LegalRepresentativeLastName" => "De Martino Norante",
# "LegalRepresentativeEmail" => "[email protected]",
# "LegalRepresentativeBirthday" => 496447200,
# "LegalRepresentativeNationality" => "IT",
# "LegalRepresentativeCountryOfResidence" => "IT",
# "ProofOfRegistration" => nil,
# "ShareholderDeclaration" => nil,
# "LegalRepresentativeAddress" => nil,
# "Statute" => nil,
# "PersonType" => "LEGAL",
# "Email" => "[email protected]",
# "Id" => "1299793",
# "Tag" => nil,
# "CreationDate" => 1387372878
# }
# document = MangoPay::KycDocument.create(legal_user['Id'], Type: 'ARTICLES_OF_ASSOCIATION', Status: 'CREATED')
# document = MangoPay::KycDocument.update(legal_user['Id'], document['Id'], Status: 'VALIDATION_ASKED')
# {
# "Id" => "1299807",
# "Tag" => nil,
# "CreationDate" => 1387373049,
# "Type" => "ARTICLES_OF_ASSOCIATION",
# "Status" => "CREATED",
# "RefusedReasonType" => nil,
# "RefusedReasonMessage" => nil
# }
# page_1 = MangoPay::KycDocument.create_page(legal_user['Id'], document['Id'], File.open('/Users/stefanoverna/Dropbox/artificio handmade/Design/illustration.jpg'))
# require 'faraday'
# class MangoApi < Struct.new(:user_id)
# def register_card(number, expiration, cvv)
# card = MangoPay::CardRegistration.create({
# UserId: user_id,
# Currency: 'EUR',
# Tag: 'test'
# })
# post_data = {
# data: card["PreregistrationData"],
# accessKeyRef: card["AccessKey"],
# cardNumber: number,
# cardExpirationDate: expiration,
# cardCvx: cvv
# }
# response = Faraday.post(card["CardRegistrationURL"], post_data)
# MangoPay::CardRegistration.update(card['Id'], {
# RegistrationData: response.body
# })
# end
# end
# # begin
# # user = MangoPay::NaturalUser.create({
# # Tag: 'test',
# # Email: '[email protected]',
# # FirstName: 'Stefano',
# # LastName: 'Verna',
# # Birthday: Date.new(1985, 9, 25).to_time.to_i,
# # Nationality: 'IT',
# # CountryOfResidence: 'IT'
# # })
# # rescue Exception => e
# # puts e.message.inspect
# # puts e.type.inspect
# # puts e.errors.inspect
# # end
# # begin
# # wallet = MangoPay::Wallet.create({
# # Owners: [user['Id']],
# # Description: 'Personal wallet',
# # Currency: 'EUR',
# # Tag: 'test'
# # })
# # rescue Exception => e
# # puts e.message.inspect
# # puts e.type.inspect
# # puts e.errors.inspect
# # end
# wallet = {
# "Owners" => [ "1227231" ],
# "Description" => "Personal wallet",
# "Balance" => { "Currency" => "EUR", "Amount" => 0 },
# "Currency" => "EUR",
# "Id" => "1227232",
# "Tag" => "test",
# "CreationDate" => 1386161361
# }
# user = {
# "FirstName" => "Stefano",
# "LastName" => "Verna",
# "Address" => nil,
# "Birthday" => 496447200,
# "Nationality" => "IT",
# "CountryOfResidence" => "IT",
# "Occupation" => nil,
# "IncomeRange" => nil,
# "ProofOfIdentity" => nil,
# "ProofOfAddress" => nil,
# "PersonType" => "NATURAL",
# "Email" => "[email protected]",
# "Id" => "1227231",
# "Tag" => "test",
# "CreationDate" => 1386161148
# }
# validated_card = {
# "Id" => "1233508",
# "Tag" => "test",
# "CreationDate" => 1386251037,
# "UserId" => "1227231",
# "AccessKey" => "1X0m87dmM2LiwFgxPLBJ",
# "PreregistrationData" => "dtxlzFRSvUcdNkJimn-i_Ag-GPKKaUYvAVTG6VK96uaMdFzfuux0VOWynb3WooOIr2CJUbxdzg0r9MqKdI2YGg",
# "RegistrationData" => "data=aVOV2m0voCq1y15IEuQCtp0Jb36VvCn1KQ-zm78SYHhOdKcYAHc14jlBns2H2ft-phVRiBNqouQBMNXXFgeytcmzAWLJ6C2QD_3uR7mX08_-6H4zbY2Nnp1TliwkEFi4",
# "CardId" => "1233580",
# "CardRegistrationURL" => "https://homologation-webpayment.payline.com/webpayment/getToken",
# "ResultCode" => "000000",
# "ResultMessage" => "Success",
# "Currency" => "EUR",
# "Status" => "VALIDATED"
# }
# secure_3d_card = {
# "Id" => "1233755",
# "Tag" => "test",
# "CreationDate" => 1386252726,
# "UserId" => "1227231",
# "AccessKey" => "1X0m87dmM2LiwFgxPLBJ",
# "PreregistrationData" => "ObMObfSdwRfyE4QClGtUc2TABi3ULM5nAsA1v4GYXQtBQib7x3EoZZSkZunBHEyJr2CJUbxdzg0r9MqKdI2YGg",
# "RegistrationData" => "data=BkJVRtaEUfDqp4NWyyhFxmxsy-Z_00a9YIRJlF7Cvevf3SBGCUurqQFdXvfon8sw_j43-EzRVdFXX9e2dcutDOJ3UmNFtD1qkXGXlvhBBuLR-0hjAXE51-YNDka0z9wi",
# "CardId" => "1233756",
# "CardRegistrationURL" => "https://homologation-webpayment.payline.com/webpayment/getToken",
# "ResultCode" => "000000",
# "ResultMessage" => "Success",
# "Currency" => "EUR",
# "Status" => "VALIDATED"
# }
# wallet = {
# "Owners" => [ "1227231" ],
# "Description" => "Personal wallet",
# "Balance" => { "Currency" => "EUR", "Amount" => 0 },
# "Currency" => "EUR",
# "Id" => "1227232",
# "Tag" => "test",
# "CreationDate" => 1386161361
# }
# success_payin = {
# "Id" => "1233741",
# "Tag" => "Test PayIn/Card/Direct",
# "CreationDate" => 1386252551,
# "AuthorId" => "1227231",
# "CreditedUserId" => "1227231",
# "DebitedFunds" => {
# "Currency" => "EUR",
# "Amount" => 1000
# },
# "CreditedFunds" => {
# "Currency" => "EUR",
# "Amount" => 1000
# },
# "Fees" => {
# "Currency" => "EUR",
# "Amount" => 0
# },
# "Status" => "SUCCEEDED",
# "ResultCode" => "000000",
# "ResultMessage" => "Success",
# "ExecutionDate" => 1386252554,
# "Type" => "PAYIN",
# "Nature" => "REGULAR",
# "CreditedWalletId" => "1227232",
# "DebitedWalletId" => nil,
# "PaymentType" => "CARD",
# "ExecutionType" => "DIRECT",
# "SecureMode" => nil,
# "CardId" => "1233580",
# "SecureModeReturnURL" => nil
# }
# MangoPay::PayIn::Card::Direct.create({
# AuthorId: user['Id'],
# CreditedUserId: wallet['Owners'][0],
# CreditedWalletId: wallet['Id'],
# DebitedFunds: { Currency: 'EUR', Amount: 1000 },
# Fees: { Currency: 'EUR', Amount: 0 },
# CardId: secure_3d_card['CardId'],
# SecureModeReturnURL: 'http://test.com',
# Tag: 'Test PayIn/Card/Direct',
# SecureMode: 'FORCE'
# })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment