Giter Club home page Giter Club logo

mangopay2-ruby-sdk's Introduction

MANGOPAY API Known Issues

You can use the issues tab of this repo to follow known issues in our production and sandbox environments.

Feel free to subscribe to an issue to be updated of any changes.

MANGOPAY API Status

For the current status of the API and scheduled maintenance announcements, please see status.mangopay.com

mangopay2-ruby-sdk's People

Contributors

andrianmoroi avatar andriinyzhnik avatar catacraciun avatar cosmin-margarit avatar georgea93 avatar glorieux avatar hobailey avatar homologist avatar iulian03 avatar laurynas avatar mangomaxoasis avatar mantaskujalis avatar micdahl avatar mickaelpois avatar mihaimoiseanu avatar murarumihai avatar my-kel avatar nicolasleger avatar nikolai-b avatar octa-george avatar oleveau avatar peterb avatar sallesma avatar seuros avatar silvianagh avatar solojr avatar stefanghivi avatar sylvain avatar vin0uz avatar visagalis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mangopay2-ruby-sdk's Issues

(UK) Bank Account registration gives no meaningful error message

When registering a bank account with an incorrect account number (for example, a 9-digit account number instead of the standard 8 digits), no useful error is provided.

The gem raises the following only:

MangoPay::ResponseError (One or several required parameters are missing or incorrect)

If the sort code is incorrect however, the following (more useful) message is returned:

One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error. SortCode: The field SortCode must match the regular expression '\d{6}'.

After creating an object CardRegistration CardRegistrationURL is always constant.

I create an object CardRegistration.

card_preregistration = MangoPay::CardRegistration.create({
        UserId: current_user.mangopay_id,
        Currency: "EUR",
        CardType: "CB_VISA_MASTERCARD"
      })

get object

{"Id"=>"14920184",
 "Tag"=>nil,
 "CreationDate"=>1469881306,
 "UserId"=>"14864666",
 "AccessKey"=>"1X0m87dmM2LiwFgxPLBJ",
 "PreregistrationData"=>"HBalUf7sKsj1NiktfVS7-3qkcqZHmUspHZMm4Ps6963_ee0enbOZtciDVpLf0nYFS4wCy-yiraxeE65tmxOe8A",
 "RegistrationData"=>nil,
 "CardId"=>nil,
 "CardType"=>"CB_VISA_MASTERCARD",
 "CardRegistrationURL"=>"https://homologation-webpayment.payline.com/webpayment/getToken",
 "ResultCode"=>nil,
 "ResultMessage"=>nil,
 "Currency"=>"EUR",
 "Status"=>"CREATED"}

Why every time url is fixed? I read documentation: hould not be posting the card info to a fixed URL, but instead, you should always post it to the CardRegistrationURL that is found in the CardRegistration object for that particular card registration.

What exactly is the problem?

Gem version 3.0.24 has no code...

Hi,

Your gem version 3.0.24 has no code. The size is 4.5 ko on rubygems. Can you push your gem again to rubygems please?

Regards.

Card Registration Kit in the gem

Hello,

I am testing your solution in a RoR project and I wonder why you did not include the card registration JS kit (at least the minified one) in the gem.

I had to host it myself in the RoR project so if the JS kit has any changes, I will still get an obsolete one in my project.

Another solution is to wrap the JS kit in another gem (like backbone : https://github.com/codebrew/backbone-rails ).

Finally, providing a minified version hosted by Mangopay itself (like Stripe do: https://js.stripe.com/v2/) is a good solution too.

Regards

Failing specs

I've just cloned the project, run the specs and it seems 10 of them are failing right now:

mangopay2-ruby-sdk git:(master) rspec spec
.....................................FF.....FF...........FF.F......FFF........................

Failures:

  1) MangoPay::KycDocument CREATE PAGE accepts File instance
     Failure/Error: MangoPay::KycDocument.create_page(new_natural_user['Id'], new_document['Id'], file)
     MangoPay::ResponseError:
       One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error. File: The type of the file submitted could not be determined - please try using a different file type
     # ./lib/mangopay.rb:93:in `request'
     # ./lib/mangopay/kyc_document.rb:51:in `create_page'
     # ./spec/mangopay/kyc_document_spec.rb:72:in `create_page'
     # ./spec/mangopay/kyc_document_spec.rb:77:in `block (3 levels) in <top (required)>'

  2) MangoPay::KycDocument CREATE PAGE accepts base64-encoded string
     Failure/Error: MangoPay::KycDocument.create_page(new_natural_user['Id'], new_document['Id'], file)
     MangoPay::ResponseError:
       Internal Server Error
     # ./lib/mangopay.rb:93:in `request'
     # ./lib/mangopay/kyc_document.rb:51:in `create_page'
     # ./spec/mangopay/kyc_document_spec.rb:72:in `create_page'
     # ./spec/mangopay/kyc_document_spec.rb:83:in `block (3 levels) in <top (required)>'

  3) MangoPay::PayIn::Card::Direct REFUND refunds a payin
     Failure/Error: refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
     MangoPay::ResponseError:
       Internal Server Error
     # ./lib/mangopay.rb:93:in `request'
     # ./lib/mangopay/http_calls.rb:71:in `refund'
     # ./spec/mangopay/payin_card_direct_spec.rb:42:in `block (3 levels) in <top (required)>'

  4) MangoPay::PayIn::Card::Direct CASH FLOW changes balances correctly
     Failure/Error: refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
     MangoPay::ResponseError:
       Internal Server Error
     # ./lib/mangopay.rb:93:in `request'
     # ./lib/mangopay/http_calls.rb:71:in `refund'
     # ./spec/mangopay/payin_card_direct_spec.rb:63:in `block (3 levels) in <top (required)>'

  5) MangoPay::PreAuthorization CREATE creates a new card pre-authorization
     Failure/Error: expect(created['Status']).to eq('SUCCEEDED')

       expected: "SUCCEEDED"
            got: "FAILED"

       (compared using ==)
     # ./spec/mangopay/preauthorization_spec.rb:14:in `block (3 levels) in <top (required)>'

  6) MangoPay::PreAuthorization UPDATE updates a card pre-authorization
     Failure/Error: updated = MangoPay::PreAuthorization.update(created['Id'] ,{
     MangoPay::ResponseError:
       One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error. PaymentStatus: PaymentSatus value has to be 'WAITING' to edit a PreAuthorization
     # ./lib/mangopay.rb:93:in `request'
     # ./lib/mangopay/http_calls.rb:20:in `update'
     # ./spec/mangopay/preauthorization_spec.rb:24:in `block (3 levels) in <top (required)>'

  7) MangoPay::Refund FETCH fetches a refund
     Failure/Error: resource = MangoPay::Transfer.refund(transfer['Id'], { AuthorId: transfer['AuthorId'] })
     MangoPay::ResponseError:
       Internal Server Error
     # ./lib/mangopay.rb:93:in `request'
     # ./lib/mangopay/http_calls.rb:71:in `refund'
     # ./spec/mangopay/refund_spec.rb:7:in `block (3 levels) in <top (required)>'

  8) MangoPay::Transfer CREATE creates a new Transfer
     Failure/Error: expect(trans['Status']).to eq('SUCCEEDED')

       expected: "SUCCEEDED"
            got: "FAILED"

       (compared using ==)
     # ./spec/mangopay/transfer_spec.rb:11:in `check_type_and_status'
     # ./spec/mangopay/transfer_spec.rb:21:in `block (3 levels) in <top (required)>'

  9) MangoPay::Transfer FETCH fetches a Transfer
     Failure/Error: expect(trans['Status']).to eq('SUCCEEDED')

       expected: "SUCCEEDED"
            got: "FAILED"

       (compared using ==)
     # ./spec/mangopay/transfer_spec.rb:11:in `check_type_and_status'
     # ./spec/mangopay/transfer_spec.rb:30:in `block (3 levels) in <top (required)>'

  10) MangoPay::Transfer REFUND refunds a transfer
     Failure/Error: refund = MangoPay::Transfer.refund(trans['Id'], {AuthorId: trans['AuthorId']})
     MangoPay::ResponseError:
       Internal Server Error
     # ./lib/mangopay.rb:93:in `request'
     # ./lib/mangopay/http_calls.rb:71:in `refund'
     # ./spec/mangopay/transfer_spec.rb:38:in `block (3 levels) in <top (required)>'

