payu-emea / openpayu_ruby Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
W dokumentacji, punkt 8.4 stoi że pole buyer.phone
nie jest wymagane.
Wbrew temu, OpenPayU::Models::Buyer
ma je w walidacji jako wymagane.
Jak wygenerować błąd: bierzemy podany w README w sekcji Transparent Order hash, wycinamy z niego shipping_method
a w buyer usuwamy lub ustawiamy na puste pole phone
, wołamy Order.create
i dostajemy wyjątek WrongOrderParameters
.
Przy tworzeniu obiektu request (zgodnie z dokumentacją tutaj), pojawia się następujący błąd w odpowiedzi z serwera:
Invalid HTTP response code (500).
Response body: {"OpenPayU":{"OrderCreateResponse":{"Status":{"StatusCode":"BUSINESS_ERROR","Severity":"ERROR","StatusDesc":"Requested command was not found. Please use TRANSPARENT or STANDARD."},"ResId":"{ca29525e-3ddf-4360-ad0b-7336ce1fe27b}"}}}.
Gdzie i jak się ustawia TRANSPARENT albo STANDARD?
tried this gem with indian payment gateway and it resulted in a 404
Using the hash you give as example in the readme (fixing little typo in shipping_method
which should be shipping_methods
) I tryed to do OpenPayU.hosted_order_form(order)
but the result is not what I expected. As you can see below all the keys are repeated once camelized and once not. This makes the POST fail.
<form action="https://secure.payu.com/api/v2/order" method="post">
<input type="hidden" value="1000" name="total_amount">
<input type="hidden" value="http://localhost/continue" name="continue_url">
<input type="hidden" value="{ba8ff33b-0b32-42e4-b61d-2dcdacba3d7f}" name="req_id">
<input type="hidden" value="http://localhost/notify" name="notify_url">
<input type="hidden" value="http://localhost/order" name="order_url">
<input type="hidden" value="127.0.0.1" name="customer_ip">
<input type="hidden" value="145227" name="merchant_pos_id">
<input type="hidden" value="Order description" name="description">
<input type="hidden" value="PLN" name="currency_code">
<input type="hidden" value="Product 1" name="products.products.name[0]">
<input type="hidden" value="1000" name="products.products.unitPrice[0]">
<input type="hidden" value="1" name="products.products.quantity[0]">
<input type="hidden" value="1" name="ext_order_id">
<input type="hidden" value="1000" name="totalAmount">
<input type="hidden" value="http://localhost/continue" name="continueUrl">
<input type="hidden" value="{ba8ff33b-0b32-42e4-b61d-2dcdacba3d7f}" name="reqId">
<input type="hidden" value="http://localhost/notify" name="notifyUrl">
<input type="hidden" value="http://localhost/order" name="orderUrl">
<input type="hidden" value="127.0.0.1" name="customerIp">
<input type="hidden" value="145227" name="merchantPosId">
<input type="hidden" value="PLN" name="currencyCode">
<input type="hidden" value="1" name="extOrderId">
<input type="hidden" value="sender=145227;signature=1cef67f5170d2872e6e2c0f7976f1e1a;algorithm=MD5" name="OpenPayu-Signature">
<button formtarget="_blank" type="submit"></button></form>
I think the problem is due this line { k.camelize(:lower) => v.map(&:prepare_keys) }
in this class OpenPayU::Models::Model.prepare_keys
I'll submit a fix as I'll be able to find one.
Ruby does not work in version 2.4.4
Copied from your Readme, @response = OpenPayU::Order.consume_notification(request)
raises an error because it calls OpenPayU::Document.verify_response
when it initializes the new Documents::Response
and try to acces to the code
property which doesn't exists.
Here is the stack trace
NoMethodError - undefined method
code' for # ActionDispatch::Request
openpayu (0.1.2) lib/openpayu/document.rb:41:in verify_response'
openpayu (0.1.2) lib/openpayu/documents/response.rb:12:in
initialize'
openpayu (0.1.2) lib/openpayu/order.rb:74:in consume_notification'
Could it be because Response
class or Document
class don't have an attr_accessor: code
?
Or maybe is a simple typo in OpenPayU::Document.verify_response
line 41: %w(200 201 422 302).include?(response.code)
maybe an @
is missing.
W pliku models/shipping_method.rb jest błąd:
validates :country, :price, :nazwa, presence: true
a powinno być
validates :country, :price, :name, presence: true
W dokumentacji parametr nazywa się CompleteUrl, w waszym module PHP równie CompleteUrl, a w Ruby ContinueUrl.
Nie działało mi tworzenie zamówienia zgodnie z instrukcjami w readme więc postanowiłem odpalić testy.
A tutaj:
openpayu_ruby git:(master) rspec
I, [2014-08-21T08:30:01.166133 #8822] INFO -- : Not reporting to Code Climate because ENV['CODECLIMATE_REPO_TOKEN'] is not set.
WARNING: VCR's FakeWeb integration is deprecated and will be removed in VCR 3.0.
Create transparent order
run with data format
create order
should eq "200"
should eq "SUCCESS"
should not be empty
Retrieve order
should eq "200"
should eq "SUCCESS"
should not be empty
Consume order notification
should not be empty
update order
should eq "200"
should eq "SUCCESS"
should eq "Status was updated"
cancel order
should eq "200"
should eq "SUCCESS"
Generate OrderNotifyResponse
should include "SUCCESS"
OpenPayU::Configuration
load from YAML
should be true (FAILED - 1)
should eq "145227"
should eq "secure"
should eq "payu.com"
valid configuration
should be true (FAILED - 2)
should eq "sandbox"
should eq "payu.pl"
should override default
should set default value
change configuration to be invalid
should raise exception
Invalid configuration
should raise exeption when tried to set invalid configuration
OpenPayU::Document
generates valid signature
OpenPayU::Models::Order
create valid order
should be true (FAILED - 3)
should be true (FAILED - 4)
should eq "114207"
should create product objects
should eq 1
should eq "OpenPayU::Models::Product"
prepare correct Hash
example at ./spec/unit/models/order_spec.rb:22
create invalid order
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
should be false (FAILED - 5)
should be false (FAILED - 6)
OpenPayU::Models::Refund
create valid refund
should be true (FAILED - 7)
create invalid refund
should be false (FAILED - 8)
OpenPayU
should sign a form
should generate form
Failures:
1) OpenPayU::Configuration load from YAML should be true
Failure/Error: it { OpenPayU::Configuration.valid?.should be_true }
expected true to respond to `true?`
# ./spec/unit/configuration_spec.rb:12:in `block (3 levels) in <top (required)>'
2) OpenPayU::Configuration valid configuration should be true
Failure/Error: it { OpenPayU::Configuration.valid?.should be_true }
expected true to respond to `true?`
# ./spec/unit/configuration_spec.rb:28:in `block (3 levels) in <top (required)>'
3) OpenPayU::Models::Order create valid order should be true
Failure/Error: it { order.valid?.should be_true }
expected true to respond to `true?`
# ./spec/unit/models/order_spec.rb:8:in `block (3 levels) in <top (required)>'
4) OpenPayU::Models::Order create valid order should be true
Failure/Error: it { order.all_objects_valid?.should be_true }
expected true to respond to `true?`
# ./spec/unit/models/order_spec.rb:9:in `block (3 levels) in <top (required)>'
5) OpenPayU::Models::Order create invalid order should be false
Failure/Error: it { order.valid?.should be_false }
expected false to respond to `false?`
# ./spec/unit/models/order_spec.rb:48:in `block (3 levels) in <top (required)>'
6) OpenPayU::Models::Order create invalid order should be false
Failure/Error: it { order.all_objects_valid?.should be_false }
expected false to respond to `false?`
# ./spec/unit/models/order_spec.rb:49:in `block (3 levels) in <top (required)>'
7) OpenPayU::Models::Refund create valid refund should be true
Failure/Error: it { refund.valid?.should be_true }
expected true to respond to `true?`
# ./spec/unit/models/refund_spec.rb:13:in `block (3 levels) in <top (required)>'
8) OpenPayU::Models::Refund create invalid refund should be false
Failure/Error: it { refund.valid?.should be_false }
expected false to respond to `false?`
# ./spec/unit/models/refund_spec.rb:22:in `block (3 levels) in <top (required)>'
Deprecation Warnings:
Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` instead. Called from /Users/filip/programming/tests/openpayu_ruby/spec/integration/order_spec.rb:14:in `block (4 levels) in <top (required)>'.
If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
`config.raise_errors_for_deprecations!`, and it will turn the
deprecation warnings into errors, giving you the full backtrace.
1 deprecation warning total
Finished in 0.12066 seconds (files took 0.26986 seconds to load)
37 examples, 8 failures
Failed examples:
rspec ./spec/unit/configuration_spec.rb:12 # OpenPayU::Configuration load from YAML should be true
rspec ./spec/unit/configuration_spec.rb:28 # OpenPayU::Configuration valid configuration should be true
rspec ./spec/unit/models/order_spec.rb:8 # OpenPayU::Models::Order create valid order should be true
rspec ./spec/unit/models/order_spec.rb:9 # OpenPayU::Models::Order create valid order should be true
rspec ./spec/unit/models/order_spec.rb:48 # OpenPayU::Models::Order create invalid order should be false
rspec ./spec/unit/models/order_spec.rb:49 # OpenPayU::Models::Order create invalid order should be false
rspec ./spec/unit/models/refund_spec.rb:13 # OpenPayU::Models::Refund create valid refund should be true
rspec ./spec/unit/models/refund_spec.rb:22 # OpenPayU::Models::Refund create invalid refund should be false
➜ openpayu_ruby git:(master)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.