README.md in alipay-0.0.1 vs README.md in alipay-0.0.2

- old
+ new

@@ -4,19 +4,25 @@ It contain this API: * Generate payment url * Send goods -* Verify when receive alipay notify +* Verify notify -Please read alipay official document first: https://b.alipay.com/order/techService.htm +Please read alipay official document first: https://b.alipay.com/order/techService.htm . ## Installation Add this line to your application's Gemfile: ```ruby +gem 'alipay', '~> 0.0.2' +``` + +or development version + +```ruby gem 'alipay', :github => 'chloerei/alipay' ``` And then execute: @@ -24,11 +30,11 @@ $ bundle ``` ## Usage -### Init +### Config ```ruby Alipay.pid = 'YOUR_PID' Alipay.key = 'YOUR_KEY' Alipay.seller_email = 'YOUR_SELLER_EMAIL' @@ -64,26 +70,27 @@ ### Send goods ```ruby options = { - :trade_no => 'trade_no_id', + :trade_no => 'TRADE_NO', :logistics_name => 'writings.io', :transport_type => 'DIRECT' } Alipay::Service.send_goods_confirm_by_platform(options) # => '<!xml version="1.0" encoding="utf-8"?><alipay><is_success>T</is_success></alipay>' ``` -### Verify when receive alipay notify +### Verify notify ```ruby -# exxample in rails +# example in rails # The notify url MUST be set when generate payment url def alipay_notify - notify_params = params.except(*request.path_parameters.keys) # except :controller_name, :action_name, :host + # except :controller_name, :action_name, :host, etc. + notify_params = params.except(*request.path_parameters.keys) if Alipay::Notify.verify?(notify_params) # valid notify, code your business logic. render :text => 'success' else render :text => 'error' @@ -91,10 +98,10 @@ end ``` ## Contributing -Bug report or pull request is welcome. +Bug report or pull request are welcome. ### Make a pull request 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`)