vpos 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +106 -43
- data/lib/vpos/version.rb +1 -1
- data/lib/vpos_module.rb +5 -5
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8ce8a846da74d76619ecc28a4c433c7a84d2e759ab0ce7c1dd9a6ad06e3a9fa0
         | 
| 4 | 
            +
              data.tar.gz: ecd2849235767f671634540dd75491d8069b200ae21b2984c3e68a8429e6a094
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3b414e72948061cbe3b478202df5196cb6f468da6071286f3623f80beb946b79f2b6c2e328430ff34f37675b464e74b0f0761b91c16af5eb3d80a7cef703b58c
         | 
| 7 | 
            +
              data.tar.gz: 87214e410ace8ec0aae927cdd91df7553d1da9b271352db6fad413ea352c488d4949becd6104514f7e3bbceb22dfff1f1855d107e5b1d086bd4da73459fb82d9
         | 
    
        data/README.md
    CHANGED
    
    | @@ -37,6 +37,7 @@ This ruby library requires you to have: | |
| 37 37 | 
             
            - POS_ID provided by EMIS that can be requested through your support bank.
         | 
| 38 38 | 
             
            - Supervisor Card provided by EMIS that can be requested through your support bank.
         | 
| 39 39 | 
             
            - Token provided by vPOS that can be generated through vPOS [merchant](https://merchant.vpos.ao) portal.
         | 
| 40 | 
            +
            - Ruby 2.6 or higher
         | 
| 40 41 |  | 
| 41 42 | 
             
            Don't have this information? [Talk to us](suporte@vpos.ao)
         | 
| 42 43 |  | 
| @@ -77,43 +78,71 @@ or using one of the optional arguments | |
| 77 78 | 
             
            | `refund_callback_url` | Merchant application JSON endpoint to accept the callback refund response | `string`
         | 
| 78 79 |  | 
| 79 80 | 
             
            ### Get a specific Transaction
         | 
| 80 | 
            -
            Retrieves a transaction given a valid transaction ID | 
| 81 | 
            +
            Retrieves a transaction given a valid transaction ID:
         | 
| 81 82 |  | 
| 82 83 | 
             
            ```ruby
         | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 84 | 
            +
            # Using a env variable token MERCHANT_VPOS_TOKEN
         | 
| 85 | 
            +
            transaction = vpos.get_transaction(transaction_id: '1jHbXEbRTIbbwaoJ6w06nLcRG7X')
         | 
| 86 | 
            +
            # Or using a explicitly stated token
         | 
| 87 | 
            +
            transaction = vpos.get_transaction(transaction_id: '1jHbXEbRTIbbwaoJ6w06nLcRG7X', token: 'EbRTIbb1jHbXEbRTIbbwaoJ6w06nLcRG7X')
         | 
| 88 | 
            +
            # {
         | 
| 89 | 
            +
            #   :status_code=>200,
         | 
| 90 | 
            +
            #   :message=>"OK",
         | 
| 91 | 
            +
            #   :data=> {
         | 
| 92 | 
            +
            #      :amount=>"1.23",
         | 
| 93 | 
            +
            #      :clearing_period=>156,
         | 
| 94 | 
            +
            #      :id=>"29fTRtkFaf8cQklRuHTvGDaecj4",
         | 
| 95 | 
            +
            #      :mobile=>"900000000",
         | 
| 96 | 
            +
            #      :parent_transaction_id=>nil,
         | 
| 97 | 
            +
            #      :pos_id=>111,
         | 
| 98 | 
            +
            #      :status=>"accepted",
         | 
| 99 | 
            +
            #      :status_datetime=>"2022-05-25T18:25:39Z",
         | 
| 100 | 
            +
            #      :status_reason=>nil,
         | 
| 101 | 
            +
            #      :type=>"payment"
         | 
| 102 | 
            +
            #    }
         | 
| 103 | 
            +
            # }
         | 
| 92 104 | 
             
            ```
         | 
| 93 105 |  | 
| 94 106 | 
             
            | Argument | Description | Type | Required |
         | 
| 95 | 
            -
            | --- | --- | --- |
         | 
| 107 | 
            +
            | --- | --- | --- | --- |
         | 
| 96 108 | 
             
            | `transaction_id` | An existing Transaction ID | `string` | Yes |
         | 
| 97 109 | 
             
            | `token` | Merchant token generated at vPOS merchant portal | `string` | No (if set as env variable) |
         | 
| 98 110 |  | 
| 99 111 | 
             
            ### New Payment Transaction
         | 
| 100 112 | 
             
            Creates a new payment transaction given a valid mobile number associated with a `MULTICAIXA` account
         | 
| 101 | 
            -
            and a valid amount | 
| 113 | 
            +
            and a valid amount:
         | 
| 102 114 |  | 
| 103 115 | 
             
            ```ruby
         | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 116 | 
            +
            # Using a env variable token MERCHANT_VPOS_TOKEN
         | 
| 117 | 
            +
            request = vpos.new_payment(customer: '900111222', amount: '123.45')
         | 
| 118 | 
            +
            # Or using a explicitly stated token
         | 
| 119 | 
            +
            request = vpos.new_payment(customer: '900111222', amount: '123.45', token: 'EbRTIbb1jHbXEbRTIbbwaoJ6w06nLcRG7X')
         | 
| 120 | 
            +
            # {:status_code=>202, :message=>"ACCEPTED", :location=>"/api/v1/requests/29fTRtkFaf8cQklRuHTvGDaecj4"}
         | 
| 121 | 
            +
             | 
| 122 | 
            +
            request_id = vpos.get_request_id(request)
         | 
| 123 | 
            +
            # "29fTRtkFaf8cQklRuHTvGDaecj4"
         | 
| 124 | 
            +
             | 
| 125 | 
            +
            transaction = vpos.get_transaction(transaction_id: "29fTRtkFaf8cQklRuHTvGDaecj4")
         | 
| 126 | 
            +
            # {
         | 
| 127 | 
            +
            #   :status_code=>200,
         | 
| 128 | 
            +
            #   :message=>"OK",
         | 
| 129 | 
            +
            #   :data=> {
         | 
| 130 | 
            +
            #      :amount=>"1.23",
         | 
| 131 | 
            +
            #      :clearing_period=>156,
         | 
| 132 | 
            +
            #      :id=>"29fTRtkFaf8cQklRuHTvGDaecj4",
         | 
| 133 | 
            +
            #      :mobile=>"900000000",
         | 
| 134 | 
            +
            #      :parent_transaction_id=>nil,
         | 
| 135 | 
            +
            #      :pos_id=>111,
         | 
| 136 | 
            +
            #      :status=>"accepted",
         | 
| 137 | 
            +
            #      :status_datetime=>"2022-05-25T18:25:39Z",
         | 
| 138 | 
            +
            #      :status_reason=>nil,
         | 
| 139 | 
            +
            #      :type=>"payment"
         | 
| 140 | 
            +
            #    }
         | 
| 141 | 
            +
            # }
         | 
| 113 142 | 
             
            ```
         | 
| 114 143 |  | 
| 115 144 | 
             
            | Argument | Description | Type | Required |
         | 
| 116 | 
            -
            | --- | --- | --- |
         | 
| 145 | 
            +
            | --- | --- | --- | --- |
         | 
| 117 146 | 
             
            | `customer` | The mobile number of the client who will pay | `string` | Yes |
         | 
| 118 147 | 
             
            | `amount` | The amount the client should pay, eg. "259.99", "259000.00" | `string` | Yes |
         | 
| 119 148 | 
             
            | `token` | Merchant token generated at vPOS merchant portal | `string` | No (if set as env variable) |
         | 
| @@ -123,42 +152,76 @@ payment = merchant.new_payment(customer: '900111222', amount: '123.45', token: ' | |
| 123 152 | 
             
            Given an existing `parent_transaction_id`, request a refund using a env variable token.
         | 
| 124 153 |  | 
| 125 154 | 
             
            ```ruby
         | 
| 126 | 
            -
             | 
| 127 | 
            -
             | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 155 | 
            +
            # Using a env variable token MERCHANT_VPOS_TOKEN
         | 
| 156 | 
            +
            request = vpos.new_refund(parent_transaction_id: '29fTRtkFaf8cQklRuHTvGDaecj4')
         | 
| 157 | 
            +
            # Or using a explicitly stated token
         | 
| 158 | 
            +
            request = vpos.new_refund(parent_transaction_id: '29fTRtkFaf8cQklRuHTvGDaecj4', token: 'EbRTIbb1jHbXEbRTIbbwaoJ6w06nLcRG7X')
         | 
| 159 | 
            +
            # {:status_code=>202, :message=>"ACCEPTED", :location=>"/api/v1/requests/29fTRtkFaf8cQklRuHTvGDaecj3"}
         | 
| 160 | 
            +
             | 
| 161 | 
            +
            request_id = vpos.get_request_id(request)
         | 
| 162 | 
            +
            # "29fTRtkFaf8cQklRuHTvGDaecj3"
         | 
| 163 | 
            +
             | 
| 164 | 
            +
            transaction = vpos.get_transaction(transaction_id: "29fTRtkFaf8cQklRuHTvGDaecj3")
         | 
| 165 | 
            +
            # {
         | 
| 166 | 
            +
            #   :status_code=>200,
         | 
| 167 | 
            +
            #   :message=>"OK",
         | 
| 168 | 
            +
            #   :data=> {
         | 
| 169 | 
            +
            #      :amount=>"1.23",
         | 
| 170 | 
            +
            #      :clearing_period=>156,
         | 
| 171 | 
            +
            #      :id=>"29fTRtkFaf8cQklRuHTvGDaecj3",
         | 
| 172 | 
            +
            #      :mobile=>nil,
         | 
| 173 | 
            +
            #      :parent_transaction_id=>29fTRtkFaf8cQklRuHTvGDaecj4,
         | 
| 174 | 
            +
            #      :pos_id=>nil,
         | 
| 175 | 
            +
            #      :status=>"accepted",
         | 
| 176 | 
            +
            #      :status_datetime=>"2022-05-25T18:25:39Z",
         | 
| 177 | 
            +
            #      :status_reason=>nil,
         | 
| 178 | 
            +
            #      :type=>"refund"
         | 
| 179 | 
            +
            #    }
         | 
| 180 | 
            +
            # }
         | 
| 135 181 | 
             
            ```
         | 
| 136 182 |  | 
| 137 183 | 
             
            | Argument | Description | Type | Required |
         | 
| 138 | 
            -
            | --- | --- | --- |
         | 
| 184 | 
            +
            | --- | --- | --- | --- |
         | 
| 139 185 | 
             
            | `parent_transaction_id` | The ID of transaction you wish to refund | `string`
         | 
| 140 186 | 
             
            | `token` | Merchant token generated at vPOS merchant portal | `string` | No (if set as env variable) |
         | 
| 141 187 | 
             
            | `callback_url` | A valid https url where vPOS is going to callback as soon he finishes to process | `string` | No |
         | 
| 142 188 |  | 
| 143 189 | 
             
            ### Poll Transaction Status
         | 
| 144 | 
            -
            Poll the status of a transaction given a valid `request_id` | 
| 190 | 
            +
            Poll the status of a transaction given a valid `request_id`
         | 
| 145 191 |  | 
| 146 192 | 
             
            Note: The `request_id` in this context is essentially the `transaction_id` of an existing request. 
         | 
| 147 193 |  | 
| 148 194 | 
             
            ```ruby
         | 
| 149 | 
            -
             | 
| 150 | 
            -
             | 
| 151 | 
            -
             | 
| 152 | 
            -
             | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 155 | 
            -
             | 
| 156 | 
            -
             | 
| 157 | 
            -
             | 
| 195 | 
            +
            # Using a env variable token
         | 
| 196 | 
            +
            request = vpos.get_request(request_id: '29fTRtkFaf8cQklRuHTvGDaecj5')
         | 
| 197 | 
            +
            # Or using a explicitly stated token
         | 
| 198 | 
            +
            request = vpos.get_request(request_id: '29fTRtkFaf8cQklRuHTvGDaecj5', token: 'EbRTIbb1jHbXEbRTIbbwaoJ6w06nLcRG7X')
         | 
| 199 | 
            +
            # {:status_code=>303, :message=>"ACCEPTED", :location=>"/api/v1/transactions/29fTRtkFaf8cQklRuHTvGDaecj5"}
         | 
| 200 | 
            +
             | 
| 201 | 
            +
            request_id = vpos.get_request_id(request)
         | 
| 202 | 
            +
            # "29fTRtkFaf8cQklRuHTvGDaecj5"
         | 
| 203 | 
            +
             | 
| 204 | 
            +
            transaction = vpos.get_transaction(transaction_id: "29fTRtkFaf8cQklRuHTvGDaecj5")
         | 
| 205 | 
            +
            # {
         | 
| 206 | 
            +
            #   :status_code=>200,
         | 
| 207 | 
            +
            #   :message=>"OK",
         | 
| 208 | 
            +
            #   :data=> {
         | 
| 209 | 
            +
            #      :amount=>"1.23",
         | 
| 210 | 
            +
            #      :clearing_period=>156,
         | 
| 211 | 
            +
            #      :id=>"29fTRtkFaf8cQklRuHTvGDaecj5",
         | 
| 212 | 
            +
            #      :mobile=>nil,
         | 
| 213 | 
            +
            #      :parent_transaction_id=>29fTRtkFaf8cQklRuHTvGDaecj4,
         | 
| 214 | 
            +
            #      :pos_id=>nil,
         | 
| 215 | 
            +
            #      :status=>"accepted",
         | 
| 216 | 
            +
            #      :status_datetime=>"2022-05-25T18:25:39Z",
         | 
| 217 | 
            +
            #      :status_reason=>nil,
         | 
| 218 | 
            +
            #      :type=>"refund"
         | 
| 219 | 
            +
            #    }
         | 
| 220 | 
            +
            # }
         | 
| 158 221 | 
             
            ```
         | 
| 159 222 |  | 
| 160 223 | 
             
            | Argument | Description | Type | Required? |
         | 
| 161 | 
            -
            | --- | --- | --- |
         | 
| 224 | 
            +
            | --- | --- | --- | --- |
         | 
| 162 225 | 
             
            | `request_id` | The ID of transaction you wish to poll | `string` | Yes |
         | 
| 163 226 | 
             
            | `token` | Merchant token generated at vPOS merchant portal | `string` | No (if set as env variable) |
         | 
| 164 227 |  | 
    
        data/lib/vpos/version.rb
    CHANGED
    
    
    
        data/lib/vpos_module.rb
    CHANGED
    
    | @@ -15,7 +15,7 @@ module VposModule | |
| 15 15 | 
             
              )
         | 
| 16 16 | 
             
                conn = connection
         | 
| 17 17 | 
             
                response = conn.post('transactions') do |req|
         | 
| 18 | 
            -
                  req.headers['Authorization'] = token
         | 
| 18 | 
            +
                  req.headers['Authorization'] = "Bearer #{token}"
         | 
| 19 19 | 
             
                  req.body = { type: "payment", pos_id: pos_id, mobile: customer, amount: amount, callback_url: callback_url }.to_json
         | 
| 20 20 | 
             
                end
         | 
| 21 21 | 
             
                return_vpos_object(response)
         | 
| @@ -24,7 +24,7 @@ module VposModule | |
| 24 24 | 
             
              def new_refund(parent_transaction_id: required, token: @token, callback_url: @refund_callback_url)
         | 
| 25 25 | 
             
                conn = connection
         | 
| 26 26 | 
             
                response = conn.post('transactions') do |req|
         | 
| 27 | 
            -
                  req.headers['Authorization'] = token
         | 
| 27 | 
            +
                  req.headers['Authorization'] = "Bearer #{token}"
         | 
| 28 28 | 
             
                  req.body = { type: "refund", parent_transaction_id: parent_transaction_id, callback_url: callback_url }.to_json
         | 
| 29 29 | 
             
                end
         | 
| 30 30 | 
             
                return_vpos_object(response)
         | 
| @@ -33,7 +33,7 @@ module VposModule | |
| 33 33 | 
             
              def get_transaction(transaction_id: required, token: @token)
         | 
| 34 34 | 
             
                conn = connection
         | 
| 35 35 | 
             
                response = conn.get("transactions/#{transaction_id}") do |req|
         | 
| 36 | 
            -
                  req.headers['Authorization'] = token
         | 
| 36 | 
            +
                  req.headers['Authorization'] = "Bearer #{token}"
         | 
| 37 37 | 
             
                end
         | 
| 38 38 | 
             
                return_vpos_object(response)
         | 
| 39 39 | 
             
              end
         | 
| @@ -42,7 +42,7 @@ module VposModule | |
| 42 42 | 
             
                if response[:location].nil?
         | 
| 43 43 | 
             
                  conn = connection
         | 
| 44 44 | 
             
                  response = conn.get("references/invalid") do |req|
         | 
| 45 | 
            -
                    req.headers['Authorization'] = token
         | 
| 45 | 
            +
                    req.headers['Authorization'] = "Bearer #{token}"
         | 
| 46 46 | 
             
                  end
         | 
| 47 47 | 
             
                else
         | 
| 48 48 | 
             
                  if response[:status_code] == 202
         | 
| @@ -56,7 +56,7 @@ module VposModule | |
| 56 56 | 
             
              def get_request(request_id: required, token: @token)
         | 
| 57 57 | 
             
                conn = connection
         | 
| 58 58 | 
             
                response = conn.get("requests/#{request_id}") do |req|
         | 
| 59 | 
            -
                  req.headers['Authorization'] = token
         | 
| 59 | 
            +
                  req.headers['Authorization'] = "Bearer #{token}"
         | 
| 60 60 | 
             
                end
         | 
| 61 61 | 
             
                return_vpos_object(response)
         | 
| 62 62 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: vpos
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0. | 
| 4 | 
            +
              version: 2.0.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sergio Maziano
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-07-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |