openpayu_ruby

  • i4_283228
    了解作者
  • 171.6KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-01 03:50
    上传日期
OpenPayU Ruby 自2014年12月19日起,我们将停止开发和支持openpayu_ruby插件。 不过,随时创建拉取请求,我们将很乐意接受。 OpenPayU Ruby库提供对PayU Gateway API版本的集成访问。 2。 安装 将此行添加到您的应用程序的Gemfile中: gem 'openpayu' 然后执行: $ bundle 或将其自己安装为: $ gem install openpayu ## Configure Gem要配置OpenPayU环境,请在config / initializers / openpayu.rb中添加一个文件,其中包含: OpenPayU::Configuration.configure do |config| config.merchant_pos_id = '145227' config.si
openpayu_ruby-master.zip
内容介绍
[![Code Climate](https://codeclimate.com/repos/524eb044f3ea00329815dff1/badges/885c2d52f25c02295344/gpa.png)](https://codeclimate.com/repos/524eb044f3ea00329815dff1/feed) # OpenPayU Ruby **On December 19, 2014 we stop developing and supporting openpayu_ruby plugin. Nevertheless, feel free to create pull requests we will gladly accept.** The OpenPayU Ruby library provides integration access to the PayU Gateway API ver. 2. ## Installation Add this line to your application's Gemfile: gem 'openpayu' And then execute: $ bundle Or install it yourself as: $ gem install openpayu ##Configure Gem To configure OpenPayU environment add a file to config/initializers/openpayu.rb containing: OpenPayU::Configuration.configure do |config| config.merchant_pos_id = '145227' config.signature_key = '13a980d4f851f3d9a1cfc792fb1f5e50' config.algorithm = 'MD5' # MD5, SHA-1, SHA-256 config.service_domain = 'payu.com' config.protocol = 'https' config.env = 'secure' config.order_url = 'http://localhost/order' config.notify_url = 'http://localhost/notify' config.continue_url = 'http://localhost/success' end Or by providing a path to YAML file OpenPayU::Configuration.configure File.join(Rails.root, 'config/openpayu.yml') Structure of YAML file: development: merchant_pos_id: '145227' signature_key: 13a980d4f851f3d9a1cfc792fb1f5e50 algorithm: MD5 # MD5, SHA-1, SHA-256 service_domain: payu.com protocol: https env: secure order_url: http://localhost/order notify_url: http://localhost/notify continue_url: http://localhost/success production: merchant_pos_id: '145227' signature_key: 13a980d4f851f3d9a1cfc792fb1f5e50 algorithm: MD5 # MD5, SHA-1, SHA-256 service_domain: payu.com protocol: https env: secure order_url: http://localhost/order notify_url: http://localhost/notify continue_url: http://localhost/success ##Usage ###Creating Transparent order For more information about order please refer to: http://developers.payu.com/pl/restapi.html#payusdk_creating_new_order_api . To create an order you must provide a Hash with order: order = { merchant_pos_id: "145227", customer_ip: "127.0.0.1", # You can user request.remote_ip in your controller ext_order_id: 1342, #Order id in your system order_url: "http://localhost/", description: "New order", currency_code: "PLN", total_amount: 10000, notify_url: "http://localhost/", complete_url: "http://localhost/", buyer: { email: 'dd@ddd.pl', phone: '123123123', first_name: 'Jan', last_name: 'Kowalski', language: 'PL', delivery: { street: 'street', postal_code: 'postal_code', city: 'city', country_code: 'PL' } }, products: [ { name: 'Mouse', unit_price: 10000, quantity: 1 } ], shipping_method: { country: 'PL', price: 'price', name: 'shipping name' } } When you have ready order Hash you can create new order: @response = OpenPayU::Order.create(order) If request succeed to create it will return "COMPLETE" as a status_code. There might be also a redirect to page with confirmation. There are three redirect types: * WARNING_CONTINUE_REDIRECT * WARNING_CONTINUE_CVV * WARNING_CONTINUE_3DS ``` case @response.status["status_code"] when 'COMPLETE' # order has been created when /WARNING_CONTINUE_/ #need to redirec user to a provided URL redirect_to @response.redirect_uri else #in other cases something went wrong logger.info "Unable to create order. Status: #{@response.status["status_code"]}. Response: #{@response}" end ``` ###Creating Hosted order If you pass the same Hash of order as above to hosted_order_form you will get a String containgin a form to embed in your view #in your controller @order_form_data = OpenPayU.hosted_order_form(order) # in your view <%= @order_form_data.html_safe %> ###Retrieving order from OpenPayU You can retrieve order by its PayU order_id @response = OpenPayU::Order.retrieve("Z963D5JQR2230925GUEST000P01") ###Cancelling order You can cancel order by its PayU order_id @response = OpenPayU::Order.cancel("Z963D5JQR2230925GUEST000P01") ###Updating order status You can update order status to accept order when Autoreceive in POS is turned off status_update = { order_id: "Z963D5JQR2230925GUEST000P01", order_status: 'COMPLETED' } @response = OpenPayU::Order.status_update(status_update) ###Handling notifications from PayU PayU sends requests to your application when order status changes @response = OpenPayU::Order.consume_notification(request) #request object from controller @response.order_status #NEW PENDING CANCELLED REJECTED COMPLETED WAITING_FOR_CONFIRMATION #you should response to PayU with special structure (OrderNotifyResponse) render json: OpenPayU::Order.build_notify_response(@response.req_id) ###Refund money @refund = OpenPayU::Refund.create({ order_id: "Z963D5JQR2230925GUEST000P01", #required description: "Money refund", #required ext_refund_id: 21312, #Refund Id in your syste, optional amount: 1000, #If not provided, returns whole transaction, optional commission_amount: 123, #optional currency_code: "PLN" #optional }) ##Changelog 0.1.2 * Gem adjusted to OpenPayU REST API v 2.0 * Communication with OpenPayU only in JSON format, XML is no longer supported ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request
评论
    相关推荐
    • first-data-ruby:First Data Global Gateway E4 API 的 Ruby 绑定
      Firstdata 'Global Gateway e4' API 的轻量级 ruby​​ 绑定。 注意:这适用于 API 的 v12+。 它根据此计算HMAC哈希( ) 安装 将此行添加到应用程序的 Gemfile 中: gem 'firstdata' 然后执行: $ bundle 或...
    • Braintree Ruby库-Ruby开发
      Braintree gem提供了对Braintree Gateway的集成访问。 请注意,支付卡行业(PCI)委员会已强制要求从服务中停用TLS的早期版本。 所有处理信用卡信息的组织都必须遵守此标准。 作为这项义务的一部分,Braintree正在...
    • Ruby-智付通SpgatewayAPI包裝
      智付通(Spgateway)API 包裝
    • barion-master.zip
      这是一个Ruby-on-Rails引擎,可在任何RoR应用程序中使用Barion Payment Gateway。 用法 如何使用我的插件。 安装 将此行添加到您的应用程序的Gemfile中: gem 'barion' 然后执行: $ bundle 或将其自己安装为: $...
    • query-gateway
      Ruby= 1.9.2 Rails 3.1 MongoDB> = 1.8.1 安装说明 有关作曲家和网关的安装说明,请参阅查询作曲家 执照 版权所有2011 The MITER Corporation 根据Apache许可证2.0版(“许可证”)获得许可; 除非遵守许可,否则...
    • Ruby-智付通金流的Rails插件
      该插件可以方便地与Spgateway集成 - 台湾的在线支付服务。
    • buckaruby:用于与Buckaroo Payment Engine 3.0进行通信的Ruby
      Buckaruby gem提供了一个用于与Buckaroo Payment Engine 3.0进行通信的Ruby库。 安装 将此行添加到您的应用程序的Gemfile中: gem 'buckaruby' 然后执行: $ bundle 或将其自己安装为: $ gem install buckaruby...
    • apollo-federation-ruby:Apollo Federation的Ruby实现
      阿波罗联盟 该gem扩展了 gem,以添加对创建模式的支持。 免责声明 该宝石仍处于测试阶段,可能存在一些错误或不兼容。 请参阅下面的。 如果您遇到任何问题,请。 安装 将此行添加到您的应用程序的Gemfile中: ...
    • ipfs_public_gateway_checker:Ruby中的公共IPFS网关检查器
      这是一个Ruby版本,可从以下版本迁移: JS版本的在线网页 Shell CLI版本 Golang版本 安装 将此行添加到您的应用程序的Gemfile中: gem 'ipfs_public_gateway_checker' 然后执行: $ bundle 或自己安装为: $ ...
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档