Finished in 7 minutes 36 seconds (files took 0.25313 seconds to load)
94 examples, 10 failures

Failed examples:

rspec ./spec/mangopay/kyc_document_spec.rb:75 # MangoPay::KycDocument CREATE PAGE accepts File instance
rspec ./spec/mangopay/kyc_document_spec.rb:81 # MangoPay::KycDocument CREATE PAGE accepts base64-encoded string
rspec ./spec/mangopay/payin_card_direct_spec.rb:40 # MangoPay::PayIn::Card::Direct REFUND refunds a payin
rspec ./spec/mangopay/payin_card_direct_spec.rb:54 # MangoPay::PayIn::Card::Direct CASH FLOW changes balances correctly
rspec ./spec/mangopay/preauthorization_spec.rb:6 # MangoPay::PreAuthorization CREATE creates a new card pre-authorization
rspec ./spec/mangopay/preauthorization_spec.rb:22 # MangoPay::PreAuthorization UPDATE updates a card pre-authorization
rspec ./spec/mangopay/refund_spec.rb:5 # MangoPay::Refund FETCH fetches a refund
rspec ./spec/mangopay/transfer_spec.rb:18 # MangoPay::Transfer CREATE creates a new Transfer
rspec ./spec/mangopay/transfer_spec.rb:26 # MangoPay::Transfer FETCH fetches a Transfer
rspec ./spec/mangopay/transfer_spec.rb:36 # MangoPay::Transfer REFUND refunds a transfer

Top 10 slowest examples (193.05 seconds, 42.3% of total time):
  MangoPay::PayIn::Card::Direct REFUND refunds a payin
    40.36 seconds ./spec/mangopay/payin_card_direct_spec.rb:40
  MangoPay::PayIn::Card::Direct CASH FLOW changes balances correctly
    37.77 seconds ./spec/mangopay/payin_card_direct_spec.rb:54
  MangoPay::Event FETCH accepts filtering params
    22.12 seconds ./spec/mangopay/event_spec.rb:8
  MangoPay::PayIn::PreAuthorized::Direct REFUND refunds a payin
    16.22 seconds ./spec/mangopay/payin_preauthorized_direct_spec.rb:40
  MangoPay::PayIn::PreAuthorized::Direct CASH FLOW changes balances correctly
    15.78 seconds ./spec/mangopay/payin_preauthorized_direct_spec.rb:54
  MangoPay::Transaction FETCH accepts filtering params
    13.93 seconds ./spec/mangopay/transaction_spec.rb:35
  MangoPay::Wallet FETCH TRANSACTIONS fetches list with two transactions after payin and payout done
    12.73 seconds ./spec/mangopay/wallet_spec.rb:48
  MangoPay::Wallet FETCH TRANSACTIONS accepts filtering params
    11.69 seconds ./spec/mangopay/wallet_spec.rb:61
  MangoPay::Transaction FETCH fetches list with two transactions after payin and payout done
    11.31 seconds ./spec/mangopay/transaction_spec.rb:22
  MangoPay::Transfer CASH FLOW changes balances correctly
    11.12 seconds ./spec/mangopay/transfer_spec.rb:51

