Giter Site home page Giter Site logo

alipay_dualfun_demo's Introduction

  • 👋 Hi, I’m @happypeter
  • 👀 I’m interested in Web development
  • 🌱 I’m currently learning GPT

alipay_dualfun_demo's People

Stargazers

 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

alipay_dualfun_demo's Issues

同步和异步

52684c1

现在达到的效果:

  • 用户付款后,不管其是否马上关闭页面(亦即同步通知是否成功),我方均可通过同步(或是异步)通知来创建 transaction 记录
  • 而且绝对不会重复创建。

各种交易状态的跟踪

担保交易中:有等待付款->等待发货->交易成功
即时到帐:等待付款 -> 交易成功

如果不判断交易状态,那么以下两种情况全都都会创建 transaction:
screen shot 2013-07-16 at 1 10 51 pm

担保交易

如果用户在收银台误选了“担保交易”,只要继续付款,付款结束后,一样可以跳回我的 return_url.
但是后续还有麻烦事:
#4 (comment)

所以对于 happycasts 还是不用为妙。

迁移到新的服务器,同时把 rails 版本升级

迁移到新的服务器,同时把 rails 版本升级:

老的 apache.conf 数据:

<VirtualHost *:80>
   ServerName alidemo.happycasts.net
   PassengerRuby /home/peter/.rbenv/versions/1.9.3-p125/bin/ruby
   DocumentRoot /home/peter/alipay_dualfun_demo/public/
   <Directory /home/peter/alipay_dualfun_demo/public/ >
      AllowOverride all
      Options -MultiViews
   </Directory>
</VirtualHost>

记录付款用户身份

太复杂的内容就不往这个 repo 放了,谈一个初步想法。
happycasts 用户登陆后方可购物,结算出总额之后,在向 alipay 发 request 之前,就创建该 transaction 的 record,当然 paid=false。record 中会存放 user.id=123,用来跟踪用户,同时存放 out_trade_no 用来跟踪本单交易。

这时发出向 alipay 的请求,从同步和异步通知中我们不必去取该用户的支付宝用户名,而是只跟踪用户到底对那个 out_trade_no 的交易付款了,只要 paid=true 了,我们就认为是 user123 出的钱。于是赋予 user123 相应的权利。

为何不用 activemerchant_patch_for_china(APFC)

donatecn 是 APFC 的作者写的一个 demo,使用 pay_fu + APFC + activemerchant

整个 stack 太复杂了,而且 pay_fu 项目已经死掉了。

所以我要仿照 @daqing 的 china_pay 自己写一个最简约的 gem,然后把大量变数很大的业务逻辑在具体项目自己代码中实现,这样透明度较好。

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.