국가별 통화,환불,인보이스,가상화폐 테스트 설계서 - SeungpilPark/uEngine-bill GitHub Wiki

국가별 통화

각 플랜별 사용가능한 통화와 Amount 를 입력하는 방식으로 한다. 이 때 서로 다른 통화의 통계 분석을 위해 killbill-anayltics 플러그인을 쓰도록 한다.

환불, 가상화폐

환불 시나리오

  • 할인 쿠폰을 즉시 적용
  • 구매자가 구독기간이 남아있는 상태에서 취소했을 경우
  • 구매자의 문의로 인한 환불
  • 플랜 변경에 따른 차액발생

PG 를 통한 환불

수동 환불

인보이스

Initial subscription creation

예제 플랜
<plan name="shotgun-monthly">
    <product>Shotgun</product>
    <initialPhases>
        <phase type="TRIAL">
            <duration>
                <unit>DAYS</unit>
                <number>30</number>
            </duration>
        </phase>
    </initialPhases>
    <finalPhase type="EVERGREEN">
        <duration>
            <unit>UNLIMITED</unit>
            <number>-1</number>
        </duration>
        <recurring>
            <billingPeriod>MONTHLY</billingPeriod>
            <recurringPrice>
                <price>
                    <currency>USD</currency>
                    <value>249.95</value>
                </price>
            </recurringPrice>
        </recurring>
    </finalPhase>
</plan>

인보이스 및 인보이스 아이템

MySQL [killbill]> select * from invoices\G
*************************** 1. row ***************************
        record_id: 1
               id: 5c6369d2-cd18-489f-9fe5-748e72f9938e
       account_id: 8e4f353f-ddbb-4155-b52d-9fe77b8e96e3
     invoice_date: 2012-04-01
      target_date: 2012-04-01
         currency: USD
           status: COMMITTED
         migrated: 0
   parent_invoice: 0
       created_by: SubscriptionBaseTransition
     created_date: 2012-04-01 00:01:15
account_record_id: 1
 tenant_record_id: 0
1 row in set (0.00 sec)

MySQL [killbill]> select * from invoice_items\G
*************************** 1. row ***************************
        record_id: 1
               id: 19667140-fa16-48e0-b04e-579b9972f612
             type: FIXED
       invoice_id: 5c6369d2-cd18-489f-9fe5-748e72f9938e
       account_id: 8e4f353f-ddbb-4155-b52d-9fe77b8e96e3
 child_account_id: NULL
        bundle_id: a7a1370e-1fa4-4c32-abd5-223e1da97339
  subscription_id: d9c7bb57-675e-4419-a340-5f6b4fd612f4
      description: shotgun-monthly-trial
        plan_name: shotgun-monthly
       phase_name: shotgun-monthly-trial
       usage_name: NULL
       start_date: 2012-04-01
         end_date: NULL
           amount: 0.000000000
             rate: NULL
         currency: USD
   linked_item_id: NULL
       created_by: SubscriptionBaseTransition
     created_date: 2012-04-01 00:01:15
account_record_id: 1
 tenant_record_id: 0

결제 및 결제 시도

MySQL [killbill]> select * from invoice_payments\G
*************************** 1. row ***************************
                record_id: 1
                       id: ac421b90-b13b-461f-bfd7-517807a895f0
                     type: ATTEMPT
               invoice_id: 5c6369d2-cd18-489f-9fe5-748e72f9938e
               payment_id: NULL
             payment_date: 2012-04-01 00:01:15
                   amount: 0.000000000
                 currency: USD
       processed_currency: USD
        payment_cookie_id: ae53501e-c9dd-45e3-8ec6-78da4e9f8d99
linked_invoice_payment_id: NULL
                  success: 0
               created_by: PaymentRequestProcessor
             created_date: 2012-04-01 00:01:15
        account_record_id: 1
         tenant_record_id: 0
1 row in set (0.00 sec)

MySQL [killbill]> select * from payment_attempts\G
*************************** 1. row ***************************
               record_id: 1
                      id: 16f869b1-c5c9-41ed-a776-87f3ce4e5bb5
              account_id: 8e4f353f-ddbb-4155-b52d-9fe77b8e96e3
       payment_method_id: c046e5be-e632-444a-905f-c4bc0c5c0086
    payment_external_key: 6bd135f7-8a7d-4448-9ce9-3889055af9e3
          transaction_id: NULL
transaction_external_key: ae53501e-c9dd-45e3-8ec6-78da4e9f8d99
        transaction_type: PURCHASE
              state_name: ABORTED
                  amount: NULL
                currency: USD
             plugin_name: __INVOICE_PAYMENT_CONTROL_PLUGIN__
       plugin_properties: ZV  <[{"IPCD_INVOICE_ID":"5c6369d2-cd18-489f-9fe5-748e72f9938e"}]
              created_by: PaymentRequestProcessor
            created_date: 2012-04-01 00:01:15
              updated_by: PaymentRequestProcessor
            updated_date: 2012-04-01 00:01:15
       account_record_id: 1
        tenant_record_id: 0
1 row in set (0.00 sec)

MySQL [killbill]> select * from payments\G
Empty set (0.00 sec)

Phase transition

결제 금액 증가에 따른 인보이스 변화와 추가 결제 트랜잭션 발생

MySQL [killbill]> select * from invoice_payments order by record_id desc limit 1\G
*************************** 1. row ***************************
                record_id: 2
                       id: e6e534e1-2ffa-4d5e-bcac-6905d4d26f61
                     type: ATTEMPT
               invoice_id: fa759cb6-6702-4a1c-85a3-9df7b101d3bc
               payment_id: b0e61973-a921-413d-a04b-84e36e3ad6bf
             payment_date: 2012-05-02 00:14:44
                   amount: 249.950000000
                 currency: USD
       processed_currency: USD
        payment_cookie_id: 943d005c-5f89-4664-88f5-c65f39a3a9c8
linked_invoice_payment_id: NULL
                  success: 1
               created_by: PaymentRequestProcessor
             created_date: 2012-05-02 00:14:44
        account_record_id: 1
         tenant_record_id: 0
1 row in set (0.00 sec)

MySQL [killbill]> select * from payment_attempts order by record_id desc limit 1\G
*************************** 1. row ***************************
               record_id: 2
                      id: 090fa541-7b69-42b2-bec7-a16f3c616071
              account_id: 8e4f353f-ddbb-4155-b52d-9fe77b8e96e3
       payment_method_id: c046e5be-e632-444a-905f-c4bc0c5c0086
    payment_external_key: d04ce5ad-e667-4113-8eb3-6d7f87f92bca
          transaction_id: 8b671a2e-6556-4aa8-8464-ef1cb99e5189
transaction_external_key: 943d005c-5f89-4664-88f5-c65f39a3a9c8
        transaction_type: PURCHASE
              state_name: SUCCESS
                  amount: NULL
                currency: USD
             plugin_name: __INVOICE_PAYMENT_CONTROL_PLUGIN__
       plugin_properties: ZV  <[{"IPCD_INVOICE_ID":"fa759cb6-6702-4a1c-85a3-9df7b101d3bc"}]
              created_by: PaymentRequestProcessor
            created_date: 2012-05-02 00:14:44
              updated_by: PaymentRequestProcessor
            updated_date: 2012-05-02 00:14:44
       account_record_id: 1
        tenant_record_id: 0
1 row in set (0.00 sec)

MySQL [killbill]> select * from payments\G
*************************** 1. row ***************************
              record_id: 1
                     id: b0e61973-a921-413d-a04b-84e36e3ad6bf
             account_id: 8e4f353f-ddbb-4155-b52d-9fe77b8e96e3
      payment_method_id: c046e5be-e632-444a-905f-c4bc0c5c0086
           external_key: d04ce5ad-e667-4113-8eb3-6d7f87f92bca
             state_name: PURCHASE_SUCCESS
last_success_state_name: PURCHASE_SUCCESS
             created_by: PaymentRequestProcessor
           created_date: 2012-05-02 00:14:44
             updated_by: PaymentRequestProcessor
           updated_date: 2012-05-02 00:14:44
      account_record_id: 1
       tenant_record_id: 0
1 row in set (0.00 sec)

MySQL [killbill]> select * from payment_transactions\G
*************************** 1. row ***************************
               record_id: 1
                      id: 8b671a2e-6556-4aa8-8464-ef1cb99e5189
              attempt_id: 090fa541-7b69-42b2-bec7-a16f3c616071
transaction_external_key: 943d005c-5f89-4664-88f5-c65f39a3a9c8
        transaction_type: PURCHASE
          effective_date: 2012-05-02 00:14:44
      transaction_status: SUCCESS
                  amount: 249.950000000
                currency: USD
        processed_amount: 249.950000000
      processed_currency: USD
              payment_id: b0e61973-a921-413d-a04b-84e36e3ad6bf
      gateway_error_code:
       gateway_error_msg:
              created_by: PaymentRequestProcessor
            created_date: 2012-05-02 00:14:44
              updated_by: PaymentRequestProcessor
            updated_date: 2012-05-02 00:14:44
       account_record_id: 1
        tenant_record_id: 0
1 row in set (0.00 sec)
⚠️ **GitHub.com Fallback** ⚠️