Top 10 slowest example groups:
  MangoPay::PayIn::Card::Direct
    23.86 seconds average (95.43 seconds / 4 examples) ./spec/mangopay/payin_card_direct_spec.rb:1
  MangoPay::Event
    22.12 seconds average (22.12 seconds / 1 example) ./spec/mangopay/event_spec.rb:1
  MangoPay::PayIn::PreAuthorized::Direct
    13.46 seconds average (53.84 seconds / 4 examples) ./spec/mangopay/payin_preauthorized_direct_spec.rb:1
  MangoPay::Transfer
    10.18 seconds average (40.72 seconds / 4 examples) ./spec/mangopay/transfer_spec.rb:1
  MangoPay::Refund
    9.8 seconds average (9.8 seconds / 1 example) ./spec/mangopay/refund_spec.rb:1
  MangoPay::Transaction
    7.63 seconds average (30.54 seconds / 4 examples) ./spec/mangopay/transaction_spec.rb:1
  MangoPay::PayOut::BankWire
    7.58 seconds average (22.75 seconds / 3 examples) ./spec/mangopay/payout_bankwire_spec.rb:1
  MangoPay::PreAuthorization
    7.41 seconds average (22.23 seconds / 3 examples) ./spec/mangopay/preauthorization_spec.rb:1
  MangoPay::Wallet
    5.31 seconds average (37.14 seconds / 7 examples) ./spec/mangopay/wallet_spec.rb:1
  MangoPay::Client
    2.71 seconds average (8.12 seconds / 3 examples) ./spec/mangopay/client_spec.rb:1

I'd like to work on a PR to allow changing the Net:HTTP's timeout, but with the specs failing it's going to be hard to be sure I'm not breaking anything.

Update object Registrationcard - status: "Error", Registration data : Invalid format

card_registration = MangoPay::CardRegistration.update(@card_preregistration['Id'], {
        RegistrationData: params['data'],
        Tag: "custom tag"
      })

get object:

{"Id"=>"14933221",
 "Tag"=>"custom tag",
 "CreationDate"=>1470042272,
 "UserId"=>"14864666",
 "AccessKey"=>"1X0m87dmM2LiwFgxPLBJ",
 "PreregistrationData"=>"HBalUf7sKsj1NiktfVS7-5hcy0wnI7S09u8Mt_wDqjHl4pF_ovjC3sT4rQlD-kkWS4wCy-yiraxeE65tmxOe8A",
 "RegistrationData"=>
  "dAj315t4g0Sq0Zy7Th16sZW8JdlJU9gOvGgqnX8CQYE31RvhjifXGGPRmadJIXl1RhB87FS5SWmLMvSvJBILNJw1oNiYNfR52yME07yw7w0biQkZzsH3JzYmrfS-dnkQ0ftIYwFxOdfmDQ5GtM_cIg",
 "CardId"=>nil,
 "CardType"=>"CB_VISA_MASTERCARD",
 "CardRegistrationURL"=>"https://homologation-webpayment.payline.com/webpayment/getToken",
 "ResultCode"=>"105206",
 "ResultMessage"=>"Registration data : Invalid format",
 "Currency"=>"EUR",
 "Status"=>"ERROR"}

Console logs:

Started GET "/finialize?data=dAj315t4g0Sq0Zy7Th16sZW8JdlJU9gOvGgqnX8CQYE31RvhjifXGGPRmadJIXl1RhB87FS5SWmLMvSvJBILNJw1oNiYNfR52yME07yw7w0biQkZzsH3JzYmrfS-dnkQ0ftIYwFxOdfmDQ5GtM_cIg" for 10.240.0.181 at 2016-08-01 09:04:33 +0000
Cannot render console from 10.240.0.181! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by PaymentsController#finialize_payment as */*
  Parameters: {"data"=>"dAj315t4g0Sq0Zy7Th16sZW8JdlJU9gOvGgqnX8CQYE31RvhjifXGGPRmadJIXl1RhB87FS5SWmLMvSvJBILNJw1oNiYNfR52yME07yw7w0biQkZzsH3JzYmrfS-dnkQ0ftIYwFxOdfmDQ5GtM_cIg"}

Why Registration data is incorrect? Can you explain more? Thank you

Accessing Rate Limit Stats

The API docs around rate limiting show the information returned via the API for rate limit tracking; specifically:

  • How many calls you're allowed.
  • How many calls you have left.
  • The time these will next be reset.

I would like to be able to run a script which obeys the rate limit. Is rate limit information provided via the SDK? How might I inspect the response headers (for example), or achieve this some other way?

POST the card info to the PSP

Hi all,
We are trying to register a card before doing a Payin following the Direct payin flow http://docs.mangopay.com/api-references/payins/payindirectcard/, but while updating the card (step 8) it answers the 500 Internal Server Error.

To post the card data I am using:
params["data"] = json_card_object['PreregistrationData']
params["accessKeyRef"] = json_card_object['AccessKey']
params["cardNumber"] = "4970101122334430"
params["cardExpirationDate"] = "0315"
params["cardCvx"] = "123"
result = Net::HTTP.post_form(URI.parse(json_card_object['CardRegistrationURL']), params)
result.body

The RegistrationData string I receive is more longer than the one in Mangopay API, something like:
data=WVmFSAUMn-G6mA8DT5RRhGeRyY2yVuBgw35ZuzCjcxxB6BXS8H3k6V9HTbWla5lPiuBaSeE_b720KH7WK_tBxHU_8uD3dhc4BnvNy6DBw5vGS2KXo6R6k6ACMqjD3a5f0ftfDdcAJsF-g-uibptl8--K13F9Jp8hQmf7PQ0qzTNuUPt1a9byNy78ZDAK-xIfnCXaSHcj3rsvcqvu89itONv0HWr75RRP2g1tAEHKkbjpheN213zUctdzvpRQyeRD

Could anybody please tell us how to solve this issue! Thanks!

With kind regards,

How to start?

Hello,
I have a rails server running and i have installed the Mangopay gem.in the system

I do not know where nor how to start with integrating the gem to my system and make it work (people contributing using Mangopay).

I run a crowdfunding platform on my Ruby on Rails sysem

Please tell me how to start (details of how to use the Mangopay bin and how to run the test suite)

Kind regards

Can not execute operations

Hello,
I have bundle installed Mangopay, run rails generate and now have client_id and passphrase

However whenever i i go into the console to execute a command, it does n't work at all.

Here is what i get when attempting to perform a natural user creation

MangoPay::NaturalUser.create({Tag: 'test', Email: '[email protected]', FirstName: 'John', LastName: 'Doe', Address: 'Here', Birthday: Date.parse('01-01-1980').to_time.to_i, Birthplace: 'Paris', Nationality: 'FR', CountryOfResidence: 'FR', Occupation: 'Worker', IncomeRange: 1})

NoMethodError: undefined method client_id' for nil:NilClass from /usr/local/rvm/gems/ruby-2.1.1/gems/mangopay-3.0.11/lib/mangopay/natural_user.rb:8:inurl'
from /usr/local/rvm/gems/ruby-2.1.1/gems/mangopay-3.0.11/lib/mangopay/http_calls.rb:8:in create' from (irb):18 from /usr/local/rvm/rubies/ruby-2.1.1/bin/irb:11:in

'

How to rescue Mangopay error caused by incorrect Iban or Bic?

Hi I installed Mangopay payment solution on my rails app. Even though I check the user's Iban and Bic when they update their profile with regular expressions, sometimes when I send the data to Mangopay I get an error message (I guess because even though iban's and bic have a correct format, mangopay finds that they dont actually exist): "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error. IBAN: IBAN or BIC not valid"

My code for sending theses infos to Mangopay looks like this:

 def create_mangopay_bank_account
    bank_account = MangoPay::BankAccount.create(current_user.mangopay_natural_user_id, mangopay_user_bank_attributes)
    current_user.bank_account_id = bank_account["Id"]
    current_user.save
  end

How can I rescue this error ? I tried something like:

 def create_mangopay_bank_account
    if MangoPay::BankAccount.create(current_user.mangopay_natural_user_id, mangopay_user_bank_attributes)
      bank_account = MangoPay::BankAccount.create(current_user.mangopay_natural_user_id, mangopay_user_bank_attributes)
      current_user.bank_account_id = bank_account["Id"]
      current_user.save
    else
      redirect_to user_path
  end

but it doesnt work...

Need a link from Card_ID to card registration

I can fetch a Card Registration : MangoPay::CardRegistration.fetch(<ID>), from a User, I can find a Card, but from a card I can't reach the Card Registration to analyse why the card is in state INVALID.

That would be very useful (I'm aware this is API related, and not SDK, but that's my interface to make tech feedbacks).

Thread local MangoPay.configuration variable

Hi,

just to let you know, I had to monkeypatch the MangoPay module so that configurations are thread-local. I did this in order to achieve multi-tenancy of MangoPay accounts in a multithreaded server (puma). Each time I receive a new request I configure MangoPay accordingly. Since each configuration lives in its own thread, I'm guaranteed each request wont mistakingly use the configuration of another request, which is the case if MangoPay.configuration is a class variable (it is shared among all threads).
Here is the patch in question

MangoPay.class_eval do
  def self.configuration=(value)
    Thread.current[:mangopay_configuration] = value
  end

  def self.configuration
    Thread.current[:mangopay_configuration]
  end

  def self.configure
    config = self.configuration || MangoPay::Configuration.new
    yield config
    self.configuration = config
  end
end

Cheers

undefined method `gsub' for 6:Fixnum

Hi guys I am new in rails and i am encountering this issue while using :
MangoPay::Wallet.fetch(wallet_id)
i've read some of your code and i've found that it comes from the url method in lib/mangopay/ressources.rb
i think it comes from the
"/v2/#{MangoPay.configuration.client_id}/#{CGI.escape(class_name.downcase)}s/#{CGI.escape(id)}"
i've changed it locally into
"/v2/#{MangoPay.configuration.client_id}/#{CGI.escape(class_name.downcase)}s/#{id}"
and it works just fine i hope it was useful.
Have a nice day

Edit : Have the same error on transaction.rb
Re-edit : Have the same error on bank_account.rb

Get error when try to create an user

Hi,
I am trying to create an application that requires the use of mangopay. I'm trying to take over the sdk.
I have a problem when creating a User.

here is my controller

class TestController < ApplicationController
    require 'mangopay'

    MangoPay.configure do |c|
        c.preproduction = true
        c.client_id = '***'
        c.client_passphrase = '***'
    end

    def index
        self.class.layout "tests"
        pagination = {'page' => 1, 'per_page' => 8} # get 1st page, 8 items per page
        @users = MangoPay::User.fetch(pagination) # => [{...}, ...]: list of 8 users data hashes
        @pagination # => {"page"=>1, "per_page"=>8, "total_pages"=>748, "total_items"=>5978}
        # @user = MangoPay::User.fetch()
    end

    def create_user
        user = {
            :Birthday => 0,
            :Nationality => "FR",
            :CountryOfResidence => "FR",
        }
        user.merge(params[:user])

        res = MangoPay::User.create(user)
        exit_status(0, "user created", 200, { user: res})
    end
end

The html page

<form accept-charset="UTF-8" action="/test/create_user" id="create_user" method="post">
<div style="margin:0;padding:0;display:inline">
    <input name="utf8" type="hidden" value="">
    <input name="authenticity_token" type="hidden" value="NskliiCZMySEiuiy6sE5+XWW/TqHRdjurv0hQiLjfrw=">
</div>
            <div class="row">
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="" for="user_FirstName">Firstname</label>
                        <input class="form-control" id="user_FirstName" name="user[FirstName]" size="30" type="text">
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="" for="user_LastName">Lastname</label>
                        <input class="form-control" id="user_LastName" name="user[LastName]" size="30" type="text">
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="" for="user_Email">Email</label>
                        <input class="form-control" id="user_Email" name="user[Email]" size="30" type="text">
                    </div>
                </div>
            </div>
            <input class="btn btn-primary" name="commit" type="submit" value="Creer">
</form>

javascript part

$('#create_user').ajaxForm({
            beforeSubmit : function(formData, jqForm, options){
                options.dataType = 'json';
            },
            success : function(responseText, status, xhr, $form){
                $('#json_response').html(responseText);
            },
            complete: function(){

            },
            error : function(e){

            }
        });

and i get this error for some reasons

MangoPay::ResponseError in TestController#create_user

The requested resource does not support http method 'POST'.
Rails.root: /home/stainz/Web/BoutiqueDeClips

Application Trace | Framework Trace | Full Trace
app/controllers/test_controller.rb:26:in `create_user'
Request

Parameters:

{"utf8"=>"✓", "authenticity_token"=>"NskliiCZMySEiuiy6sE5+XWW/TqHRdjurv0hQiLjfrw=", "user"=>{"FirstName"=>"Arthur", "LastName"=>"Féral", "Email"=>"[email protected]"}, "commit"=>"Creer"}
Show session dump

Show env dump

Response

Headers:

None

this test was performed on local machine
I'd forgotten configuration settings?

thanks for any help

Next release

Can you release gem on rubygems with merged PR #69 ? :)
Thanks !

Log file is not a valid option

Hello sirs and thank you in advance for your time and help.
When I start the rails server I'm getting the next error message:

/Users/myuser/repos/myproject/web/config/initializers/mangopay.rb:7:in `block in <top (required)>': undefined method `log_file=' for #<MangoPay::Configuration:0x007fd88ab3db10> (NoMethodError)
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/mangopay-3.0.23/lib/mangopay.rb:68:in `configure'
    from /Users/myuser/repos/myproject/web/config/initializers/mangopay.rb:3:in `<top (required)>'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `block in load'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:652:in `block in load_config_initializer'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/notifications.rb:166:in `instrument'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:651:in `load_config_initializer'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:615:in `each'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:615:in `block in <class:Engine>'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:419:in `block in each_strongly_connected_component_from'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `each'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:413:in `call'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:413:in `each_strongly_connected_component_from'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
    from /Users/myuser/repos/myproject/web/config/environment.rb:5:in `<top (required)>'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:92:in `preload'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:143:in `serve'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:131:in `block in run'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:125:in `loop'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:125:in `run'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'

Here is my initializer:

MANGOPAY_CONFIG = YAML.load_file("#{::Rails.root}/config/mangopay.yml")[::Rails.env]

MangoPay.configure do |c|
  c.preproduction = true
  c.client_id = MANGOPAY_CONFIG['client_id']
  c.client_passphrase = MANGOPAY_CONFIG['client_passphrase']
  c.log_file = "#{::Rails.root}/log/mangopay.log"
end

Am I doing anything wrong?
Thank you!

BankAccount.create requires user_id

Hello,

I'm wondering why BankAccount.create asks for user_id while the docs does not stars UserId as a required param.

Based on the fetch route, UserId should be stared.

Regards,

New bank account types not supported

Hi,

It looks like the bank account creation method no longer matches what's on the Mangopay docs. The docs (http://docs.mangopay.com/api-references/bank-accounts/) say I can create bank accounts of different types (namely, IBAN, US, GB, CA, and OTHER) by POSTing to .../bankaccount/{type}, but there doesn't seem to by anyway to accomplish this via the gem.

MangoPay::BankAccount.create doesn't append any type to the end of the URL, so this falls back to the default IBAN type, even if a 'Type' => 'GB' etc is passed as a parameter (it seems to be ignored by the API unless the correct URL is used). I've tried manually posting to .../bankaccount/GB and this works fine. The gem just doesn't support this currently by the looks of things.

I can submit a patch for this which would subclass BankAccount with the different types i.e. BankAccount::GB, BankAccount::US etc, if people think this is the correct solution?

In sandbox when creating PayOut return satus "CREATED"

Hello

I am reading documentation mangopay: In the sandbox environment BankWire PayOuts will be processed automatically

You mean with status "SUCCEEDED"?

I work in sandbox. I create new payout and return hash with status: CREATED.

pay_out = MangoPay::PayOut::BankWire.create({
      AuthorId: current_user.mangopay_id,
      DebitedFunds: { Currency: 'EUR', Amount: amount },
      Fees: { Currency: 'EUR', Amount: 0 },
      DebitedWalletId: current_user.wallet_id,
      BankAccountId: banc_acount['Id'],
      Communication: 'This is a test',
      Tag: 'Test Bank Wire'
    })
{"Id"=>"15148471",
 "Tag"=>"Test Bank Wire",
 "CreationDate"=>1470905271,
 "AuthorId"=>"15003823",
 "CreditedUserId"=>nil,
 "DebitedFunds"=>{"Currency"=>"EUR", "Amount"=>324},
 "CreditedFunds"=>{"Currency"=>"EUR", "Amount"=>324},
 "Fees"=>{"Currency"=>"EUR", "Amount"=>0},
 "Status"=>"CREATED",
 "ResultCode"=>nil,
 "ResultMessage"=>nil,
 "ExecutionDate"=>nil,
 "Type"=>"PAYOUT",
 "Nature"=>"REGULAR",
 "CreditedWalletId"=>nil,
 "DebitedWalletId"=>"15003848",
 "PaymentType"=>"BANK_WIRE",
 "BankAccountId"=>"15148463",
 "BankWireRef"=>nil}

Why not SUCCEEDED?

Unable to Authenticate using Wiki-recommended instructions

On the main Wiki page here: https://github.com/Mangopay/mangopay2-ruby-sdk/wiki

The recommended way of configuring MangoPay in an application is to run the command:

rails generate mangopay:install CLIENT_ID CLIENT_NAME

This yields an error: No value provided for required arguments 'client_email'

So I presume I just add a third argument:

rails generate mangopay:install CLIENT_ID CLIENT_NAME CLIENT_EMAIL

This also yields an error:

NoMethodError: undefined method create' for MangoPay::Client:Class`

I assume this is either outdated documentation or the gem has a bug in it

Payment with firefox. Server can`t know what return to client.

Hi

We are implementing the same scenario as in this example https://github.com/Mangopay/mangopay2-php-sdk/blob/master/demos/paymentDirect/payment.php

PayIn have status SUCCESS. But server return error: 406. See below data from web console firefox.

network - xhr: status: 406, method: get, getTocken: http://localhost:3000/finialize?data=5RSy5qslgAQ7I5fkw79Lp0Tn2Q4KxeTcg-d1ngO56EjRGeKzsrLY_XTuRwDm-dX6Pyit6T8LnOAnD6I2V3x-32QC63V6bTZybplzxBXFGSbtzpJt1NIoKcGRMw1Wxiln_uh-M22NjZ6dU5YsJBBYuA

register_card.coffee

............................................................................
............................................................................
mangoPay.cardRegistration.sendDataWithAjax(
      # URL to capture response
      finialize_url,
      # Card data
      cardData,
      # Result Ajax callback
      (data) ->
        $this.replaceWith('<p> Payment okay</p> </br> <div id="contract_url"><a href="">Return back to project</a></div>')
        $("#contract_url a").attr("href", contract_url)

        #doRedirect = -> window.location.href = data['url']
        #setTimeout doRedirect, 2000

      (xhr, status, error) ->
        $('body').prepend("<div class='alert alert-warning'>Payment error </div>");



    )

    return false

If create payment with google chrome return from server without error. Maybe can you help why server can`t know what return to client? Thank you.

One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.

Hello, since you released the v2, i gave it a try and i encoutered this issue with all the create methods for LegalUser, NaturalUser and Client

I ran the generator command and get my credentials

MangoPay.configure do |c|
c.preproduction = true
c.client_id = 'xxx'
c.client_passphrase = 'xxx'
end

Then in my controller i got , as following your wiki

MangoPay::LegalUser.create({
Name: 'Super',
LegalPersonType: 'BUSINESS',
HeadquartersAddress: 'Here',
LegalRepresentativeFirstName: 'John',
LegalRepresentativeLastName: 'Doe',
LegalRepresentativeAdress: 'Here',
LegalRepresentativeEmail: '[email protected]',
LegalRepresentativeBirthday: '',
LegalRepresentativeNationality: 'FR',
LegalRepresentativeCountryOfResidence: 'FR',
Statute: '',
ProofOfRegistration: '',
ShareholderDeclaration: ''
})

or

MangoPay::NaturalUser.create({
"Tag" => 'test',
"Email" => '[email protected]',
"FirstName" => 'John',
"LastName" => 'Doe',
"Address" => 'Here',
"Birthday" => '10/10/1991',
"Birthplace" => 'Paris',
"Nationality" => 'FR',
"CountryOfResidence" => 'FR',
"Occupation" => 'Worker',
"IncomeRange" => 1
})

Then it raises this error :

"One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error."

Any ideas?

Thanks!

Method cards in User doesn't show all cards for user_id

Hi, I am using the Pay-In method in my application but when I want to create a new card and to pay with it, the payment is done but the card isn't registrated for the user. Then if I search with the console to find the user_id for the card of the transaction made before, I find the good one. When I do : MangoPay::User.cards(user_id), it doesn't give me the last card used for that transaction... Do you have any idea?

Idempotency support missing

The latest version of the v2 API supports idempotency-key being set in the request header to avoid operations happening twice:

https://docs.mangopay.com/api-references/idempotency-support/

However there is currently no way trivial way to set that request header on a per request basis on this gem: https://github.com/Mangopay/mangopay2-ruby-sdk/blob/master/lib/mangopay.rb#L82
(or globally not overriding the default values).

Adding support for it in the library would be highly appreciated.

Also having support for fetching results from requests with the idempotency-key set would be nice to have.

Using Faraday ?

Hi,

I've started working on a MangoPay integration for a (kind of) market place.

I see that API requests are using Net::HTTP. and the MangoPay.request has multiple responsibilities.
It doesn't make MangoPay easy to extend and customize.

For example, I'd like to use another HTTP adapter (like net-http_persistent or typhoeus) and add some instrumentation around the requests.

For this kind of customization, I usually use Faraday which lets me change the adapter and add some middleware, very easily.
Exposing Faraday outside of MangoPay is not hard too. You can look at how Elasticsearch does this :

All this is just a thought, a direction that seems to be a good idea (in theory, but verified in practice too).
What do you think about it?

Thanks for maintaining a Ruby "SDK", I appreciate not having to do this myself 😉

MangoPay::ResponseError (Error this mean of payment for this asked currency has been disabled)

I've created a Web Payin with different payment methods, Visa, BCMC and PayLib works as expected but MasterPass, Diners, iDeal and Maestro don't. It returns me this error :
MangoPay::ResponseError (Error this mean of payment for this asked currency has been disabled error: The method payment MASTERPASS with the ccy EUR is not active for the partner xxxxxxx)

It works fine in development with my sandbox account, but in production with the live account it raises the error.

Looking in the Mangopay documentation i've found nothing, and didn't have much luck in the gem documentation.

Any ideas what can cause this problem ?

My code for the payin creation :
`def create_payin(card_type, url)
mango = MangoPay::PayIn::Card::Web.create({
AuthorId: @buyer.mangopay_user_id,
CreditedUserId: @seller.mangopay_user_id,
DebitedFunds: { Currency: 'EUR', Amount: (@booking.price100) },
# Fees: { Currency: 'EUR', Amount: ((@booking.price
0.10)*100) },
Fees: { Currency: 'EUR', Amount: 0},
CreditedWalletId: @seller.mangopay_wallet_id,
ReturnURL: "#{url}/bookings/result",
CardType: card_type,
Culture: 'FR',
Tag: "booking #{@booking.id}"
})

	# Save the transaction in booking_transaction
	BookingTransaction::new({booking_id: @booking.id, transaction_id: mango.fetch('Id')}).save
	
	# return redirect url to payment form
	return mango.fetch('RedirectURL')
end`

KYC Document Page Create requires "Type"?

We're processing KYC submissions, but the "create page" step is failing.

We're calling MangoPay::KycDocument.create_page (source) with the ID of our user, the ID of a previously-created document, and a base64-encoded file string.

document = MangoPay::KycDocument.create(mangopay_user_id, { 'Type': 'IDENTITY_PROOF' })
MangoPay::KycDocument.create_page(mangopay_user_id, document[:Id], file_base64)

The document object is returned with a status of "CREATED" in line 1. However, an exception is thrown when attempting to create the page (line 2):

One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error. Type: The Type field is required.

There is no reference to the document's type or a page type requirement in the API docs.

Any ideas?

Idempotency support does not work for Direct Pay In

With both the latest version of the gem from Rubygems, and the latest version available in the master branch, this call to create a Direct Pay In does not add the Idempotency-Key http header to the request.

MangoPay::PayIn::Card::Direct.create({
  AuthorId:            author_id,
  CreditedUserId:      account_id,
  CreditedWalletId:    wallet_id,
  DebitedFunds:        { Currency: curreny, Amount: amount },
  Fees:                { Currency: curreny, Amount: 0 },
  CardType:            'CB_VISA_MASTERCARD',
  CardId:              card_id,
  SecureModeReturnURL: 'https://test.com/',
  Tag:                 'any tag'
}, idempotency_key)

Sample headers logged with HTTPLogger:

User_agent: MangoPay V2 RubyBindings/3.0.22
Authorization: Bearer c7e7ef2b0b644b3880209da57ed487ff
Content-Type: application/json
X_mangopay_client_user_agent: {"bindings_version":"3.0.22","lang":"ruby","lang_version":"2.2.5 p319 (2016-04-26)","platform":"x86_64-darwin15","uname":"Darwin MacBook-Air-2.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64"}
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept: */*
User-Agent: Ruby
Host: api.sandbox.mangopay.com
Content-Length: 282

However it does work for preauthorizations like this:

MangoPay::PreAuthorization.create({
 AuthorId: author_id,
 DebitedFunds: { Currency: currency, Amount: amount },
 CardId: card_id,
 SecureMode: 'DEFAULT',
 SecureModeReturnURL: 'https://test.com',
 Tag: 'any tag'
}, idempotency_key)

Sample headers logged with HTTPLogger:

User_agent: MangoPay V2 RubyBindings/3.0.21
Authorization: Bearer 059dfeae29b84c7098c6a00bd8185e4d
Content-Type: application/json
X_mangopay_client_user_agent: {"bindings_version":"3.0.21","lang":"ruby","lang_version":"2.2.5 p319 (2016-04-26)","platform":"x86_64-darwin15","uname":"Darwin MacBook-Air-2.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64"}
Idempotency-Key: preauthorization-49
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept: */*
User-Agent: Ruby
Host: api.sandbox.mangopay.com
Content-Length: 200

I've traced the problem to this method, when the idempotency key is passed to MangoPay::PayIn::Card::Direct.create, it is received in this method as the id argument instead of the idempotency_key. I am not sure what's the reason for that legacy logic.

Should I be calling MangoPay::PayIn::Card::Direct.create in a different way? Is this a bug?

check if object exists

I'm using a simple rake task to browse through my transactions. Each of my payments has its own mangopay_user_id. Is there a way to test the ID without raising an error if the object does not exist ?

  @payin = MangoPay::PayIn.fetch(payment.mangopay_charge_id)

raises me a:

The ressource does not exist RessourceNotFound: Cannot found the ressource PayIn with the id=52282550

And therefore aborst the rake.

ERRNO enoent while trying to create a naturaluser

Hi,

I've just started mangopay integration to my project, so I decided to test the installation just by creating a MangoPay::NaturalUser after configuration.
While trying to execute my code on localhost this error appears:
"No such file or directory @ rb_sysopen - /log/mangopay.log"
While in '/root/log/mangopay.log' i created the log file 'mangopay.log'

I'm a beginner in rails and I've been strugling all night long around this does anybody knows how to solve the error ?

here's the code that fails :
"client = MangoPay::NaturalUser.create({
Email: current_user.email,
FirstName: current_user.name,
LastName: current_user.surname,
Birthday: current_user.birthday,
Nationality: trad_country(current_user.citizenship),
Address: current_user.adress.rue + current_user.adress.city +
trad_country(current_user.adress.country),
CountryOfResidence: trad_country(current_user.adress.country)
})
"
Thx

error messages improvements

According to the code the api returns the detailed error messages while the exception only display the generic error message

that would be really helpful to display the whole issue rather than just the message

One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.

that one can be a bit difficult to debug

Dependencies errors with Rails 4

I've got a dependency error when I try to use the gem on a Rails 4 project because of multi_json

Here is my Gemfile

source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'jbuilder', '~> 1.2'
gem 'mangopay', '~> 3.0.0'

and the error after my bundle

Bundler could not find compatible versions for gem "multi_json":
  In Gemfile:
    mangopay (~> 3.0.0) ruby depends on
      multi_json (~> 1.7.7) ruby

    jbuilder (~> 1.2) ruby depends on
      multi_json (1.8.2)

Moreover I'm not sure the doc is right because if I'm not wrong the api v2 is realised.

Occasional authorization problems

We've noticed that there can occassionally be sporadic but unexpected authorization problems and after analyse, a huge percentage of these problems are with those using the Ruby SDK. We therefore need to investigate whether the SDK is correctly handling the oauth tokens, and correctly generating new ones when it should.
The token regeneration logic seems fine though, so perhaps it's something else.

Problem with ssl on sandbox

When i try to access a client or wallet data i have one error about ssl certificate:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Everything works good on production but on the staging (with http or https) i've got this error

Any reason why request_headers is private ?

I came to ask myself the question whilst doing a cardRegistration.

As far as i know there is no method in the MangoPay gem to call the PayLine API.

Since the MangoPay.request method can only call the mangopay API, we have to build our own request.

We have to authenticate to the PayLine API, and for that purpose we need the authentication headers, since all the data are accessible why does the method MangoPay.request_headers is private ?

If it has a good reason to be private how about modifying the request method so that we can use it against PayLine too ? (i'm ready to make the changes but i wanted to get your opinion before doing any work :))

Decimal payment

I'm using mangopay with my rails app, and I'm trying to make a payment amount 56.56, but I get the payment amount 57. How i can use decimal amount?

Testing recommendations

Hi,

I was wondering what is the recommended testing strategy when using this gem.
I've been using it within an application for basic hand-tested features, but now I need to implement more complexe behavior and I want to set up automated tests.

It would be nice if the gem provided some stubs (and ideally some matchers too), in the same spirit as the fake credit cards provided for payments in the sandbox environment.

Thank you for providing this SDK. 👏

Rspec stubbing: Your authorization do not allow you to access to this information

I encounter the issue described here: #12
Using Rails 4.2.3, MangoPay SDK v3.0.18

I am writing my tests, I stub every request coming from api.sandbox.mangopay.com
I monkey patched MangoPay.request to be sure that my stubbed responses are corrects and there is no difference in the JSON. (Didn't change the behavior, it is just logging)

When testing legal user creation, MangoPay sdk throw me this error:
Your authorization do not allow you to access to this information

This is the critical part of the code:

if status.personal?
  MangoPay::NaturalUser.create(user_hash)
else
  MangoPay::LegalUser.create(user_hash)
end

I'll investigate further

This error is not thrown each time I launch my tests while the behavior of the tests do not change.
Any clue ?

Where is the Iframe?

Hi guys,
I'm trying to implement mangopay on my personal project using this gem, but I cannot understand: where is the iframe? In other words this is my work flow:
step 1) buyer = MangoPay::NaturalUser.create
step 2) seller = MangoPay::LegalUser.create
seller_wallet = MangoPay::Wallet.create
step 3) payment_from_buyer_to_seller = MangoPay::PayIn::Card::Web.create

This is taken by this wiki, but there is not any reference to the use of the iframe

different behavior in rails console and server

Investigating an issue this morning. Sorry for still not being able to be precise but what i encounter is really weird.

I have a user model which has a mango_user method which fetches the mango_user with the SDK - version 3.0.9.

calling exactly the same method for exactly the same user raises different things on an http request and with the console.

http request raises a MangoPay::ResponseError with the following properties:

rails console simply works. i'm still investigating but I currently don't understand what's going on

PayIn error status PSP technical error with 3d secure test card

We get this error when trying to create payment Direct PayIn with card 3d secure. We are implementing the same scenario as in this example https://github.com/Mangopay/mangopay2-php-sdk/blob/master/demos/paymentDirect/payment.php#L20 So initially we have a form that a user fills with his data like card id, ccv and that stuff. Then we use JavaScript SDK to submit this data to the MangoPay server. We also have an ajaxURL set that points to the URL on our server.

# create pay-in CARD DIRECT
      payIn = MangoPay::PayIn::Card::Direct.create(CreditedWalletId: current_user.wallet_id,
                                                   CardId: card['Id'],
                                                   AuthorId: card_registration['UserId'],
                                                   Tag: 'deposit',
                                                   SecureModeReturnURL: contract_url(@contract),
                                                   DebitedFunds: { Amount: (@contract.amount*100).to_i, Currency: 'EUR' },
                                                   Fees: { Amount: 0, Currency: 'EUR' },
                                                   # payment type as CARD
                                                   PaymentDetails: { CardType: card['CardType'], CardId: card['Id'] },
                                                   SecureMode: "DEFAULT")

return answer:

{"Id"=>"17198559",
 "Tag"=>"deposit",
 "CreationDate"=>1477642519,
 "AuthorId"=>"15460637",
 "CreditedUserId"=>"15460637",
 "DebitedFunds"=>{"Currency"=>"EUR", "Amount"=>30000},
 "CreditedFunds"=>{"Currency"=>"EUR", "Amount"=>30000},
 "Fees"=>{"Currency"=>"EUR", "Amount"=>0},
 "Status"=>"FAILED",
 "ResultCode"=>"009199",
 "ResultMessage"=>"PSP technical error",
 "ExecutionDate"=>nil,
 "Type"=>"PAYIN",
 "Nature"=>"REGULAR",
 "CreditedWalletId"=>"15460638",
 "DebitedWalletId"=>nil,
 "PaymentType"=>"CARD",
 "ExecutionType"=>"DIRECT",
 "SecureMode"=>"DEFAULT",
 "CardId"=>"17198553",
 "SecureModeReturnURL"=>nil,
 "SecureModeRedirectURL"=>nil,
 "SecureModeNeeded"=>true,
 "StatementDescriptor"=>nil}

registration_card.coffee

mangoPay.cardRegistration.sendDataWithAjax(
      # URL to capture response
      finialize_url,
      # Card data
      cardData,
      # Result Ajax callback
      (data) ->
        $this.replaceWith('<p>Votre paiement a bien été reçu.</p> </br> <div id="contract_url"><a href="">Voir le contrat</a></div>')
        $("#contract_url a").attr("href", contract_url)

        #doRedirect = -> window.location.href = data['url']
        #setTimeout doRedirect, 2000

      (xhr, status, error) ->
        location.reload()
        # $('body').prepend("<div class='alert alert-warning'>Payment error </div>");

use your test card: 3012349999999999

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.